/** * @TODO - there has to be a less heavy way of doing this... */ public function init($username = null) { global $db, $cache, $plugins; global $groupscache, $forum_cache, $fpermcache, $mybb, $cached_forum_permissions_permissions, $cached_forum_permissions; if (!defined('IN_MYBB')) { define('IN_MYBB', true); } @(include_once dirname(DOCROOT) . '/mies/inc/init.php'); @(include_once MYBB_ROOT . 'inc/class_session.php'); try { ob_start(); if (isset($mybb)) { $session = new \session(); $session->init(); $mybb->session =& $session; $this->myBB = $mybb; } else { $this->myBB = new \stdClass(); $this->myBB->user = ['username' => null]; if ($this->app['config']['mybb']['allowRandom']) { $this->myBB->user['username'] = $username; } } ob_end_clean(); } catch (\Exception $e) { throw new AuthenticationException('Could not initialize MYBB application for authentication.'); } }
function oauth_callback($config) { $aConfig = array('appid' => $config['appid'], 'appkey' => $config['appkey'], 'api' => 'get_user_info,add_topic,add_one_blog,add_album,upload_pic,list_album,add_share,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idollist,add_idol,del_idol,get_tenpay_addr'); $sUrl = "https://graph.qq.com/oauth2.0/token"; $aGetParam = array("grant_type" => "authorization_code", "client_id" => $aConfig["appid"], "client_secret" => $aConfig["appkey"], "code" => $_GET["code"], "state" => $_GET["state"], "redirect_uri" => $_SESSION["URI"]); unset($_SESSION["state"]); unset($_SESSION["URI"]); $sContent = get($sUrl, $aGetParam); if ($sContent !== FALSE) { $aTemp = explode("&", $sContent); $aParam = $oauth_data = array(); foreach ($aTemp as $val) { $aTemp2 = explode("=", $val); $aParam[$aTemp2[0]] = $aTemp2[1]; } $oauth_data["access_token"] = $aParam["access_token"]; $sUrl = "https://graph.qq.com/oauth2.0/me"; $aGetParam = array("access_token" => $aParam["access_token"]); $sContent = get($sUrl, $aGetParam); if ($sContent !== FALSE) { $aTemp = array(); preg_match('/callback\\(\\s+(.*?)\\s+\\)/i', $sContent, $aTemp); $aResult = json_decode($aTemp[1], true); $session = new session(); $oauth_data['oauth_openid'] = $aResult["openid"]; $session->set('oauth_data', $oauth_data); } } }
/** * Saves the metaboxes * @global type $post_type * @param type $post_id * @return boolean */ public function save_meta_boxes($post_id) { global $post_type; $session = new session(); if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) { return false; } if ($post_type !== 'syn_rest_meal') { return false; } $full_price = $session->post_var('full_price'); $small_plate_price = $session->post_var('small_plate_price'); $display_price = $session->post_var('display_price', 'off'); $calorie_count = $session->post_var('calorie_count'); $new_addition = $session->post_var('new_addition'); $healthy_option = $session->post_var('healthy_option'); $gluten_free = $session->post_var('gluten_free'); $spice_rating = $session->post_var('spice_rating'); update_post_meta($post_id, 'full_price', $full_price); update_post_meta($post_id, 'small_plate_price', $small_plate_price); update_post_meta($post_id, 'display_price', $display_price); update_post_meta($post_id, 'calorie_count', $calorie_count); update_post_meta($post_id, 'new_addition', $new_addition); update_post_meta($post_id, 'healthy_option', $healthy_option); update_post_meta($post_id, 'gluten_free', $gluten_free); update_post_meta($post_id, 'spice_rating', $spice_rating); }
function validaLogin() { $email = $_POST['email']; $senha = $_POST['senha']; echo '1'; if (!isset($email) || !isset($senha)) { sessao_limpa(); } echo '2'; if (strlen(trim($email)) == 0 || strlen(trim($senha) == 0)) { header("Location: /login/error/msg/u_s"); } echo '3'; $model = new model(); $query = "SELECT * FROM usuario WHERE email_usuario = '{$email}' AND senha_usuario = '{$senha}'"; $result = $model->readSQL($query); $session = new session(); if ($result) { $session->sessao_grava($result[0]['email_usuario'], $result[0]['id_usuario_tipo']); header("Location: /index"); } else { $session->sessao_limpa(); header("Location: /login/error/msg/u_s"); } }
public function testsession2() { $v = JSFW()->getVersion(); jiashu::loadLib('session'); $sess = new session(); JSFW()->setTplData('n', $sess->sessionStart()->getSession('testsession'))->setTplData('v', $v); JSFW()->render('index'); }
function logout() { global $CONF, $LNG, $TMPL; require_once "{$CONF['path']}/sources/misc/session.php"; $session = new session(); $session->delete($_COOKIE['atsphp_sid_user_cp']); $TMPL['content'] = $LNG['user_cp_logout_message']; }
/** * @Route("/secured/disconnect") * @Template() */ public function disconnectAction() { //On initialise la variable error a nul pour ne pas avoir de message d'erreur $session = new session(); $session->invalidate(); return $this->redirect('/'); //On redirige vers l'accueil }
public function index_action($pagina = 1) { $session = new session(); $session->sessao_valida(); $_SESSION['pagina'] = $pagina; $this->smarty->assign('paginador', $this->mostraGrid()); $this->smarty->assign('title', 'Departamentos'); $this->smarty->display('departamento/index.tpl'); }
public function checkSession() { //Cette fonction sert à vérfier que l'utilisateur est connecté $session = new session(); if ($session->isStarted()) { return true; } else { return $this->render("loginBundle:default:login.html.twig", array('error' => "Veuillez vous connecter")); } }
public function index_action($pagina = 1) { $session = new session(); $session->sessao_valida(); $_SESSION['pagina'] = $pagina; $this->smarty->assign('paginador', $this->mostraGrid()); $this->smarty->assign('title', 'Estados'); //call the smarty $this->smarty->display('estado/index.tpl'); }
function checkLogin() { $session = new session(); $login = $session->get("person_id"); if (isset($login)) { return true; } else { return false; } }
public function save_meta_boxes($post_id) { global $post_type, $wpdb; $session = new session(); if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) { return false; } if ($post_type !== 'syn_rest_reservation') { return false; } $first_name = $session->post_var('first_name'); $last_name = $session->post_var('last_name'); $phone_number = $session->post_var('phone_number'); $email_address = $session->post_var('email_address'); $guests_count = $session->post_var('guests_count'); $reservation_date = $session->post_var('reservation_date'); $reservation_time = $session->post_var('reservation_time'); update_post_meta($post_id, 'first_name', $first_name); update_post_meta($post_id, 'last_name', $last_name); update_post_meta($post_id, 'phone_number', $phone_number); update_post_meta($post_id, 'email_address', $email_address); update_post_meta($post_id, 'guests_count', $guests_count); update_post_meta($post_id, 'reservation_date', $reservation_date); update_post_meta($post_id, 'reservation_time', $reservation_time); $arrival_time = date('Y-m-d H:i:s', strtotime("{$reservation_date}, {$reservation_time}")); update_post_meta($post_id, 'arrival_time', $arrival_time); $title = 'Reservation: ' . $first_name . ' ' . $last_name; $where = array('ID' => $post_id); $wpdb->update($wpdb->posts, array('post_title' => $title), $where); }
private function get_current_user($sessID) { $sess = new session($sessID); if ($sess->Started()) { $person = new person(); $person->load_current_user($sess->Get("personID")); // update session_started, which affects session lifetime $sess->Save(); return $person; } }
public function index_action() { $session = new session(); $session->sessao_valida(); $modelEvento = new eventoModel(); $resEvento = $modelEvento->getEvento('stat<>0'); //send the records to template sytem $this->smarty->assign('evento', $resEvento); $this->smarty->assign('title', 'Emissão de Crachá'); $this->smarty->assign('listacliente', null); //call the smarty $this->smarty->display('cracha/index.tpl'); }
public function index_action($pagina = 1) { $session = new session(); $session->sessao_valida(); $_SESSION['pagina'] = $pagina; //list all records $cidade_model = new cidadeModel(); //send the records to template sytem $this->smarty->assign('title', 'Cidades'); $this->smarty->assign('paginador', $this->mostraGrid()); //call the smarty $this->smarty->display('cidade/index.tpl'); }
/** * Methode qui va notifier une action * Arguments: * + $id: l'id de mon objet * + $message: le message de notre notification * + $nature: product | cms | categorie * + $criticity: success - danger - warning - info * nature: 0 mon compte, 1 product , 2 categories, 3 cms, 4 fournisseurs */ public function notify($id, $message, $nature = 'product', $criticity = "success") { // 1. Nous récupérons dans une variable $tabsession // le tableau de notifications par sa nature // $this->session->get('nature') permet de récupérer une information par sa clef // le 2eme argument a la fonction get() permet d'initialiser un tableau vide // si ma clefs en session n'existe pas $tabsession = $this->session->get($nature, array()); // 2. Nous stockons dans ce tableau // la notification avec un message, avec une criticité et une date $tabsession[$id] = array('message' => $message, 'criticity' => $criticity, 'date' => new \DateTime("now")); // 3. nous enregistrons le tableau des notifications en session $this->session->set($nature, $tabsession); }
function get_url() { global $sess; $sess or $sess = new session(); $url = "project/project.php?projectID=" . $this->get_id(); if ($sess->Started()) { $url = $sess->url(SCRIPT_PATH . $url); // This for urls that are emailed } else { static $prefix; $prefix or $prefix = config::get_config_item("allocURL"); $url = $prefix . $url; } return $url; }
function reset() { $this->_items =& session :: get('session_cart_' . $this->_cart_id . '_items'); if(!is_array($this->_items)) $this->_items = array(); }
public static function get_instance() { if (is_null(session::$instance)) { session::$instance = new session(); } return session::$instance; }
function new_password() { global $CONF, $DB, $FORM, $LNG, $TMPL; require_once "{$CONF['path']}/sources/misc/session.php"; $session = new session(); list($type, $data) = $session->get($FORM['sid']); $TMPL['username'] = $DB->escape($data); $password = md5($FORM['password']); if ($type == 'lost_pw') { $session->delete($FORM['sid']); $DB->query("UPDATE {$CONF['sql_prefix']}_sites SET password = '******' WHERE username = '******'username']}'", __FILE__, __LINE__); $TMPL['content'] = $this->do_skin('lost_pw_finish_2'); } else { $this->error($LNG['g_session_expired']); } }
public function addStepOne() { $data = array(); $data['boat_name'] = $_POST['headline']; $data['boat_type'] = $_POST['boat_type']; $data['construction_year'] = $_POST['year']; $data['ce_category'] = $_POST['boat_category']; $data['yard'] = $_POST['boat_yard']; $data['boat_model'] = $_POST['boat_model']; $data['latitude'] = $_POST['latitude']; $data['longitude'] = $_POST['longitude']; $data['length'] = $_POST['length']; $data['width'] = $_POST['width']; $data['clearance'] = $_POST['clearance']; $data['draft'] = $_POST['draft']; $data['weight'] = $_POST['weight']; $data['passengers'] = $_POST['passengers']; $data['cabins'] = $_POST['cabins']; $data['berth'] = $_POST['berth']; $data['deck_color'] = $_POST['deck_color']; $data['hull_color'] = $_POST['hull_color']; $data['deck_mat'] = $_POST['deck_mat']; $data['hull_mat'] = $_POST['hull_mat']; $data['type'] = $_POST['featured_status']; $data['userid'] = session::get('userId'); // $data['title'] = $_POST['headline']; // $data['city'] = $_POST['city']; // $data['country'] = $_POST['country']; // $data['telec'] = $_POST['telecomute']; // $data['type'] = $_POST['featured_status']; // $data['userid'] = session::get('userId'); return $this->model->addStepOne($data); }
function setcollecte($id, $mode_paiement, $pj, $date_paiement) { global $db; //$nextid=getnextidtable('collecte'); $date = date('Y-m-d-', strtotime($date_paiement)); $values["mode_paiement"] = MySQL::SQLValue($mode_paiement); $values["date_paiement"] = MySQL::SQLValue($date); $values["etat_paiement"] = MySQL::SQLValue("Payé"); $where["id"] = MySQL::SQLValue($id); if (!$db->UpdateRows("collecte", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("collecte", $values); logg('Enregistrement collecte ', 195, $id, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/collecte"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $id, $newdir, "Attachement_collecte_"); autoarchive($newdir . changnom($pj, $id, 'Attachement_collecte_'), "Fichier joint collecte {$id}", 195, $id, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $id = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::ID, true)); $password = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::PASSWORD, true)); $rePassword = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::SECOND_PASSWORD, true)); $idPregunta = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::RESTAURAR_ID, true)); $respuesta = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::RESPUESTA_SECRETA, true)); $flag = true; if ($flag == true) { request::getInstance()->setMethod('GET'); } $ids = array(usuarioTableClass::ID => $id); $data = array(usuarioTableClass::PASSWORD => md5($password), usuarioTableClass::RESTAURAR_ID => $idPregunta, usuarioTableClass::RESPUESTA_SECRETA => $respuesta); usuarioTableClass::update($ids, $data); routing::getInstance()->getUrlObj('shfSecurity', 'index'); } else { routing::getInstance()->forward('recuperar', 'consultar'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
/** * Сохранить данные * @access public */ public function _set() { $data = $this->prepare_set(); if (!empty($data)) { session::set($data, NULL, $this->di->name); } }
private static function start() { if (!self::$alive) { session_start(); self::$alive = true; } }
public static function run() { if (!isset($_SERVER['REDIRECT_URL'])) { throw new Exception(); } $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix())); $path = explode('/', $_SERVER['REDIRECT_URL']); //array_shift($path); if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) { req::$controller = array_shift($path); if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) { req::$function = array_shift($path); } } unset($path); session::get_instance()->start(); if (uuid::check(req::$controller)) { $obj = state::load(req::$controller); if (!$obj instanceof ctrl) { throw new Exception(); } call_user_func(array($obj, req::$function)); } else { $obj = eval('return new ' . req::$controller . '_ctrl();'); if (!$obj instanceof ctrl) { throw new Exception(); } util::redirect($obj, req::$function, $_GET); } }
/** * Set up the required user object and server variables for the suites */ protected function setUp() { global $user, $phpbb_root_path; // Put this into a global function being run by every test to init a proper user session $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_ADDR'] = '127.0.0.1'; $_SERVER['SERVER_PORT'] = 80; $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER['QUERY_STRING'] = ''; $_SERVER['REQUEST_URI'] = '/tests/'; $_SERVER['SCRIPT_NAME'] = '/tests/index.php'; $_SERVER['PHP_SELF'] = '/tests/index.php'; $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'; /* [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 DOCUMENT_ROOT] => /var/www/ [SCRIPT_FILENAME] => /var/www/tests/index.php */ // Set no user and trick a bit to circumvent errors $user = new user(); $user->lang = true; $user->browser = !empty($_SERVER['HTTP_USER_AGENT']) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : ''; $user->referer = !empty($_SERVER['HTTP_REFERER']) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : ''; $user->forwarded_for = !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? (string) $_SERVER['HTTP_X_FORWARDED_FOR'] : ''; $user->host = !empty($_SERVER['HTTP_HOST']) ? (string) strtolower($_SERVER['HTTP_HOST']) : (!empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); $user->page = session::extract_current_page($phpbb_root_path); }
function editreform($nextid, $titre, $desc, $montant, $pj, $date) { global $db; $usrid = $_SESSION['userid']; $date_operation = date('Y-m-d-', strtotime($date)); $values["titre"] = MySQL::SQLValue($titre); $values["description"] = MySQL::SQLValue($desc); $values["montant"] = MySQL::SQLValue($montant); $values["date_operation"] = MySQL::SQLValue($date_operation); $where["id"] = MySQL::SQLValue($nextid); if (!$db->UpdateRows("produit_reform", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("produit_reform", $values); logg('Enregistrement Produit Reform ', 167, $nextid, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/produit"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $nextid, $newdir, "Attachement_produit_reform"); autoarchive($newdir . changnom($pj, $nextid, 'Attachement_produit_reform'), "Fichier joint produit Reform {$nextid}", 100, $nextid, "produit_reform", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
/** * Checks the remaining SMS left this month making a GET request * * @return int - free SMS this month */ public function get_free() { $response = $this->session->get($this->send_request_uri); $element = $this->find($response->body, '#syndication p.item span.value', 0); $result = intval(trim($element->plaintext)); return $result; }
public static function is_equals($key, $value) { if (session::is_set($key) and $_SESSION[$key] == $value) { return true; } return false; }