$schema = Schema::get();
// For storing user-submitted flags on profiles
-
- $schema->ensureTable('group_privacy_settings',
- array(new ColumnDef('group_id',
- 'integer',
- null,
- false,
- 'PRI'),
- new ColumnDef('allow_privacy',
- 'integer'),
- new ColumnDef('allow_sender',
- 'integer'),
- new ColumnDef('created',
- 'datetime'),
- new ColumnDef('modified',
- 'timestamp')));
-
- $schema->ensureTable('group_message',
- array(new ColumnDef('id',
- 'char',
- 36,
- false,
- 'PRI'),
- new ColumnDef('uri',
- 'varchar',
- 255,
- false,
- 'UNI'),
- new ColumnDef('from_profile',
- 'integer',
- null,
- false,
- 'MUL'),
- new ColumnDef('to_group',
- 'integer',
- null,
- false,
- 'MUL'),
- new ColumnDef('content',
- 'text'),
- new ColumnDef('rendered',
- 'text'),
- new ColumnDef('url',
- 'varchar',
- 255,
- false,
- 'UNI'),
- new ColumnDef('created',
- 'datetime')));
-
- $schema->ensureTable('group_message_profile',
- array(new ColumnDef('to_profile',
- 'integer',
- null,
- false,
- 'PRI'),
- new ColumnDef('group_message_id',
- 'char',
- 36,
- false,
- 'PRI'),
- new ColumnDef('created',
- 'datetime')));
-
+ $schema->ensureTable('group_privacy_settings', Group_privacy_settings::schemaDef());
+ $schema->ensureTable('group_message', Group_message::schemaDef());
+ $schema->ensureTable('group_message_profile', Group_message_profile::schemaDef());
return true;
}
- /**
- * Load related modules when needed
- *
- * @param string $cls Name of the class to be loaded
- *
- * @return boolean hook value
- */
- function onAutoload($cls)
- {
- $dir = dirname(__FILE__);
-
- switch ($cls)
- {
- case 'GroupinboxAction':
- case 'ShowgroupmessageAction':
- case 'NewgroupmessageAction':
- include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
- return false;
- case 'Group_privacy_settings':
- case 'Group_message':
- case 'Group_message_profile':
- include_once $dir . '/'.$cls.'.php';
- return false;
- case 'GroupMessageCommand':
- case 'GroupMessageList':
- case 'GroupMessageListItem':
- case 'GroupMessageForm':
- include_once $dir . '/'.strtolower($cls).'.php';
- return false;
- default:
- return true;
- }
- }
-
/**
* Map URLs to actions
*
- * @param Net_URL_Mapper $m path-to-action mapper
+ * @param URLMapper $m path-to-action mapper
*
* @return boolean hook value
*/
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect('group/:nickname/inbox',
array('action' => 'groupinbox'),
*
* @see Action
*/
- function onEndGroupGroupNav($groupnav)
+ function onEndGroupGroupNav(Menu $groupnav)
{
$action = $groupnav->action;
$group = $groupnav->group;
*
* @result boolean hook value
*/
- function onEndGroupSave($group)
+ function onEndGroupSave(User_group $group)
{
$gps = new Group_privacy_settings();
*
* @param GroupEditForm $form form being shown
*/
- function onEndGroupEditFormData($form)
+ function onEndGroupEditFormData(GroupEditForm $form)
{
$gps = null;
if (!empty($form->group)) {
- $gps = Group_privacy_settings::staticGet('group_id', $form->group->id);
+ $gps = Group_privacy_settings::getKV('group_id', $form->group->id);
}
$form->out->elementStart('li');
return true;
}
- function onEndGroupSaveForm($action)
+ function onEndGroupSaveForm(GroupAction $action)
{
$gps = null;
- if (!empty($action->group)) {
- $gps = Group_privacy_settings::staticGet('group_id', $action->group->id);
+ if (!empty($action->getGroup())) {
+ $gps = Group_privacy_settings::getKV('group_id', $action->getGroup()->id);
}
$orig = null;
if (empty($gps)) {
$gps = new Group_privacy_settings();
- $gps->group_id = $action->group->id;
+ $gps->group_id = $action->getGroup()->id;
} else {
$orig = clone($gps);
}
*
* @return boolean hook value
*/
- function onStartIntepretCommand($cmd, $arg, $user, &$result)
+ function onStartInterpretCommand($cmd, $arg, User $user, &$result)
{
if ($cmd == 'd' || $cmd == 'dm') {
*
* @return boolean hook value
*/
- function onEndGroupActionsList($widget, $group)
+ function onEndGroupActionsList(Widget $widget, User_group $group)
{
$cur = common_current_user();
$action = $widget->out;
*
* @param
*/
- function onStartNoticeSave(&$notice) {
+ function onStartNoticeSave(Notice &$notice) {
// Look for group tags
// FIXME: won't work for remote groups
// @fixme if Notice::saveNew is refactored so we can just pull its list
foreach (array_unique($match[1]) as $nickname) {
$group = User_group::getForNickname($nickname, $profile);
- if (empty($group)) {
+ if (!$group instanceof User_group) {
continue;
}
"but group ".$group->nickname." does not allow them.");
}
- $user = User::staticGet('id', $notice->profile_id);
+ $user = User::getKV('id', $notice->profile_id);
if (empty($user)) {
common_log(LOG_WARNING,
*
* @return boolean hook value
*/
- function onEndGroupProfileElements($action, $group)
+ function onEndGroupProfileElements(Action $action, User_group $group)
{
$gps = Group_privacy_settings::forGroup($group);
return true;
}
- function onStartShowExportData($action)
+ function onStartShowExportData(GroupAction $action)
{
if ($action instanceof ShowgroupAction) {
- $gps = Group_privacy_settings::forGroup($action->group);
+ $gps = Group_privacy_settings::forGroup($action->getGroup());
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
return false;
return true;
}
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$versions[] = array('name' => 'GroupPrivateMessage',
- 'version' => STATUSNET_VERSION,
+ 'version' => GNUSOCIAL_VERSION,
'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:GroupPrivateMessage',
'rawdescription' =>