';
}
- if($library['rpm']){
+ if ($library['rpm']) {
echo '
rpm: ' . htmlentities($library['rpm']) . '
';
}
- if($library['pear']){
+ if ($library['pear']) {
echo '
pear: ' . htmlentities($library['pear']) . '
';
}
echo '
';
@@ -377,8 +376,7 @@ E_O_T;
Installed Libraries
E_O_T;
- foreach($present_libraries as $library)
- {
+ foreach ($present_libraries as $library) {
echo '
';
if ($library['url']) {
echo ''.htmlentities($library['name']).'';
@@ -514,11 +512,11 @@ STR;
if (empty($sitename)) {
updateStatus("No sitename specified.", true);
- $fail = true;
+ $fail = true;
}
- if($fail){
- showForm();
+ if ($fail) {
+ showForm();
return;
}
@@ -603,8 +601,7 @@ function pgsql_db_installer($host, $database, $username, $password) {
if (empty($password)) {
$sqlUrl = "pgsql://$username@$host/$database";
- }
- else {
+ } else {
$sqlUrl = "pgsql://$username:$password@$host/$database";
}
From 93605dce99832868c3fdbb8af42db507a8005e97 Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Sun, 13 Sep 2009 18:32:59 +1200
Subject: [PATCH 13/47] removed commented out code we no longer want
---
install.php | 5 -----
1 file changed, 5 deletions(-)
diff --git a/install.php b/install.php
index 30c6780abc..6e7e833a30 100644
--- a/install.php
+++ b/install.php
@@ -505,11 +505,6 @@ STR;
$fail = true;
}
-// if (empty($password)) {
-// updateStatus("No password specified.", true);
-// $fail = true;
-// }
-
if (empty($sitename)) {
updateStatus("No sitename specified.", true);
$fail = true;
From dbc08ef0a09e481e0884a38ee704f4d193edef6a Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Mon, 14 Sep 2009 19:08:05 +1200
Subject: [PATCH 14/47] most of code style errors gone
Conflicts:
install.php
---
install.php | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/install.php b/install.php
index 6e7e833a30..dea03fc5ec 100644
--- a/install.php
+++ b/install.php
@@ -516,8 +516,7 @@ STR;
}
global $dbModules;
- $db = call_user_func($dbModules[$dbtype]['installer'],
- $host, $database, $username, $password);
+ $db = call_user_func($dbModules[$dbtype]['installer'], $host, $database, $username, $password);
if (!$db) {
// database connection failed, do not move on to create config file.
@@ -540,12 +539,10 @@ STR;
updateStatus("StatusNet has been installed at $link");
updateStatus("You can visit your new StatusNet site.");
-?>
-
-
Date: Sun, 13 Sep 2009 20:15:21 +1200
Subject: [PATCH 15/47] added most of the required doxygen
---
index.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/index.php b/index.php
index e2296549f3..83c14c4955 100644
--- a/index.php
+++ b/index.php
@@ -15,6 +15,10 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
+ *
+ * @category StatusNet
+ * @package StatusNet
+ * @license GNU Affero General Public License http://www.gnu.org/licenses/
*/
define('INSTALLDIR', dirname(__FILE__));
From a2f4fe7fc80fa851dd9293d64c4727d4bb233b90 Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Sun, 13 Sep 2009 20:16:07 +1200
Subject: [PATCH 16/47] fixed up if statements
---
index.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.php b/index.php
index 83c14c4955..8f2a7cf7f8 100644
--- a/index.php
+++ b/index.php
@@ -49,11 +49,11 @@ function handleError($error)
}
$logmsg = "PEAR error: " . $error->getMessage();
- if(common_config('site', 'logdebug')) {
+ if (common_config('site', 'logdebug')) {
$logmsg .= " : ". $error->getDebugInfo();
}
common_log(LOG_ERR, $logmsg);
- if(common_config('site', 'logdebug')) {
+ if (common_config('site', 'logdebug')) {
$bt = $error->getBacktrace();
foreach ($bt as $line) {
common_log(LOG_ERR, $line);
From 738b6d1690ad595b85657fa282132459865fed93 Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Sun, 13 Sep 2009 20:31:19 +1200
Subject: [PATCH 17/47] lotsa of multiline if statements and function calls
changed style to meat pear code style
---
index.php | 54 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 20 deletions(-)
diff --git a/index.php b/index.php
index 8f2a7cf7f8..71de393246 100644
--- a/index.php
+++ b/index.php
@@ -33,7 +33,8 @@ $action = null;
function getPath($req)
{
if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER))
- && array_key_exists('p', $req)) {
+ && array_key_exists('p', $req)
+ ) {
return $req['p'];
} else if (array_key_exists('PATH_INFO', $_SERVER)) {
return $_SERVER['PATH_INFO'];
@@ -59,18 +60,25 @@ function handleError($error)
common_log(LOG_ERR, $line);
}
}
- if ($error instanceof DB_DataObject_Error ||
- $error instanceof DB_Error) {
- $msg = sprintf(_('The database for %s isn\'t responding correctly, '.
- 'so the site won\'t work properly. '.
- 'The site admins probably know about the problem, '.
- 'but you can contact them at %s to make sure. '.
- 'Otherwise, wait a few minutes and try again.'),
- common_config('site', 'name'),
- common_config('site', 'email'));
+ if ($error instanceof DB_DataObject_Error
+ || $error instanceof DB_Error
+ ) {
+ $msg = sprintf(
+ _(
+ 'The database for %s isn\'t responding correctly, '.
+ 'so the site won\'t work properly. '.
+ 'The site admins probably know about the problem, '.
+ 'but you can contact them at %s to make sure. '.
+ 'Otherwise, wait a few minutes and try again.'
+ ),
+ common_config('site', 'name'),
+ common_config('site', 'email')
+ );
} else {
- $msg = _('An important error occured, probably related to email setup. '.
- 'Check logfiles for more info..');
+ $msg = _(
+ 'An important error occured, probably related to email setup. '.
+ 'Check logfiles for more info..'
+ );
}
$dac = new DBErrorAction($msg, 500);
@@ -131,10 +139,11 @@ function main()
$_lighty_url = @parse_url($_lighty_url);
if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/') {
- $_lighty_path = preg_replace('/^'.preg_quote(common_config('site','path')).'\//', '', substr($_lighty_url['path'], 1));
+ $_lighty_path = preg_replace('/^'.preg_quote(common_config('site', 'path')).'\//', '', substr($_lighty_url['path'], 1));
$_SERVER['QUERY_STRING'] = 'p='.$_lighty_path;
- if ($_lighty_url['query'])
+ if ($_lighty_url['query']) {
$_SERVER['QUERY_STRING'] .= '&'.$_lighty_url['query'];
+ }
parse_str($_lighty_url['query'], $_lighty_query);
foreach ($_lighty_query as $key => $val) {
$_GET[$key] = $_REQUEST[$key] = $val;
@@ -145,7 +154,7 @@ function main()
$_SERVER['REDIRECT_URL'] = preg_replace("/\?.+$/", "", $_SERVER['REQUEST_URI']);
// quick check for fancy URL auto-detection support in installer.
- if (isset($_SERVER['REDIRECT_URL']) && (preg_replace("/^\/$/","",(dirname($_SERVER['REQUEST_URI']))) . '/check-fancy') === $_SERVER['REDIRECT_URL']) {
+ if (isset($_SERVER['REDIRECT_URL']) && (preg_replace("/^\/$/", "", (dirname($_SERVER['REQUEST_URI']))) . '/check-fancy') === $_SERVER['REDIRECT_URL']) {
die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs.");
}
global $user, $action;
@@ -153,8 +162,12 @@ function main()
Snapshot::check();
if (!_have_config()) {
- $msg = sprintf(_("No configuration file found. Try running ".
- "the installation program first."));
+ $msg = sprintf(
+ _(
+ "No configuration file found. Try running ".
+ "the installation program first."
+ )
+ );
$sac = new ServerErrorAction($msg);
$sac->showPage();
return;
@@ -200,9 +213,10 @@ function main()
// If the site is private, and they're not on one of the "public"
// parts of the site, redirect to login
- if (!$user && common_config('site', 'private') &&
- !isLoginAction($action) &&
- !preg_match('/rss$/', $action)) {
+ if (!$user && common_config('site', 'private')
+ && !isLoginAction($action)
+ && !preg_match('/rss$/', $action)
+ ) {
common_redirect(common_local_url('login'));
return;
}
From 87c59fe8734479046c8433f74787f615484b3df7 Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Sun, 13 Sep 2009 20:32:58 +1200
Subject: [PATCH 18/47] fixed indentation for the pear code styles
---
index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.php b/index.php
index 71de393246..b8d9c7c69d 100644
--- a/index.php
+++ b/index.php
@@ -34,7 +34,7 @@ function getPath($req)
{
if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER))
&& array_key_exists('p', $req)
- ) {
+ ) {
return $req['p'];
} else if (array_key_exists('PATH_INFO', $_SERVER)) {
return $_SERVER['PATH_INFO'];
From 5ca90e2c8cbc76693cf0f2278d14f2a35da7e34e Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Mon, 14 Sep 2009 19:19:11 +1200
Subject: [PATCH 19/47] pulled @author from git logs
Conflicts:
install.php
---
index.php | 14 ++++++++++++++
install.php | 21 ++++++++++++++++-----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/index.php b/index.php
index b8d9c7c69d..a1d983dce7 100644
--- a/index.php
+++ b/index.php
@@ -19,6 +19,20 @@
* @category StatusNet
* @package StatusNet
* @license GNU Affero General Public License http://www.gnu.org/licenses/
+ * @author Brenda Wallace
+ * @author Christopher Vollick
+ * @author CiaranG
+ * @author Craig Andrews
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Gina Haeussge
+ * @author Jeffery To
+ * @author Mike Cochrane
+ * @author Robin Millette
+ * @author Sarven Capadisli
+ * @author Tom Adams
*/
define('INSTALLDIR', dirname(__FILE__));
diff --git a/install.php b/install.php
index dea03fc5ec..07a7bfaaf7 100644
--- a/install.php
+++ b/install.php
@@ -18,12 +18,22 @@
*
* @category Installation
* @package Installation
- * @license GNU Affero General Public License http://www.gnu.org/licenses/
*
+ * @author Adrian Lang
+ * @author Brenda Wallace
+ * @author Brett Taylor
+ * @author Brion Vibber
+ * @author CiaranG
+ * @author Craig Andrews
+ * @author Eric Helgeson
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Robin Millette
+ * @author Sarven Capadisli
+ * @author Tom Adams
+ * @license GNU Affero General Public License http://www.gnu.org/licenses/
*/
-
-
define('INSTALLDIR', dirname(__FILE__));
$external_libraries=array(
@@ -281,6 +291,7 @@ function checkPrereqs()
$missingExtensions[] = $info['check_module'];
}
}
+
if (count($missingExtensions) == count($dbModules)) {
$req = implode(', ', $missingExtensions);
printf('
Cannot find mysql or pgsql extension. You need one or the other: %s
', $req);
@@ -682,7 +693,7 @@ function writeConf($sitename, $server, $path, $fancy, $db)
*
* @return boolean - indicating success or failure
*/
-function runDbScript($filename, $conn, $type = 'mysql')
+function runDbScript($filename, $conn, $type = 'mysqli')
{
$sql = trim(file_get_contents($filename));
$stmts = explode(';', $sql);
@@ -693,7 +704,7 @@ function runDbScript($filename, $conn, $type = 'mysql')
}
// FIXME: use PEAR::DB or PDO instead of our own switch
switch ($type) {
- case 'mysql':
+ case 'mysqli':
$res = mysql_query($stmt, $conn);
if ($res === false) {
$error = mysql_error();
From 84da24aba41b459ad8b2735328e257275c0f6136 Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Sun, 13 Sep 2009 21:27:34 +1200
Subject: [PATCH 20/47] cleaned up code style
---
actions/all.php | 82 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 58 insertions(+), 24 deletions(-)
diff --git a/actions/all.php b/actions/all.php
index 29a19afb6b..e56e10c21f 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -1,5 +1,5 @@
.
+ *
+ * @category Actions
+ * @package Actions
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Mike Cochrane
+ * @author Robin Millette
+ * @author Adrian Lang
+ * @author Meitar Moscovitz
+ * @author Sarven Capadisli
+ * @author Craig Andrews
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Jeffery To
+ * @author Zach Copley
+ * @author csarven
+ * @license GNU Affero General Public License http://www.gnu.org/licenses/
+ * @link http://status.net
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
require_once INSTALLDIR.'/lib/personalgroupnav.php';
require_once INSTALLDIR.'/lib/noticelist.php';
@@ -43,8 +63,8 @@ class AllAction extends ProfileAction
$this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
}
- if($this->page > 1 && $this->notice->N == 0){
- $this->serverError(_('No such page'),$code=404);
+ if ($this->page > 1 && $this->notice->N == 0) {
+ $this->serverError(_('No such page'), $code = 404);
}
return true;
@@ -73,20 +93,33 @@ class AllAction extends ProfileAction
function getFeeds()
{
- return array(new Feed(Feed::RSS1,
- common_local_url('allrss', array('nickname' =>
- $this->user->nickname)),
- sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
- new Feed(Feed::RSS2,
- common_local_url('api', array('apiaction' => 'statuses',
- 'method' => 'friends_timeline',
- 'argument' => $this->user->nickname.'.rss')),
- sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
- new Feed(Feed::ATOM,
- common_local_url('api', array('apiaction' => 'statuses',
- 'method' => 'friends_timeline',
- 'argument' => $this->user->nickname.'.atom')),
- sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)));
+ return array(
+ new Feed(Feed::RSS1,
+ common_local_url(
+ 'allrss', array(
+ 'nickname' =>
+ $this->user->nickname)
+ ),
+ sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
+ new Feed(Feed::RSS2,
+ common_local_url(
+ 'api', array(
+ 'apiaction' => 'statuses',
+ 'method' => 'friends_timeline',
+ 'argument' => $this->user->nickname.'.rss'
+ )
+ ),
+ sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
+ new Feed(Feed::ATOM,
+ common_local_url(
+ 'api', array(
+ 'apiaction' => 'statuses',
+ 'method' => 'friends_timeline',
+ 'argument' => $this->user->nickname.'.atom'
+ )
+ ),
+ sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
+ );
}
function showLocalNav()
@@ -106,8 +139,7 @@ class AllAction extends ProfileAction
} else {
$message .= sprintf(_('You can try to [nudge %s](../%s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
}
- }
- else {
+ } else {
$message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to his or her attention.'), $this->user->nickname);
}
@@ -126,17 +158,19 @@ class AllAction extends ProfileAction
$this->showEmptyListMessage();
}
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'all', array('nickname' => $this->user->nickname));
+ $this->pagination(
+ $this->page > 1, $cnt > NOTICES_PER_PAGE,
+ $this->page, 'all', array('nickname' => $this->user->nickname)
+ );
}
function showPageTitle()
{
$user =& common_current_user();
if ($user && ($user->id == $this->user->id)) {
- $this->element('h1', NULL, _("You and friends"));
+ $this->element('h1', null, _("You and friends"));
} else {
- $this->element('h1', NULL, sprintf(_('%s and friends'), $this->user->nickname));
+ $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));
}
}
From fcff85bb3610a0f2a77bfa72cf26ce8019ec0378 Mon Sep 17 00:00:00 2001
From: Brenda Wallace
Date: Sun, 13 Sep 2009 21:55:45 +1200
Subject: [PATCH 21/47] code style cleanup
---
actions/api.php | 100 ++++++++++++++++++++++++++++--------------------
1 file changed, 58 insertions(+), 42 deletions(-)
diff --git a/actions/api.php b/actions/api.php
index c236378bcb..9b5f548074 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -1,5 +1,5 @@
.
+ *
+ * @category Actions
+ * @package Actions
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Brenda Wallace
+ * @author Jeffery To
+ * @author Robin Millette
+ * @author Tom Adams
+ * @author Christopher Vollick
+ * @author CiaranG
+ * @author Craig Andrews
+ * @author Evan Prodromou
+ * @author Evan Prodromou
+ * @author Gina Haeussge
+ * @author Mike Cochrane
+ * @author Sarven Capadisli
+ * @license GNU Affero General Public License http://www.gnu.org/licenses/
+ * @link http://status.net
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
class ApiAction extends Action
{
@@ -37,7 +58,7 @@ class ApiAction extends Action
$this->api_action = $this->arg('apiaction');
$method = $this->arg('method');
$argument = $this->arg('argument');
- $this->basic_auth_process_header();
+ $this->basic_auth_process_header();
if (isset($argument)) {
$cmdext = explode('.', $argument);
@@ -46,7 +67,7 @@ class ApiAction extends Action
$this->content_type = strtolower($cmdext[1]);
} else {
- # Requested format / content-type will be an extension on the method
+ //Requested format / content-type will be an extension on the method
$cmdext = explode('.', $method);
$this->api_method = $cmdext[0];
$this->content_type = strtolower($cmdext[1]);
@@ -55,10 +76,10 @@ class ApiAction extends Action
if ($this->requires_auth()) {
if (!isset($this->auth_user)) {
- # This header makes basic auth go
+ //This header makes basic auth go
header('WWW-Authenticate: Basic realm="StatusNet API"');
- # If the user hits cancel -- bam!
+ //If the user hits cancel -- bam!
$this->show_basic_auth_error();
} else {
$nickname = $this->auth_user;
@@ -69,7 +90,7 @@ class ApiAction extends Action
$this->user = $user;
$this->process_command();
} else {
- # basic authentication failed
+ //basic authentication failed
list($proxy, $ip) = common_client_ip();
common_log(LOG_WARNING, "Failed API auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip.");
@@ -84,7 +105,7 @@ class ApiAction extends Action
if ($user) {
$this->user = $user;
}
- # Twitter doesn't throw an error if the user isn't found
+ //Twitter doesn't throw an error if the user isn't found
}
$this->process_command();
@@ -97,7 +118,7 @@ class ApiAction extends Action
$actionfile = INSTALLDIR."/actions/$action.php";
if (file_exists($actionfile)) {
- require_once($actionfile);
+ include_once $actionfile;
$action_class = ucfirst($action)."Action";
$action_obj = new $action_class();
@@ -113,10 +134,10 @@ class ApiAction extends Action
call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
} else {
- $this->clientError("API method not found!", $code=404);
+ $this->clientError("API method not found!", $code = 404);
}
} else {
- $this->clientError("API method not found!", $code=404);
+ $this->clientError("API method not found!", $code = 404);
}
}
@@ -184,10 +205,11 @@ class ApiAction extends Action
$user_id = $this->arg('user_id');
$screen_name = $this->arg('screen_name');
- if (empty($this->api_arg) &&
- empty($id) &&
- empty($user_id) &&
- empty($screen_name)) {
+ if (empty($this->api_arg)
+ && empty($id)
+ && empty($user_id)
+ && empty($screen_name)
+ ) {
return true;
} else {
return false;
@@ -208,35 +230,29 @@ class ApiAction extends Action
function basic_auth_process_header()
{
- if(isset($_SERVER['AUTHORIZATION']) || isset($_SERVER['HTTP_AUTHORIZATION']))
- {
- $authorization_header = isset($_SERVER['HTTP_AUTHORIZATION'])?$_SERVER['HTTP_AUTHORIZATION']:$_SERVER['AUTHORIZATION'];
- }
+ if (isset($_SERVER['AUTHORIZATION']) || isset($_SERVER['HTTP_AUTHORIZATION'])) {
+ $authorization_header = isset($_SERVER['HTTP_AUTHORIZATION'])? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['AUTHORIZATION'];
+ }
- if(isset($_SERVER['PHP_AUTH_USER']))
- {
- $this->auth_user = $_SERVER['PHP_AUTH_USER'];
- $this->auth_pw = $_SERVER['PHP_AUTH_PW'];
- }
- elseif ( isset($authorization_header) && strstr(substr($authorization_header, 0,5),'Basic') )
- {
- // decode the HTTP_AUTHORIZATION header on php-cgi server self
- // on fcgid server the header name is AUTHORIZATION
+ if (isset($_SERVER['PHP_AUTH_USER'])) {
+ $this->auth_user = $_SERVER['PHP_AUTH_USER'];
+ $this->auth_pw = $_SERVER['PHP_AUTH_PW'];
+ } elseif (isset($authorization_header) && strstr(substr($authorization_header, 0, 5), 'Basic')) {
+ // decode the HTTP_AUTHORIZATION header on php-cgi server self
+ // on fcgid server the header name is AUTHORIZATION
- $auth_hash = base64_decode( substr($authorization_header, 6) );
- list($this->auth_user, $this->auth_pw) = explode(':', $auth_hash);
+ $auth_hash = base64_decode(substr($authorization_header, 6));
+ list($this->auth_user, $this->auth_pw) = explode(':', $auth_hash);
- // set all to NULL on a empty basic auth request
- if($this->auth_user == "") {
- $this->auth_user = NULL;
- $this->auth_pw = NULL;
- }
- }
- else
- {
- $this->auth_user = NULL;
- $this->auth_pw = NULL;
- }
+ // set all to null on a empty basic auth request
+ if ($this->auth_user == "") {
+ $this->auth_user = null;
+ $this->auth_pw = null;
+ }
+ } else {
+ $this->auth_user = null;
+ $this->auth_pw = null;
+ }
}
function show_basic_auth_error()
@@ -252,7 +268,7 @@ class ApiAction extends Action
$this->element('request', null, $_SERVER['REQUEST_URI']);
$this->elementEnd('hash');
$this->endXML();
- } else if ($this->content_type == 'json') {
+ } else if ($this->content_type == 'json') {
header('Content-Type: application/json; charset=utf-8');
$error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
print(json_encode($error_array));
From 5bad7040b14bf61d84cc33c8b4cf2af3b5861d3b Mon Sep 17 00:00:00 2001
From: Adrian Lang
Date: Mon, 14 Sep 2009 22:08:17 +0200
Subject: [PATCH 22/47] Fix bad merge d7ae0ed4fd755ebad0788a17d0f2fb6a6ca9d63b
---
lib/omb.php | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/lib/omb.php b/lib/omb.php
index 9133af7a05..0566701ff1 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -80,14 +80,9 @@ function omb_broadcast_notice($notice)
$posted = array();
while ($rp->fetch()) {
- if (!array_key_exists($rp->postnoticeurl, $posted)) {
- common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
- if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
- common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
- $posted[$rp->postnoticeurl] = true;
- } else {
- common_log(LOG_DEBUG, 'Failed posting to ' . $rp->postnoticeurl);
- }
+ if (isset($posted[$rp->postnoticeurl])) {
+ /* We already posted to this url. */
+ continue;
}
common_debug('Posting to ' . $rp->postnoticeurl, __FILE__);
From 4081ed79b02fd06f7c347803478e1f835311c2ab Mon Sep 17 00:00:00 2001
From: Zach Copley
Date: Tue, 15 Sep 2009 12:59:32 -0700
Subject: [PATCH 23/47] Make it impossible to delete self-subscriptions via the
API
---
actions/twitapifriendships.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index f2ea46910e..eea8945c39 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -99,6 +99,12 @@ class TwitapifriendshipsAction extends TwitterapiAction
$other = $this->get_profile($id);
$user = $apidata['user']; // Alwyas the auth user
+ if ($user->id == $other->id) {
+ $this->clientError(_("You cannot unfollow yourself!"),
+ 403, $apidata['content-type']);
+ return;
+ }
+
$sub = new Subscription();
$sub->subscriber = $user->id;
$sub->subscribed = $other->id;
From 38409f1683351ae2b9bc932d441c6021a8b2aae7 Mon Sep 17 00:00:00 2001
From: Zach Copley
Date: Tue, 15 Sep 2009 14:37:11 -0700
Subject: [PATCH 24/47] Add Jiminy to notice sources
---
db/notice_source.sql | 1 +
1 file changed, 1 insertion(+)
diff --git a/db/notice_source.sql b/db/notice_source.sql
index f590d1b97a..2657763f44 100644
--- a/db/notice_source.sql
+++ b/db/notice_source.sql
@@ -21,6 +21,7 @@ VALUES
('identichat','identichat','http://identichat.prosody.im/', now()),
('IdentiFox','IdentiFox','http://www.bitbucket.org/uncryptic/identifox/', now()),
('identitwitch','IdentiTwitch','http://richfish.org/identitwitch/', now()),
+ ('Jiminy','Jiminy','http://code.google.com/p/jiminy/', now()),
('LaTwit','LaTwit','http://latwit.mac65.com/', now()),
('LiveTweeter', 'LiveTweeter', 'http://addons.songbirdnest.com/addon/1204', now()),
('livetweeter', 'livetweeter', 'http://addons.songbirdnest.com/addon/1204', now()),
From 94466da35afcb0b1680a478964b58fbc7970f4ec Mon Sep 17 00:00:00 2001
From: Zach Copley
Date: Tue, 15 Sep 2009 16:31:09 -0700
Subject: [PATCH 25/47] Got rid of a bunch of ugly warnings
---
install.php | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/install.php b/install.php
index 07a7bfaaf7..a8f1ef4e24 100644
--- a/install.php
+++ b/install.php
@@ -1,5 +1,5 @@
.
- *
+ *
* @category Installation
* @package Installation
- *
+ *
* @author Adrian Lang
* @author Brenda Wallace
* @author Brett Taylor
@@ -33,7 +33,7 @@
* @author Tom Adams
* @license GNU Affero General Public License http://www.gnu.org/licenses/
*/
-
+
define('INSTALLDIR', dirname(__FILE__));
$external_libraries=array(
@@ -211,10 +211,10 @@ $dbModules = array(
),
);
-/**
+/**
* the actual installation.
* If call libraries are present, then install
- *
+ *
* @return void
*/
function main()
@@ -222,8 +222,8 @@ function main()
if (!checkPrereqs()) {
return;
}
-
- if ($_GET['checklibs']) {
+
+ if (!empty($_GET['checklibs'])) {
showLibs();
} else {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -243,7 +243,7 @@ function main()
*/
function haveExternalLibrary($external_library)
{
- if (isset($external_library['include']) && ! include_once $external_library['include'] ) {
+ if (isset($external_library['include']) && ! @include_once $external_library['include'] ) {
return false;
}
if (isset($external_library['check_function']) && ! function_exists($external_library['check_function'])) {
@@ -282,7 +282,7 @@ function checkPrereqs()
printf('
Cannot load required extension: %s
', $req);
$pass = false;
}
- }
+ }
// Make sure we have at least one database module available
global $dbModules;
$missingExtensions = array();
@@ -291,13 +291,13 @@ function checkPrereqs()
$missingExtensions[] = $info['check_module'];
}
}
-
+
if (count($missingExtensions) == count($dbModules)) {
$req = implode(', ', $missingExtensions);
- printf('
Cannot find mysql or pgsql extension. You need one or the other: %s
', $req);
+ printf('
Cannot find mysql or pgsql extension. You need one or the other.');
$pass = false;
}
-
+
if (!is_writable(INSTALLDIR)) {
printf('
Cannot write config file to: %s
', INSTALLDIR);
printf('
On your server, try this command: chmod a+w %s', INSTALLDIR);
@@ -365,19 +365,19 @@ function showLibs()
E_O_T;
foreach ($absent_libraries as $library) {
echo '
';
- if ($library['url']) {
+ if (isset($library['url'])) {
echo ''.htmlentities($library['name']).'';
} else {
echo htmlentities($library['name']);
}
echo '
';
- if ($library['deb']) {
+ if (isset($library['deb'])) {
echo '