Пример #1
0
function Streams_0_8_6_Streams_mysql()
{
    $app = Q_Config::expect('Q', 'app');
    // access for managing communities
    $access = new Streams_Access();
    $access->publisherId = $app;
    $access->streamName = 'Streams/community*';
    $access->ofUserId = '';
    $access->ofContactLabel = "{$app}/admins";
    $access->readLevel = Streams::$READ_LEVEL['messages'];
    $access->writeLevel = Streams::$WRITE_LEVEL['edit'];
    $access->adminLevel = Streams::$ADMIN_LEVEL['manage'];
    $access->save();
    // access for managing categories
    $access = new Streams_Access();
    $access->publisherId = $app;
    $access->streamName = 'Streams/category/';
    $access->ofUserId = '';
    $access->ofContactLabel = "{$app}/admins";
    $access->readLevel = Streams::$READ_LEVEL['messages'];
    $access->writeLevel = Streams::$WRITE_LEVEL['close'];
    $access->adminLevel = Streams::$ADMIN_LEVEL['manage'];
    $access->save();
    // template to help users relate things to Streams/category streams
    Streams_Stream::insert(array('publisherId' => '', 'name' => 'Streams/category/', 'type' => 'Streams/template', 'title' => 'Untitled Category', 'icon' => 'Streams/category', 'content' => '', 'attributes' => null, 'readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['relate'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']))->execute();
    // template to help users create subcategories for things
    Streams_RelatedTo::insert(array('toPublisherId' => '', 'toStreamName' => 'Streams/category/', 'type' => 'subcategories', 'fromPublisherId' => '', 'fromStreamName' => 'Streams/category/'))->execute();
}
Пример #2
0
function Streams_0_8_7_Streams_mysql()
{
    $app = Q_Config::expect('Q', 'app');
    $user = Users_User::fetch($app, true);
    $simulated = array('row' => $user, 'inserted' => true, 'modifiedFields' => $user->fields);
    Q::event('Db/Row/Users_User/saveExecute', $simulated, 'after');
    $stream = array('publisherId' => '', 'name' => "Streams/images/", 'type' => 'Streams/template', 'title' => 'Image Gallery', 'icon' => 'default', 'content' => '', 'attributes' => null, 'readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['close'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']);
    $access = array('publisherId' => '', 'streamName' => "Streams/images/", 'ofUserId' => '', 'grantedByUserId' => null, 'ofContactLabel' => "{$app}/admins", 'readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['close'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']);
    Streams_Stream::insert($stream)->execute();
    Streams_Access::insert($access)->execute();
    $stream['name'] = $access['streamName'] = 'Streams/image/';
    $stream['icon'] = 'Streams/image';
    $stream['title'] = 'Untitled Image';
    Streams_Stream::insert($stream)->execute();
    Streams_Access::insert($access)->execute();
    $stream['name'] = $access['streamName'] = 'Streams/file/';
    $stream['icon'] = 'files/_blank';
    $stream['title'] = 'Untitled File';
    Streams_Stream::insert($stream)->execute();
    Streams_Access::insert($access)->execute();
}