Ejemplo n.º 1
0
 /**
  * TuiyoLocalize::initiate()
  * Initiates a language domain
  * @param mixed $domain
  * @param mixed $locale
  * @param mixed $encoding
  * @return
  */
 public function initiate($domain, $locale, $encoding)
 {
     //Initialize gettText
     $locale = !empty($locale) ? $locale : TUIYO_DEFAULT_LOCALE;
     $domain = !empty($domain) ? $domain : 'system';
     $encoding = !empty($encoding) ? $encoding : TUIYO_DEFAULT_ENCODING;
     putenv("LANG={$locale}");
     if (!extension_loaded('gettext')) {
         TuiyoLoader::import("gettext.gettext", "elibrary", "inc");
         T_setlocale(LC_ALL, $locale);
         T_bindtextdomain($domain, TUIYO_LOCALE);
         T_bind_textdomain_codeset($domain, $encoding);
         T_textdomain($domain);
         //return TRUE;
     }
     setlocale(LC_ALL, $locale);
     bindtextdomain($domain, TUIYO_LOCALE);
     bind_textdomain_codeset($domain, $encoding);
     textdomain($domain);
     $path = "components/com_tuiyo/locale/" . $locale;
     //Load the parameters for the site!
     if (!class_exists('JSite')) {
         $path = "../components/com_tuiyo/locale/" . $locale;
     }
     $GLOBALS['mainframe']->addMetaTag("locale", $locale);
     $GLOBALS['mainframe']->addCustomHeadTag('<link href="' . $path . '/LC_MESSAGES/system.client.json" lang="' . $locale . '" rel="gettext" />');
 }
Ejemplo n.º 2
0
 /**
  * TuiyoViewGroups::display()
  * @param mixed $tmplData
  * @return void
  */
 public function display($tmplData)
 {
     //Intro
     $doc = $GLOBALS['API']->get("document");
     $user = $GLOBALS['API']->get("user", null);
     $bc = $GLOBALS['mainframe']->getPathway();
     $pt = $GLOBALS['mainframe']->setPageTitle(_("Community groups"));
     $styleDir = TUIYO_LIVE_PATH . '/client/default/';
     $bc->addItem($user->name);
     $doc->addCSS(TUIYO_LIVE_PATH . '/client/default/css/groupspage.css');
     $doc->addJS(TUIYO_LIVE_PATH . '/client/default/script/groupspage.js');
     $doc->addJS(TUIYO_STREAM);
     $doc->addJS(TUIYO_OEMBED);
     $pModel = TuiyoLoader::model("applications", true);
     $plugins = $pModel->getAllSystemPlugins("services", false);
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $user, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => !$user->joomla->get('guest') ? 1 : 0);
     $activity = $doc->parseTmpl("activity", $tmplPath, $tmplVars);
     $this->assignRef("activity", $activity);
     $this->assignRef('livestyle', $styleDir);
     $this->assignRef('user', $user);
     $this->assignRef('data', $tmplData);
     $this->setLayoutExt('tpl');
     //Output
     parent::display($tpl);
 }
Ejemplo n.º 3
0
 public function test()
 {
     $aModel = TuiyoLoader::model("applications", true);
     $aUser = TuiyoAPI::get("user", null);
     $aDocument = TuiyoAPI::get("document", null);
     $aParams = $aModel->getSingleUserPlugin($aUser->id, "twitter");
     if (!is_object($aParams)) {
         $aDocument->enqueMessage(_("Cannot Load the service for this user"), "error");
         return false;
     }
     echo $aParams->get("oauth_verifier");
     /* Build TwitterOAuth object with client credentials. */
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
     $view =& $this->getView("twitter", "html");
     /* Get temporary credentials. */
     $access_token = $connection->getAccessToken($aParams->get('oauth_verifier', false));
     /* Create a TwitterOauth object with consumer/user tokens. */
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
     /* If method is set change API call made. Test is called by default. */
     $content = $connection->get('account/verify_credentials');
     //print_R($content);
     $user = $connection->get('account/verify_credentials');
     $userPublicFeeds = $connection->get('statuses/public_timeline');
     print_R($userPublicFeeds);
 }
Ejemplo n.º 4
0
 public function readArticle($articleID, $tpl = null)
 {
     $document = $GLOBALS['API']->get("document", null);
     $user = $GLOBALS['API']->get('user', null);
     $model = TuiyoLoader::model("articles", true);
     //styles
     //$document->addCSS(TUIYO_STYLEDIR.'/css/articles.css');
     $document->addJS(TUIYO_STYLEDIR . '/script/articles.js');
     $document->addJS(TUIYO_STREAM);
     $document->addJS(TUIYO_OEMBED);
     $pModel = TuiyoLoader::model("applications", true);
     $plugins = $pModel->getAllSystemPlugins("services", false);
     $styleDir = TUIYO_LIVE_PATH . '/client/default/';
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $user, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => !$user->joomla->get('guest') ? 1 : 0);
     $activity = $document->parseTmpl("activity", $tmplPath, $tmplVars);
     $myarticles = $model->getArticlesStream($user->id);
     $allarticles = $model->getArticlesStream();
     $article = $model->getArticle($articleID, $user->id);
     $this->assignRef("article", $article);
     $GLOBALS['mainframe']->getPathway()->addItem(_("Articles"));
     $GLOBALS['mainframe']->setPageTitle($article['story']->posttitle);
     $this->assignRef("activity", $activity);
     $this->setLayout("read");
     $this->setLayoutExt("tpl");
     $canpost = !$user->joomla->get('guest') ? 1 : 0;
     $categories = $model->getArticlesCategories();
     $this->assignRef('livestyle', $styleDir);
     $this->assignRef("categories", $categories);
     $this->assignRef("user", $user);
     $this->assignRef("canpost", $canpost);
     parent::display($tpl);
 }
Ejemplo n.º 5
0
 /**
  * TuiyoViewPhotos::display()
  * Displays the photos page ;
  * @param mixed $tpl
  * @return void
  */
 function display($tpl = null)
 {
     global $mainframe, $API;
     $doc =& $API->get("document");
     $bc =& $mainframe->getPathway();
     $user =& $API->get("user", null);
     $pt =& $mainframe->setPageTitle(_("Photos gallery"));
     $plugModel =& TuiyoLoader::model('applications', true);
     $bc->addItem($user->name);
     $doc->addCSS(TUIYO_LIVE_PATH . '/client/default/css/photospage.css');
     $doc->addJS(TUIYO_LIVE_PATH . '/client/default/script/photospage.js');
     $doc->addJS(TUIYO_JS . '/includes/jqueryui/effects.core.js');
     $doc->addJS(TUIYO_JS . '/includes/jqueryui/ui.core.js');
     $doc->addJS(TUIYO_JS . '/includes/jqueryui/ui.draggable.js');
     $doc->addJS(TUIYO_JS . '/includes/jqueryui/ui.droppable.js');
     $doc->addJS(TUIYO_JS . '/includes/jqueryui/effects.slide.js');
     //		$doc->addJS( TUIYO_CAROUSEL );
     $livestyle = TUIYO_LIVE_PATH . '/client/default/';
     $doc->addJS(TUIYO_OEMBED);
     $doc->addJS(TUIYO_STREAM);
     $plugins = $plugModel->getAllSystemPlugins("services", false);
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplPath2 = TUIYO_VIEWS . DS . "photos" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $user, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => !$user->joomla->get('guest') ? 1 : 0);
     $activity = $doc->parseTmpl("activity", $tmplPath, $tmplVars);
     $commenter = $doc->parseTmpl("comments", $tmplPath2, $tmplVars);
     $this->assignRef("user", $user);
     $this->assignRef('activity', $activity);
     $this->assignRef("commenter", $commenter);
     $this->assignRef('livestyle', $livestyle);
     parent::display($tpl);
 }
Ejemplo n.º 6
0
 /**
  * Adds the ilike service to user tables;
  * @param unknown_type $post
  * @param unknown_type $userid
  */
 public function addService($post, $userid)
 {
     TuiyoLoader::helper("parameter");
     $table =& TuiyoLoader::table("userplugins", true);
     $table->load(null);
     //blank
     $table->name = "ilike";
     $table->type = "service";
     $table->userid = (int) $userid;
     $table->privacy = '%p00%';
     //get parameters;
     $registry = new JRegistry();
     $postParams = JRequest::getVar('params', array(), 'post', 'array');
     if (count($postParams)) {
         $registry->loadArray($postParams);
         $table->params = $registry->toString();
         //store the username and password and anything else;
     }
     if (!$table->store()) {
         echo $table->getError();
         return false;
         //get the eror;
     }
     return true;
 }
Ejemplo n.º 7
0
 /**
  * TuiyoControllerProtocol::returnResponse()
  * Returns a response from the recent request
  * @return void
  */
 private function returnResponse($status = 200, $body = '', $format = 'json')
 {
     $doc =& TuiyoAPI::get("document");
     $docType =& $doc->getDOCTYPE();
     $view =& $this->getView("protocol", empty($docType) || $docType == "html" ? $format : $docType);
     /** Response Formulator **/
     TuiyoLoader::import("rest.response");
     TuiyoLoader::import("rest.utility");
     $view->display();
 }
Ejemplo n.º 8
0
 public function display()
 {
     $aModel = TuiyoLoader::model("applications", true);
     $aUser = TuiyoAPI::get("user", null);
     $aDocument = TuiyoAPI::get("document", null);
     //Get the parameters of a single user application/service
     $aParams = $aModel->getSingleUserPlugin($aUser->id, "feed");
     //get the feedURl
     //$aParams->get("feedURL", null);
     $view = $this->getView("feed", "html");
     return $view->display();
 }
Ejemplo n.º 9
0
 /**
  * TuiyoModelNotifications::loadNotice()
  * Remove LoadNotice
  * @param mixed $noticeID
  * @param mixed $userID
  * @return
  */
 public function loadNotice($noticeID, $userID)
 {
     $nTable = TuiyoLoader::table("notifications", true);
     $document = TuiyoApi::get("document");
     $nTable->load((int) $noticeID);
     if ((int) $userID === (int) $nTable->userid) {
         $nTable->status = 1;
         if (!$nTable->store()) {
             $document->enqueMessage($nTable->getError(), "error");
         }
     }
     return $nTable;
 }
Ejemplo n.º 10
0
 /**
  * TuiyoViewGroups::display()
  * Displays a user Feed
  * @return void
  */
 public function showFeed()
 {
     global $mainframe, $API;
     static $rendered = false;
     if ($rendered) {
         return true;
     }
     $groupID = JRequest::getInt('gid');
     $auth = $API->get("authentication");
     $auth->requireAuthentication();
     $tUser = TuiyoAPI::get('user', null);
     $gModel = TuiyoLoader::model("groups", true);
     $tModel = TuiyoLoader::model("timeline", true);
     $gData = $gModel->getGroup($groupID);
     if (empty($groupID) || !$gData || $gData->isMember < 1) {
         JError::raiseError(TUIYO_NOT_FOUND, _('The group feed either does not exists or you do not have the necessary permissions'));
         return false;
     }
     $tData = $tModel->getGroupTimeline($gData->groupID, $tUser->id);
     $document =& JFactory::getDocument();
     $params =& $mainframe->getParams();
     $feedEmail = @$mainframe->getCfg('feed_email') ? $mainframe->getCfg('feed_email') : 'author';
     $siteEmail = $mainframe->getCfg('mailfrom');
     $document->title = $gData->gName;
     $document->description = sprintf(_("Updates from %s / group"), $gData->gName);
     $document->link = JRoute::_(TUIYO_INDEX . '&amp;view=groups&amp;do=getFeed&amp;format=feed&amp;gid=' . $gData->{$groupID});
     foreach ($tData as $stream) {
         // load individual item creator class
         $item = new JFeedItem();
         // strip html from feed item title
         $title = $this->escape("@{$stream->username} {$stream->datetime}: {$stream->title} {$stream->bodytext} ");
         $title = html_entity_decode($title);
         // url link to article
         $link = JRoute::_(TUIYO_INDEX . '&amp;view=profile&amp;do=viewStatus&user='******'feed');
     //$this->setLayoutExt('tpl');
     $rendered = true;
 }
Ejemplo n.º 11
0
 public function addNewCategory()
 {
     $model = TuiyoLoader::model("categories", true);
     $data = JRequest::get("post");
     $referer = JRequest::getVar("HTTP_REFERER", null, "SERVER");
     //Referer
     //Notice messages;
     $msg = "Category data saved successfully";
     $mType = "notice";
     if (!$model->addCategory($data)) {
         $msg = "Could not save category data";
         $mType = "error";
     }
     $this->setRedirect($referer, $msg, $mType);
     $this->redirect();
 }
Ejemplo n.º 12
0
 public function saveArticle()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $auth = TuiyoAPI::get("authentication");
     $auth->requireAuthentication();
     $user = TuiyoAPI::get("user");
     $data = JRequest::get("post", JREQUEST_ALLOWRAW);
     $aModel = TuiyoLoader::model("articles", true);
     $msg = _('The article has been saved successfully');
     if (!$aModel->editSaveArticle($user, $data)) {
         $msg = $aModel->getError();
     }
     //Redirect on success;
     $referer = JRoute::_(TUIYO_INDEX . '&view=articles');
     $this->setRedirect($referer, $msg);
 }
Ejemplo n.º 13
0
 /**
  * @param mixed $data
  * @return
  */
 function showChatBox($tpl = null)
 {
     $document = TuiyoAPI::get('document', null);
     $user = TuiyoAPI::get('user', null);
     $plugModel = TuiyoLoader::model("applications", true);
     //$this->setLayout("chatroom");
     //echo "show chat box"; die;
     //parent::display($tpl);
     $document->addJS(TUIYO_OEMBED);
     $document->addJS(TUIYO_STREAM);
     $plugins = $plugModel->getAllSystemPlugins("services", false);
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $user, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => !$user->joomla->get('guest') ? 1 : 0);
     $activity = $document->parseTmpl("activity", $tmplPath, $tmplVars);
     $this->assignRef("activity", $activity);
     parent::display($tpl);
 }
Ejemplo n.º 14
0
 /**
  * TuiyoPluginCheckUpdate::onAdminStart()
  * 
  * @param mixed $args
  * @return void
  */
 public function onAdminStart($args = null)
 {
     //die;
     $version = TuiyoLoader::helper("parameter");
     $version = TuiyoLoader::helper("version");
     $versionXML = new JSimpleXML();
     $document = $GLOBALS['API']->get("document");
     $url = "https://github.com/Tuiyo/ignite/raw/master/VERSION.XML";
     $updateUrl = 'index.php?option=com_tuiyo&context=SystemTools&do=autoCenter&run=systemupdate';
     $vParams = TuiyoAPI::getURL($url);
     //print_r($vParams);
     $vData = new TuiyoParameter();
     $version =& new TuiyoVersion();
     $latest = $vData->get("release") . '.' . $vData->get("devlevel") . '.' . $vData->get("devstatus");
     if ($version->isOutDated($latest)) {
         $document->enqueMessage(sprintf(_('Your version of Tuiyo is outdated. <a href="%s">Please click here to automatically upgrated to Tuiyo %2s</a>'), $updateUrl, $latest), "notice");
     }
 }
Ejemplo n.º 15
0
 /**
  * Overits the parent function
  * Default display for views control
  * @see JView::display()
  */
 public function display($tpl = null)
 {
     $document = $GLOBALS['API']->get('document', null);
     $user = $GLOBALS['API']->get('user', null);
     $GLOBALS['mainframe']->getPathway()->addItem(_("Discussions Boards"));
     $GLOBALS['mainframe']->setPageTitle(_("Discussion Boards"));
     //styles
     $document->addCSS(TUIYO_STYLEDIR . '/css/discussions.css');
     $document->addJS(TUIYO_STYLEDIR . '/script/discussions.js');
     $document->addJS(TUIYO_STREAM);
     $document->addJS(TUIYO_OEMBED);
     $pModel = TuiyoLoader::model("applications", true);
     $plugins = $pModel->getAllSystemPlugins("services", false);
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $user, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => !$user->joomla->get('guest') ? 1 : 0);
     $activity = $document->parseTmpl("activity", $tmplPath, $tmplVars);
     $this->assignRef("activity", $activity);
     parent::display($tpl);
 }
Ejemplo n.º 16
0
 public function onAfterTimelineLoad($args = null)
 {
     $aModel = TuiyoLoader::model("applications", true);
     $aUser = TuiyoAPI::get("user", null);
     $aDocument = TuiyoAPI::get("document", null);
     $aXMLParser = new JSimpleXML();
     //Get the parameters of a single user application/service
     $aParams = $aModel->getSingleUserPlugin($aUser->id, "feed");
     //get the feedURl
     $feedURL = $aParams->get("feedURL", null);
     //$feedData   = TuiyoAPI::getURL( $feedURL );
     //$tempfilename = TUIYO_CACHE.DS.date("YmdHis")."feed.xml";
     //$tempFeed 	  = fopen($tempfilename, 'w') ;
     //fwrite($tempFeed , trim($feedData));
     //fclose($tempFeed);
     //echo $tempfilename;
     //$feedXML 	= @$aXMLParser->loadFile($tempfilename);
     //unlink($tempfilename);
     //print_R($aXMLParser);
 }
Ejemplo n.º 17
0
 /**
  * 
  * Constructor
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     //Load the service controller
     $service = JRequest::getString('service', null);
     $doTask = JRequest::getString('do', null);
     if (empty($service)) {
         throw new Exception(_('undefined service'));
     }
     //Require service Controller
     $this->_serviceController =& TuiyoLoader::plugin((string) $service, true);
     $this->_serviceView =& $this->getView("services", "html");
     //Check that the service has the requested method and register call!
     if (!empty($doTask) && method_exists($this->_serviceController, $doTask)) {
         //echo "method exists";
         $this->_serviceController->{$doTask}();
         //call_user_func_array(array($this->_serviceController, $doTask) );
         return;
     }
 }
Ejemplo n.º 18
0
 public function chatBox()
 {
     //1. Get Pre-requisites;
     $participant = JRequest::getVar("participant", null);
     $server = JRequest::get("server");
     $method = strtolower($server['REQUEST_METHOD']);
     $model =& TuiyoLoader::model("messages", true);
     $view = $this->getView("system", "html");
     $document =& $GLOBALS['API']->get("document");
     $user =& $GLOBALS['API']->get("user", null);
     /** Check we have a valid token and Check we have a valid token***/
     if (empty($user->id) || $user->joomla->get('guest')) {
         JError::raiseError(TUIYO_BAD_REQUEST, _("Invalid user ID"));
     }
     $chatRoom = array();
     //$model->initiateChatRoom( $user->id, $participant );
     $view->assignRef("user", $user);
     $view->assignRef("chatroom", $chatRoom);
     $view->showChatBox();
 }
Ejemplo n.º 19
0
 public function addCategory($data)
 {
     $catCreator = TuiyoAPI::get("user", null);
     $catTree = TuiyoLoader::table("categories", true);
     $catTree->load(null);
     $catTree->title = trim($data['cattitle']);
     $catTree->parent = (int) $data['catpid'];
     $catTree->slug = trim($data['catslug']);
     $catTree->creator = (int) $catCreator->id;
     $catTree->description = trim($data['catdescription']);
     $catTree->dateadded = date('Y-m-d H:is');
     $catTree->status = (int) $data['catstatus'];
     //print_r( $catTree );
     if (!$catTree->store()) {
         JError::raiseError(TUIYO_SERVER_ERROR, $catTree->getError());
         return false;
     }
     //Restructure the Tree;
     $catTree->restructureTree();
     return true;
 }
Ejemplo n.º 20
0
 /**
  * TuiyoNotify::_()
  * 
  * @param mixed $userIdTo
  * @param mixed $title
  * @param mixed $actionLink
  * @param mixed $actionTitle
  * @param string $application
  * @param mixed $template
  * @param mixed $templateVars
  * @return void
  */
 public function _($userIdTo, $title, $actionLink, $actionTitle, $application = 'system', $template = NULL, $templateVars = NULL)
 {
     global $mainframe;
     TuiyoLoader::helper("parameter");
     //1. Check App can send Mail
     //2. Load the user message is being sent to
     $document = TuiyoApi::get("document");
     $userFrom = TuiyoApi::get("user", null);
     $user = TuiyoApi::get("user", (int) $userIdTo);
     $notifyTable = TuiyoLoader::table("notifications", true);
     $notifyParams = TuiyoParameter::load("emails");
     if ($userIdTo < 1) {
         $document->enqueMessage(_("Could not notify the user due to a UserID({$userIdTo}) error"), "error");
         return false;
     }
     //3. Add Notification Title to database;
     $notifyTable->title = $title;
     $notifyTable->userid = $userIdTo;
     $notifyTable->link = $actionLink;
     $notifyTable->linktitle = $actionTitle;
     $notifyTable->application = $application;
     $notifyTable->status = 0;
     $notifyTable->type = $template;
     $notifyTable->template = json_encode($templateVars);
     if (!$notifyTable->store()) {
         $document->enqueMessage(sprintf(_("Could not notify the user due to the following error: %s"), $notifyTable->getError()), "error");
         return false;
     }
     if (!empty($template)) {
         $eTitle = $notifyParams->get($template . "Title");
         $eBody = $notifyParams->get($template . "Body");
         $subject = html_entity_decode($eTitle, ENT_QUOTES);
         $message = html_entity_decode($eBody, ENT_QUOTES);
         TuiyoNotify::sendMail($user->joomla->get('email'), $subject, $message);
     }
 }
Ejemplo n.º 21
0
 /**
  * TuiyoViewWelcome::display()
  * 
  * @param mixed $tpl
  * @return void
  */
 public function display($tpl = null)
 {
     global $mainframe;
     $docu = $GLOBALS['API']->get('document', null);
     $bc =& $mainframe->getPathway();
     $rModel = TuiyoLoader::model("resources", true);
     $plugModel = TuiyoLoader::model("applications", true);
     $gModel = TuiyoLoader::model("groups", true);
     $aModel = TuiyoLoader::model("articles", true);
     $docu->addCSS(TUIYO_LIVE_PATH . '/client/default/css/welcomepage.css');
     $docu->addJS(TUIYO_LIVE_PATH . '/client/default/script/welcomepage.js');
     $docu->addJS(TUIYO_OEMBED);
     $docu->addJS(TUIYO_STREAM);
     $bc->addItem(_('Welcome Lobby'), TUIYO_INDEX . '&view=welcome');
     $tdoc = $docu;
     $user = TuiyoAPI::get("user");
     $onlineMembers = $rModel->getOnlineUsers();
     $newestMembers = $rModel->getNewestUsers();
     $popularGroups = $gModel->getPopularGroups();
     $allarticles = $aModel->getArticlesStream();
     //@TODO replace with getAllSystemPlugins
     $plugins = $plugModel->getAllSystemPlugins("services", false);
     $tmplPath = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars = array("styleDir" => TUIYO_STYLEDIR, "user" => $user, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => !$user->joomla->get('guest') ? 1 : 0);
     $activity = $tdoc->parseTmpl("activity", $tmplPath, $tmplVars);
     //Check for the existence of a gravatar
     TuiyoLoader::helper("parameter");
     $sysCfg = TuiyoParameter::load("global");
     $this->assignRef("settings", $sysCfg);
     $this->assignRef("allarticles", $allarticles);
     $this->assignRef("activity", $activity);
     $this->assignRef("onlinefriends", $onlineMembers);
     $this->assignRef("newestmembers", $newestMembers);
     $this->assignRef("populargroups", $popularGroups);
     parent::display($tpl);
 }
Ejemplo n.º 22
0
 /**
  * TuiyoViewTuiyo::showAutoCenter()
  * Automation center view
  * @param mixed $data
  * @return
  */
 public function showAutoCenter($macro = null)
 {
     $TMPL = $GLOBALS["API"]->get("document");
     $TMPL->IconPath = $iconPath;
     $tmplVars = array("styleDir" => $livestyle, "livePath" => TUIYO_LIVE_PATH, "iconPath" => TUIYO_LIVE_PATH . '/client/default/', "user" => JFactory::getUser());
     if (!empty($macro)) {
         $macroObj = TuiyoLoader::macro((string) $macro, true);
         if (is_object($macroObj)) {
             $tmplVars["macro"] = $macroObj;
         }
     }
     $tmplPath = JPATH_COMPONENT_ADMINISTRATOR . DS . "views" . DS . "tuiyo" . DS . "tmpl";
     $tmplData = $TMPL->parseTmpl("automation", $tmplPath, $tmplVars);
     return $tmplData;
 }
Ejemplo n.º 23
0
 /**
  * Packages and downloads resources
  * TuiyoControllerResources::downloadResources()
  * 
  * @return void
  */
 public function downloadResources()
 {
     //Get JSON view
     $view = $this->getView("profile", "json");
     $resp = array("code" => TUIYO_OK, "error" => null, "data" => "");
     //Get Session Information
     $model = $this->getModel("resources");
     $sData = "";
     //$model->getSessionData( );
     $user = TuiyoAPI::get("user", null);
     $fids = JRequest::getVar("fid");
     //Get the resources class
     TuiyoLoader::import("user.uploads");
     $myFiles = new TuiyoUploads("archive");
     $queue = array();
     foreach ($fids as $key => $fid) {
         if ($model->userCanDelete($user->id, $fid)) {
             $queue[] = $model->getFilePath($fid);
         }
     }
     $resourceLink = $myFiles->archiveFiles($user->id, $queue);
     $resp["extra"] = $resourceLink;
     //1. If user owns files add to archive queue;
     //2. Archives the files
     //3. Output response with download link saved in cache!
     //4. Download file from cache!
     return $view->encode($resp);
 }
Ejemplo n.º 24
0
 /**
  * TuiyoModelWidgets::getAllWidgets()
  * Gets all available widgets on this system
  * @return
  */
 public function getAllWidgets()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $user = TuiyoAPI::get("user", null);
     $appModel = TuiyoLoader::model("applications", true);
     $sysPlugins = $appModel->getAllUserPlugins($user->id, "services", false);
     $widgetData = array();
     $widgetFiles = array();
     foreach ($sysPlugins as $plugin) {
         //If the plugin has a widget file;
         $widgetFile = TUIYO_PLUGINS . DS . $plugin . DS . 'widget.xml';
         if (file_exists($widgetFile)) {
             $widgetFiles[] = $widgetFile;
         }
     }
     foreach ($widgetFiles as $xmlFile) {
         $wdg = array();
         $xml = TuiyoAPI::get("xml", $xmlFile);
         $root = $xml->file->document;
         $wdg["version"] = $root->attributes("version");
         $wdg["file"] = JURI::root() . str_replace(array(DS), array("/"), $xmlFile);
         $wdg["file"] = str_replace(JPATH_ROOT, "", $wdg["file"]);
         foreach ((array) $root->widgetdata[0]->children() as $data) {
             $dataName = $data->attributes("name");
             $dataValue = $data->attributes("content");
             if (empty($dataName) || is_array($dataName)) {
                 continue;
             }
             if (empty($dataValue) || is_array($dataValue)) {
                 continue;
             }
             $wdg[$dataName] = $dataValue;
         }
         $widgetData[] = $wdg;
     }
     return (array) $widgetData;
 }
Ejemplo n.º 25
0
 /**
  * TuiyoModelEvents::addEvent()
  * Creates and stores a new User Event
  * @param mixed $userID
  * @param mixed $postData
  * @return void
  */
 public function addEvent($userID, $postData)
 {
     $eventTable = TuiyoLoader::table('events', true);
     $rsvpTable = TuiyoLoader::table('eventsrsvp', true);
     $auth = TuiyoAPI::get('authentication');
     $doc = TuiyoAPI::get('document');
     //Must be loggged IN
     $auth->requireAuthentication();
     $eventTable->title = trim($postData['title']);
     if (empty($eventTable->title)) {
         $doc->enqueMessage(_('You did not specify an event title'), 'error');
         return false;
     }
     $eventTable->location = trim($postData['location']);
     $eventTable->street = trim($postData['street']);
     $eventTable->city = trim($postData['city']);
     $eventTable->startdate = date('Y-m-d', strtotime($postData['startdate']));
     $eventTable->enddate = date('Y-m-d', strtotime($postData['enddate']));
     $startYear = date('Y', strtotime($postData['startdate']));
     $startMonth = date('m', strtotime($postData['startdate']));
     $startDay = date('d', strtotime($postData['startdate']));
     $startHour = (int) $postData['startTimeHour'];
     $startMin = (int) $postData['startTimeMin'];
     $startSec = (int) $postData['startTimeSec'];
     $endYear = date('Y', strtotime($postData['enddate']));
     $endMonth = date('m', strtotime($postData['enddate']));
     $endDay = date('d', strtotime($postData['enddate']));
     $endHour = (int) $postData['endTimeHour'];
     $endMin = (int) $postData['endTimeMin'];
     $endSec = (int) $postData['endTimeSec'];
     $startTime = mktime($startHour, $startMin, $startSec, $startMonth, $startDay, $startYear);
     $endTime = mktime($endHour, $endMin, $endSec, $endMonth, $endDay, $endYear);
     if ($endTime < $startTime) {
         $doc->enqueMessage(_('The event end Date/Time cannot be before the start Date/Time'), "error");
         return false;
     }
     $eventTable->starttime = date('Y-m-d H:i:s', $startTime);
     $eventTable->endtime = date('Y-m-d H:i:s', $endTime);
     $eventTable->description = $postData['description'];
     $eventTable->poster = trim(htmlspecialchars_decode($postData['poster']));
     $eventTable->privacy = (int) $postData['privacy'];
     $eventTable->createdby = (int) $userID;
     if (!$eventTable->store()) {
         $doc->enqueueMessage($eventTable->getError(), "error");
         return false;
     }
     //addHost to Event
     $rsvpTable->eventid = $eventTable->eventid;
     $rsvpTable->role = 'host';
     $rsvpTable->userid = $eventTable->createdby;
     $rsvpTable->approved = 1;
     if (!$rsvpTable->store()) {
         $eventTable->delete();
         $doc->enqueueMessage(_('An error occured whilst adding you to the event'), "error");
         $doc->enqueueMessage($eventTable->getError(), "error");
         return false;
     }
     return true;
 }
Ejemplo n.º 26
0
 public function auth()
 {
     JRequest::setVar("tmpl", "component");
     $user = $GLOBALS['API']->get('user', null);
     $mainframe = $GLOBALS['mainframe'];
     //If user is not guest send back to homepage
     if (!$user->joomla->get('guest')) {
         $mainframe->redirect(JRoute::_(TUIYO_INDEX . "&amp;view=welcome", FALSE));
         return false;
     }
     $view = $this->getView('welcome', 'html');
     $invite = JRequest::getString("ic", NULL, 'request');
     $inviteeN = NULL;
     $inviteeE = NULL;
     if (!empty($invite)) {
         $iTable = TuiyoLoader::table("invites");
         $iObject = $iTable->findInvite($invite);
         if (!empty($iObject) && is_object($iObject)) {
             $inviteeN = $iObject->name;
             $inviteeE = $iObject->email;
         }
         $view->assignRef("inviteCode", $invite);
         $view->assignRef("inviteeName", $inviteeN);
         $view->assignRef("inviteeEmail", $inviteeE);
     }
     $view->showAuthPage($invite, $inviteeN);
 }
Ejemplo n.º 27
0
 /**
  * Produces an archive of files 
  * 
  * TuiyoUploads::archiveFiles()
  * 
  * @param mixed $userID
  * @param mixed $files
  * @return link on success, raises error on failure
  */
 public function archiveFiles($userID, $files)
 {
     //move the file to the cache
     $targetCache = JPATH_CACHE . DS;
     $targetFolder = $targetCache . DS . $this->_randomCode(4);
     $targetName = $targetFolder . DS . $this->_randomCode(4) . ".archive.zip";
     $archiveFiles = array();
     $archiveZip = new ZipArchive();
     //Create Folder;
     if (JFolder::create($targetFolder)) {
         //create the file and throw the error if unsuccessful
         if ($archiveZip->open($targetName, ZIPARCHIVE::CREATE) !== true) {
             trigger_error(_("Could not open {$targetName} archive"), E_USER_ERROR);
             return false;
         }
         //Archive the files
         foreach ($files as $file) {
             $name = JFile::getName($file);
             $dest = $targetFolder . DS . $name;
             if (!JFile::copy($file, $dest)) {
                 trigger_error(_("Could not archive files"), E_USER_ERROR);
                 return false;
             }
             //add the File
             $archiveZip->addFile($dest, $name);
         }
     }
     $archiveZip->close();
     //If the achive exists! copy it to user resource!
     if (JFile::exists($targetName)) {
         if (JFile::move($targetName, $targetCache . DS . basename($targetName))) {
             JFolder::delete($targetFolder);
             $fData = array("name" => basename($targetName));
             //Save to the resources table
             $resourceTable =& TuiyoLoader::table("resources", true);
             $resourceLink =& $resourceTable->saveFile($fData, $this->_fileType);
             return $resourceLink;
         }
     }
     return false;
 }
Ejemplo n.º 28
0
 * @since     : 1.0.0 alpha                                         *   
 * @package   : tuiyo                                               *
 * ******************************************************************
 */
/**
 * no direct access
 */
defined('TUIYO_EXECUTE') || die('Restricted access');
/**
 * joomla Controller
 */
jimport('joomla.application.component.controller');
/**
 * Tuiyo Controller
 */
TuiyoLoader::controller('core');
/**
 * TuiyoControllerTimeline
 * @author Livingstone Fultang
 * @copyright 2009
 * @version $Id$
 * @access public
 */
class TuiyoControllerTimeline extends JController
{
    /**
     * 
     * The Valid status types
     * @var unknown_type
     */
    var $validTypes = array("status", "idea", "comment", "opinion", "activity", "compliment", "question");
Ejemplo n.º 29
0
 public function registerPlugins()
 {
     $plugins = TuiyoLoader::model("applications", true);
     $services = $plugins->getAllSystemPlugins();
     $services[] = "system";
     //@TODO Crazy way to add the system plugin;
     $groups = array("timeline" => array(), "profile" => array(), "messages" => array(), "administrator" => array());
     foreach ($services as $service) {
         $timeline = TUIYO_PLUGINS . DS . $service . DS . "events.timeline.php";
         $profile = TUIYO_PLUGINS . DS . $service . DS . "events.profile.php";
         $messages = TUIYO_PLUGINS . DS . $service . DS . "events.messages.php";
         $administrator = TUIYO_PLUGINS . DS . $service . DS . "events.administrator.php";
         $authentication = TUIYO_PLUGINS . DS . $service . DS . "events.authentication.php";
         //Plugins
         if (file_exists($timeline)) {
             $groups["timeline"][$service] = $timeline;
         }
         //Profile
         if (file_exists($profile)) {
             $groups["profile"][$service] = $profile;
         }
         //Administrator
         if (file_exists($administrator)) {
             $groups["administrator"][$service] = $administrator;
         }
     }
     $session = JSession::getInstance('none', array());
     $session->set("PLUGIN_GROUPS", $groups);
     $GLOBALS['PLUGIN_GROUPS'] = $groups;
 }
Ejemplo n.º 30
0
 /**
  * TuiyoPrivacy::isFriendTo()
  * Verifies that $userID is friends with $profileID
  * @param mixed $profileID
  * @param mixed $userID
  * @return boolean
  */
 private function isFriendOf($profileID, $userID = NULL)
 {
     $model =& TuiyoLoader::model("friends", true);
     $user =& TuiyoAPI::get("user", $userID);
     if (empty($profileID) && $user->joomla->get('guest')) {
         return false;
     }
     $profileID = !empty($profileID) ? (int) $profileID : JError::raiseError(404, _("Profile does not exists"));
     $userID = !empty($userID) ? (int) $userID : $user->id;
     if (($rel = $model->isFriendOf($profileID, $userID)) !== FALSE) {
         if ((int) $rel->state < 1 && $rel->thisUserID != $userID) {
             return false;
         }
         return true;
     }
     //Are not friends
     return false;
 }