Ejemplo n.º 1
0
 /**
  * TuiyoModelNotifications::removeNotice()
  * Remove the notifications
  * @param mixed $noticeID
  * @param mixed $userID
  * @return void
  */
 public function removeNotice($noticeID, $userID)
 {
     $notice =& $this->loadNotice($noticeID, $userID);
     $document = TuiyoApi::get("document");
     if ((int) $notice->userid === (int) $userID) {
         if (!$notice->delete()) {
             $document->enqueMessage($notice->getError(), "error");
             return false;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * TuiyoModelTimeline::setStatusComment()
  * @param mixed $userID
  * @param mixed $postData
  * @param mixed $options
  * @return void
  */
 public function setStatusComment($userID, $postData, $options = array())
 {
     $commenter = TuiyoApi::get("user", null);
     $table = TuiyoLoader::table("timeline");
     $table->load(null);
     //print_R($postData);
     $statusText = strval($postData['commentbody']);
     //get out all mentions in the update string
     preg_match_all('#@([\\d\\w]+)#', $statusText, $mentions);
     preg_match_all('/#([\\d\\w]+)/', $statusText, $hashTags);
     $table->tags = sizeof($hashTags[1]) > 0 ? json_encode($hashTags[1]) : null;
     $table->mentions = sizeof($mentions[1]) > 0 ? json_encode($mentions[1]) : null;
     $table->userID = (int) $userID;
     $table->template = null;
     $table->datetime = date('Y-m-d H:i:s');
     $table->data = $statusText;
     $table->type = "comment";
     $table->source = isset($postData['source']) ? $postData['source'] : "web";
     $table->source = strval($table->source);
     $table->inreplyto = isset($postData['inreplyto']) ? (int) $postData['inreplyto'] : JError::raiseError(403, _("Invalid activity ID"));
     if (!$table->store()) {
         trigger_error($table->getError(), E_USER_ERROR);
         return false;
     }
     //Send Notifications to All users participating in this discussion
     TuiyoLoader::library("mail.notify");
     $getParticipants = $table->getAllCommenters($table->inreplyto);
     $firstAuthors = array();
     //Notify Authors
     foreach ($getParticipants["author"] as $author) {
         $firstAuthors[] = $author;
         if ($userID != $author) {
             $userTo = TuiyoAPI::get("user", $author);
             $actionLink = JRoute::_(TUIYO_INDEX . "&view=profile&do=viewStatus&user={$userTo->username}&id={$table->inreplyto}");
             $emailTitle = sprintf(_("%s commented on your wall post"), "@" . $commenter->username);
             $emailBody = "";
             //str_replace( $tSearch , $tVars , $notifyParams->get( "connectionRequestEmailBody" , null ) );
             //echo $notifyEmail ;
             TuiyoNotify::_($userTo->id, $emailTitle, $actionLink, _("View Status"));
             TuiyoNotify::sendMail($userTo->email, $emailTitle, $emailBody);
         }
     }
     //Notify Participants
     foreach ($getParticipants["participant"] as $tookpart) {
         if ($userID != $tookpart) {
             $firstauthor = TuiyoAPI::get("user", (int) $firstAuthors[0]);
             $userTo = TuiyoAPI::get("user", $tookpart);
             $actionLink = JRoute::_(TUIYO_INDEX . "&view=profile&do=viewStatus&user={$firstauthor->username}&id={$table->inreplyto}");
             $emailTitle = sprintf(_("%s commented on %2s wall post"), "@" . $commenter->username, "@" . $firstauthor->username);
             $emailBody = "";
             //str_replace( $tSearch , $tVars , $notifyParams->get( "connectionRequestEmailBody" , null ) );
             //echo $notifyEmail ;
             TuiyoNotify::_($userTo->id, $emailTitle, $actionLink, _("View Status"));
             TuiyoNotify::sendMail($userTo->email, $emailTitle, $emailBody);
         }
     }
     return $table;
 }
Ejemplo n.º 3
0
 /**
  * TuiyoUser::getUserSocialBook()
  * Returns an array of user social information
  * @param mixed $userID
  * @return void
  */
 public function getUserSocialBook($userID = NULL)
 {
     static $instance = array();
     $table = TuiyoLoader::table("fields", true);
     $self = !is_a($this, 'TuiyoUser') ? TuiyoUser::getInstance() : $this;
     $contact = new stdClass();
     $userID = empty($userID) ? $self->id : $userID;
     /**Returns an object with the current users */
     if (isset($instance[$userID]) && is_object($instance[$userID])) {
         return (object) $instance[$userID];
     }
     //Load User Social
     $fields = $table->listAll(TRUE);
     $params = TuiyoApi::get("params");
     $params->loadParams("user.social", $userID);
     $defines = $params->defined;
     foreach ($fields as $field) {
         $field->fd = $params->get($field->fn);
     }
     //Return a list of fields and values
     return (array) $fields;
 }
Ejemplo n.º 4
0
 /**
  * TuiyoViewProfile::display()
  * Displays the default profile page
  * @param mixed $tpl
  * @param mixed $profileID
  * @param mixed $privacy
  * @return void
  */
 public function display($tpl = null, $profileID = NULL, $privacy = NULL)
 {
     $tdoc = TuiyoAPI::get("document");
     $params = TuiyoApi::get("params");
     $model = TuiyoLoader::model("applications", true);
     $gModel = TuiyoLoader::model("groups", true);
     $pModel = TuiyoLoader::model("photos", true);
     $sModel = TuiyoLoader::model("statistics", true);
     $tModel = TuiyoLoader::model("timeline", true);
     $bc = $GLOBALS['mainframe']->getPathway();
     $GLOBALS['mainframe']->setPageTitle(sprintf(_("%s | Profile"), $this->thatuser->name));
     $bc->addItem($this->thatuser->name);
     $livestyle = TUIYO_LIVE_PATH . '/client/default/';
     $tPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl" . DS;
     $tFile = "information";
     $socialApps = $model->getAllUserApplications((int) $this->thatuser->id);
     $tInfoVars = array("user" => $this->thatuser, "contact" => $this->thatuser->getUserContact(), "social" => $this->thatuser->getUserSocialBook(), "privacy" => $this->privacy, "rating" => $this->thatuser->getUserRating(), "styleDir" => $livestyle);
     $information = $tdoc->parseTmpl($tFile, $tPath, $tInfoVars);
     $groups = $gModel->getUserGroups($this->thatuser->id);
     $albums = $pModel->getAlbums($this->thatuser->id, "profile", NULL, TRUE, TRUE);
     $statistics = $sModel->getUserStatistics($this->thatuser->id);
     $laststatus = $tModel->getLastestUserStatus($this->thatuser->id, $this->thisuser->id);
     //Get the HTML
     $sharingWith = array("p00" => "@everyone");
     if ($this->thatuser->id != $this->thisuser->id) {
         $sharingWith = array("p" . $this->thatuser->id => $this->thatuser->name . " (" . $this->thatuser->username . ")");
     }
     $plugins = $model->getAllUserPlugins($this->thatsuser->id, "services", false);
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $this->thisuser, "sharewith" => $sharingWith, "plugins" => $plugins, "canPost" => !$this->thisuser->joomla->get('guest') ? 1 : 0);
     $activity = $tdoc->parseTmpl("activity", $tmplPath, $tmplVars);
     $tdoc->addCSS(TUIYO_LIVE_PATH . '/client/default/css/profilepage.css');
     $tdoc->addJS(TUIYO_JS . '/includes/jqueryui/effects.core.js');
     $tdoc->addJS(TUIYO_JS . '/includes/jqueryui/effects.slide.js');
     $tdoc->addJS(TUIYO_JS . '/includes/jqueryui/ui.core.js');
     $tdoc->addJS(TUIYO_JS . '/includes/jqueryui/ui.stars.min.js');
     $tdoc->addJS(TUIYO_LIVE_PATH . '/client/default/script/profile.js');
     $tdoc->addJS(TUIYO_OEMBED);
     $tdoc->addJS(TUIYO_STREAM);
     $this->assignRef("rating", $tInfoVars["rating"]);
     $this->assignRef('information', $information);
     $this->assignRef('rawinformation', $tInfoVars);
     $this->assignRef('laststatus', $laststatus);
     $this->assignRef('externalapps', $socialApps);
     $this->assignRef('livestyle', $livestyle);
     $this->assignRef("activity", $activity);
     $this->assignRef("groups", $groups);
     $this->assignRef("photoalbums", $albums);
     $this->assignRef("statistics", $statistics);
     $this->setLayoutExt('tpl');
     parent::display($tpl);
     $rssLink = JRoute::_(TUIYO_INDEX . '&view=profile&do=getFeed&format=feed&pid=' . $this->thatuser->id);
     $attribs = JArrayHelper::toString(array("type" => "application/rss+xml", "rel" => "alternate", "title" => "RSS 2.0 {$this->thatuser->name} updates", "href" => $rssLink));
     $generatedTag = '<link ' . $attribs . ' />';
     //Trigger after profileDraw Events
     $GLOBALS["mainframe"]->addCustomHeadTag($generatedTag);
     $GLOBALS["events"]->trigger("onAfterProfileDraw");
 }
Ejemplo n.º 5
0
 /**
  * TuiyoNotify::sendMail()
  * Sending a direct Email
  * @param mixed $recipientEmail
  * @param mixed $mailSubject
  * @param mixed $mailBody
  * @return
  */
 public function sendMail($recipientEmail, $mailSubject, $mailBody)
 {
     $mailer =& JFactory::getMailer();
     $config =& JFactory::getConfig();
     $documt =& TuiyoApi::get("document");
     //Sender and Recipient
     $sitename = $config->getValue('config.sitename');
     $mailfrom = $config->getValue('config.mailfrom');
     $fromname = $config->getValue('config.fromname');
     $siteURL = JURI::base();
     //$mailer->addAttachment( PATH_COMPONENT.DS.'assets'.DS.'document.pdf' );
     $send =& JUtility::sendMail($mailfrom, $fromname, $recipientEmail, $mailSubject, $mailBody);
     if ($send !== true) {
         echo $send->getError();
         $documt->enqueMessage(_("Could not send the notification email"), "error");
         return false;
     }
     return $send;
 }