Inheritance: extends AppController
Ejemplo n.º 1
0
 public function authControl()
 {
     $this->app_session->logout();
     $controller = new DashboardController(true);
     $controller->addSuccessMessage("You have successfully logged out.");
     return $controller->go();
 }
 public function control()
 {
     $this->setPageTitle('Log in');
     $this->setViewTemplate('session.login.tpl');
     $this->view_mgr->addHelp('login', 'userguide/accounts/index');
     $this->disableCaching();
     //don't show login form if already logged in
     if ($this->isLoggedIn()) {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         $owner_dao = DAOFactory::getDAO('OwnerDAO');
         if (isset($_POST['Submit']) && $_POST['Submit'] == 'Log In' && isset($_POST['email']) && isset($_POST['pwd'])) {
             if ($_POST['email'] == '' || $_POST['pwd'] == '') {
                 if ($_POST['email'] == '') {
                     $this->addErrorMessage("Email must not be empty");
                     return $this->generateView();
                 } else {
                     $this->addErrorMessage("Password must not be empty");
                     return $this->generateView();
                 }
             } else {
                 $session = new Session();
                 $user_email = $_POST['email'];
                 if (get_magic_quotes_gpc()) {
                     $user_email = stripslashes($user_email);
                 }
                 $this->addToView('email', $user_email);
                 $owner = $owner_dao->getByEmail($user_email);
                 if (!$owner) {
                     $this->addErrorMessage("Incorrect email");
                     return $this->generateView();
                 } elseif (!$owner->is_activated) {
                     $this->addErrorMessage("Inactive account. " . $owner->account_status . ". " . '<a href="forgot.php">Reset your password.</a>');
                     return $this->generateView();
                 } elseif (!$session->pwdCheck($_POST['pwd'], $owner_dao->getPass($user_email))) {
                     //failed login
                     if ($owner->failed_logins >= 10) {
                         $owner_dao->deactivateOwner($user_email);
                         $owner_dao->setAccountStatus($user_email, "Account deactivated due to too many failed logins");
                     }
                     $owner_dao->incrementFailedLogins($user_email);
                     $this->addErrorMessage("Incorrect password");
                     return $this->generateView();
                 } else {
                     // this sets variables in the session
                     $session->completeLogin($owner);
                     $owner_dao->updateLastLogin($user_email);
                     $owner_dao->resetFailedLogins($user_email);
                     $owner_dao->clearAccountStatus('');
                     $controller = new DashboardController(true);
                     return $controller->control();
                 }
             }
         } else {
             return $this->generateView();
         }
     }
 }
 /**
  * Bounce user to public page or to error page.
  * @TODO bounce back to original action once signed in
  */
 protected function bounce() {
     if (get_class($this)=='DashboardController' || get_class($this)=='PostController') {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         $config = Config::getInstance();
         throw new Exception('You must <a href="'.$config->getValue('site_root_path').
         'session/login.php">log in</a> to do this.');
     }
 }
 /**
  * Bounce user to public page or to error page.
  * @TODO bounce back to original action once signed in
  */
 protected function bounce()
 {
     $config = Config::getInstance();
     if (get_class($this) == 'DashboardController' || get_class($this) == 'PostController') {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         throw new ControllerAuthException('You must log in to access this controller: ' . get_class($this));
     }
 }
 public function go()
 {
     if ($this->isLoggedIn()) {
         // If logged in, we go to DashboardController
         $controller = new DashboardController();
         echo $controller->go();
     } else {
         // If is not logged in, we go to LoginController
         $controller = new LoginController();
         echo $controller->go();
     }
 }
 public function __construct()
 {
     $dashboard = App::make('Lib\\Repositories\\Dashboard\\DashboardRepositoryInterface');
     $validator = App::make('Lib\\Services\\Validation\\DashboardValidator');
     $scraper = App::make('Lib\\Services\\Scraping\\Scraper');
     parent::__construct($dashboard, $validator, $scraper);
 }
 public function command()
 {
     $geyser_id = Request::post('geyser_id');
     $element_select = Request::post('e');
     $gstate_select = Request::post('g');
     $schedule_select = Request::post('s');
     $settings_url = "http://localhost:8080/om2m/nscl/applications/geyser_" . $geyser_id . "/containers/SETTINGS/contentInstances";
     $schedule_url = "http://localhost:8080/om2m/nscl/applications/Scheduler/containers/SCHEDULE_" . $geyser_id . "/contentInstances";
     if (!empty($element_select)) {
         $data = '{"Gstate":' . '"' . $gstate_select . '"' . '}';
         DashboardController::doPOST($settings_url, $data);
     } else {
         if (!empty($gstate_select)) {
             $data = '{"Rstate":' . '"' . $element_select . '"' . '}';
             DashboardController::doPOST($settings_url, $data);
         } else {
             if (!empty($schedule_select)) {
                 if (strcmp($schedule_select, "low") == 0) {
                     $data = "40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40";
                 } else {
                     if (strcmp($schedule_select, "smart") == 0) {
                         $data = "35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,60,60,60,60,60,60,60,60,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,50,50,50,50,50,50,50,50,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35";
                     } else {
                         if (strcmp($schedule_select, "high") == 0) {
                             $data = "65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65";
                         }
                     }
                 }
                 DashboardController::doPOST($schedule_url, $data);
             }
         }
     }
     $this->View->render('dashboard/index');
 }
Ejemplo n.º 8
0
 /**
  * Hightlight menu path. Automatically run on every use.
  *
  * @since 2.0.0
  * @access public
  */
 public function Initialize()
 {
     parent::Initialize();
     if ($this->Menu) {
         $this->Menu->HighlightRoute('/dashboard/settings');
     }
 }
Ejemplo n.º 9
0
 /**
  * Runs before every call to this controller.
  */
 public function initialize()
 {
     parent::initialize();
     Gdn_Theme::section('Dashboard');
     set_time_limit(0);
     // Is this even doing anything?
 }
Ejemplo n.º 10
0
 /**
  * Runs before every call to this controller.
  */
 public function initialize()
 {
     parent::initialize();
     Gdn_Theme::section('Dashboard');
     $this->Model = new DBAModel();
     $this->Form = new Gdn_Form();
     $this->addJsFile('dba.js');
 }
Ejemplo n.º 11
0
 /**
  * Set menu path. Automatically run on every use.
  *
  * @since 2.0.0
  * @access public
  */
 public function initialize()
 {
     parent::initialize();
     Gdn_Theme::section('Dashboard');
     if ($this->Menu) {
         $this->Menu->highlightRoute('/dashboard/settings');
     }
 }
Ejemplo n.º 12
0
 public function Initialize()
 {
     parent::Initialize();
     Gdn_Theme::Section('Dashboard');
     $this->Model = new DBAModel();
     $this->Form = new Gdn_Form();
     $this->Form->InputPrefix = '';
     $this->AddJsFile('dba.js');
 }
Ejemplo n.º 13
0
 public function index()
 {
     $glparams = DataObjectFactory::Factory('GLParams');
     if (is_null($glparams->ar_disposals_proceeds_account()) || is_null($glparams->ar_disposals_proceeds_centre()) || is_null($glparams->ar_pl_suspense_account()) || is_null($glparams->ar_pl_suspense_centre())) {
         $flash = Flash::Instance();
         $flash->addError('GL Support is not enabled');
     }
     parent::index();
 }
Ejemplo n.º 14
0
 public function control()
 {
     $this->setPageTitle('Log in');
     $this->setViewTemplate('session.login.tpl');
     $this->disableCaching();
     //don't show login form if already logged in
     if ($this->isLoggedIn()) {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         $od = DAOFactory::getDAO('OwnerDAO');
         if (isset($_POST['Submit']) && $_POST['Submit'] == 'Log In' && isset($_POST['email']) && isset($_POST['pwd'])) {
             if ($_POST['email'] == '' || $_POST['pwd'] == '') {
                 if ($_POST['email'] == '') {
                     $this->addErrorMessage("Email must not be empty");
                     return $this->generateView();
                 } else {
                     $this->addErrorMessage("Password must not be empty");
                     return $this->generateView();
                 }
             } else {
                 $session = new Session();
                 $user_email = $_POST['email'];
                 $this->addToView('email', $user_email);
                 $owner = $od->getByEmail($user_email);
                 if (!$owner) {
                     $this->addErrorMessage("Incorrect email");
                     return $this->generateView();
                 } elseif (!$session->pwdCheck($_POST['pwd'], $od->getPass($user_email))) {
                     $this->addErrorMessage("Incorrect password");
                     return $this->generateView();
                 } else {
                     // this sets variables in the session
                     $session->completeLogin($owner);
                     $od->updateLastLogin($user_email);
                     $controller = new DashboardController(true);
                     return $controller->control();
                 }
             }
         } else {
             return $this->generateView();
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * Make this look like a dashboard page and add the resources
  *
  * @since 1.0
  * @access public
  */
 public function Initialize()
 {
     parent::Initialize();
     $this->Application = 'Yaga';
     Gdn_Theme::Section('Dashboard');
     if ($this->Menu) {
         $this->Menu->HighlightRoute('/badge');
     }
     $this->AddJsFile('admin.badges.js');
     $this->AddCssFile('badges.css');
 }
Ejemplo n.º 16
0
 /**
  * Make this look like a dashboard page and add the resources
  *
  * @since 1.0
  * @access public
  */
 public function Initialize()
 {
     parent::Initialize();
     $this->Application = 'Yaga';
     Gdn_Theme::Section('Dashboard');
     if ($this->Menu) {
         $this->Menu->HighlightRoute('/yaga');
     }
     $this->AddSideMenu('yaga/settings');
     $this->AddCssFile('yaga.css');
 }
Ejemplo n.º 17
0
 public function Index()
 {
     $userPreferences = UserPreferences::instance(EGS_USERNAME);
     if ($userPreferences->userCanSetPreferences() && !$userPreferences->userHasPreferences()) {
         $message = "<strong>Welcome to EGS. It looks like this is your first time using the system, or you have not yet got round to setting your preferences.</strong><br />\n        You can <a href=\"/?module=dashboard&controller=preferences\">setup your preferences now</a>, or use the 'Preferences' link that is available in the top right of your screen when using the system.";
         $this->view->set("info_message", $message);
     }
     parent::index();
     $this->view->set('usealternative', false);
     $this->view->set('page_title', $this->getPageName());
 }
 public function init()
 {
     parent::init();
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
     // -1.8.5.custom.min.js');
     Requirements::css('frontend-dashboards/thirdparty/aristo/aristo.css');
     if (class_exists('WebServiceController')) {
         Requirements::javascript('webservices/javascript/webservices.js');
     }
 }
Ejemplo n.º 19
0
 /**
  * Make this look like a dashboard page and add the resources
  *
  * @since 1.0
  * @access public
  */
 public function Initialize()
 {
     parent::Initialize();
     $this->Application = 'Yaga';
     Gdn_Theme::Section('Dashboard');
     if ($this->Menu) {
         $this->Menu->HighlightRoute('/rank');
     }
     $this->AddJsFile('jquery-ui-1.10.0.custom.min.js');
     $this->AddJsFile('admin.ranks.js');
 }
 public function init()
 {
     $board = $this->data()->FixedDashboard();
     if ($board->ID && $board->canView()) {
         $this->currentDashboard = $board;
     }
     parent::init();
     Requirements::css('frontend-dashboards/thirdparty/aristo/aristo.css');
     if (class_exists('WebServiceController')) {
         Requirements::javascript('webservices/javascript/webservices.js');
     }
 }
Ejemplo n.º 21
0
 public function listStudents()
 {
     $toReturn = array('students' => array(), "classes" => array());
     if (Input::get('selectType') == "selStudents") {
         $studentIds = array();
         $studentList = Input::get('studentInfo');
         while (list($key, $value) = each($studentList)) {
             $studentIds[] = $value['id'];
         }
         $students = User::whereIn('id', $studentIds)->get();
         foreach ($students as $value) {
             $toReturn['students'][$value->id] = array("id" => $value->id, "fullName" => $value->fullName, "class" => $value->studentClass, "acYear" => $value->studentAcademicYear);
         }
     } else {
         $students = User::where('studentAcademicYear', Input::get('acYear'))->where('studentClass', Input::get('classId'))->where('role', 'student')->where('activated', 1)->get();
         foreach ($students as $value) {
             $toReturn['students'][$value->id] = array("id" => $value->id, "fullName" => $value->fullName, "class" => $value->studentClass, "acYear" => $value->studentAcademicYear);
         }
     }
     $DashboardController = new DashboardController();
     $toReturn['classes'] = $DashboardController->classesList(Input::get('acYear'));
     return $toReturn;
 }
 /**
  * Highlight route and do authenticator setup.
  *
  * Always called by dispatcher before controller's requested method.
  * 
  * @since 2.0.3
  * @access public
  */
 public function Initialize()
 {
     parent::Initialize();
     if ($this->Menu) {
         $this->Menu->HighlightRoute('/dashboard/authentication');
     }
     $this->EnableSlicing($this);
     $Authenticators = Gdn::Authenticator()->GetAvailable();
     $this->ChooserList = array();
     $this->ConfigureList = array();
     foreach ($Authenticators as $AuthAlias => $AuthConfig) {
         $this->ChooserList[$AuthAlias] = $AuthConfig['Name'];
         $Authenticator = Gdn::Authenticator()->AuthenticateWith($AuthAlias);
         $ConfigURL = is_a($Authenticator, "Gdn_Authenticator") && method_exists($Authenticator, 'AuthenticatorConfiguration') ? $Authenticator->AuthenticatorConfiguration($this) : FALSE;
         $this->ConfigureList[$AuthAlias] = $ConfigURL;
     }
     $this->CurrentAuthenticationAlias = Gdn::Authenticator()->AuthenticateWith('default')->GetAuthenticationSchemeAlias();
 }
Ejemplo n.º 23
0
 public function control()
 {
     if ($this->isLoggedIn()) {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         // register form validation
         $this->addHeaderCSS('assets/css/validate_password.css');
         $this->addHeaderJavaScript('assets/js/jquery.validate.min.js');
         $this->addHeaderJavaScript('assets/js/jquery.validate.password.js');
         $this->addHeaderJavaScript('assets/js/validate_password.js');
         $config = Config::getInstance();
         $is_registration_open = $config->getValue('is_registration_open');
         $this->disableCaching();
         $invite_dao = DAOFactory::getDAO('InviteDAO');
         if (isset($_GET['code'])) {
             $invite_code = $_GET['code'];
         } else {
             $invite_code = null;
         }
         $this->addToView('invite_code', $invite_code);
         $is_invite_code_valid = $invite_dao->isInviteValid($invite_code);
         if ($invite_code != null && $is_invite_code_valid) {
             $this->addSuccessMessage("Welcome, VIP! You've been invited to register on " . $config->getValue('app_title_prefix') . "ThinkUp.");
         }
         $has_been_registered = false;
         if (!$is_registration_open && !$is_invite_code_valid) {
             $this->addToView('closed', true);
             $disable_xss = true;
             $this->addErrorMessage('<p>Sorry, registration is closed on this installation of ' . $config->getValue('app_title_prefix') . "ThinkUp.</p>" . '<p><a href="http://thinkupapp.com">Install ThinkUp on your own server.</a></p>', null, $disable_xss);
         } else {
             $owner_dao = DAOFactory::getDAO('OwnerDAO');
             $this->addToView('closed', false);
             $captcha = new Captcha();
             if (isset($_POST['Submit']) && $_POST['Submit'] == 'Register') {
                 foreach ($this->REQUIRED_PARAMS as $param) {
                     if (!isset($_POST[$param]) || $_POST[$param] == '') {
                         $this->addErrorMessage('Please fill out all required fields.');
                         $this->is_missing_param = true;
                     }
                 }
                 if (!$this->is_missing_param) {
                     $valid_input = true;
                     if (!Utils::validateEmail($_POST['email'])) {
                         $this->addErrorMessage("Incorrect email. Please enter valid email address.", 'email');
                         $valid_input = false;
                     }
                     if (strcmp($_POST['pass1'], $_POST['pass2']) || empty($_POST['pass1'])) {
                         $this->addErrorMessage("Passwords do not match.", 'password');
                         $valid_input = false;
                     } else {
                         if (!preg_match("/(?=.{8,})(?=.*[a-zA-Z])(?=.*[0-9])/", $_POST['pass1'])) {
                             $this->addErrorMessage("Password must be at least 8 characters and contain both numbers " . "and letters.", 'password');
                             $valid_input = false;
                         }
                     }
                     if (!$captcha->doesTextMatchImage()) {
                         $this->addErrorMessage("Entered text didn't match the image. Please try again.", 'captcha');
                         $valid_input = false;
                     }
                     if ($valid_input) {
                         if ($owner_dao->doesOwnerExist($_POST['email'])) {
                             $this->addErrorMessage("User account already exists.", 'email');
                         } else {
                             // Insert the details into the database
                             $activation_code = $owner_dao->create($_POST['email'], $_POST['pass2'], $_POST['full_name']);
                             if ($activation_code != false) {
                                 $es = new ViewManager();
                                 $es->caching = false;
                                 $es->assign('application_url', Utils::getApplicationURL(false));
                                 $es->assign('email', urlencode($_POST['email']));
                                 $es->assign('activ_code', $activation_code);
                                 $message = $es->fetch('_email.registration.tpl');
                                 Mailer::mail($_POST['email'], "Activate Your Account on " . $config->getValue('app_title_prefix') . "ThinkUp", $message);
                                 SessionCache::unsetKey('ckey');
                                 $this->addSuccessMessage("Success! Check your email for an activation link.");
                                 //delete invite code
                                 if ($is_invite_code_valid) {
                                     $invite_dao->deleteInviteCode($invite_code);
                                 }
                                 $has_been_registered = true;
                             } else {
                                 $this->addErrorMessage("Unable to register a new user. Please try again.");
                             }
                         }
                     }
                 }
                 if (isset($_POST["full_name"])) {
                     $this->addToView('name', $_POST["full_name"]);
                 }
                 if (isset($_POST["email"])) {
                     $this->addToView('mail', $_POST["email"]);
                 }
                 $this->addToView('has_been_registered', $has_been_registered);
             }
             $challenge = $captcha->generate();
             $this->addToView('captcha', $challenge);
         }
         $this->view_mgr->addHelp('register', 'userguide/accounts/index');
         return $this->generateView();
     }
 }
	<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN SIDEBAR -->
	<div class="page-sidebar-wrapper">
		<div class="page-sidebar navbar-collapse collapse">
			<ul class="page-sidebar-menu" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
				<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
				
                                <!-- ACA SE CREARA EL DASHBOARD DINAMICO -->
                                <?php 
$dashboard = new DashboardController();
echo $dashboard->get_dashboard_sidebar_menu($rol, "Gestionar Usuarios");
?>
				<!--FINAL DEL DASHBOARD DINAMICO -->
			</ul>
			<!-- END SIDEBAR MENU -->
		</div>
	</div>
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
 public function Initialize()
 {
     parent::Initialize();
     Gdn_Theme::Section('Dashboard');
 }
Ejemplo n.º 26
0
 /**
  * Run before
  */
 public function initialize()
 {
     parent::initialize();
     Gdn_Theme::section('Dashboard');
 }
Ejemplo n.º 27
0
 public function testCleanXSS()
 {
     $with_xss = true;
     $builders = $this->buildData($with_xss);
     $this->simulateLogin('*****@*****.**');
     //required params
     $_GET['u'] = 'ev';
     $_GET['n'] = 'twitter';
     $_GET['v'] = 'tweets-all';
     $controller = new DashboardController(true);
     $results = $controller->go();
     $this->assertNoPattern("/This is post <script>alert\\('wa'\\);<\\/script>\\d+/", $results);
     $this->assertPattern("/This is post &#60;script&#62;alert\\(&#39;wa&#39;\\);&#60;\\/script&#62;\\d+/", $results);
 }
Ejemplo n.º 28
0
 /**
  * Always triggered first. Add Javascript files.
  *
  * @since 2.0.?
  * @access public
  */
 public function Initialize()
 {
     parent::Initialize();
     Gdn_Theme::Section('Dashboard');
     $this->AddJsFile('log.js');
     $this->AddJsFile('jquery.expander.js');
     $this->AddJsFile('jquery-ui.js');
     $this->Form->InputPrefix = '';
 }
 public static function set_allowed_dashlets($dashlets)
 {
     Config::inst()->update('DashboardController', 'allowed_dashlets', $dashlets);
     self::$allowed_dashlets = $dashlets;
 }
Ejemplo n.º 30
0
$this_section = SECTION_DASHBOARD;
unset($_SESSION['this_section']);
//for hmtl editor repository
// get actions
$actions = array('listing', 'store_user_block', 'disable_block');
$action = 'listing';
if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
    $action = $_GET['action'];
}
// load styles from dashboard plugins
$dashboar_plugin_styles = DashboardManager::get_links_for_styles_from_dashboard_plugins();
$htmlHeadXtra[] = $dashboar_plugin_styles;
// interbreadcrumb
//$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('Dashboard'));
// course description controller object
$dashboard_controller = new DashboardController();
if (isset($_GET['path'])) {
    $path = $_GET['path'];
}
// distpacher actions to controller
switch ($action) {
    case 'listing':
        $dashboard_controller->display();
        break;
    case 'store_user_block':
        $dashboard_controller->store_user_block();
        break;
    case 'disable_block':
        $dashboard_controller->close_user_block($path);
        break;
    default: