Example #1
0
 /**
  * The index action is the default action of this Wall Module. It prepares the widget
  * wall of the user and render the view according to its preferences.
  *
  * If the current user is not authenticated, it will be redirected to the users/index
  * action that will allows you to acces the login form of the application.
  *
  */
 public function index($continuePurchase = false, $langage = null, $forcebrowser = false)
 {
     # Try to force users to use firefox
     //		if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){
     //			$forcebrowser = true;
     //		}
     //		if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){
     //			require(DefaultFC::getView('compatibility.tpl'));
     //			die();
     //		}else{
     //			$_SESSION['forcebrowser'] = true;
     //		}
     if (Auth::isAuth()) {
         // Determine if the 'category widget' is installed.
         if (Widgets::isInstalled('categoryList')) {
             $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories');
         }
         // Determine if the 'tag cloud widget' is installed.
         if (Widgets::isInstalled('tagCloud')) {
             $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud');
         }
         // Determine if the view must allow the user to manage widgets.
         $widgetManagement = false;
         if (Auth::isAdmin() || Auth::isGod()) {
             $widgetManagement = true;
         }
         // Determine if the view must show the list of installed widgets or
         // a link to the PALETTE Service Browser.
         $useServiceBrowser = USE_SERVICE_BROWSER;
         $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null;
         require DefaultFC::getView('index.tpl');
     } else {
         DefaultFC::redirection('users/index?ref=wall');
     }
 }
Example #2
0
 public function index()
 {
     // Globals are evil !
     $lg = $GLOBALS['lang'];
     if (!file_exists(dirname(__FILE__) . "/../views/common/onlinehelp/{$lg}.tpl")) {
         $lg = 'en';
     }
     // Determine if the view must allow the user to manage widgets.
     $widgetManagement = false;
     if (Auth::isAdmin() || Auth::isGod()) {
         $widgetManagement = true;
     }
     // Help file to include in the view.
     $helpInclusion = dirname(__FILE__) . "/../views/common/onlinehelp/{$lg}.tpl";
     # Get Avaliable Langue
     $availableLanguages = Util::getAvailableLanguages();
     $userLanguage = Auth::getLanguage();
     require_once DefaultFC::getView("help.tpl");
 }
Example #3
0
 public function preferences()
 {
     // Bad authentication ?
     if (isset($_SESSION['isError'])) {
         $isError = $_SESSION['isError'];
         $message = $_SESSION['message'];
         unset($_SESSION['isError']);
         unset($_SESSION['message']);
     } else {
         $isError = false;
         if (isset($_SESSION['message'])) {
             $message = $_SESSION['message'];
             unset($_SESSION['message']);
         }
     }
     // Determine if the view must allow the user to manage widgets.
     $widgetManagement = false;
     if (Auth::isAdmin() || Auth::isGod()) {
         $widgetManagement = true;
     }
     $availableLanguages = Util::getAvailableLanguages();
     $userLanguage = Auth::getLanguage();
     $openId = Auth::getOpenId();
     require DefaultFC::getView('preferences.tpl');
 }
 /**
  * This action is triggered through a POST HTTP Request in order to modifiy
  * the name of an existing category.
  * 
  * @param integer $categoryId The numeric identifier of the category the user wants to modify the name.
  * @param string $catregoryName The new name of the category the user wants to modify the name.
  */
 public function edit($categoryId, $categoryName)
 {
     // Security check.
     if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         DefaultFC::redirection('users/index?ref=admin');
     }
     try {
         Categories::modify($categoryId, $categoryName);
         // Ok no exception thrown !
         $_SESSION['isError'] = false;
         $_SESSION['message'] = sprintf(__("The category '%s' has been successfuly updated."), $categoryName);
         DefaultFC::redirection('adminCategories/index');
     } catch (CategoryException $e) {
         // An error occured. Normally, the category name already exists.
         $_SESSION['isError'] = true;
         if ($e->getCode() == CategoryException::ALREADY_EXISTS) {
             $_SESSION['message'] = sprintf(__("The category '%s' already exists."), $categoryName);
         } else {
             $_SESSION['message'] = __("Please provide a category name.");
         }
         DefaultFC::redirection('adminCategories/index');
     }
 }
Example #5
0
 /**
  * The Delete action of the Admin module should be triggered through an HTTP POST request in order to
  * uninstall a widget that was installed in the widget repository.
  *
  * @param string $widget The identifier of the widget that must uninstalled from the widget repository.
  */
 public function delete($widget)
 {
     // Security check.
     if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         DefaultFC::redirection('users/index?ref=admin');
     }
     // Action
     Widgets::uninstall($widget);
     $_SESSION['isError'] = false;
     $_SESSION['message'] = __("The widget has been deleted successfully.");
     DefaultFC::redirection('admin/index');
 }
 public function deleteAction($userId)
 {
     if (Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         UsersManagement::deleteUser($userId);
         $_SESSION['isError'] = false;
         $_SESSION['message'] = __('The user has been successfuly removed from the portal.');
         DefaultFC::redirection('adminUsers/index');
     } else {
         redirect('users/index');
     }
 }