forked from GNUsocial/gnu-social
		
	Merge branch 'master' into testing
This commit is contained in:
		| @@ -646,7 +646,7 @@ search | ||||
| Some stuff for search. | ||||
|  | ||||
| type: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either | ||||
|     be 'fulltext' (default) or 'like'. The former is faster and more efficient | ||||
|     be 'fulltext' or 'like' (default). The former is faster and more efficient | ||||
|     but requires the lame old MyISAM engine for MySQL. The latter | ||||
|     will work with InnoDB but could be miserably slow on large | ||||
|     systems. We'll probably add another type sometime in the future, | ||||
|   | ||||
| @@ -106,10 +106,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction | ||||
|  | ||||
|         $self = $this->getSelfUri(); | ||||
|  | ||||
|         $link = common_local_url( | ||||
|             'ApiTimelineGroup', | ||||
|             array('nickname' => $this->group->nickname) | ||||
|         ); | ||||
|         $link = common_local_url('showgroup', | ||||
|                                  array('nickname' => $this->group->nickname)); | ||||
|  | ||||
|         switch($this->format) { | ||||
|         case 'xml': | ||||
|   | ||||
| @@ -55,6 +55,25 @@ require_once INSTALLDIR.'/lib/feedlist.php'; | ||||
|  */ | ||||
| class ShowstreamAction extends ProfileAction | ||||
| { | ||||
|     var $notice; | ||||
|  | ||||
|     function prepare($args) | ||||
|     { | ||||
|         parent::prepare($args); | ||||
|  | ||||
|         $p = Profile::current(); | ||||
|  | ||||
|         if (empty($this->tag)) { | ||||
|             $stream = new ProfileNoticeStream($this->profile, $p); | ||||
|         } else { | ||||
|             $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p); | ||||
|         } | ||||
|  | ||||
|         $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     function isReadOnly($args) | ||||
|     { | ||||
|         return true; | ||||
| @@ -224,13 +243,9 @@ class ShowstreamAction extends ProfileAction | ||||
|  | ||||
|     function showNotices() | ||||
|     { | ||||
|         $notice = empty($this->tag) | ||||
|           ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) | ||||
|             : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null); | ||||
|  | ||||
|         $pnl = null; | ||||
|         if (Event::handle('ShowStreamNoticeList', array($notice, $this, &$pnl))) { | ||||
|             $pnl = new ProfileNoticeList($notice, $this); | ||||
|         if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) { | ||||
|             $pnl = new ProfileNoticeList($this->notice, $this); | ||||
|         } | ||||
|         $cnt = $pnl->show(); | ||||
|         if (0 == $cnt) { | ||||
|   | ||||
| @@ -23,6 +23,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } | ||||
| class TagAction extends Action | ||||
| { | ||||
|     var $notice; | ||||
|     var $tag; | ||||
|     var $page; | ||||
|  | ||||
|     function prepare($args) | ||||
|     { | ||||
|   | ||||
| @@ -87,7 +87,7 @@ class Notice extends Managed_DataObject | ||||
|  | ||||
|     public static function schemaDef() | ||||
|     { | ||||
|         return array( | ||||
|         $def = array( | ||||
|             'fields' => array( | ||||
|                 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), | ||||
|                 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'who made the update'), | ||||
| @@ -127,11 +127,14 @@ class Notice extends Managed_DataObject | ||||
|                 'notice_created_idx' => array('created'), | ||||
|                 'notice_replyto_idx' => array('reply_to'), | ||||
|                 'notice_repeatof_idx' => array('repeat_of'), | ||||
|             ), | ||||
|             'fulltext indexes' => array( | ||||
|                 'content' => array('content'), | ||||
|             ) | ||||
|         ); | ||||
|  | ||||
|         if (common_config('search', 'type') == 'fulltext') { | ||||
|             $def['fulltext indexes'] = array('content' => array('content')); | ||||
|         } | ||||
|  | ||||
|         return $def; | ||||
|     } | ||||
|      | ||||
| 	function multiGet($kc, $kvs, $skipNulls=true) | ||||
|   | ||||
| @@ -51,7 +51,7 @@ class Profile extends Managed_DataObject | ||||
|  | ||||
|     public static function schemaDef() | ||||
|     { | ||||
|         return array( | ||||
|         $def = array( | ||||
|             'description' => 'local and remote users have profiles', | ||||
|             'fields' => array( | ||||
|                 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), | ||||
| @@ -72,11 +72,16 @@ class Profile extends Managed_DataObject | ||||
|             'primary key' => array('id'), | ||||
|             'indexes' => array( | ||||
|                 'profile_nickname_idx' => array('nickname'), | ||||
|             ), | ||||
|             'fulltext indexes' => array( | ||||
|                 'nickname' => array('nickname', 'fullname', 'location', 'bio', 'homepage') | ||||
|             ), | ||||
|             ) | ||||
|         ); | ||||
|  | ||||
|         // Add a fulltext index | ||||
|  | ||||
|         if (common_config('search', 'type') == 'fulltext') { | ||||
|             $def['fulltext indexes'] = array('nickname' => array('nickname', 'fullname', 'location', 'bio', 'homepage')); | ||||
|         } | ||||
|  | ||||
|         return $def; | ||||
|     } | ||||
|  | ||||
| 	function multiGet($keyCol, $keyVals, $skipNulls=true) | ||||
|   | ||||
| @@ -69,6 +69,12 @@ class PopularNoticeSection extends NoticeSection | ||||
|  | ||||
|     function moreUrl() | ||||
|     { | ||||
|         return common_local_url('favorited'); | ||||
|         if (common_config('singleuser', 'enabled')) { | ||||
|             $user = User::singleUser(); | ||||
|             common_local_url('showfavorites', array('nickname' => | ||||
|                                                     $user->nickname)); | ||||
|         } else { | ||||
|             return common_local_url('favorited'); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -107,9 +107,11 @@ class Schema | ||||
|     { | ||||
|         $td = $this->getTableDef($table); | ||||
|  | ||||
|         foreach ($td->columns as $cd) { | ||||
|             if ($cd->name == $column) { | ||||
|                 return $cd; | ||||
|         if (!empty($td) && !empty($td->columns)) { | ||||
|             foreach ($td->columns as $cd) { | ||||
|                 if ($cd->name == $column) { | ||||
|                     return $cd; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -560,12 +562,18 @@ class Schema | ||||
|         $uniques = $this->diffArrays($old, $def, 'unique keys'); | ||||
|         $indexes = $this->diffArrays($old, $def, 'indexes'); | ||||
|         $foreign = $this->diffArrays($old, $def, 'foreign keys'); | ||||
|         $fulltext = $this->diffArrays($old, $def, 'fulltext indexes'); | ||||
|  | ||||
|         // Drop any obsolete or modified indexes ahead... | ||||
|         foreach ($indexes['del'] + $indexes['mod'] as $indexName) { | ||||
|             $this->appendDropIndex($statements, $tableName, $indexName); | ||||
|         } | ||||
|  | ||||
|         // Drop any obsolete or modified fulltext indexes ahead... | ||||
|         foreach ($fulltext['del'] + $fulltext['mod'] as $indexName) { | ||||
|             $this->appendDropIndex($statements, $tableName, $indexName); | ||||
|         } | ||||
|  | ||||
|         // For efficiency, we want this all in one | ||||
|         // query, instead of using our methods. | ||||
|  | ||||
| @@ -622,6 +630,11 @@ class Schema | ||||
|             $this->appendCreateIndex($statements, $tableName, $indexName, $def['indexes'][$indexName]); | ||||
|         } | ||||
|  | ||||
|         foreach ($fulltext['mod'] + $fulltext['add'] as $indexName) { | ||||
|             $colDef = $def['fulltext indexes'][$indexName]; | ||||
|             $this->appendCreateFulltextIndex($statements, $tableName, $indexName, $colDef); | ||||
|         } | ||||
|  | ||||
|         return $statements; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -47,7 +47,7 @@ if (!defined('STATUSNET')) { | ||||
|  | ||||
| class TaggedProfileNoticeStream extends ScopingNoticeStream | ||||
| { | ||||
|     function __construct($profile, $tag, $userProfile) | ||||
|     function __construct($profile, $tag, $userProfile=-1) | ||||
|     { | ||||
|         if (is_int($userProfile) && $userProfile == -1) { | ||||
|             $userProfile = Profile::current(); | ||||
|   | ||||
| @@ -47,7 +47,7 @@ if (!defined('STATUSNET')) { | ||||
| class ActivityPlugin extends Plugin | ||||
| { | ||||
|     const VERSION = '0.1'; | ||||
|     const SOURCE  = 'system'; | ||||
|     const SOURCE  = 'activity'; | ||||
|  | ||||
|     // Flags to switch off certain activity notices | ||||
|     public $StartFollowUser = true; | ||||
|   | ||||
| @@ -115,21 +115,20 @@ class DirectoryPlugin extends Plugin | ||||
|     { | ||||
|  | ||||
|         $m->connect( | ||||
|             'directory/users', | ||||
|             'directory/users/:filter', | ||||
|             array('action' => 'userdirectory'), | ||||
|             array('filter' => 'all') | ||||
|             array('filter' => '[0-9a-zA-Z]|(0-9)') | ||||
|         ); | ||||
|  | ||||
|         $m->connect( | ||||
|             'directory/users/:filter', | ||||
|             array('action' => 'userdirectory'), | ||||
|             array('filter' => '([0-9a-zA-Z_]{1,64}|0-9)') | ||||
|             'directory/users', | ||||
|             array('action' => 'userdirectory') | ||||
|         ); | ||||
|  | ||||
|         $m->connect( | ||||
|             'groups/:filter', | ||||
|             array('action' => 'groupdirectory'), | ||||
|             array('filter' => '([0-9a-zA-Z_]{1,64}|0-9)') | ||||
|             array('filter' => '[0-9a-zA-Z]|(0-9)') | ||||
|         ); | ||||
|  | ||||
|         $m->connect( | ||||
|   | ||||
| @@ -206,7 +206,7 @@ class NeweventAction extends Action | ||||
|                 throw new ClientException(_m('Event must have an end time.')); | ||||
|             } | ||||
|  | ||||
|             if (isset($this->url) && Validate::uri($this->url) === false) { | ||||
|             if (!empty($this->url) && Validate::uri($this->url) === false) { | ||||
|                 // TRANS: Client exception thrown when trying to post an event with an invalid URL. | ||||
|                 throw new ClientException(_m('URL must be valid.')); | ||||
|             } | ||||
|   | ||||
| @@ -293,8 +293,16 @@ class MobileProfilePlugin extends WAP20Plugin | ||||
|     function _showLogo($action) | ||||
|     { | ||||
|         $action->elementStart('address', 'vcard'); | ||||
|         if (common_config('singleuser', 'enabled')) { | ||||
|             $user = User::singleUser(); | ||||
|             $url = common_local_url('showstream', array('nickname' => $user->nickname)); | ||||
|         } else { | ||||
|             $url = common_local_url('public'); | ||||
|         } | ||||
|  | ||||
|         $action->elementStart('a', array('class' => 'url home bookmark', | ||||
|                                        'href' => common_local_url('public'))); | ||||
|                                          'href' => $url)); | ||||
|  | ||||
|         if (common_config('site', 'mobilelogo') || | ||||
|             file_exists(Theme::file('logo.png')) || | ||||
|             file_exists(Theme::file('mobilelogo.png'))) { | ||||
|   | ||||
| @@ -54,19 +54,19 @@ class OStatusPlugin extends Plugin | ||||
|         // Discovery actions | ||||
|         $m->connect('main/ownerxrd', | ||||
|                     array('action' => 'ownerxrd')); | ||||
|         $m->connect('main/ostatus', | ||||
|                     array('action' => 'ostatusinit')); | ||||
|         $m->connect('main/ostatustag', | ||||
|                     array('action' => 'ostatustag')); | ||||
|         $m->connect('main/ostatustag?nickname=:nickname', | ||||
|                     array('action' => 'ostatustag'), array('nickname' => '[A-Za-z0-9_-]+')); | ||||
|         $m->connect('main/ostatus?nickname=:nickname', | ||||
|         $m->connect('main/ostatus/nickname/:nickname', | ||||
|                   array('action' => 'ostatusinit'), array('nickname' => '[A-Za-z0-9_-]+')); | ||||
|         $m->connect('main/ostatus?group=:group', | ||||
|         $m->connect('main/ostatus/group/:group', | ||||
|                   array('action' => 'ostatusinit'), array('group' => '[A-Za-z0-9_-]+')); | ||||
|         $m->connect('main/ostatus?peopletag=:peopletag&tagger=:tagger', | ||||
|         $m->connect('main/ostatus/peopletag/:peopletag/tagger/:tagger', | ||||
|                   array('action' => 'ostatusinit'), array('tagger' => '[A-Za-z0-9_-]+', | ||||
|                                                           'peopletag' => '[A-Za-z0-9_-]+')); | ||||
|         $m->connect('main/ostatus', | ||||
|                     array('action' => 'ostatusinit')); | ||||
|  | ||||
|         // Remote subscription actions | ||||
|         $m->connect('main/ostatussub', | ||||
| @@ -246,16 +246,16 @@ class OStatusPlugin extends Plugin | ||||
|         $cur = common_current_user(); | ||||
|  | ||||
|         if (empty($cur)) { | ||||
|             $output->elementStart('li', 'entity_subscribe'); | ||||
|             $profile = $peopletag->getTagger(); | ||||
|             $widget->out->elementStart('li', 'entity_subscribe'); | ||||
|  | ||||
|             $url = common_local_url('ostatusinit', | ||||
|                                     array('group' => $group->nickname)); | ||||
|             $widget->out->element('a', array('href' => $url, | ||||
|                                         'class' => 'entity_remote_subscribe'), | ||||
|                                              'class' => 'entity_remote_subscribe'), | ||||
|                                 // TRANS: Link to subscribe to a remote entity. | ||||
|                                 _m('Subscribe')); | ||||
|  | ||||
|             $output->elementEnd('li'); | ||||
|             $widget->out->elementEnd('li'); | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
| @@ -752,11 +752,11 @@ class OStatusPlugin extends Plugin | ||||
|      * deny the join. | ||||
|      * | ||||
|      * @param User_group $group | ||||
|      * @param User $user | ||||
|      * @param Profile    $profile | ||||
|      * | ||||
|      * @return mixed hook return value | ||||
|      */ | ||||
|     function onStartJoinGroup($group, $user) | ||||
|     function onStartJoinGroup($group, $profile) | ||||
|     { | ||||
|         $oprofile = Ostatus_profile::staticGet('group_id', $group->id); | ||||
|         if ($oprofile) { | ||||
| @@ -768,15 +768,13 @@ class OStatusPlugin extends Plugin | ||||
|             // NOTE: we don't use Group_member::asActivity() since that record | ||||
|             // has not yet been created. | ||||
|  | ||||
|             $member = Profile::staticGet($user->id); | ||||
|  | ||||
|             $act = new Activity(); | ||||
|             $act->id = TagURI::mint('join:%d:%d:%s', | ||||
|                                     $member->id, | ||||
|                                     $profile->id, | ||||
|                                     $group->id, | ||||
|                                     common_date_iso8601(time())); | ||||
|  | ||||
|             $act->actor = ActivityObject::fromProfile($member); | ||||
|             $act->actor = ActivityObject::fromProfile($profile); | ||||
|             $act->verb = ActivityVerb::JOIN; | ||||
|             $act->object = $oprofile->asActivityObject(); | ||||
|  | ||||
| @@ -786,10 +784,10 @@ class OStatusPlugin extends Plugin | ||||
|             // TRANS: Success message for subscribe to group attempt through OStatus. | ||||
|             // TRANS: %1$s is the member name, %2$s is the subscribed group's name. | ||||
|             $act->content = sprintf(_m('%1$s has joined group %2$s.'), | ||||
|                                     $member->getBestName(), | ||||
|                                     $profile->getBestName(), | ||||
|                                     $oprofile->getBestName()); | ||||
|  | ||||
|             if ($oprofile->notifyActivity($act, $member)) { | ||||
|             if ($oprofile->notifyActivity($act, $profile)) { | ||||
|                 return true; | ||||
|             } else { | ||||
|                 $oprofile->garbageCollect(); | ||||
| @@ -809,7 +807,7 @@ class OStatusPlugin extends Plugin | ||||
|      * it'll be left with a stray membership record. | ||||
|      * | ||||
|      * @param User_group $group | ||||
|      * @param Profile $user | ||||
|      * @param Profile $profile | ||||
|      * | ||||
|      * @return mixed hook return value | ||||
|      */ | ||||
|   | ||||
| @@ -53,6 +53,13 @@ class OStatusQueueHandler extends QueueHandler | ||||
|         $this->notice = $notice; | ||||
|         $this->user = User::staticGet('id', $notice->profile_id); | ||||
|  | ||||
|         try { | ||||
|             $profile = $this->notice->getProfile(); | ||||
|         } catch (Exception $e) { | ||||
|             common_log(LOG_ERR, "Can't get profile for notice; skipping: " . $e->getMessage()); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         $this->pushUser(); | ||||
|  | ||||
|         foreach ($notice->getGroups() as $group) { | ||||
|   | ||||
| @@ -188,7 +188,7 @@ class RealtimePlugin extends Plugin | ||||
|         // Add to the public timeline | ||||
|  | ||||
|         if ($notice->is_local == Notice::LOCAL_PUBLIC || | ||||
|             ($notice->is_local == Notice::REMOTE_OMB && !common_config('public', 'localonly'))) { | ||||
|             ($notice->is_local == Notice::REMOTE && !common_config('public', 'localonly'))) { | ||||
|             $paths[] = array('public', null, null); | ||||
|         } | ||||
|  | ||||
| @@ -294,9 +294,18 @@ class RealtimePlugin extends Plugin | ||||
|         // root url from page output | ||||
|  | ||||
|         $action->elementStart('address'); | ||||
|  | ||||
|         if (common_config('singleuser', 'enabled')) { | ||||
|             $user = User::singleUser(); | ||||
|             $url = common_local_url('showstream', array('nickname' => $user->nickname)); | ||||
|         } else { | ||||
|             $url = common_local_url('public'); | ||||
|         } | ||||
|  | ||||
|         $action->element('a', array('class' => 'url', | ||||
|                                   'href' => common_local_url('public')), | ||||
|                                     'href' => $url), | ||||
|                          ''); | ||||
|  | ||||
|         $action->elementEnd('address'); | ||||
|  | ||||
|         $action->showContentBlock(); | ||||
| @@ -475,7 +484,7 @@ class RealtimePlugin extends Plugin | ||||
|             break; | ||||
|          case 'tag': | ||||
|             $tag = $action->trimmed('tag'); | ||||
|             if (empty($tag)) { | ||||
|             if (!empty($tag)) { | ||||
|                 $arg1 = $tag; | ||||
|             } else { | ||||
|                 $this->log(LOG_NOTICE, "Unexpected 'tag' action without tag argument"); | ||||
|   | ||||
| @@ -108,7 +108,6 @@ class SearchSubPlugin extends Plugin | ||||
|         $m->connect('search/:search/unsubscribe', | ||||
|                     array('action' => 'searchunsub'), | ||||
|                     array('search' => Router::REGEX_TAG)); | ||||
|  | ||||
|         $m->connect(':nickname/search-subscriptions', | ||||
|                     array('action' => 'searchsubs'), | ||||
|                     array('nickname' => Nickname::DISPLAY_FMT)); | ||||
|   | ||||
| @@ -92,9 +92,12 @@ class SearchSubMenu extends MoreMenu | ||||
|             $id = $this->menuItemID($actionName, $args); | ||||
|         } | ||||
|  | ||||
|         // Add 'q' as a search param, not part of the url path | ||||
|  | ||||
|         $url = common_local_url($actionName, array(), $args); | ||||
|         if ($actionname == 'searchsub') { | ||||
|             // Add 'q' as a search param, not part of the url path | ||||
|             $url = common_local_url($actionName, array(), $args); | ||||
|         } else { | ||||
|             $url = common_local_url($actionName, $args); | ||||
|         } | ||||
|  | ||||
|         $this->out->menuItem($url, | ||||
|                              $label, | ||||
|   | ||||
| @@ -108,14 +108,14 @@ class SitemapPlugin extends Plugin | ||||
|         $m->connect('sitemapindex.xml', | ||||
|                     array('action' => 'sitemapindex')); | ||||
|  | ||||
|         $m->connect('/notice-sitemap-:year-:month-:day-:index.xml', | ||||
|         $m->connect('notice-sitemap-:year-:month-:day-:index.xml', | ||||
|                     array('action' => 'noticesitemap'), | ||||
|                     array('year' => '[0-9]{4}', | ||||
|                           'month' => '[01][0-9]', | ||||
|                           'day' => '[0123][0-9]', | ||||
|                           'index' => '[1-9][0-9]*')); | ||||
|  | ||||
|         $m->connect('/user-sitemap-:year-:month-:day-:index.xml', | ||||
|         $m->connect('user-sitemap-:year-:month-:day-:index.xml', | ||||
|                     array('action' => 'usersitemap'), | ||||
|                     array('year' => '[0-9]{4}', | ||||
|                           'month' => '[01][0-9]', | ||||
| @@ -196,12 +196,6 @@ class SitemapPlugin extends Plugin | ||||
|                                                  null, false), | ||||
|                                    new ColumnDef('modified', 'timestamp'))); | ||||
|  | ||||
|         $userCreated = $schema->getColumnDef('user', 'created'); | ||||
|  | ||||
|         if (empty($userCreated) || $userCreated->key != 'MUL') { | ||||
|             $schema->createIndex('user', 'created'); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -81,15 +81,15 @@ class SubscriptionThrottlePlugin extends Plugin | ||||
|     /** | ||||
|      * Filter group joins to see if they're coming too fast. | ||||
|      * | ||||
|      * @param Group $group The group being joined | ||||
|      * @param User  $user  The user joining | ||||
|      * @param Group   $group   The group being joined | ||||
|      * @param Profile $profile The profile joining | ||||
|      * | ||||
|      * @return boolean hook value | ||||
|      */ | ||||
|     function onStartJoinGroup($group, $user) | ||||
|     function onStartJoinGroup($group, $profile) | ||||
|     { | ||||
|         foreach ($this->groupLimits as $seconds => $limit) { | ||||
|             $mem = $this->_getNthMem($user, $limit); | ||||
|             $mem = $this->_getNthMem($profile, $limit); | ||||
|             if (!empty($mem)) { | ||||
|  | ||||
|                 $jointime = strtotime($mem->created); | ||||
| @@ -130,16 +130,16 @@ class SubscriptionThrottlePlugin extends Plugin | ||||
|     /** | ||||
|      * Get the Nth most recent group membership for this user | ||||
|      * | ||||
|      * @param User    $user The user to get memberships for | ||||
|      * @param integer $n    How far to count back | ||||
|      * @param Profile $profile The user to get memberships for | ||||
|      * @param integer $n       How far to count back | ||||
|      * | ||||
|      * @return Group_member a membership or null | ||||
|      */ | ||||
|     private function _getNthMem($user, $n) | ||||
|     private function _getNthMem($profile, $n) | ||||
|     { | ||||
|         $mem = new Group_member(); | ||||
|  | ||||
|         $mem->profile_id = $user->id; | ||||
|         $mem->profile_id = $profile->id; | ||||
|         $mem->orderBy('created DESC'); | ||||
|         $mem->limit($n - 1, 1); | ||||
|  | ||||
|   | ||||
| @@ -357,6 +357,75 @@ class TwitterauthorizationAction extends Action | ||||
|         $this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options')); | ||||
|         // TRANS: Fieldset legend. | ||||
|         $this->element('legend', null, _m('Connection options')); | ||||
|  | ||||
|         $this->hidden('access_token_key', $this->access_token->key); | ||||
|         $this->hidden('access_token_secret', $this->access_token->secret); | ||||
|         $this->hidden('twuid', $this->twuid); | ||||
|         $this->hidden('tw_fields_screen_name', $this->tw_fields['screen_name']); | ||||
|         $this->hidden('tw_fields_name', $this->tw_fields['fullname']); | ||||
|         $this->hidden('token', common_session_token()); | ||||
|  | ||||
|         // Don't allow new account creation if site is flagged as invite only | ||||
| 	if (common_config('site', 'inviteonly') == false) { | ||||
|             $this->elementStart('fieldset'); | ||||
|             $this->element('legend', null, | ||||
|                            // TRANS: Fieldset legend. | ||||
|                            _m('Create new account')); | ||||
|             $this->element('p', null, | ||||
|                            // TRANS: Sub form introduction text. | ||||
|                           _m('Create a new user with this nickname.')); | ||||
|             $this->elementStart('ul', 'form_data'); | ||||
|  | ||||
|             // Hook point for captcha etc | ||||
|             Event::handle('StartRegistrationFormData', array($this)); | ||||
|  | ||||
|             $this->elementStart('li'); | ||||
|             // TRANS: Field label. | ||||
|             $this->input('newname', _m('New nickname'), | ||||
|                          ($this->username) ? $this->username : '', | ||||
|                          // TRANS: Field title for nickname field. | ||||
|                          _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); | ||||
|             $this->elementEnd('li'); | ||||
|             $this->elementStart('li'); | ||||
|             // TRANS: Field label. | ||||
|             $this->input('email', _m('LABEL','Email'), $this->getEmail(), | ||||
|                          // TRANS: Field title for e-mail address field. | ||||
|                          _m('Used only for updates, announcements, '. | ||||
|                            'and password recovery')); | ||||
|             $this->elementEnd('li'); | ||||
|  | ||||
|             // Hook point for captcha etc | ||||
|             Event::handle('EndRegistrationFormData', array($this)); | ||||
|  | ||||
|             $this->elementEnd('ul'); | ||||
|             // TRANS: Button text for creating a new StatusNet account in the Twitter connect page. | ||||
|             $this->submit('create', _m('BUTTON','Create')); | ||||
|             $this->elementEnd('fieldset'); | ||||
|         } | ||||
|  | ||||
|         $this->elementStart('fieldset'); | ||||
|         $this->element('legend', null, | ||||
|                        // TRANS: Fieldset legend. | ||||
|                        _m('Connect existing account')); | ||||
|         $this->element('p', null, | ||||
|                        // TRANS: Sub form introduction text. | ||||
|                        _m('If you already have an account, login with your username and password to connect it to your Twitter account.')); | ||||
|         $this->elementStart('ul', 'form_data'); | ||||
|         $this->elementStart('li'); | ||||
|         // TRANS: Field label. | ||||
|         $this->input('nickname', _m('Existing nickname')); | ||||
|         $this->elementEnd('li'); | ||||
|         $this->elementStart('li'); | ||||
|         // TRANS: Field label. | ||||
|         $this->password('password', _m('Password')); | ||||
|         $this->elementEnd('li'); | ||||
|         $this->elementEnd('ul'); | ||||
|         $this->elementEnd('fieldset'); | ||||
|  | ||||
|         $this->elementStart('fieldset'); | ||||
|         $this->element('legend', null, | ||||
|                        // TRANS: Fieldset legend. | ||||
|                        _m('License')); | ||||
|         $this->elementStart('ul', 'form_data'); | ||||
|         $this->elementStart('li'); | ||||
|         $this->element('input', array('type' => 'checkbox', | ||||
| @@ -379,69 +448,9 @@ class TwitterauthorizationAction extends Action | ||||
|         $this->elementEnd('label'); | ||||
|         $this->elementEnd('li'); | ||||
|         $this->elementEnd('ul'); | ||||
|         $this->hidden('access_token_key', $this->access_token->key); | ||||
|         $this->hidden('access_token_secret', $this->access_token->secret); | ||||
|         $this->hidden('twuid', $this->twuid); | ||||
|         $this->hidden('tw_fields_screen_name', $this->tw_fields['screen_name']); | ||||
|         $this->hidden('tw_fields_name', $this->tw_fields['fullname']); | ||||
|  | ||||
|         $this->elementStart('fieldset'); | ||||
|         $this->hidden('token', common_session_token()); | ||||
|         $this->element('legend', null, | ||||
|                        // TRANS: Fieldset legend. | ||||
|                        _m('Create new account')); | ||||
|         $this->element('p', null, | ||||
|                        // TRANS: Sub form introduction text. | ||||
|                        _m('Create a new user with this nickname.')); | ||||
|         $this->elementStart('ul', 'form_data'); | ||||
|  | ||||
|         // Hook point for captcha etc | ||||
|         Event::handle('StartRegistrationFormData', array($this)); | ||||
|  | ||||
|         $this->elementStart('li'); | ||||
|         // TRANS: Field label. | ||||
|         $this->input('newname', _m('New nickname'), | ||||
|                      ($this->username) ? $this->username : '', | ||||
|                      // TRANS: Field title for nickname field. | ||||
|                      _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); | ||||
|         $this->elementEnd('li'); | ||||
|         $this->elementStart('li'); | ||||
|         // TRANS: Field label. | ||||
|         $this->input('email', _m('LABEL','Email'), $this->getEmail(), | ||||
|                      // TRANS: Field title for e-mail address field. | ||||
|                      _m('Used only for updates, announcements, '. | ||||
|                        'and password recovery')); | ||||
|         $this->elementEnd('li'); | ||||
|  | ||||
|         // Hook point for captcha etc | ||||
|         Event::handle('EndRegistrationFormData', array($this)); | ||||
|  | ||||
|         $this->elementEnd('ul'); | ||||
|         // TRANS: Button text for creating a new StatusNet account in the Twitter connect page. | ||||
|         $this->submit('create', _m('BUTTON','Create')); | ||||
|         $this->elementEnd('fieldset'); | ||||
|  | ||||
|         $this->elementStart('fieldset'); | ||||
|         $this->element('legend', null, | ||||
|                        // TRANS: Fieldset legend. | ||||
|                        _m('Connect existing account')); | ||||
|         $this->element('p', null, | ||||
|                        // TRANS: Sub form introduction text. | ||||
|                        _m('If you already have an account, login with your username and password to connect it to your Twitter account.')); | ||||
|         $this->elementStart('ul', 'form_data'); | ||||
|         $this->elementStart('li'); | ||||
|         // TRANS: Field label. | ||||
|         $this->input('nickname', _m('Existing nickname')); | ||||
|         $this->elementEnd('li'); | ||||
|         $this->elementStart('li'); | ||||
|         // TRANS: Field label. | ||||
|         $this->password('password', _m('Password')); | ||||
|         $this->elementEnd('li'); | ||||
|         $this->elementEnd('ul'); | ||||
|         // TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page.. | ||||
|         $this->submit('connect', _m('BUTTON','Connect')); | ||||
|         $this->elementEnd('fieldset'); | ||||
|  | ||||
|         $this->elementEnd('fieldset'); | ||||
|         $this->elementEnd('form'); | ||||
|     } | ||||
|   | ||||
| @@ -149,7 +149,7 @@ function newNotice($i, $tagmax) | ||||
|         $options['scope'] |= Notice::SITE_SCOPE; | ||||
|     } | ||||
|  | ||||
|     $notice = Notice::saveNew($user->id, $content, 'system', $options); | ||||
|     $notice = Notice::saveNew($user->id, $content, 'createsim', $options); | ||||
| } | ||||
|  | ||||
| function newSub($i) | ||||
|   | ||||
| @@ -1502,16 +1502,16 @@ content:'☠'; | ||||
| font-size:150%; | ||||
| } | ||||
|  | ||||
| #content .notice-source-system div.entry-title, .notice-source-system div.entry-content { | ||||
| #content .notice-source-activity div.entry-title, .notice-source-activity div.entry-content { | ||||
|     margin-left: 0; | ||||
| }  | ||||
|  | ||||
| #content .notice-source-system div.entry-title { | ||||
| #content .notice-source-activity div.entry-title { | ||||
|     font-style: italic; | ||||
|     min-height: 0; | ||||
| } | ||||
|  | ||||
| #content .notice-source-system .notice div.entry-title { | ||||
| #content .notice-source-activity .notice div.entry-title { | ||||
|     font-style: normal; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user