Example #1
0
 public function __construct()
 {
     /** Do we need user to be logged in? **/
     //TuiyoControllerCore::init( "Tuiyo", false );
     TuiyoEventLoader::preparePlugins("administrator");
     //Parent constructor or break
     parent::__construct();
 }
Example #2
0
 /**
  * TuiyoControllerTimeline::__construct()
  * @return void
  */
 public function __construct()
 {
     //		if (!JRequest::getCmd( 'view') ) {
     //         	JRequest::setVar('view', 'profile');
     //      	}
     TuiyoControllerCore::init("Timeline", false);
     TuiyoEventLoader::preparePlugins("timeline");
     parent::__construct();
 }
Example #3
0
 public function invoke($args = null)
 {
     TuiyoEventLoader::resolve($this->subordinate);
     return call_user_func_array(array($this->subordinate, $this->method), array($this->arguments));
 }
Example #4
0
 /**
  * TuiyoControllerApps::remove()
  * Removes an application from a user profile
  * @return void
  */
 public function remove()
 {
     $tble = TuiyoLoader::table("userapps");
     $post = JRequest::get('post');
     $user = $GLOBALS['API']->get("user");
     $model = $this->getModel("applications");
     $appName = strval($post['app']);
     //Check The user Token
     if (!JRequest::checkToken() || $user->id != (int) $post['uid']) {
         trigger_error(_("Invalid Token. Access Denied"), E_USER_ERROR);
         return false;
     }
     //1a. Check that user does not already have App!
     //    and that there is actually an application with this id
     if ($tble->userHasApp($appName, $user->id) && $this->_appExists($appName)) {
         if (!$tble->uninstallUserApp($appName, $user->id)) {
             trigger_error(_("Could not remove the application"), E_USER_ERROR);
             return false;
         }
         //Trigger after application unistall events
         TuiyoEventLoader::preparePlugins("admin");
         $GLOBALS["events"]->trigger("onApplicationUnistall", $appName);
         //4. Increment the application userCount;
         $tble->decrAppUserCount($appName, 1);
     }
     //5.Redirect to their new app!
     $redirectMessage = sprintf(_("The %s application has been un-installed from your account, and all data removed. "), $appName);
     $redirectURL = JRoute::_(TUIYO_INDEX . '&view=profile&do=homepage');
     $this->setRedirect($redirectURL, $redirectMessage, "notice");
     $this->redirect();
 }
Example #5
0
 public function __construct()
 {
     TuiyoControllerCore::init("Notifications", false);
     TuiyoEventLoader::preparePlugins("notifications");
     parent::__construct();
 }
Example #6
0
 public function __construct()
 {
     TuiyoEventLoader::preparePlugins("macros");
 }
Example #7
0
 /**
  * TuiyoControllerCore::buildProfile()
  * 
  * @return void
  */
 public function buildProfile()
 {
     $view =& $this->getView("profile", "html");
     $resp = array("code" => TUIYO_OK, "error" => null, "data" => null, "extra" => null, "msg" => null, "msgtyp" => "messassge");
     $file =& JRequest::get('files');
     $data =& JRequest::get('post');
     //avatar Only
     $data['file'] = $file;
     //1: Validate the data
     //2:a Save Data into TuiyoUsers
     $profileLink = JRoute::_(TUIYO_PROFILE_INDEX);
     $profileObj = $GLOBALS['API']->get("user", null);
     if (!$profileObj->createProfile($data)) {
         $resp["msgtyp"] = "error";
         $resp["msg"] = $profileObj->getErrors();
     }
     //2:b Save Data to all other table (Social fields)
     //3: If avatar uploaded, Create Avatar Album
     //4: If Group Joined, add user to group;
     //5: If Invited add users to friends lists!
     //6: Call All afterProfileBuild Hooks!
     TuiyoEventLoader::preparePlugins("profile");
     $GLOBALS["events"]->trigger("onProfileBuild", $profileObj);
     //7: Hurray your profile has been created
     //Redirect#
     $this->setRedirect($profileLink, $resp["msg"], $resp["msgtyp"]);
     $this->redirect();
 }