Example #1
0
 public function IndexAction()
 {
     Site::$keywords = $this->company->tags;
     Site::$title = $this->company->name . ' на PromSpace';
     $group_tags_array = GroupModel::GetList();
     $region_tags_array = RegionModel::GetList();
     $region_tags_array[0] = 'Вся Россия';
     $group_tags_array[0] = 'Не определено';
     $products = ProductModel::GetAll()->where('company_id = ?', [0 => $this->company->id]);
     $contacts = array();
     if (!User::isLogged()) {
         if ($this->company->open == 2) {
             $contacts = ContactsModel::GetAll()->where('company_id = ?', [0 => $this->company->id]);
         }
         $this->render('nologged', ['company' => $this->company, 'group_tags' => $group_tags_array, 'region_tags' => $region_tags_array, 'contacts' => $contacts, 'products' => $products, 'simmilar' => $this->GetSimmilar()]);
     } elseif ($this->company->id == User::company() or User::admin()) {
         if ($this->company->logo == '') {
             Site::Message('Мы рекомендуем Вам установить логтип для профиля, это сделает его более привлекательным для клиентов');
         }
         $contacts = ContactsModel::GetAll()->where('company_id = ?', [0 => $this->company->id]);
         $this->render('edit', ['company' => $this->company, 'group_tags' => $group_tags_array, 'region_tags' => $region_tags_array, 'contacts' => $contacts, 'products' => $products, 'simmilar' => $this->GetSimmilar()]);
     } else {
         if ($this->company->open == 0 and FavoriteModel::i_friend($this->company->id) or $this->company->open > 0) {
             $contacts = ContactsModel::GetAll()->where('company_id = ?', [0 => $this->company->id]);
         }
         $this->render('index', ['company' => $this->company, 'group_tags' => $group_tags_array, 'region_tags' => $region_tags_array, 'favorite' => FavoriteModel::my_friend($this->company->id) ? 'favorite.png' : 'star.png', 'contacts' => $contacts, 'products' => $products, 'simmilar' => $this->GetSimmilar()]);
     }
 }
Example #2
0
 public function actionEdit()
 {
     $categories = Category::getCategoryList();
     if (!$categories) {
         $categories = array();
     }
     $email = User::isLogged();
     $user = User::getUserByEmail($email);
     $name = $user['name'];
     $password = '';
     $result = '';
     if (isset($_POST['submit'])) {
         $name = FunctionLibrary::clearStr($_POST['name']);
         $password = FunctionLibrary::clearStr($_POST['password']);
         $errors = array();
         if (!User::checkName($name)) {
             $errors[] = 'Имя должно быть больше 1 символа.';
         }
         if (!User::checkPassword($password)) {
             $errors[] = 'Пароль должен быть больше 5 символов.';
         }
         if (empty($errors)) {
             $result = User::edit($user['id'], $name, $password);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
 public function __construct()
 {
     parent::__construct();
     $vars['website_title'] = 'Admin WF3';
     $vars['website_description'] = 'Admin Description';
     $vars['author'] = 'Admin Author';
     $vars['pages'] = self::$pages;
     $vars['menu'] = self::$menu;
     if (!User::isLogged()) {
         $this->response->redirect(ROOT_HTTP . 'login');
     }
     $user = User::get($this->session->user_id);
     //echo 'id: '.$user->id.', level: '.$user->level;
     //echo $this->route;
     //if (!$user->canDo($this->route)) {
     //	exit('Not allowed action');
     //}
     /*
     if $this->route == admin/student/create/
     			user-> 'student_create'
     'student_update'
     'student_delete'
     */
     $this->response->addVars($vars);
 }
 public function __construct()
 {
     parent::__construct();
     $vars = array('HTTP_ROOT' => ROOT_HTTP . $this->lang->getUserLang() . '/', 'CSS_ROOT' => CSS_HTTP, 'JS_ROOT' => JS_HTTP, 'IMG_ROOT' => IMG_HTTP, 'referer' => REFERER, 'uri' => $this->getUri(), 'querystring' => $this->getQueryString(), 'current_page' => $this->route, 'target' => $this->target, 'action' => $this->action, 'params' => $this->getParams(), 'lang' => $this->lang->getUserLang(), 'website_title' => 'Tokyo Tour', 'website_description' => 'Website Description', 'author' => 'Website Author', 'title' => '', 'description' => '');
     $quarters = Quarter::getList('SELECT id, name, type, description FROM quarter ORDER BY name ASC');
     //$pictures = Picture::getList('SELECT id, quarter_id, src, info_id, user_id FROM photo ORDER BY id ASC');
     //$infos = Info::getList('SELECT id, quarter_id, name, type, description, url, rating, theme FROM info ORDER BY id ASC');
     $vars['quarters'] = $quarters;
     //$vars['infos'] = $infos;
     // $vars['pictures'] = $pictures;
     $quarter_pages = array();
     foreach ($quarters as $quarter) {
         $quarter_pages['quarter/' . $quarter->getSlug()] = $quarter->name;
     }
     $vars['pages'] = array('home/index' => Lang::_('Accueil'), 'quarter' => array(Lang::_('Les quartiers'), $quarter_pages), 'quarter/random' => Lang::_('Quartier aléatoire'), 'contact' => Lang::_('Vos suggestions'), 'search' => Lang::_('Recherche avancée'));
     if (User::isLogged()) {
         $vars['user'] = User::get($this->session->user_id);
     }
     $archives_dates = array();
     for ($i = 0; $i < 12; $i++) {
         $time = strtotime('-' . $i . ' month');
         $month_value = date('Y-m', $time);
         $month_label = ucfirst(Lang::_(strtolower(date('F', $time))));
         $year = date('Y', $time);
         $archives_dates[$month_value] = $month_label . ' ' . $year;
     }
     $vars['archives_dates'] = $archives_dates;
     $this->response->addVars($vars);
 }
 public function start()
 {
     if (User::isLogged() == true) {
         Site::Message('Вы уже зарегистрированы в каталоге!');
         $this->Route();
     }
 }
 function dispatch()
 {
     $this->page->setTitle(__('title.login', APP_TITLE));
     $user = new User();
     if ($user->isLogged()) {
         $this->redirect('root');
     }
 }
 function dispatch()
 {
     $user = new User();
     if (!$user->isLogged()) {
         $this->name = 'grouppublic';
     }
     $this->page->setTitle(__('page.groups'));
 }
Example #8
0
 function dispatch()
 {
     $this->page->setTitle(__('page.groups'));
     $user = new User();
     if (!$user->isLogged()) {
         $this->redirect('node', [$this->fetchGet('s'), $this->fetchGet('n')]);
     }
 }
 public function countPM()
 {
     if (!parent::isLogged()) {
         return false;
     }
     $nickname = $this->username[0]->nickname;
     return parent::resultCountQuery("SELECT COUNT(*) FROM {$this->prefix}personalmessage WHERE destinatario='{$nickname}' AND letto='0'");
 }
Example #10
0
 function dispatch()
 {
     $this->page->setTitle(__('page.contacts'));
     $user = new User();
     if (!$user->isLogged()) {
         $this->redirect('blog', [$this->fetchGet('f')]);
     }
 }
Example #11
0
 public function __construct()
 {
     $email = User::isLogged();
     $user = User::getUserByEmail($email);
     if ($user['role'] == 'super_admin' || $user['role'] == 'admin') {
         return true;
     }
     die('Access denied.');
 }
Example #12
0
 public function get_login()
 {
     if (User::isLogged()) {
         //SI YA ESTA LOGUEADO
         return Redirect::to('/');
     } else {
         return View::make('login.login');
     }
 }
Example #13
0
 function checkSession()
 {
     if ($this->session_only) {
         $user = new \User();
         if (!$user->isLogged()) {
             $this->name = 'login';
         }
     }
 }
Example #14
0
 function dispatch()
 {
     $session = \Sessionx::start();
     //requestURL('http://localhost:1560/unregister/', 2, ['sid' => $session->sessionid]);
     $this->page->setTitle(__('page.login'));
     $user = new User();
     if ($user->isLogged()) {
         $this->redirect('root');
     }
 }
 public function main($templateVarList)
 {
     if (!parent::isLogged() || $this->username[0]->grado > 1) {
         // Change this value if you want to change the permissions :)
         $language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
         $rendering = array();
         $rendering['manteinance'] = $language == 'it' ? $this->config[0]->nomesito . ' è in manutenzione.' : $this->config[0]->nomesito . ' is in manteinance.';
         die($rendering['manteinance']);
     }
 }
 protected function checkAdmin()
 {
     $userId = User::isLogged();
     // Проверяем авторизирован ли пользователь
     $user = User::getUserById($userId);
     //Получаем инфу о текущем пользователе по id
     if ($user['is_admin'] == 'admin') {
         //если пользователь админ,у его есть доступ к админ панели
         return true;
     }
     die('У Вас нет прав Администратора');
 }
 public function execute($parameters = [])
 {
     $result = [];
     if (!isset($parameters['action'])) {
         $result = ['Result' => 'ERROR', 'Message' => 'Faltan parámetros'];
         return json_encode($result);
     }
     switch ($parameters['action']) {
         case 'patients_list':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             extract($parameters);
             $jtStartIndex = isset($jtStartIndex) ? $jtStartIndex : 0;
             $jtPageSize = isset($jtPageSize) ? $jtPageSize : 10;
             $jtSorting = isset($jtSorting) ? $jtSorting : 'name ASC';
             $result['Result'] = 'OK';
             $result['Records'] = Patient::getPaginatePatients($jtStartIndex, $jtPageSize, $jtSorting);
             $result['TotalRecordCount'] = Patient::getTotal();
             return $result;
             break;
         case 'patient_create':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             $p = new Patient();
             $result = $p->patient($parameters);
             return $result;
             break;
         case 'patient_update':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             $p = new Patient();
             $result = $p->uPatient($parameters);
             return $result;
             break;
         case 'patient_delete':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             extract($parameters);
             $result = [];
             return $result;
             break;
         default:
             $result = ['Result' => 'ERROR', 'Message' => 'Acción no definida'];
             return json_encode($result);
     }
 }
 public function start()
 {
     if (User::isLogged() == false) {
         Site::Message('Неверная ссылка');
         $this->route();
     } else {
         $this->company = CompanyModel::GetObj()->id(User::company());
         if ($this->company->id == 0) {
             SQL::Query('INSERT INTO `companys` (id) VALUES (null);');
             $this->company->id = SQL::$db->lastInsertId();
             $user = UserModel::GetObj()->id(User::GetID());
             $user->companyid = $this->company->id;
             $user->save();
         }
     }
 }
 public function __construct()
 {
     parent::__construct();
     $vars['website_title'] = 'Backoffice';
     $vars['website_description'] = 'Admin Description';
     $vars['author'] = 'Admin Author';
     $vars['pages'] = array('admin/index/' => array('Dashboard', 'fa-dashboard'), 'admin/quarter/' => array('Quarters', 'fa fa-map-marker'), 'admin/info/' => array('Info', 'fa fa-info-circle'), 'admin/photo/' => array('Picture', 'fa fa-picture-o'), 'admin/user/' => array('Users', 'fa fa-user'), 'admin/comment/' => array('Comment', 'fa fa-paper-plane'), 'admin/contact/' => array('Contact', 'fa fa-envelope'));
     if (!User::isLogged()) {
         $this->response->redirect(ROOT_HTTP . 'login');
     }
     $user = User::get($this->session->user_id);
     if ($user->status === 0) {
         $this->response->redirect(ROOT_HTTP . 'login');
     }
     $this->response->addVars($vars);
 }
Example #20
0
 private function adminWarnings()
 {
     $this->load->library('user');
     $user = new User($this->registry);
     if ($user->isLogged()) {
         if ($this->journal2->is_https) {
             $current_url = parse_url('https://' . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI']);
             $config_url = parse_url(HTTPS_SERVER);
         } else {
             $current_url = parse_url('http://' . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI']);
             $config_url = parse_url(HTTP_SERVER);
         }
         if ($config_url['scheme'] . $config_url['host'] !== $current_url['scheme'] . $current_url['host']) {
             $this->journal2->admin_warnings = 'Store address conflict!';
         }
     }
 }
Example #21
0
 function dispatch()
 {
     $this->page->setTitle(__('page.news'));
     $user = new User();
     if (!$user->isLogged()) {
         $pd = new \Modl\PostnDAO();
         $p = $pd->get($this->fetchGet('s'), $this->fetchGet('n'), $this->fetchGet('i'));
         if ($p) {
             if ($p->isMicroblog()) {
                 $this->redirect('blog', [$p->origin, $p->nodeid]);
             } else {
                 $this->redirect('node', [$p->origin, $p->node, $p->nodeid]);
             }
         } else {
             $this->redirect('login');
         }
     }
 }
 public function __construct()
 {
     parent::__construct();
     $vars = array('HTTP_ROOT' => ROOT_HTTP . $this->lang->getUserLang() . '/', 'CSS_ROOT' => CSS_HTTP, 'JS_ROOT' => JS_HTTP, 'IMG_ROOT' => IMG_HTTP, 'referer' => REFERER, 'uri' => $this->getUri(), 'querystring' => $this->getQueryString(), 'current_page' => $this->route, 'target' => $this->target, 'action' => $this->action, 'request' => $this->request, 'lang' => $this->lang->getUserLang(), 'website_title' => 'Presence V 1.0', 'website_description' => 'Site Web Intranet de Présence avec Admin', 'author' => 'Eric Madjarian', 'title' => 'Presence V 1.0', 'description' => 'Site Web Intranet de Présence avec Admin');
     $vars['pages'] = self::$pages;
     $this->user = new User();
     if (User::isLogged()) {
         $this->user = User::get($this->session->user_id);
     }
     $vars['user'] = $this->user;
     $archives_dates = array();
     for ($i = 0; $i < 12; $i++) {
         $time = strtotime('-' . $i . ' month');
         $month_value = date('Y-m', $time);
         $month_label = ucfirst(Lang::_(strtolower(date('F', $time))));
         $year = date('Y', $time);
         $archives_dates[$month_value] = $month_label . ' ' . $year;
     }
     $vars['archives_dates'] = $archives_dates;
     $this->response->addVars($vars);
 }
 public function setpasswordAction()
 {
     $pass1 = Request::post('pass1', '', 'safe');
     $pass2 = Request::post('pass2', '', 'safe');
     if (User::isLogged()) {
         if ($pass1 != $pass2) {
             Site::Message('Введенные пароли не совпадают');
             $this->Render('setpass');
         } elseif (strlen($pass1) < 6) {
             Site::Message('Введенный новый пароль, короче шести символов');
             $this->Render('setpass');
         } else {
             UserModel::SetPassword(User::GetID(), $pass1);
             Site::Message('Пароль успешно изменен');
             $this->Route();
         }
     } else {
         Site::Message('Неверная ссылка');
         $this->Route();
     }
 }
 public function insert()
 {
     if (!User::isLogged()) {
         $this->response->redirect(ROOT_HTTP . 'login');
     }
     $isPost = $this->request->isPost();
     $quarter_id = $this->request->post('quarter_id', null);
     $info_id = $this->request->post('info_id', null);
     $comment = new Comment();
     $comment->user_id = $this->session->user_id;
     $errors = array();
     $success = false;
     if ($isPost) {
         if (empty($quarter_id) && empty($info_id)) {
             throw new Exception('Undefined quarter/info');
         }
         foreach ($this->request->post as $key => $value) {
             try {
                 if (property_exists($comment, $key)) {
                     $comment->{$key} = $this->request->post($key, '');
                 }
             } catch (Exception $e) {
                 $errors[$key] = $e->getMessage();
             }
         }
         if (empty($errors)) {
             $success = $comment->insert();
             if ($success) {
                 $this->response->redirect(REFERER);
             }
         }
     }
     //$form = $comment->getCommentForm('insert', ROOT_HTTP.$this->lang->getUserLang().'/comment/post', $this->request, $isPost, $errors);
     //$vars['form'] = $form;
     $vars['isPost'] = $isPost;
     $vars['errors'] = $errors;
     $vars['success'] = $success;
     $this->render('partials/comment', $vars);
 }
Example #25
0
 public function IndexAction()
 {
     if (User::isLogged()) {
         Site::Message('Вы уже вошли в систему');
         $this->Route();
     } elseif (Request::isPosted('loguser')) {
         User::LoginByPass(Request::post('loguser', '', 'mail'), Request::post('logpass', '', 'safe'));
         if (!User::isLogged()) {
             Site::Error('Неверный логин или пароль');
             $this->Render();
         } else {
             Site::Message('Вы успешно вошли в систему');
             if (!User::admin()) {
                 $this->Route('profile');
             } else {
                 $this->Route();
             }
         }
     } else {
         $this->Render();
     }
 }
 /**
  * @return bool
  * Метод для редактирования данных пользователя(самим пользователем)
  */
 public function actionEdit()
 {
     $userId = User::isLogged();
     //получаем id из сессии
     $user = User::getUserById($userId);
     //получаем инфу по id
     $name = $user['name'];
     $password = $user['password'];
     $res = false;
     $fail = false;
     if (isset($_POST['submit'])) {
         $name = $_POST['name'];
         $password = $_POST['password'];
         if (!User::isValidNamePassword($name, $password)) {
             $fail = 'Имя не должно быть пустым/Пароль больше 5 символов';
         }
         if ($fail == false) {
             $res = User::edit($userId, $name, md5($password));
             //Сохраняем изменения в БД
         }
     }
     $args = array('res' => $res, 'errors' => $fail, 'name' => $name, 'password' => $password);
     return self::render('edit', $args);
 }
Example #27
0
        ?>
            <li><a href="login.php">Login</a></li>
            <li><a href="register.php">Registrati</a></li>            
          <?php 
    } else {
        ?>
            <li><a href="logout.php">Logout</a></li>            
          <?php 
    }
    ?>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>
    <?php 
    if (User::isLogged()) {
        ?>
<div class="alert alert-success " style="text-align:right;" role="alert">Benvenuto/a <?php 
        echo User::loggedName();
        ?>
</div>
    <?php 
    }
    /*
        ?>
        Session:<?php
        var_dump($_SESSION);
        ?>
        <br/>
        Request:<?php
        var_dump($_REQUEST);
<?php

include './Authentication.php';
//$_SESSION['loggedin'] = 'gustavo';
//unset($_SESSION['loggedin']);
//$_COOKIE['Loggedin'] = 'gustavo';
//unset($_COOKIE['Loggedin']);
$user = new User();
if ($user->isLogged()) {
    header("Location: http://www.google.com");
    exit;
}
Example #29
0
<div id="admin-container">
<?php 
if (User::isLogged() and User::isAdmin()) {
    ?>
		<div class="title-container">
			<h1>Admin Panel</h1>
		</div>

		<div id="report-panel" class="panel">
			<div class="title-container">
				<img class="title-icon" src="src/img/default/report_icon.png"/><h2>Reports Panel</h2>
			</div>
			<div class="result-container">
				<?php 
    echo Engine::getReports()['reply'];
    ?>
			</div>
		</div>

		<div id="users-infos-panel" class="panel">
			<div class="title-container">
				<img class="title-icon" src="src/img/default/report_icon.png"/><h2>Users Infos Panel</h2>
			</div>
			<div class="result-container">
				<?php 
    echo Engine::getUserInfos()['reply'];
    ?>
			</div>
		</div>
<?php 
} else {
Example #30
0
 public static function sendUserMessage($toPlayerId, $messageContent)
 {
     if (User::isLogged()) {
         $newStaticBdd = new BDD();
         if (!empty($toPlayerId) and !empty($messageContent)) {
             $fromPlayerId = self::getId();
             $toPlayerId = $toPlayerId;
             $messageContent = $newStaticBdd->real_escape_string(htmlspecialchars($messageContent));
             $userInfos = $newStaticBdd->select("userlink", "users", "WHERE id LIKE '" . $toPlayerId . "'");
             $getUserInfos = $newStaticBdd->num_rows($userInfos);
             if ($getUserInfos == 1) {
                 $newStaticBdd->insert("messages_user", "from_player, to_player, message_content, time", "'" . $fromPlayerId . "', '" . $toPlayerId . "', '" . $messageContent . "', '" . time() . "'");
                 $dataArray['result'] = true;
                 $dataArray['error'] = null;
                 $dataArray['reply'] = "Your message has been successfully send !";
             } else {
                 $dataArray['result'] = false;
                 $dataArray['error'] = "Sorry, the player was not found ...";
                 $dataArray['reply'] = null;
             }
         } else {
             $dataArray['result'] = false;
             $dataArray['error'] = "Your message is empty !";
             $dataArray['reply'] = null;
         }
     }
     return $dataArray;
 }