function withFB() { if (Auth::isLogged()) { die('Hacking Attempt'); } Mold::theme("Register/register_with_fb"); }
function process_login() { $username = addslashes($_POST["admin_email"]); $password = addslashes($_POST["admin_password"]); $rememberme = isset($_POST["rememberme"]) ? 1 : 0; if ($password == "") { $password = "******"; } $row = array("admin_email" => $username, "admin_password" => $password, "rememberme" => $rememberme); /*if ($this->ldapLogin($username, $password)) { $row["admin_ldap"] = 1; }*/ //login pakai row credential Auth::login($row); //kalau sukses if (Auth::isLogged()) { //load school setting // $ss = new Schoolsetting(); // $ss->loadToSession(); //redirect //Account::setRedirection (); Hook::processHook($this->login_hook); Redirect::firstPage(); } else { Redirect::loginFailed(); } }
/** @Auth("*") */ public function login() { if (Auth::isLogged()) { $this->_redirect('~/unidade'); } if (is_post) { $form = $this->_data(); $usuario = Usuario::logar($form->oab, $form->senha); if ($usuario) { if ($usuario->Bloqueado == 1) { $this->_flash('alert alert-error fade in', 'Login ou Senha incorreta!'); //Usuário bloqueado! } else { Auth::set($usuario->EhAdmin == 1 ? "admin" : "usuario"); Session::set('usuario', $usuario); $url = '~/ci/rascunho'; if (isset($_GET['forwarded']) && $_GET['forwarded'] != '') { $url = '~/' . $_GET['forwarded']; } $this->_redirect($url); } } else { $this->_flash('alert alert-error fade in', 'Login ou Senha incorreta!'); } } return $this->_view(); }
public static function check() { if (!Auth::isLogged()) { return False; } return Auth::getUser()["abonement"] == 1; }
public static function indexCheckRemember() { if (!Auth::isLogged()) { $row = self::checkRemember(); if (count($row) > 0) { self::login($row); } } }
public function access() { if (!Auth::isLogged()) { $this->redirect("/login"); } if (!Auth::isAdmin()) { Error::httpError(403); } }
public function logout() { global $_TB_IDENTITY; if (Auth::isLogged(App::$instance)) { setcookie(md5("logged" . $_TB_IDENTITY[App::$instance->user->origin]['serviceName']), false, time() - 3600, '/', Null, 0); } else { App::$instance->MQ->setMessage('Вы не авторизированы'); } ST::redirectToRoute("Index/index"); }
public function CheckRequestedRoute($controller, $action) { $routes = App::$instance->routes; $result = new stdClass(); $result->controller = false; $result->action = false; $result->method = false; $result->access = false; $result->ajax = false; foreach ($routes as $route) { //is ajax? if (ST::isAjaxRequest() && $route->ajax) { $result->ajax = true; } // dump($result); //check requested controller if ($route->controller === $controller) { $result->controller = True; //check requested action foreach ($route->action as $founded_action) { // dump($founded_action); if ($founded_action === '*' || $founded_action === $action) { $result->action = True; //check requested method foreach ($route->methods as $founded_method) { if ($founded_method === '*' || $founded_method === strtolower($_SERVER['REQUEST_METHOD'])) { $result->method = True; //check requested access foreach ($route->access as $founded_access) { if ($founded_access === '*') { $result->access = True; break; } if (Auth::isLogged(App::$instance) && $founded_access === '@') { $result->access = True; break; } if (Auth::isLogged(App::$instance)) { if ($founded_access === App::$instance->user->role) { $result->access = True; //check requested access } } } } } // break; } } // break; } } // dump($result); return $result; }
public function actionActivate() { if (!Auth::isLogged()) { $this->redirect("/"); } $message = false; if (isset($_POST['code'])) { $model = CodeModel::model()->where("`code`='" . $_POST['code'] . "'")->findRow(); if (!$model) { $message = "Данный код не найден."; } else { Abonement::addMonths($model->months); $model->delete(); $message = "Код успешно активирован."; } } $this->view("abonem/activate", array("message" => $message), false); }
function login() { $username = addslashes($_POST["admin_username"]); $password = addslashes($_POST["admin_password"]); $rememberme = isset($_POST["rememberme"]) ? 1 : 0; $row = array("admin_username" => $username, "admin_password" => $password, "rememberme" => $rememberme); //login pakai row credential Auth::login($row); //kalau sukses if (Auth::isLogged()) { //load school setting $ss = new Schoolsetting(); $ss->loadToSession(); //redirect Account::setRedirection(); } else { Redirect::loginFailed(); } }
public function actionActivate() { if (!Auth::isLogged()) { $this->redirect("/"); } $message = false; if (isset($_POST['code'])) { $model = CodeModel::model()->where("`code`='" . $_POST['code'] . "' and count>0")->findRow(); if (!$model) { $message = "Данный код не найден."; } else { Abonement::addMonths($model); //$model->delete(); $model->count = $model->count - 1; $model->user_id = Auth::getUser()['id']; $model->user_login = Auth::getUser()['login']; $model->update(); $message = "Код успешно активирован."; } } $this->view("abonem/activate", array("message" => $message), false); }
public function pull() { if (!Auth::isLogged(App::$instance)) { die(json_encode([])); } // not auth //set time barrier if (!$this->isCanBePulled()) { die(json_encode([])); } // not time come $startThere = date_create()->modify("-120 seconds"); $readed = $this->sesRead(); //define last access time $this->putLastRequestTime(); //get notices $notifications = Notification::where("created_at", ">", $startThere)->where("created_at", "<", date_create())->whereNotIn("id", $readed['filtered'])->whereIn("to", [0, App::$instance->user->id])->take(5)->get(); //humanize if (count($notifications)) { foreach ($notifications as $notice) { $notice->humanized = new stdClass(); $notice->humanized->created_at = date_create($notice->created_at)->format("d.m.Y H:i:s"); } } //mark as collected if (count($notifications)) { foreach ($notifications as $notice) { $readed['raw'][] = [$notice->id, date_create()->format("Y-m-d H:i:s")]; } $this->sesWrite($readed['raw']); } if (ST::isAjaxRequest()) { print json_encode($notifications); } else { return $notifications; } }
public function login() { if (empty($_POST['log'])) { if (Auth::isLogged()) { header('location: ' . URL . CONTEXT_PATH_ADMIN); } else { $this->view->renderAdmin(RENDER_VIEW_USER_LOGIN, TRUE); } } else { //Thực hiện đăng nhập // run the login() method in the login-model, put the result in $login_successful (true or false) Model::autoloadModel('User'); $model = new UserModel($this->db); if ($model->loginValidate()) { if ($model->login($_POST['log'])) { header('location: ' . URL . CONTEXT_PATH_ADMIN); } else { $this->view->renderAdmin(RENDER_VIEW_USER_LOGIN, TRUE); } } else { $this->view->renderAdmin(RENDER_VIEW_USER_LOGIN, TRUE); } } }
<?php session_start(); require "../../../auth.php"; if (Auth::isLogged()) { } else { header('Location:forms/404.php'); } include '../../functions.php'; global $db; $today = date("Y-m-d"); $myadmin = $_SESSION['auth']['myadmin']; $myid = $_SESSION['auth']['myid']; if ($myadmin == 1) { $sql = "SELECT id, nom_usage FROM collaborateurs ORDER BY nom_usage "; } else { $sql = "SELECT id, nom_usage FROM collaborateurs Where ((collaborateurs.debauche > '{$today}') OR (collaborateurs.debauche IS NULL)) ORDER BY nom_usage "; } $sth = $db->query($sql); $list_collab = $sth->fetchall(); $sql = "SELECT DISTINCT clients.id as id_cli, clients.nom, (SELECT colors.ref\n FROM colors INNER JOIN (collaborateurs INNER JOIN (clients INNER JOIN color_client_collab ON clients.id = color_client_collab.id_client) ON collaborateurs.id = color_client_collab.id_collab) ON colors.id = color_client_collab.id_color\n WHERE (((clients.id)=id_cli) AND ((collaborateurs.id)={$myid}))) FROM (clients INNER JOIN contrats ON clients.id = contrats.id_client) INNER JOIN (collaborateurs INNER JOIN affect_cont_collab ON collaborateurs.id = affect_cont_collab.id_collab) ON contrats.id = affect_cont_collab.id_contrat WHERE (((collaborateurs.id)={$myid}))"; $stcli = $db->query($sql); $list_cli = $stcli->fetchall(); $sql = "SELECT date_format(heures.heures, '%H:%i') FROM heures"; $sth = $db->query($sql); $list_h = $sth->fetchall(); ?> <link rel="stylesheet" type="text/css" href="./src/css/app-new.css"> <link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- <link href="./font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> -->
$data["question"] = new stdClass(); $data["question"]->question_content = ""; $data["question"]->question_hint = ""; $data["question"]->question_type = "checkbox"; $data["question"]->question_weight = "1"; $data["question"]->question_weight = "1"; $data["choices"] = array(); $data["choices"][0] = new stdClass(); $data["choices"][0]->choice_status = 0; $data["choices"][0]->question_type = "checkbox"; $data["choices"][0]->choice_content = ""; $data["choices"][0]->choice_id = -1; } } } else { if ($auth->isLogged() && Validation::Query($_GET, array("id")) && is_numeric($_GET["id"])) { $question_result = $_MYSQLI->query('SELECT * FROM question INNER JOIN questionnaire ON questionnaire_id = question_questionnaire_id WHERE question_id = ' . $_GET["id"]); if ($question_result->num_rows > 0) { $error = false; $data["question"] = $question_result->fetch_object(); $own = $data["question"]->questionnaire_user_id == Auth::getUserId(); $choice_query = ' SELECT *, SUM(case when answer_student_user_id = ' . Auth::getUserId() . ' then 1 else 0 end) as checked FROM question q JOIN choice c ON c.choice_question_id = q.question_id LEFT JOIN answer a ON a.answer_choice_id = c.choice_id WHERE question_id = ' . $_GET["id"] . ' GROUP BY choice_id ORDER BY question_num ASC, question_id ASC'; $choice_result = $_MYSQLI->query($choice_query); $choice_ids = array(); $data["choices"] = array();
<?php ST::deployTemplate('heads/ui_timepicker.inc'); RenderEngine::MenuChanger(); ?> <div class="container"> <div class="col-md-12 text-center"> <br><br><br><br> <h1 class="text-muted">Ошибка</h1> <span class="text-muted" style="font-size: 160px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">401</span> <h1 class="text-muted">Недостаточно прав для доступа</h1> <hr> <h4 class="text-center"><?php echo !Auth::isLogged(App::$instance) ? "<a href='" . ST::routeToCa('AuthNew/login') . "'>Войти в систему</a> " : ''; ?> </h4> </div> </div>
public function process_login_fb() { $email = $_SESSION['sementara']['admin_email']; $fbid = $_SESSION['sementara']['admin_fb_id']; if ($fbid == "" || $email == "") { Redirect::loginFailed(); } $arr = $this->getWhere("admin_email = '{$email}' AND admin_fb_id='{$fbid}' AND admin_aktiv = 1 "); if (count($arr) > 0) { //load by login ID $obj = $arr[0]; $row = toRow($obj); $this->fill($row); if (isset($this->admin_id)) { $_SESSION["admin_session"] = 1; $_SESSION["account"] = $obj; //Update setlastlogin self::setLastUpdate($_SESSION["account"]->admin_id); //lanjut //loading metadata $meta = new AccountMeta(); $meta->getMeta($this->admin_id); //now loading roles $this->loadRole(); //set cookie Auth::setCookie($this->rememberme, $this->admin_id, $this->admin_email, $this->admin_password); //kalau sukses if (Auth::isLogged()) { //load school setting // $ss = new Schoolsetting(); // $ss->loadToSession(); //redirect //Account::setRedirection (); $acl = new AccountLogin(); Hook::processHook($acl->login_hook); //login hook doesnt seem to work =>bypass $qp = new QuizPoints(); $qp->getPoints(); $qp->saveUnsaved(); Redirect::firstPage(); } else { Redirect::loginFailed(); } } else { return 0; } } }
public static function submit_ul() { if ($_POST['judul_ulangan'] == "" || $_POST['ulangan_file'] == "" || $_POST['deskripsi_ulangan'] == "" || !Auth::isLogged()) { die('no id'); } $ul = new QuizUlangan(); if ($_GET['ups']) { if (!isset($_POST['ul_id'])) { die('no id'); } else { $ul->getByID(addslashes($_POST['ul_id'])); if ($ul->ulangan_creator_id != Account::getMyID()) { die('not allowed'); } $ul->load = 1; } } $json['bool'] = 0; $ul->ulangan_level_id = 0; $ul->ulangan_aktif = 0; $ul->ulangan_name = addslashes($_POST['judul_ulangan']); $ul->ulangan_image = addslashes($_POST['ulangan_file']); $ul->ulangan_descr = addslashes($_POST['deskripsi_ulangan']); $ul->ulangan_fb_image = addslashes($_POST['ulangan_file']); $ul->ulangan_creator_id = Account::getMyID(); $ul->ulangan_jumlah_soal = 10; $scc = $ul->save(); if ($scc) { $json['bool'] = 1; $json['ul_id'] = $scc; } echo json_encode($json); exit; }
<?php session_start(); require_once '../common/var.conf.php'; require_once DOCUMENT_ROOT . '/common/utils.php'; require_once DOCUMENT_ROOT . '/class/Smarty_HEHLan.class.php'; require_once DOCUMENT_ROOT . '/class/Database.class.php'; require_once DOCUMENT_ROOT . '/class/Auth.class.php'; require_once DOCUMENT_ROOT . '/class/Query.class.php'; $connected = false; $allowed = false; $chatIsActive = false; $database = new Database(); $smarty = new Smarty_HEHLan(); $connected = Auth::isLogged(); $allowed = Auth::isAllowed(3); if (!$connected && !$allowed) { header('Location: ../index.php'); } $sql = 'SELECT * FROM downloads ORDER BY published_date DESC'; $query = new Query($database, $sql); $query->execute(); $downloads = $query->getResult(); // send to the template $smarty->assign('con', $connected); $smarty->assign('downloads', $downloads); $smarty->display(DOCUMENT_ROOT . '/view/templates/admin/downloads.tpl');
public static function printB3l1Deal($lgcp) { $hrg_dipakai = $lgcp->camp_paket_hemat_price; if ($lgcp->camp_type == 2) { //bulk only $hrg_dipakai = $lgcp->camp_satuan_price; } //ganti angka dengan XXX if (!Auth::isLogged()) { $hrg_dipakai = self::convertXXX($hrg_dipakai); $lgcp->camp_satuan_price = self::convertXXX($lgcp->camp_satuan_price); $lgcp->camp_bulk_qty = "X"; } ?> <div class="deal_beli"> <div class="col-md-6"> <div class="camp_image" > <a href="<?php echo _SPPATH; ?> cw/campaign/<?php echo $lgcp->camp_id; ?> /<?php echo urlencode($lgcp->camp_name); ?> /1"> <img src="<?php echo _SPPATH . _PHOTOURL; echo $lgcp->camp_foto_panjang; ?> " width="100%"> </a> </div> </div> <div class="col-md-6"> <div class="campaign_text"> <div style="float:right; width: 95px; text-align: center; padding: 5px;"> <button style="width: 100%;" onclick="document.location='<?php echo _SPPATH; ?> cw/campaign/<?php echo $lgcp->camp_id; ?> /<?php echo urlencode($lgcp->camp_name); ?> /1';" class="btn btn-default"><?php echo Lang::t('VIEW'); ?> </button> </div> <h2 class="ct"> <a href="<?php echo _SPPATH; ?> cw/campaign/<?php echo $lgcp->camp_id; ?> /<?php echo urlencode($lgcp->camp_name); ?> /1"> <?php echo stripslashes($lgcp->camp_name); ?> </a> </h2> <!-- <div class="descr"> <?php echo stripslashes($lgcp->camp_descr); ?> </div>--> <div class="rupiah storeprice">Store Price : <span style="text-decoration: line-through;" class="coret">Rp.<?php echo rupiah($lgcp->camp_ori_price); ?> </span></div> <!--<div class="rupiah pahe satuan">Harga Satuan : Rp.<?php echo rupiah($lgcp->camp_satuan_price); ?> </div>--> <div class="rupiah pahe"> Rp.<?php echo rupiah($hrg_dipakai); ?> <?php if ($lgcp->camp_type < 2) { ?> <span style="cursor:pointer; font-size: 13px; color:blue; text-decoration: underline;" onclick="$('#camp_<?php echo $lgcp->camp_id; ?> ').toggle();" >?</span> <div id="camp_<?php echo $lgcp->camp_id; ?> " style="display:none; background-color: #dedede; font-size: 13px; padding: 10px; margin: 5px;"> Beli <?php echo $lgcp->camp_bulk_qty; ?> dan kelipatannya untuk mendapatkan harga lebih murah dari toko... </div> <?php } ?> </div> <?php if (!Auth::isLogged()) { ?> <div style="margin-top: 20px;"> <div style="text-decoration: underline; color:#d2322d;cursor: pointer;" onclick="document.location='<?php echo _SPPATH; ?> register';" ><?php echo Lang::t('LOGIN UNTUK DAPAT MELIHAT HARGA'); ?> </div> </div> <?php } ?> </div> </div> <div class="clearfix"></div> </div> <?php }
<?php ST::deployTemplate('heads/ui_timepicker.inc'); RenderEngine::MenuChanger(); if (!Auth::isLogged(App::$instance)) { App::$instance->MQ->setMessage('Создавать заявки могут только зарегистрированные пользователи, пожалуйста, войдите в систему или зарегистрируйтесь'); ST::redirectToRoute('AuthNew/login'); } ?> <div class="container"> <div class="col-md-12"> <h3 class="text-muted heading-main">ВКС в нашем Планировщике созданные на основе ВКС ЦА <?php echo ST::linkToCaVksPage($caVksId, true); ?> </h3> <hr> <?php if (count($vkses)) { ?> <table class="table table-striped table-hover"> <th class="col-lg-1">id</th><th class="col-lg-2">Тема</th><th class="col-lg-2">Заказчик</th><th class="col-lg-5">Участники</th><th class="col-lg-2">Создана</th> <th>Статус</th> <?php foreach ($vkses as $vks) { ?> <tr> <td><?php echo ST::linkToVksPage($vks->id, true); ?> </td>
function loginpage() { if (Auth::isLogged()) { header("Location:" . _SPPATH . "mydashboard"); exit; } // pr($_COOKIE); // pr($_SESSION); ?> <style> @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } .loginbox{ margin-top: 50px; } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } .loginbox{ margin-top: 80px; } } </style> <div class="container attop" > <div class="col-md-4 col-md-offset-4 loginbox " style="text-align: center; "> <div style="padding: 20px; padding-bottom: 0px;"> <img class="animated zoomIn" src="<?php echo _SPPATH; ?> images/appear-text.png" style="max-width: 80%;"> </div> <div class="berpadding"> <?php $acc = new AccountLogin(); $acc->loginForm(); ?> <style> .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] { margin-left: 0px; display: none; } .checkboxspan{ margin-left: 20px; display: none; } .btn-primary { color: #fff; background-color: #008247; border-color: #008247; } .btn-primary:hover,.btn-primary:focus{ background-color: #00a157; border-color: #00a157; } a{ color: #005c32; text-decoration: underline; } a:hover{ color: #008d4c; } </style> <div style="margin-top: 10px; text-align: right;color: #005c32;"> <!-- <a class="btn btn-default" href="--><?php //=_SPPATH; ?> <!--forgotpassword">forgot password</a>--> <a href="<?php echo _SPPATH; ?> register">register</a> <i class="glyphicon glyphicon-option-vertical"></i> <a href="<?php echo _SPPATH; ?> enquiry">learn more</a> <i class="glyphicon glyphicon-option-vertical"></i> <a href="<?php echo _SPPATH; ?> forgotpassword">forgot password</a> </div> <!-- <h1 class="hype" style="margin-bottom: 30px;">OR</h1>--> <!-- <a class="btn btn-lg btn-success btn-block" href="--><?php //=_SPPATH; ?> <!--register">Register</a>--> <!-- --> </div> </div> <div class="clearfix" ></div> <!-- <div style="text-align: center; padding-top: 30px;">--> <!-- Copyright © PT. Indo Mega Byte--> <!-- </div>--> </div> <?php }
function printTreeRecursive($startNode, $anak2) { if (count($anak2[$startNode]) > 0) { ?> <ul <?php if ($startNode === 0) { ?> class="nav navbar-nav navbar-right"<?php } else { ?> class="dropdown-menu"<?php } ?> > <?php foreach ($anak2[$startNode] as $n => $o) { //drop down if (count($anak2[$o->menu_id]) > 0) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <?php echo $o->menu_name; ?> <span class="caret"></span></a> <?php $this->printTreeRecursive($o->menu_id, $anak2); ?> </li> <?php } else { if ($o->menu_submenu_titletext != "" && $o->menu_submenu_titletext != $this->active_submenu_title) { $this->active_submenu_title = $o->menu_submenu_titletext; ?> <li role="separator" class="divider"></li> <li class="dropdown-header"><?php echo Lang::t($o->menu_submenu_titletext); ?> </li> <?php } if (strpos($URL, "http://")) { $URL = $o->menu_link; } else { $URL = _LANGPATH . $o->menu_link; } ?> <li> <a href="<?php echo $URL; ?> "><?php echo $o->menu_name; ?> </a></li> <?php } } ?> <?php if ($startNode === 0) { ?> <li> <div style="padding-top: 7px;"> <?php Lang::picker(); ?> </div> </li> <?php if (Auth::isLogged() && Role::hasRole('admin')) { ?> <li> <?php global $backEndClass; ?> <a href="<?php echo _LANGPATH . $backEndClass; ?> /home">BE</a> </li> <?php } } ?> </ul> <?php } }
function productPrinter($prod, $cp) { //pr($prod); $src = Pwa::getMainPic($prod); //elseif($nr == 1)$mainpic = $exp[0]; if ($prod->prod_diskon > 0) { $hrgbaru = ceil((100 - $prod->prod_diskon) / 100 * $prod->prod_price); } else { $hrgbaru = $prod->prod_price; } //cek apakah stok ada if ($prod->prod_stock > 0) { $adastock = 1; } else { $adastock = 0; } //cek apakah stok ada if ($prod->prod_stock > 0 && $prod->prod_stock <= Efiwebsetting::getData('stock_limit')) { $limited_stock = 1; } else { $limited_stock = 0; } ?> <style> .product_dalaman{ margin: 5px; background-color: #e6e6e6; } .prod_price{ font-weight: bold; font-style: italic; padding-bottom: 20px; } .prod_button{ padding-bottom: 10px; } .product_name a{ font-size: 17px; color: #323232; font-weight: bold; } .coret{ text-decoration: line-through; } .pcon{ padding: 5px; } .product_name{ padding-bottom: 10px; } </style> <div class="product col-md-3 col-sm-12 col-xs-12"> <div class="product_dalaman"> <?php if (!$adastock) { ?> <div style="position: absolute;z-index: 1; font-weight: bold; font-size: 3vmin; padding: 10px; color:white; background-color: #888;"> OUT OF STOCK </div> <?php } ?> <?php if ($limited_stock) { ?> <div style="position: absolute;z-index: 1; font-weight: bold; font-size: 3vmin; padding: 10px; color:white; background-color: red;"> LIMITED STOCK </div> <?php } ?> <div class="product_pic"> <?php if ($prod->prod_diskon > 0) { ?> <div style="color:white;position: absolute; z-index: 1; width: 80px; height: 80px; background-color: rgba(180,2,2,0.8); border-radius: 0px; border-bottom-right-radius: 10px;"> <div style="float: right; width: 20px; height: 20px; margin-right: 0px; margin-top: 30px;">%</div> <div style="font-size: 45px; margin-left: 10px; margin-top: 5px; position: absolute; text-align: center;"><?php echo $prod->prod_diskon; ?> </div> <div style="margin-top: 55px; margin-left: 28px;" >off</div> </div> <?php } ?> <a href="<?php echo _SPPATH; ?> pwa/p/<?php echo $prod->prod_id; ?> /<?php echo urlencode($prod->prod_name); ?> "> <img width="100%" src="<?php echo $src["thumbs"]; ?> " alt="<?php echo $prod->prod_name; ?> "> </a> </div> <div class="pcon"> <div class="product_name"> <a href="<?php echo _SPPATH; ?> pwa/p/<?php echo $prod->prod_id; ?> /<?php echo urlencode(str_replace("/", " or ", $prod->prod_name)); ?> "> <?php echo $prod->prod_name; ?> </a> </div> <!--div class="prod_descr"> <div class="prod_price"> Harga Toko <br> Rp. <span class="coret"><?php echo rupiah($prod->prod_price); ?> </span> </div> <div class="prod_price"> Harga Satuan <br> Rp. <span class="big"><?php echo rupiah($prod->prod_satuan_price); ?> </span> </div> <div class="prod_price"> Harga Hemat <br> Rp. <span class="bigger"><?php echo rupiah($prod->prod_bulk_price); ?> </span> </div> </div>--> <div class="prod_button btn-group" role="group"> <?php if (Auth::isLogged()) { if ($adastock) { ?> <?php if ($cp->camp_type < 2) { ?> <button onclick="addPahe('<?php echo $prod->prod_id; ?> ','<?php echo $prod->prod_name; ?> ','<?php echo $src["thumbs"]; ?> ');" class="btn btn-danger"><i class="glyphicon glyphicon-shopping-cart"></i> <?php echo Lang::t('Hemat'); ?> </button> <?php } ?> <?php if ($cp->camp_type == 2 || $cp->camp_type == 0) { ?> <button onclick="document.location='<?php echo _SPPATH; ?> addOrder?pid=<?php echo $prod->prod_id; ?> ';" class="btn btn-danger"><i class="glyphicon glyphicon-shopping-cart"></i> <?php echo Lang::t('Satuan'); ?> </button> <?php } ?> <?php } } ?> <button onclick="document.location='<?php echo _SPPATH; ?> pwa/p/<?php echo $prod->prod_id; ?> /<?php echo urlencode($prod->prod_name); ?> ';" class="btn btn-default"><?php echo Lang::t('View'); ?> </button> </div> <div id="pahe_meldung_<?php echo $prod->prod_id; ?> " class="pahemeldung" style="display: none;">Keranjang Harga Hemat diupdate</div> </div> </div> </div> <?php }
public static function printMenuMobile() { ?> <style> .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus{ color:#fff; } .navbar-default .navbar-nav .open .dropdown-menu > li > a{ color:#fff; } </style> <?php $menu = self::$menus; //pr($menu); $menu2 = array_reverse($menu); foreach ($menu as $text => $m) { if ($m != "tools") { ?> <li> <a href="<?php echo _SPPATH . $m; ?> "><?php echo $text; ?> </a> </li> <?php } else { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo $text; ?> <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="<?php echo _SPPATH; ?> tools?mode=email">TBS Email</a></li> <li><a href="<?php echo _SPPATH; ?> tools?mode=wikipedia">TBS Wikipedia</a></li> <li><a href="<?php echo _SPPATH; ?> km">TBS Knowledge</a></li> <li><a href="<?php echo _SPPATH; ?> webapps">TBS Apps</a></li> </ul> </li> <?php } ?> <?php } if (Auth::isLogged()) { ?> <hr> <?php /* <li> <a class="admin-button-mobile" href="<?= _SPPATH; ?>order"><?= Lang::t('cart'); ?></a> </li> <li> <a class="admin-button-mobile" href="<?= _SPPATH; ?>myorder"><?= Lang::t('order history'); ?></a> </li>*/ ?> <li> <a class="admin-button-mobile" href="<?php echo _SPPATH; ?> p/user/<?php echo Account::getMyID(); ?> "><?php echo Lang::t('profil'); ?> </a> </li> <li> <a class="admin-button-mobile" href="<?php echo _SPPATH; ?> logout"><?php echo Lang::t('keluar'); ?> </a> </li> <?php } else { ?> <hr> <li> <a class="admin-button-mobile" href="<?php echo _SPPATH; ?> register"><?php echo Lang::t('masuk'); ?> </a> </li> <?php } //echo Role::hasRole("admin"); if (Role::hasRole("admin")) { ?> <hr> <li> <a class="admin-button-mobile" href="<?php echo _SPPATH; ?> EfiHome/home"><?php echo Lang::t('Admin'); ?> </a> </li> <?php } }
return $response->withRedirect('/login'); } })->setName('login'); // Player profile $app->get('/player/{id}', function ($request, $response, $args) { if (!Auth::isLogged()) { return $response->withRedirect('/login'); } else { require_once '../private/classes/Player.class.php'; $datas = new Player(); $datas = $datas->getInfos($args['id']); //echo json_encode($datas); //exit; return $this->view->render($response, 'player.html', ['head_title' => "Player profil", 'p_id' => $datas['other'][0]['playerid'], 'p_uid' => $datas['other'][0]['uid'], 'p_name' => $datas['other'][0]['name'], 'p_aliases' => $datas['aliases'], 'p_licenses' => $datas['licenses'], 'p_vehicles' => $datas['vehicles'], 'datas' => $datas['other']]); } })->setArgument('id', null); // Search $app->map(['GET', 'POST'], '/search[/{searchquery}]', function ($request, $response, $args) { if (!Auth::isLogged()) { return $response->withRedirect('/login'); } else { if ($request->isPost()) { // Post to get return $response->withRedirect('/search/' . $_POST['searchquery']); } require_once '../private/classes/Player.class.php'; $datas = new Player(); $datas = $datas->getSearch($args['searchquery']); return $this->view->render($response, 'search.html', ['head_title' => "Search results", 'query' => mb_strimwidth($args['searchquery'], 0, 45, "..."), 'datas' => $datas]); } })->setName('search');
public function checkLogin() { $auth = new Auth($this->db); return $auth->isLogged(); }
<?php /** * Init the twig templating engine */ // Get the config $init = new Init(); // Get container $container = $app->getContainer(); // Register component on container $container['view'] = function ($container) { $view = new Slim\Views\Twig('tpl/', ['cache' => false]); $view->addExtension(new Slim\Views\TwigExtension($container['router'], $container['request']->getUri())); return $view; }; // Custom vars $twig = $container->view->getEnvironment(); $twig->addGlobal('current_url', $_SERVER["REQUEST_URI"]); $twig->addGlobal('is_logged', Auth::isLogged()); if (isset($_SESSION['Auth']['role'])) { $twig->addGlobal('logged_role', $_SESSION['Auth']['role']); } else { $twig->addGlobal('logged_role', null); } // Cop level $twig->addGlobal('at_cop', array('0' => $init::_AT_COP_0, '1' => $init::_AT_COP_1, '2' => $init::_AT_COP_2, '3' => $init::_AT_COP_3, '4' => $init::_AT_COP_4, '5' => $init::_AT_COP_5, '6' => $init::_AT_COP_6, '7' => $init::_AT_COP_7));
<?php require_once "include/auth.class.php"; require_once "include/validation.class.php"; require_once "include/security.class.php"; require_once "include/database.inc.php"; require_once "include/sqlbuilder.class.php"; $auth = new Auth(); if ($auth->isLogged()) { header("Location: index.php"); exit; } $_RULES = array("user_firstname" => Validation::$f->notEmpty_String, "user_lastname" => Validation::$f->notEmpty_String, "user_email" => Validation::$f->Email, "user_schoolname" => Validation::$f->notEmpty_String, "user_password" => Validation::$f->notEmpty_String, "user_repassword" => Validation::$f->notEmpty_String); $v = new Validation($_POST, array("user_firstname", "user_lastname", "user_email", "user_schoolname", "user_password", "user_repassword"), $_RULES); $email_available = true; $error = ""; $repassword = true; if ($v->fieldsExists()) { $repassword = $_POST["user_password"] == $_POST["user_repassword"]; $email_available = Auth::user_exists($_POST["user_email"]) == 0; if (!$email_available) { $error = "E-Mail non disponible"; } else { if (!$repassword) { $error = "Les mots de passe ne correspondent pas"; } else { $error = "Champ(s) invalide(s)"; } } if ($v->testAll() && $repassword && $email_available) { $statement = new SQLBuilder($_MYSQLI);
public function prepareEvents($events) { if (count($events)) { foreach ($events as $event) { $start = $event->start_date_time; $end = $event->end_date_time; // if (isset($event->fromCa)) { $event->start_date_time = $event->start_date_time instanceof DateTime ? $event->start_date_time : date_create($event->start_date_time); $event->end_date_time = $event->end_date_time instanceof DateTime ? $event->end_date_time : date_create($event->end_date_time); $start = $event->start_date_time->setTimeZone(new DateTimeZone(App::$instance->opt->ca_timezone)); $end = $event->end_date_time->setTimeZone(new DateTimeZone(App::$instance->opt->ca_timezone)); $mskStart = clone $start; $mskEnd = clone $end; $start->setTimezone(new DateTimeZone(App::$instance->opt->timezone)); $end->setTimezone(new DateTimeZone(App::$instance->opt->timezone)); $event->mks_start_time = $mskStart->format("H:i"); $event->mks_end_time = $mskEnd->format("H:i"); $event->mks_date = $mskStart->format("d.m.Y"); $event->mks_start = $mskStart->format("Y-m-d H:i"); $event->mks_end = $mskEnd->format("Y-m-d H:i"); } $event->start_time = $start->format("H:i"); $event->end_time = $end->format("H:i"); $event->date = $start->format("d.m.Y"); $event->start = $start->format("Y-m-d H:i"); $event->end = $end->format("Y-m-d H:i"); ST::deployColorScheme($event, App::$instance->user->colors['local_default']); if (!isset($event->fromCa)) { $event->titleCustom = "<span style='font-size: 10px;'><span class='label label-success'>#" . $event->id . "</span> "; } else { $event->titleCustom = "<span style='font-size: 10px;'><span class='label label-warning'>#" . $event->id . "</span> "; } if ($event->status == VKS_STATUS_PENDING) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">Pending</span> '; ST::deployColorScheme($event, App::$instance->user->colors['local_pending']); } if (isset($event->fromCa)) { $event->titleCustom = $event->titleCustom . '<span class="label label-info" style="background-color: brown;">СA</span> '; ST::deployColorScheme($event, App::$instance->user->colors['fromca_local_linked']); if (!$event->isLinked) { if (!$event->tbFlag) { ST::deployColorScheme($event, App::$instance->user->colors['fromca_no_local_linked']); } $event->titleCustom = $event->titleCustom . '<span class="label label-info" style="background-color: #F2EE0F; color: #000;">НЗ</span> '; } if ($event->flag) { ST::deployColorScheme($event, App::$instance->user->colors['fromca_with_flag']); } if ($event->tbFlag) { ST::deployColorScheme($event, App::$instance->user->colors['local_with_flag']); } } if (Auth::isAdmin(App::$instance) && isset($event->link_ca_vks_id) && !$event->other_tb_required) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">TbToCa</span>'; // $event->backgroundColor = "#B9BAB2"; // $event->borderColor = "#B9BAB2"; } if (!isset($event->fromCa) && $event->other_tb_required) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">TbToTb</span> '; } if (!isset($event->fromCa) && $event->is_simple) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">Simple</span> '; ST::deployColorScheme($event, App::$instance->user->colors['local_simple']); } if (Auth::isAdmin(App::$instance)) { if (!isset($event->fromCa) && $event->record_required) { $event->titleCustom = $event->titleCustom . "<span class='label label-danger'><span class='glyphicon glyphicon-facetime-video'></span></span> "; } if (!isset($event->fromCa)) { if ($event->flag) { ST::deployColorScheme($event, App::$instance->user->colors['local_with_flag']); // $event->titleCustom = $event->titleCustom.'<span class="label label-danger" style="background-color: #F730D5">Flag</span> '; } } else { } } if (Auth::isAdmin(App::$instance)) { if ($event->admin_id == App::$instance->user->id) { ST::deployColorScheme($event, App::$instance->user->colors['local_im_admin']); } } if (Auth::isLogged(App::$instance) && !Auth::isAdmin(App::$instance)) { if ($event->owner_id == App::$instance->user->id && $event->status != VKS_STATUS_PENDING) { ST::deployColorScheme($event, App::$instance->user->colors['local_im_owner']); } } $event->titleCustom .= "<span style='font-size: 9px;'>" . $event->start_time . " - " . $event->end_time . "</span>"; $event->titleCustom .= "<div class='plank-title' style='font-size: 9px; word-break: normal; word-wrap: normal; white-space: pre-wrap;'>" . $event->title . "</div></span>"; if (Auth::isAdmin(App::$instance)) { $event->codes = '-'; if (isset($event->connection_codes) && count($event->connection_codes)) { $tmp = array(); foreach ($event->connection_codes as $code) { $tmp[] = $code->value; } $event->codes = implode(", ", $tmp); } $event->titleCustom .= "<span class='' style='font-size: 9px;'>code: " . $event->codes . "</span>"; } $event->title = null; //костыль } } return $events; }