Example #1
0
 public function move(Wall $dest, $user)
 {
     CommentsIndex::changeParent(0, $dest->getId(), $this->mThreadId);
     $wallHistory = new WallHistory($this->mCityId);
     $wallHistory->moveThread($this->mThreadId, $dest->getId());
     $main = $this->getThreadMainMsg();
     $main->load();
     // this is use to build a history in contribiution page
     $main->markAsMove($user);
     $this->invalidateCache();
 }
Example #2
0
 public function actionEdit()
 {
     $id = Yii::app()->request->getParam('id');
     // Current wall type we are in (Dashboard, Space, User)
     // Used to properly render the result wall item.
     $wallType = Yii::app()->request->getParam('wallType');
     $edited = false;
     $model = Post::model()->findByPk($id);
     if ($model->content->canWrite()) {
         if (isset($_POST['Post'])) {
             $_POST['Post'] = Yii::app()->input->stripClean($_POST['Post']);
             $model->attributes = $_POST['Post'];
             if ($model->validate()) {
                 $model->save();
                 // Reload record to get populated updated_at field
                 $model = Post::model()->findByPk($id);
                 // Set current wall type
                 Wall::$currentType = $wallType;
                 // Return the new post
                 $output = $this->widget('application.modules_core.post.widgets.PostWidget', array('post' => $model, 'justEdited' => true), true);
                 Yii::app()->clientScript->render($output);
                 echo $output;
                 return;
             }
         }
         $this->renderPartial('edit', array('post' => $model, 'edited' => $edited, 'wallType' => $wallType), false, true);
     } else {
         throw new CHttpException(403, Yii::t('PostModule.controllers_PostController', 'Access denied!'));
     }
 }
 /**
  * Runs the activity widget
  */
 public function run()
 {
     // Save Wall Type
     Wall::$currentType = $this->type;
     $javascriptVariablePass = "******" . Yii::app()->createUrl('//wall/wall/streamActivity', array('type' => $this->type, 'guid' => $this->guid, 'limit' => 10, 'from' => 'lastEntryId')) . "';\n";
     $javascriptVariablePass .= "var activityStartUrl = '" . Yii::app()->createUrl('//wall/wall/streamActivity', array('type' => $this->type, 'guid' => $this->guid, 'limit' => 10)) . "';\n";
     $javascriptVariablePass .= "var activityPermaLinkUrl = '" . Yii::app()->createUrl('//wall/perma/wallEntry') . "';\n";
     Yii::app()->clientScript->registerScript('activityUrls', $javascriptVariablePass, CClientScript::POS_BEGIN);
     $this->render('activityStream', array());
 }
Example #4
0
 /** @test */
 public function clockShouldTockEachTime()
 {
     $clock = new Wall(1);
     $clock->init();
     $to = intval(microtime(true) * 1000);
     $this->assertFalse($clock->tick(), "Tick without time moving");
     $this->assertFalse($clock->tock($to), "Tock without time moving");
     usleep(2000);
     $clock->inc();
     $this->assertTrue($clock->tick(), "No tick, even though time inc'd");
     $to += 4;
     $this->assertFalse($clock->tock($to), "Tock without time moving");
     usleep(2000);
     $clock->inc();
     $this->assertTrue($clock->tock($to), "No tock!");
 }
Example #5
0
 /**
  * On run of integrity check command, validate all user data
  *
  * @param type $event
  */
 public static function onIntegrityCheck($event)
 {
     $integrityChecker = $event->sender;
     $integrityChecker->showTestHeadline("Validating User Module (" . User::model()->count() . " entries)");
     foreach (User::model()->findAll() as $u) {
         $profile = $u->getProfile();
         if ($profile == null || $profile->isNewRecord) {
             $integrityChecker->showWarning("No profile table record found for " . $u->username);
         }
         if ($u->wall_id == "") {
             $wall = new Wall();
             $wall->object_model = 'User';
             $wall->object_id = $u->id;
             $wall->save();
             $u->wall_id = $wall->id;
             $u->save();
             $integrityChecker->showFix("Created wall table entry for " . $u->username);
         }
     }
 }
 public function actionLoadNext($id, $last, $limit)
 {
     if (Yii::app()->request->isAjaxRequest) {
         $wall = Wall::model()->loadNext($last, $limit, $id);
         foreach ($wall as $item) {
             $res .= $this->renderPartial('//profile/profile/_wallItem', array('item' => $item), true);
         }
         echo json_encode(array('status' => 'ok', 'data' => $res));
     } else {
         throw new CException('Not Found', 404);
     }
 }
Example #7
0
 /**
  * Creates the Wall Widget
  */
 public function run()
 {
     // Save Wall Type
     Wall::$currentType = $this->type;
     $guid = null;
     if ($this->contentContainer != "") {
         $guid = $this->contentContainer->guid;
     }
     // Set some Urls for this wall
     $reloadUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => $this->wallObjectStreamLimit, 'from' => 'lastEntryId', 'filters' => 'filter_placeholder', 'sort' => 'sort_placeholder'));
     $startUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => $this->wallObjectStreamLimit, 'filters' => 'filter_placeholder', 'sort' => 'sort_placeholder'));
     $singleEntryUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => 1, 'from' => 'fromEntryId'));
     // Render It
     $this->render('stream', array('type' => $this->type, 'reloadUrl' => $reloadUrl, 'startUrl' => $startUrl, 'singleEntryUrl' => $singleEntryUrl));
 }
Example #8
0
 /**
  * Creates the Wall Widget
  */
 public function run()
 {
     // Should be at least 4, because its possible to stick at maximum 3 object
     // Otherwise sticky system may break the wall
     $wallObjectStreamLimit = 4;
     // Save Wall Type
     Wall::$currentType = $this->type;
     $guid = null;
     if ($this->contentContainer != "") {
         $guid = $this->contentContainer->guid;
     }
     // Set some Urls for this wall
     $reloadUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => $wallObjectStreamLimit, 'from' => 'lastEntryId', 'filters' => 'filter_placeholder', 'sort' => 'sort_placeholder'));
     $startUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => $wallObjectStreamLimit, 'filters' => 'filter_placeholder', 'sort' => 'sort_placeholder'));
     $singleEntryUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => 1, 'from' => 'fromEntryId'));
     // Render It
     $this->render('stream', array('type' => $this->type, 'reloadUrl' => $reloadUrl, 'startUrl' => $startUrl, 'singleEntryUrl' => $singleEntryUrl));
 }
Example #9
0
 /**
  * Creates the Wall Widget
  */
 public function run()
 {
     // Save Wall Type
     Wall::$currentType = $this->type;
     $guid = null;
     if ($this->contentContainer != "") {
         $guid = $this->contentContainer->guid;
     }
     // Set some Urls for this wall
     $reloadUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => $this->wallObjectStreamLimit, 'from' => 'lastEntryId', 'filters' => 'filter_placeholder', 'sort' => 'sort_placeholder'));
     $startUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => $this->wallObjectStreamLimit, 'filters' => 'filter_placeholder', 'sort' => 'sort_placeholder'));
     $singleEntryUrl = Yii::app()->createUrl($this->streamAction, array('type' => $this->type, 'guid' => $guid, 'limit' => 1, 'from' => 'fromEntryId'));
     $view = 'stream_deprecated';
     /**
      * For backward compatiblity use modules 'stream' view
      */
     if (get_class($this) != 'WallStreamWidget') {
         $view = 'stream';
     }
     // Render It
     $this->render($view, array('type' => $this->type, 'reloadUrl' => $reloadUrl, 'startUrl' => $startUrl, 'singleEntryUrl' => $singleEntryUrl));
 }
 /**
  * Moves thread
  * @request destinationBoardId - id of destination board
  * @request rootMessageId - thread id
  */
 public function moveThread()
 {
     // permission check needed here
     if (!$this->wg->User->isAllowed('wallmessagemove')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $this->status = 'error';
     $destinationId = $this->getVal('destinationBoardId', '');
     $threadId = $this->getVal('rootMessageId', '');
     if (empty($destinationId)) {
         $this->errormsg = wfMsg('wall-action-move-validation-select-wall');
         return true;
     }
     $wall = Wall::newFromId($destinationId);
     $thread = WallThread::newFromId($threadId);
     if (empty($wall)) {
         $this->errormsg = 'unknown';
     }
     $thread->move($wall, $this->wg->User);
     $this->status = 'ok';
 }
Example #11
0
 public function getUser()
 {
     $title = F::app()->wg->Title;
     $ns = $title->getNamespace();
     $user = null;
     if ($ns == NS_USER_WALL) {
         /**
          * @var $w Wall
          */
         $w = Wall::newFromTitle($title);
         $user = $w->getUser();
     } else {
         if ($ns == NS_USER_WALL_MESSAGE) {
             // title to wall thread is Thread:dddd, which does not exist in the db. this will
             // result in articleId being 0, which will break the logic later. So we need
             // to fetch the existing title here (Username/@comment-...)
             if (intval($title->getText()) > 0) {
                 $mainTitle = Title::newFromId($title->getText());
                 if (empty($mainTitle)) {
                     $mainTitle = Title::newFromId($title->getText(), Title::GAID_FOR_UPDATE);
                 }
                 if (!empty($mainTitle)) {
                     $title = $mainTitle;
                 }
             }
             /**
              * @var $wm WallMessage
              */
             $wm = WallMessage::newFromTitle($title);
             $user = $wm->getWallOwner();
         }
     }
     if (is_null($user)) {
         return UserProfilePageHelper::getUserFromTitle($title);
     }
     return $user;
 }
 public function commentdelete()
 {
     $wid = isset($_POST['id']) ? addslashes($_POST['id']) : '';
     if ($wid == "") {
         die('ID empty');
     }
     $json['bool'] = 0;
     $wallmurid = new MuridWallComment();
     //load
     $wallmurid->getByID($wid);
     if ($wallmurid->cid_admin_id == Account::getMyID()) {
         $json['bool'] = $wallmurid->delete($wid);
         if ($json['bool']) {
             $wall = new MuridWall();
             $wall->getByID($wallmurid->wid);
             $wall->wall_commentcount--;
             $wall->load = 1;
             $tgl = Wall::getDateTime();
             $wall->wall_update = $tgl;
             $json['bool'] = $wall->save();
         }
     } else {
         $json['err'] = Lang::t('Not Authorize');
     }
     die(json_encode($json));
 }
Example #13
0
<?php

require "include.php";
$w = new Wall($_REQUEST['owner']);
echo $w->load($_REQUEST['count'], $_REQUEST['offset'], $_REQUEST['activity']);
Example #14
0
 public function moveAllThread(Wall $dest)
 {
     CommentsIndex::changeParent($this->getId(), $dest->getId());
     $wallHistory = new WallHistory($this->mCityId);
     $wallHistory->moveThreads($this->getId(), $dest->getId());
 }
Example #15
0
$ret .= "<div>";
$ret .= "   <p>Subscribe to the current wall using <a href=\"" . $base_uri . "/atom.php?id=" . $owner_hash . "\">this Atom feed</a>.</p>\n";
$ret .= "</div>";
// Add notification message
if (strlen($notification) > 0) {
    $ret .= $notification;
}
// Add message form
$ret .= $form_area;
// Display warning if the user isn't allowed to view a certain wall
if (isset($warning)) {
    $ret .= "<h3>You are not allowed to see this page because you are not a friend of ";
    $ret .= "<a href=\"view?webid=" . urlencode($owner_webid) . "\">" . $profile->get_name() . ".</a></h3>";
} else {
    // Display messages
    $w = new Wall($owner_hash);
    $posts = $w->load(20, 0, $_REQUEST['activity']);
    $offset = $w->get_offset();
    // page content
    $ret .= "<div id=\"wall\">\n";
    $ret .= $posts;
    // add Load more button
    $ret .= "</div>\n";
    $ret .= "<p></p>\n";
}
$ret .= "</div>\n";
// prepare etag
$etag_array = get_etag($owner_hash);
$lastmod = gmdate('D, d M Y H:i:s \\G\\M\\T', $etag_array['date']);
$etag = $etag_array['etag'];
$ifmod = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $lastmod : null;
 /**
  * @brief Hook to change tabs on user wall page
  *
  * @param $template
  * @param $contentActions
  * @return bool
  *
  * @author Andrzej 'nAndy' Łukaszewski
  */
 public static function onSkinTemplateTabs($template, &$contentActions)
 {
     $app = F::App();
     if (!empty($app->wg->EnableWallExt)) {
         $helper = new WallHelper();
         $title = $app->wg->Title;
         if ($title->getNamespace() === NS_USER) {
             if (!empty($contentActions['namespaces']) && !empty($contentActions['namespaces']['user_talk'])) {
                 $contentActions['namespaces']['user_talk']['text'] = wfMessage('wall-message-wall')->text();
                 $userWallTitle = static::getWallTitle();
                 if ($userWallTitle instanceof Title) {
                     $contentActions['namespaces']['user_talk']['href'] = $userWallTitle->getLocalUrl();
                 }
                 // BugId:23000 Remove the class="new" to prevent the link from being displayed as a redlink in monobook.
                 if ($app->wg->User->getSkin() instanceof SkinMonoBook) {
                     unset($contentActions['namespaces']['user_talk']['class']);
                 }
             }
         }
         if ($title->getNamespace() === NS_USER_WALL || $title->getNamespace() === NS_USER_WALL_MESSAGE) {
             if ($title->getNamespace() === NS_USER_WALL_MESSAGE) {
                 $text = $title->getText();
                 $id = intval($text);
                 if ($id > 0) {
                     $wm = WallMessage::newFromId($id);
                 } else {
                     // sometimes (I found it on a revision diff page) $id here isn't a number from (in example) Thread:1234 link
                     // it's a text similar to this: AndLuk/@comment-38.127.199.123-20120111182821
                     // then we need to use WallMessage constructor method
                     $wm = new WallMessage($title);
                 }
                 if (empty($wm)) {
                     // FB#19394
                     return true;
                 }
                 /* @var $wm WallMessage */
                 $wall = $wm->getWall();
                 $user = $wall->getUser();
             } else {
                 $wall = Wall::newFromTitle($title);
                 $user = $wall->getUser();
             }
             $contentActions['namespaces'] = array();
             if ($user instanceof User) {
                 $contentActions['namespaces']['user-profile'] = array('class' => false, 'href' => $user->getUserPage()->getFullUrl(), 'text' => wfMessage('nstab-user')->text());
             }
             $contentActions['namespaces']['message-wall'] = array('class' => 'selected', 'href' => $wall->getUrl(), 'text' => wfMessage('wall-message-wall')->text());
         }
         if ($title->getNamespace() === NS_USER_WALL && $title->isSubpage()) {
             $userTalkPageTitle = $helper->getTitle(NS_USER_TALK);
             $contentActions = array();
             $contentActions['namespaces'] = array();
             $contentActions['namespaces']['view-source'] = array('class' => false, 'href' => $userTalkPageTitle->getLocalUrl(array('action' => 'edit')), 'text' => wfMessage('user-action-menu-view-source')->text());
             $contentActions['namespaces']['history'] = array('class' => false, 'href' => $userTalkPageTitle->getLocalUrl(array('action' => 'history')), 'text' => wfMessage('user-action-menu-history')->text());
         }
     }
     return true;
 }
 public function getWallForIndexPage($title)
 {
     if ($title->getNamespace() == NS_WIKIA_FORUM_TOPIC_BOARD) {
         $topicTitle = $this->getTopicTitle();
         if (!empty($topicTitle)) {
             $wall = Wall::newFromRelatedPages($title, $topicTitle->getArticleId());
             $this->response->setVal('topicText', $topicTitle->getPrefixedText());
             $wall->disableCache();
         } else {
             $wall = Wall::newFromTitle($title);
         }
     } else {
         $wall = Wall::newFromTitle($title);
     }
     return $wall;
 }
Example #18
0
 public function setUpApproved()
 {
     $userInvite = UserInvite::model()->findByAttributes(array('email' => $this->email));
     if ($userInvite !== null) {
         // User was invited to a space
         if ($userInvite->source == UserInvite::SOURCE_INVITE) {
             $space = Space::model()->findByPk($userInvite->space_invite_id);
             if ($space != null) {
                 $space->addMember($this->id);
             }
         }
         // Delete/Cleanup Invite Entry
         $userInvite->delete();
     }
     // Auto Assign User to the Group Space
     $group = Group::model()->findByPk($this->group_id);
     if ($group != null && $group->space_id != "") {
         $space = Space::model()->findByPk($group->space_id);
         if ($space !== null) {
             $space->addMember($this->id);
         }
     }
     //
     // Auto Add User to the default spaces
     foreach (Space::model()->findAllByAttributes(array('auto_add_new_members' => 1)) as $space) {
         $space->addMember($this->id);
     }
     // Create new wall record for this user
     $wall = new Wall();
     $wall->object_model = 'User';
     $wall->object_id = $this->id;
     $wall->save();
     $this->wall_id = $wall->id;
     $this->wall = $wall;
     User::model()->updateByPk($this->id, array('wall_id' => $wall->id));
 }
 public function getWallForIndexPage($title)
 {
     $wall = Wall::newFromTitle($title);
     return $wall;
 }
Example #20
0
 /**
  * Execute the Stream Action and returns a JSON output.
  */
 public function run()
 {
     $this->init();
     $this->prepareSQL();
     $this->setupFilterSQL();
     Yii::beginProfile('runStreamAction');
     $stickedFirstOrder = "";
     // Show sticked items?
     if (($this->type == Wall::TYPE_SPACE || $this->type == Wall::TYPE_USER) && $this->wallEntryLimit != 1) {
         if ($this->wallEntryFrom == "") {
             $stickedFirstOrder = "content.sticked DESC,";
         } else {
             $this->sqlWhere .= " AND (content.sticked != 1 OR content.sticked is NULL)";
         }
     }
     //$order = "ORDER BY ".$stickedFirstOrder."wall_entry.created_at DESC";
     $order = "ORDER BY " . $stickedFirstOrder . "wall_entry.id DESC";
     if ($this->sorting == self::SORT_UPDATED_AT) {
         $order = "ORDER BY " . $stickedFirstOrder . "wall_entry.updated_at DESC";
     }
     $sql = "SELECT wall_entry.*\n\t\t\tFROM wall_entry\n                        LEFT JOIN content ON wall_entry.content_id = content.id\n                        LEFT JOIN user creator ON creator.id = content.created_by\n\t\t\t{$this->sqlJoin}\n\t\t\tWHERE creator.status = 1\n\t\t\t{$this->sqlWhere}\n\t\t\t{$this->sqlGroupBy}\n            {$order}\n\t\t\tLIMIT {$this->wallEntryLimit}\n\t\t";
     // Execute SQL
     $entries = WallEntry::model()->with('content')->findAllBySql($sql, $this->sqlParams);
     // Save Wall Type
     Wall::$currentType = $this->type;
     $output = "";
     $lastEntryId = "";
     $generatedWallEntryIds = array();
     foreach ($entries as $entry) {
         $underlyingObject = $entry->content->getUnderlyingObject();
         $user = $underlyingObject->content->user;
         $output .= Yii::app()->getController()->renderPartial('application.modules_core.wall.views.wallEntry', array('entry' => $entry, 'user' => $user, 'mode' => $this->mode, 'object' => $underlyingObject, 'content' => $underlyingObject->getWallOut()), true);
         $generatedWallEntryIds[] = $entry->id;
         $lastEntryId = $entry->id;
     }
     // Fire JQuery Time AGO
     Yii::app()->clientScript->registerScript('timeago', '$(".time").timeago();');
     $pageOut = "";
     Yii::app()->clientScript->renderHead($pageOut);
     Yii::app()->clientScript->renderBodyBegin($pageOut);
     $pageOut .= $output;
     Yii::app()->clientScript->renderBodyEnd($pageOut);
     $json = array();
     $json['output'] = $pageOut;
     $json['lastEntryId'] = $lastEntryId;
     $json['counter'] = count($entries);
     $json['entryIds'] = $generatedWallEntryIds;
     Yii::endProfile('runStreamAction');
     echo CJSON::encode($json);
     Yii::app()->end();
 }
$mysession->initSession();
$content = $_POST["content"];
$toWall = $_POST["toWall"];
$patron = "/^[[:digit:]]+\$/";
if (isset($_SESSION['id']) and preg_match($patron, $_SESSION['id'])) {
    $fromUser = $_SESSION['id'];
} else {
    //El id 1 pertenece al usuario anonimo
    $fromUser = 1;
}
if (isset($_POST["toUser"]) and preg_match($patron, $_POST["toUser"])) {
    $toUser = $_POST["toUser"];
} else {
    header('location:index.php?error=4');
    exit;
}
echo "string";
$wallRepo = new WallRepositoryService();
$wallResult = $wallRepo->getWallByUserId($toUser);
if ($row = $wallResult->fetch_object()) {
    $wall = new Wall();
    $messages = $wall->getMessages($row->limite_muro, $toUser);
    if (count($messages) < $row->limite_muro) {
        $cbcCipher = new CbcCipher($content);
        $content = $cbcCipher->encrypt();
        $message = new Message($content, $toWall, $fromUser);
        header('location: ../../index.php?usuario=' . $toUser);
    } else {
        header('location: ../../index.php?usuario=' . $toUser . '&alert');
    }
}
Example #22
0
 /**
  * Before deletion of a Space
  */
 protected function beforeDelete()
 {
     foreach (SpaceSetting::model()->findAllByAttributes(array('space_id' => $this->id)) as $spaceSetting) {
         $spaceSetting->delete();
     }
     // Disable all enabled modules
     foreach ($this->getAvailableModules() as $moduleId => $module) {
         if ($this->isModuleEnabled($moduleId)) {
             $this->disableModule($moduleId);
         }
     }
     HSearch::getInstance()->deleteModel($this);
     $this->getProfileImage()->delete();
     // Remove all Follwers
     UserFollow::model()->deleteAllByAttributes(array('object_id' => $this->id, 'object_model' => 'Space'));
     //Delete all memberships:
     //First select, then delete - done to make sure that SpaceMembership::beforeDelete() is triggered
     $spaceMemberships = SpaceMembership::model()->findAllByAttributes(array('space_id' => $this->id));
     foreach ($spaceMemberships as $spaceMembership) {
         $spaceMembership->delete();
     }
     UserInvite::model()->deleteAllByAttributes(array('space_invite_id' => $this->id));
     // Delete all content objects of this space
     foreach (Content::model()->findAllByAttributes(array('space_id' => $this->id)) as $content) {
         $content->delete();
     }
     // When this workspace is used in a group as default workspace, delete the link
     foreach (Group::model()->findAllByAttributes(array('space_id' => $this->id)) as $group) {
         $group->space_id = "";
         $group->save();
     }
     Wall::model()->deleteAllByAttributes(array('id' => $this->wall_id));
     return parent::beforeDelete();
 }
    $userHasWall = false;
}
if ($userHasWall) {
    $objWall = $wallResult->fetch_object();
    $privacidad = $objWall->privacidad;
    $idMuro = $objWall->id_muro;
    $anonimoLectura = $objWall->flag_anonimo_lectura;
    $anonimoEscritura = $objWall->flag_anonimo_escritura;
    $limiteMuro = $objWall->limite_muro;
    $objLimit = $MessageLimitResult->fetch_object();
    $limitPrivateMsg = $objLimit->limite;
    //limite de mensaje de la bandeja de entrada $limiteMensajePri
    $IdBandeja = $objLimit->id_bandeja;
    $totalPrivateMsg = $MessageNumResult;
    //cantidad de mensajes en bandeja de entrada
    $wall = new Wall();
    $messages = $wall->getMessages($limiteMuro, $idUsuario);
    if ($messages != null) {
        foreach ($messages as $obj) {
            $mensajes[] = $obj->contenido;
            $nombre = $obj->nombre;
            $apellido = $obj->apellido;
            $rows[] = $obj;
        }
    }
    if (isset($_SESSION["id"])) {
        $results = $wall->isInWhiteList($idMuro, $_SESSION["id"]);
        if ($results->num_rows > 0) {
            $userAllow = true;
        } else {
            $userAllow = false;
Example #24
0
 public function postInsert($event)
 {
     $wall = new Wall();
     $wall->decision_id = $this->id;
     $token = substr(md5(uniqid()), 0, 6);
     while (WallTable::getInstance()->findOneBy('token', $token)) {
         $token = substr(md5(uniqid()), 0, 6);
     }
     $wall->token = $token;
     $wall->save();
     $this->createDashboard();
 }
Example #25
0
 /**
  * Before deletion of a Room
  */
 protected function beforeDelete()
 {
     foreach (RoomSetting::model()->findAllByAttributes(array('room_id' => $this->id)) as $roomSetting) {
         $roomSetting->delete();
     }
     // Disable all enabled modules
     foreach ($this->getAvailableModules() as $moduleId => $module) {
         if ($this->isModuleEnabled($moduleId)) {
             $this->disableModule($moduleId);
         }
     }
     Yii::app()->search->delete($this);
     $this->getProfileImage()->delete();
     // Remove all Follwers
     //UserFollow::model()->deleteAllByAttributes(array('object_id' => $this->id, 'object_model' => 'Room'));
     //Delete all memberships:
     //First select, then delete - done to make sure that RoomsMembership::beforeDelete() is triggered
     $roomMemberships = RoomMembership::model()->findAllByAttributes(array('room_id' => $this->id));
     foreach ($roomMemberships as $roomMembership) {
         $roomMembership->delete();
     }
     UserInvite::model()->deleteAllByAttributes(array('room_invite_id' => $this->id));
     // Delete all content objects of this room
     foreach (Content::model()->findAllByAttributes(array('room_id' => $this->id)) as $content) {
         $content->delete();
     }
     // When this room is used in a group as default room, delete the link
     foreach (Group::model()->findAllByAttributes(array('room_id' => $this->id)) as $group) {
         $group->room_id = "";
         $group->save();
     }
     Wall::model()->deleteAllByAttributes(array('id' => $this->wall_id));
     return parent::beforeDelete();
 }
Example #26
0
 public function testAutoWallCreation()
 {
     $user = new User();
     $user->username = "******";
     $user->email = "*****@*****.**";
     $this->assertTrue($user->save());
     $this->assertNotNull($user->wall_id);
     $wall = Wall::model()->findByPk($user->wall_id);
     $this->assertNotNull($wall);
     $this->assertNotNull($user->wall);
 }
Example #27
0
 /**
  * @return Wall
  */
 public function getWall()
 {
     $wall = Wall::newFromTitle($this->getArticleTitle());
     return $wall;
 }
Example #28
0
 /**
  * After Save Addons
  *
  * @return type
  */
 protected function afterSave()
 {
     // Search Stuff
     if (!$this->isNewRecord) {
         HSearch::getInstance()->deleteModel($this);
     }
     if ($this->status == User::STATUS_ENABLED) {
         HSearch::getInstance()->addModel($this);
     }
     if ($this->isNewRecord) {
         $userInvite = UserInvite::model()->findByAttributes(array('email' => $this->email));
         if ($userInvite !== null) {
             // User was invited to a space
             if ($userInvite->source == UserInvite::SOURCE_INVITE) {
                 $space = Space::model()->findByPk($userInvite->space_invite_id);
                 if ($space != null) {
                     $space->addMember($this->id);
                 }
             }
             // Delete/Cleanup Invite Entry
             $userInvite->delete();
         }
         // Auto Assign User to the Group Space
         $group = Group::model()->findByPk($this->group_id);
         if ($group != null && $group->space_id != "") {
             $space = Space::model()->findByPk($group->space_id);
             if ($space !== null) {
                 $space->addMember($this->id);
             }
         }
         $this->notifyGroupAdminsForApproval();
         // Auto Add User to the default spaces
         foreach (Space::model()->findAllByAttributes(array('auto_add_new_members' => 1)) as $space) {
             $space->addMember($this->id);
         }
         // Create new wall record for this user
         $wall = new Wall();
         $wall->type = Wall::TYPE_USER;
         $wall->object_model = 'User';
         $wall->object_id = $this->id;
         $wall->save();
         $this->wall_id = $wall->id;
         $this->wall = $wall;
         User::model()->updateByPk($this->id, array('wall_id' => $wall->id));
     }
     return parent::afterSave();
 }
<?php

require_once dirname(__DIR__) . "/services/InboxRepositoryService.php";
require_once dirname(__DIR__) . "/domain/Wall.php";
//SETTEA EL LIMITE DE LA CANTIDAD MAXIMA DE MENSAJES
//BANDEJA_DE_ENTRADA (Mensajes Privados)
if (isset($_POST["MsjPrivLimit"])) {
    $limite1 = $_POST["MsjPrivLimit"];
    $inbox = new InboxRepositoryService();
    $inbox->modifyLimitInbox($limite1);
}
//MURO (Mensajes Publicos)
if (isset($_POST["MsjPublicLimit"])) {
    $limite2 = $_POST["MsjPublicLimit"];
    $wall = new Wall();
    $wall->modifyLimitAllWall($limite2);
}