From 896dbfaf675c4a91f2bc5a22fe2eac6f6461ec0f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 12 Mar 2009 14:59:36 +1300 Subject: fixed quoting of the table named "user" --- lib/featureduserssection.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/featureduserssection.php b/lib/featureduserssection.php index aed94b1a5..4b9238d47 100644 --- a/lib/featureduserssection.php +++ b/lib/featureduserssection.php @@ -57,9 +57,14 @@ class FeaturedUsersSection extends ProfileSection $quoted[] = "'$nick'"; } + $table = "user"; + if(common_config('db','quote_identifiers')) { + $table = '"' . $table . '"'; + } + $qry = 'SELECT profile.* ' . - 'FROM profile JOIN user on profile.id = user.id ' . - 'WHERE user.nickname in (' . implode(',', $quoted) . ') ' . + 'FROM profile JOIN '. $table .' on profile.id = '. $table .'.id ' . + 'WHERE '. $table .'.nickname in (' . implode(',', $quoted) . ') ' . 'ORDER BY profile.created DESC '; $limit = PROFILES_PER_SECTION + 1; -- cgit v1.2.3-54-g00ecf From 18c8a55ba61e507f08162149273a9a33b9b73ca0 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 17 Mar 2009 10:36:12 +1300 Subject: use common_database_tablename instead of repeating that if structure everywhere --- actions/featured.php | 7 +------ lib/util.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/actions/featured.php b/actions/featured.php index 14d653cea..86fd3f374 100644 --- a/actions/featured.php +++ b/actions/featured.php @@ -116,15 +116,10 @@ class FeaturedAction extends Action $quoted[] = "'$nick'"; } - $table = "user"; - if(common_config('db','quote_identifiers')) { - $table = '"' . $table . '"'; - } - $user = new User; $user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted))); $user->limit(($this->page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1); - $user->orderBy($table .'.nickname ASC'); + $user->orderBy(common_database_tablename('user') .'.nickname ASC'); $user->find(); diff --git a/lib/util.php b/lib/util.php index 6341438ca..19637d546 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1300,3 +1300,16 @@ function common_compatible_license($from, $to) // XXX: better compatibility check needed here! return ($from == $to); } + +/** + * returns a quoted table name, if required according to config + */ +function common_database_tablename($tablename) +{ + + if(common_config('db','quote_identifiers')) { + $tablename = '"'. $tablename .'"'; + } + //table prefixes could be added here later + return $tablename; +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From b8bfc8beaede4977573a978f825231347bf91385 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 8 Apr 2009 00:27:04 -0400 Subject: far fewer icons in the sidebar --- lib/groupminilist.php | 2 +- lib/profileminilist.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/groupminilist.php b/lib/groupminilist.php index fe38d0340..e8d3a4e3a 100644 --- a/lib/groupminilist.php +++ b/lib/groupminilist.php @@ -33,7 +33,7 @@ if (!defined('LACONICA')) { require_once INSTALLDIR.'/lib/grouplist.php'; -define('GROUPS_PER_MINILIST', 80); +define('GROUPS_PER_MINILIST', 27); /** * Widget to show a list of groups, good for sidebar diff --git a/lib/profileminilist.php b/lib/profileminilist.php index 0d466bba8..57496d0e9 100644 --- a/lib/profileminilist.php +++ b/lib/profileminilist.php @@ -33,7 +33,7 @@ if (!defined('LACONICA')) { require_once INSTALLDIR.'/lib/profilelist.php'; -define('PROFILES_PER_MINILIST', 80); +define('PROFILES_PER_MINILIST', 27); /** * Widget to show a list of profiles, good for sidebar -- cgit v1.2.3-54-g00ecf From 154e8bb858516e4c37427d837b506a48f1131b01 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 8 Apr 2009 00:32:28 -0400 Subject: use mini logo at mini size, not stream logo --- lib/groupminilist.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/groupminilist.php b/lib/groupminilist.php index e8d3a4e3a..ae2d237f1 100644 --- a/lib/groupminilist.php +++ b/lib/groupminilist.php @@ -75,8 +75,9 @@ class GroupMiniList extends GroupList 'href' => $this->group->homeUrl(), 'rel' => 'contact group', 'class' => 'url')); - $logo = ($this->group->stream_logo) ? - $this->group->stream_logo : User_group::defaultLogo(AVATAR_STREAM_SIZE); + + $logo = ($this->group->mini_logo) ? + $this->group->mini_logo : User_group::defaultLogo(AVATAR_MINI_SIZE); $this->out->element('img', array('src' => $logo, 'width' => AVATAR_MINI_SIZE, -- cgit v1.2.3-54-g00ecf From 44006a35dd6a7e74f0e3218da54b31a0ea3f571b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 8 Apr 2009 04:46:00 +0000 Subject: Better debugging output flag --- lib/twitter.php | 30 +++++++++++++++--------------- scripts/synctwitterfriends.php | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/twitter.php b/lib/twitter.php index 01723bd83..ccc6c93ca 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -46,7 +46,7 @@ function get_twitter_data($uri, $screen_name, $password) common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $screen_name.", __FILE__); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "cURL error: $errmsg - trying to load: $uri with user $screen_name.\n"; } } @@ -106,7 +106,7 @@ function update_twitter_user($twitter_id, $screen_name) if ($result) { common_debug("Removed uri ($uri) from another foreign_user who was squatting on it."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print("Removed uri ($uri) from another Twitter user who was squatting on it.\n"); } } @@ -122,7 +122,7 @@ function update_twitter_user($twitter_id, $screen_name) common_log(LOG_WARNING, "Couldn't update foreign_user data for Twitter user: $screen_name"); common_log_db_error($fuser, 'UPDATE', __FILE__); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "UPDATE failed: for Twitter user: $twitter_id - $screen_name. - "; print common_log_objstring($fuser) . "\n"; $error = &PEAR::getStaticProperty('DB_DataObject','lastError'); @@ -155,7 +155,7 @@ function add_twitter_user($twitter_id, $screen_name) if ($result) { common_log(LOG_WARNING, "Twitter bridge - removed invalid Twitter user squatting on uri: $new_uri"); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "Removed invalid Twitter user squatting on uri: $new_uri\n"; } } @@ -177,7 +177,7 @@ function add_twitter_user($twitter_id, $screen_name) common_log(LOG_WARNING, "Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name."); common_log_db_error($fuser, 'INSERT', __FILE__); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "INSERT failed: could not add new Twitter user: $twitter_id - $screen_name. - "; print common_log_objstring($fuser) . "\n"; $error = &PEAR::getStaticProperty('DB_DataObject','lastError'); @@ -185,7 +185,7 @@ function add_twitter_user($twitter_id, $screen_name) } } else { common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id)."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "Added new Twitter user: $screen_name ($twitter_id).\n"; } } @@ -212,7 +212,7 @@ function save_twitter_user($twitter_id, $screen_name) common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' . "$fuser->id to $screen_name, was $fuser->nickname"); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print 'Updated nickname (and URI) for Twitter user ' . "$fuser->id to $screen_name, was $fuser->nickname\n"; } @@ -241,7 +241,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) return $friends; } - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "Twitter 'social graph' ids method says $screen_name has " . count($friends_ids) . " friends.\n"; } @@ -252,7 +252,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) if ($pages == 0) { common_log(LOG_WARNING, "Twitter bridge - $screen_name seems to have no friends."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "$screen_name seems to have no friends.\n"; } } @@ -264,7 +264,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) if (!$data) { common_log(LOG_WARNING, "Twitter bridge - Couldn't retrieve page $i of $screen_name's friends."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "Couldn't retrieve page $i of $screen_name's friends.\n"; } continue; @@ -276,7 +276,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password) common_log(LOG_WARNING, "Twitter bridge - No data for page $i of $screen_name's friends."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "No data for page $i of $screen_name's friends.\n"; } continue; @@ -295,7 +295,7 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password) if (empty($friends)) { common_debug("Twitter bridge - Couldn't get friends data from Twitter for $screen_name."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "Couldn't get friends data from Twitter for $screen_name.\n"; } return false; @@ -310,7 +310,7 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password) if (!save_twitter_user($friend_id, $friend_name)) { common_log(LOG_WARNING, "Twitter bridge - couldn't save $screen_name's friend, $friend_name."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "Couldn't save $screen_name's friend, $friend_name.\n"; } continue; @@ -328,11 +328,11 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password) if ($result === true) { common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname."); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print("Subscribed $friend_user->nickname to $user->nickname.\n"); } } else { - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "$result ($friend_user->nickname to $user->nickname)\n"; } } diff --git a/scripts/synctwitterfriends.php b/scripts/synctwitterfriends.php index d108416f4..794301f0f 100755 --- a/scripts/synctwitterfriends.php +++ b/scripts/synctwitterfriends.php @@ -27,8 +27,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('LACONICA', true); -// Set this to true to get useful console output -define('SCRIPT_DEBUG', false); +// Uncomment this to get useful console output +//define('SCRIPT_DEBUG', true); require_once(INSTALLDIR . '/lib/common.php'); @@ -62,7 +62,7 @@ while ($flink->fetch()) { $result = save_twitter_friends($user, $fuser->id, $fuser->nickname, $flink->credentials); - if (SCRIPT_DEBUG) { + if (defined('SCRIPT_DEBUG')) { print "\nDONE\n"; } else { print "DONE\n"; -- cgit v1.2.3-54-g00ecf From 01695dc3465c8198123c254816f9a93a35b6c773 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Mon, 13 Apr 2009 15:03:34 -0700 Subject: Fix bad dates in API's JSON search results --- lib/jsonsearchresultslist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/jsonsearchresultslist.php b/lib/jsonsearchresultslist.php index 0cdcf0c51..f786c20a8 100644 --- a/lib/jsonsearchresultslist.php +++ b/lib/jsonsearchresultslist.php @@ -232,7 +232,7 @@ class ResultItem $this->profile_image_url = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE); - $this->created_at = date('r', $this->notice->created); + $this->created_at = common_date_rfc2822($this->notice->created); } /** -- cgit v1.2.3-54-g00ecf