示例#1
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;
 }
示例#2
0
 /**
  * TuiyoViewTuiyo::display()
  * Default welcome page for admin view
  * @param mixed $tpl
  * @return
  */
 public function display($tpl = null)
 {
     $TMPL = $GLOBALS['API']->get('document');
     $USER = $GLOBALS['API']->get('user', null);
     $DOCU = JFactory::getDocument();
     $MODEL = TuiyoLoader::model('applications', true);
     $APPS = $MODEL->getApplicationExtendedList();
     $DOCU->addStyleSheet('components/com_tuiyo/style/css/common.css');
     $DOCU->addScript('components/com_tuiyo/style/script/global.js');
     $DOCU->addScript(TUIYO_OEMBED);
     $DOCU->addScript(TUIYO_STREAM);
     $version = TuiyoLoader::helper("version");
     $document = $GLOBALS['API']->get("document");
     if (!is_a($version, 'TuiyoVersion')) {
         $version =& new TuiyoVersion();
     }
     $longVersion = $version->getLongVersion();
     $plugins = $MODEL->getAllSystemPlugins("services", false);
     $tmplPath2 = TUIYO_VIEWS . DS . "profile" . DS . "tmpl";
     $tmplVars2 = array("styleDir" => TUIYO_STYLEDIR, "user" => $USER, "sharewith" => array("p00" => "@everyone"), "plugins" => $plugins, "canPost" => 0);
     $activity = $TMPL->parseTmpl("activity", $tmplPath2, $tmplVars2);
     $tmplVars = array("apps" => $APPS, "activity" => $activity, "styleDir" => $livestyle, "livePath" => TUIYO_LIVE_PATH, "iconPath" => TUIYO_LIVE_PATH . '/client/default/');
     $tmplVars["version"] = $longVersion;
     $tmplPath = JPATH_COMPONENT_ADMINISTRATOR . DS . "views" . DS . "tuiyo" . DS . "tmpl";
     $tplData = !is_null($tpl) ? $tpl : $TMPL->parseTmpl("default", $tmplPath, $tmplVars);
     $tmplVars["adminPage"] = $tplData;
     $content = $TMPL->parseTmpl("admin", $tmplPath, $tmplVars);
     echo $content;
 }
 /**
  * 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");
     }
 }
示例#4
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);
 }
示例#5
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);
     }
 }
示例#6
0
 /**
  * TuiyoModelFriends::addInvite()
  * Generates an Invite
  * @param mixed $inviter
  * @param mixed $invitee
  * @return
  */
 public function addInvite($inviter, $invitee, $message = NULL)
 {
     $iTable = TuiyoLoader::table("invites", TRUE);
     $iNotify = TuiyoLoader::library("mail.notify", true);
     if (empty($invitee->email) || !isset($invitee->email) || $iTable->hasExistingAccount($invitee->email)) {
         return false;
     }
     $iTable->load(NULL);
     $iData = array("userid" => $inviter->id, "email" => $invitee->email, "state" => 0, "name" => !empty($invitee->name) ? $invitee->name : $invitee->email, "code" => $iTable->generateCode());
     if (!$iTable->bind($iData)) {
         JError::raiseError(TUIYO_SERVER_ERROR, $iTable->getError());
         return false;
     }
     //We can Now save the table
     if (!$iTable->store($iData)) {
         return false;
     }
     //Send and Email to the user with the activation code;
     TuiyoLoader::helper("parameter");
     TuiyoLoader::library("mail.notify");
     $notifyParams = TuiyoParameter::load("emails");
     $tVars = array($invitee->name, JURI::base(), $inviter->username, $message);
     $tSearch = array("[name]", "[link]", "[username]", "[message]");
     $emailTitle = str_replace($tSearch, $tVars, $notifyParams->get("inviteEmailTitle", null));
     $emailBody = str_replace($tSearch, $tVars, $notifyParams->get("inviteEmailBody", null));
     //echo $notifyEmail ;
     TuiyoNotify::sendMail($invitee->email, $emailTitle, $emailBody);
     return true;
 }
示例#7
0
 /**
  * TuiyoModelProfile::getDesigns()
  * @return
  */
 public function getTemplateParams()
 {
     global $mainframe, $API;
     TuiyoLoader::helper("parameter");
     $params = array('template' => $mainframe->getTemplate(), 'file' => "userparams.xml", 'directory' => JPATH_THEMES);
     $user = $API->get("user");
     // check
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = JFilterInput::clean($params['template'], 'cmd');
     $userparams = JFilterInput::clean($params['file'], 'cmd');
     $userparams = $directory . DS . $template . DS . "html" . DS . "com_tuiyo" . DS . $userparams;
     $userdata = TUIYO_STYLES . DS . $user->id . DS . $template . ".ini";
     if (!file_exists($userparams) || !is_file($userparams)) {
         //If theres no userparams.xml file forget it
         return null;
     }
     if (!file_exists($userdata) || !is_file($userdata) || !is_readable($userdata)) {
         jimport('joomla.filesystem.file');
         JFile::write($userdata, "");
     }
     $content = file_get_contents($directory . DS . $template . DS . 'params.ini');
     $params = new TuiyoParameter($content, $userparams);
     return $params;
 }
示例#8
0
 /**
  * TuiyoUser::getUserAvatar()
  * @param mixed $userID
  * @return object
  */
 public function getUserAvatar($userID = NULL, $type = NULL)
 {
     $avatar = new userAvatar();
     $self = TuiyoUser::getInstance(empty($userID) ? null : (int) $userID);
     $userID = empty($userID) ? $self->id : (int) $userID;
     /**Returns an object with the current users */
     $params = TuiyoApi::get("params");
     $params->loadParams("user.avatar", $userID);
     $thumb200 = $params->get("thumb200", null);
     $thumb70 = $params->get("thumb70", null);
     $thumb35 = $params->get("thumb35", null);
     //Paths
     $pathThumb200 = JPATH_ROOT . DS . str_replace(array("/"), array(DS), substr($thumb200, 1));
     $pathThumb70 = JPATH_ROOT . DS . str_replace(array("/"), array(DS), substr($thumb70, 1));
     $pathThumb35 = JPATH_ROOT . DS . str_replace(array("/"), array(DS), substr($thumb35, 1));
     $pathRoot = JURI::root();
     //No avatr Urls
     $noAvatarThumb200URL = "components/com_tuiyo/files/noavatar200.jpg";
     $noAvatarThumb70URL = "components/com_tuiyo/files/noavatar70.jpg";
     $noAvatarThumb35URL = "components/com_tuiyo/files/noavatar35.jpg";
     $gravatarURL = "http://www.gravatar.com/avatar.php?gravatar_id=%s&default=%s&size=%s&border=%s&rating=%s";
     $userEmail = $self->joomla->get('email');
     //Finally Tell us What the avatars truley are
     $avatar->thumb200 = !empty($thumb200) && file_exists($pathThumb200) ? $pathRoot . substr($thumb200, 1) : $pathRoot . $noAvatarThumb200URL;
     $avatar->thumb70 = !empty($thumb70) && file_exists($pathThumb70) ? $pathRoot . substr($thumb70, 1) : $pathRoot . $noAvatarThumb70URL;
     $avatar->thumb35 = !empty($thumb35) && file_exists($pathThumb35) ? $pathRoot . substr($thumb35, 1) : $pathRoot . $noAvatarThumb35URL;
     if ($avatar->thumb200 == $noAvatarThumb200URL) {
         //Check for the existence of a gravatar
         TuiyoLoader::helper("parameter");
         $sysCfg = TuiyoParameter::load("global");
         $maxRating = $sysCfg->get("siteGravatarMaxRating", "X");
         if ((bool) $sysCfg->get("siteEnableGravatars", 1)) {
             $hash = md5($userEmail);
             $uri = 'http:www.gravatar.com/avatar/' . $hash . '?d=404';
             $jRoot = JURI::root();
             $avatar->thumb200 = sprintf($gravatarURL, $hash, $jRoot . '/' . $noAvatarThumb200URL, 200, 0, $maxRating);
             $avatar->thumb70 = sprintf($gravatarURL, $hash, $jRoot . '/' . $noAvatarThumb70URL, 70, 0, $maxRating);
             $avatar->thumb35 = sprintf($gravatarURL, $hash, $jRoot . '/' . $noAvatarThumb35URL, 35, 0, $maxRating);
         }
     }
     $params = null;
     unset($params);
     if (isset($type) && !empty($type) && isset($avatar->{$type})) {
         $required = $avatar->{$type};
         unset($avatar);
         return $required;
     }
     $required = clone $avatar;
     unset($avatar);
     //return (object) $instance[$userID];
     return (object) $required;
 }
示例#9
0
 * @copyright : 2008 tuiyo Platform                                 *
 * @license   : http://platform.tuiyo.com/license   BSD License     * 
 * @version   : Release: $Id$                                       * 
 * @link      : http://platform.tuiyo.com/                          * 
 * @author 	  : livingstone[at]drstonyhills[dot]com                 * 
 * @access 	  : Public                                              *
 * @since     : 1.0.0 alpha                                         *   
 * @package   : tuiyo                                               *
 * ******************************************************************
 */
/**
 * no direct access
 */
defined('_JEXEC') || die('Restricted access');
jimport('joomla.application.component.controller');
TuiyoLoader::helper("parameter");
/**
 * TuiyoControllerSystemTools
 * 
 * @copyright 2009
 * @version $Id$
 * @access public
 */
class TuiyoControllerSystemTools extends JController
{
    /**
     * TuiyoControllerSystemTools::__construct()
     * @return
     */
    public function __construct()
    {
示例#10
0
 /**
  * Imports a helper file or class
  * Loads a helper from the public helpers
  * @param mixed $fileName
  * @param bool $createInstance
  */
 public function helper($fileName, $createInstance = false, $parameters = null)
 {
     TuiyoLoader::import($fileName, 'helper');
     if ($createInstance) {
         $helperClass = ucfirst(TUIYO_LIB) . ucfirst(self::$_loaded[$fileName]);
         if (in_array($helperClass, self::$_stored["helpers"])) {
             $object = self::$_stored["helpers"][$helperClass];
             if (is_object($object)) {
                 return $object;
             } else {
                 unset(self::$_stored["helpers"][$helperClass]);
                 TuiyoLoader::helper($fileName, $createInstance, $parameters);
             }
         }
         $helper = new $helperClass($parameters);
         self::$_stored["helpers"][$helperClass] =& $helper;
         return $helper;
     }
 }
示例#11
0
 /**
  * TuiyoAPI::getUrlViaProxy()
  * 
  * @param mixed $URL
  * @param mixed $proxyName
  * @param mixed $proxyPort
  * @return
  */
 public function getUrlViaProxy($URL, $proxyName = NULL, $proxyPort = NULL)
 {
     if (empty($proxyName) || empty($proxyPort)) {
         TuiyoLoader::helper("parameter");
         $params =& TuiyoParameter::load("global");
         $proxyName = $params->get("serverHttpProxyName", null);
         $proxyPort = $params->get("serverHttpProxyPort", null);
     }
     $parsed = parse_url($URL);
     $host = $parsed["host"];
     $path = $parsed["path"];
     $out = "GET {$path} HTTP/1.0\r\nHost: {$host}\r\n\r\n";
     $fp = fsockopen($proxyName, $proxyPort);
     $content = null;
     $body = false;
     if (!$fp) {
         return false;
     }
     $bytes = fputs($fp, "GET {$URL} HTTP/1.0\r\nHost: {$proxyName}\r\n\r\n");
     do {
         $header .= fgets($fp, 128);
     } while (strpos($header, "\r\n\r\n") === false);
     while (!feof($fp)) {
         $lfp = fgets($fp, $bytes);
         $content .= $lfp;
         //if ( $body ) $content.= $lfp;
         //if ( $lfp == "\r\n" ) $body = true;
     }
     fclose($fp);
     //$content 	= substr($content, strpos($content, "\r\n\r\n") + 4);
     return $content;
 }
示例#12
0
 /**
  * Loads system plugins.
  * @param $type
  * @param $pluginXML
  * @param $incSystem
  * @param $excUserPlugins
  */
 public function getAllSystemPlugins($type = "services", $pluginXML = false, $incSystem = false, $excUserPlugins = false, $userID = null)
 {
     //Import the Joomla Folder Library
     jimport('joomla.filesystem.folders');
     //Import the Tuiyo Alias of JParameter
     TuiyoLoader::helper("parameter");
     //Scan the plugin folder
     $plugins = JFolder::folders(TUIYO_PLUGINS);
     $exclude = array("system");
     //If we want to exclude user plugins
     if ($excUserPlugins && isset($userID)) {
         $userPlugins = $this->getAllUserPlugins($userID, $type, false);
         $exclude = array_merge($exclude, (array) $userPlugins);
     }
     $plugins = array_diff($plugins, $exclude);
     if (!$pluginXML) {
         return $plugins;
     }
     //If we have to load the XML files
     $pluginsSpec = array();
     foreach ($plugins as $plugin) {
         $newPluginSpec = array();
         $newPlugin = new stdClass();
         $newPluginID = strtolower($plugin);
         $newPluginXMLf = TUIYO_PLUGINS . DS . $newPluginID . DS . "plugin.xml";
         $newPluginLivePath = TUIYO_LIVE_PATH . '/plugins/' . $newPluginID;
         if (!file_exists($newPluginXMLf)) {
             continue;
         }
         //this is not a plugin
         $newPluginXML = TuiyoAPI::get("xml", $newPluginXMLf);
         $root = $newPluginXML->file->document;
         $rootType = $root->attributes("type");
         if ((string) $rootType != "plugin") {
             continue;
         }
         //this is not a plugin
         //Load data
         $pluginParams = new TuiyoParameter('', $newPluginXMLf);
         $pluginParams->setXML($newPluginXML->file->document);
         $newPluginSpec['serviceID'] = $newPluginID;
         $newPluginSpec['serviceDescription'] = $root->description[0]->_data;
         $newPluginSpec['serviceLivePath'] = $newPluginLivePath;
         $newPluginSpec['serviceExecuteJS'] = $newPluginLivePath . '/' . $newPluginID . '.js';
         $newPluginSpec['settings_default_html'] = $pluginParams->renderHTML("params", "plugin");
         $newPluginSpec['settings_administrator_html'] = $pluginParams->renderHTML("params", "administrator");
         $newPluginSpec['settings_photos_html'] = $pluginParams->renderHTML("params", "photos");
         $newPluginSpec['settings_privacy_html'] = $pluginParams->renderHTML("params", "privacy");
         $pluginsSpec[$newPluginID] = $newPluginSpec;
     }
     return $pluginsSpec;
 }