/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!$this->session->has('lastActivityTime')) { $this->session->put('lastActivityTime', time()); } else { if (time() - $this->session->get('lastActivityTime') > $this->getTimeOut()) { $this->session->forget('lastActivityTime'); Auth::logout(); return redirect($this->getRedirectUrl())->with([$this->getSessionLabel() => 'You have been inactive for ' . $this->timeout / 60 . ' minutes ago.']); } } $this->session->put('lastActivityTime', time()); return $next($request); }
/** * 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 user_cpl() { global $CONF, $DB, $FORM, $LNG, $TMPL; $TMPL['header'] = $LNG['user_cp_header']; if (!isset($_COOKIE['atsphp_sid_user_cp'])) { $this->login(); } else { require_once "{$CONF['path']}/sources/misc/session.php"; $session = new session(); list($type, $data) = $session->get($_COOKIE['atsphp_sid_user_cp']); $TMPL['username'] = $DB->escape($data); if ($type == 'user_cp') { $session->update($_COOKIE['atsphp_sid_user_cp']); // Array containing the valid .php files from the sources/user_cp directory $action = array('edit' => 1, 'link_code' => 1); if (isset($FORM['b']) && isset($action[$FORM['b']])) { $page_name = $FORM['b']; require_once "{$CONF['path']}/sources/user_cp/{$page_name}.php"; $page = new $page_name(); $TMPL['content'] = $this->do_skin('user_cp'); } elseif (isset($FORM['b']) && $FORM['b'] == 'logout') { $this->logout(); } else { $this->main(); } } else { $this->login(); } } }
function edit_quote($id, $date, $montant, $pj) { global $db; $date = date('Y-m-d-', strtotime($date)); $values["datinsert"] = MySQL::SQLValue($date); $values["montant"] = MySQL::SQLValue($montant); $where["id"] = MySQL::SQLValue($id); if (!$db->UpdateRows("quotpatronal", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("quotpatronal", $values); logg('Enregistrement Quote Part Patronal ', 175, $id, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/quotpatronal"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $id, $newdir, "Attachement_quotpatronal_"); autoarchive($newdir . changnom($pj, $id, 'Attachement_quotpatronal_'), "Fichier joint Quote Part Patronal {$id}", 175, $id, "quotpatronal", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
function show($id, $text = "") { if (!session::get("tooltips")) { // display text from database if ($id) { $helpArray = fetch_to_array(database::query("SELECT * FROM system WHERE name='{$id}'"), ""); if ($helpArray) { $entry = current($helpArray); } $right = right::get_field($id); $user = right::get("rights"); $temp = $entry[text]; // admin informations if (right::superuser()) { $temp .= "<hr><table>"; $temp .= "<tr><td>fieldname</td><td>{$id}</td></tr>"; // fieldname $temp .= "<tr><td>edit</td><td>" . right::int2string($right[edit]) . "</td></tr>"; // edit rights $temp .= "<tr><td>view</td><td>" . right::int2string($right[view]) . "</td></tr>"; // view rights $temp .= "</table>"; $clickEvent = " onmousedown = edit("{$id}")"; } if ($text) { $temp .= "<hr>{$text}"; } return "onmouseover='return overlib("" . $temp . "");' onmouseout='return nd()' {$clickEvent}"; } // display special text } }
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 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; } }
function render_file_select() { $id = $this->get_attribute('id'); $md5id = substr(md5($id), 0, 5); $file_node_id = $this->get_value(); if ($file_node_id && ($file_data = fetch_one_by_node_id($file_node_id))) { $span_name = $file_data['identifier']; $span_description = $file_data['description']; $span_size = $file_data['size']; $span_mime = $file_data['mime_type']; $start_path = '/root?action=file_select&node_id=' . $file_data['parent_node_id']; } else { $span_name = ''; $span_description = ''; $span_size = ''; $span_mime = ''; } $start_path_condition = ""; if (!$start_path) { $start_path = $this->get_attribute('start_path'); if (!$start_path) { $start_path = session::get('limb_file_select_working_path'); } if (!$start_path) { $start_path = '/root/images_folder'; } $start_path .= '?action=file_select'; } $start_path_condition = "file_select_{$md5id}.set_start_path('{$start_path}');"; echo "<span id='{$md5id}_span_empty'><img src='/shared/images/no_img.gif'></span>\n \t\t\t\t<span id='{$md5id}_span_content'>\n \t\t\t\t\t<a id='{$md5id}_href' href='#'><img id='{$md5id}_img' align='center' src='/shared/images/1x1.gif'/> <span id='{$md5id}_name'>{$span_name}</span></a><br>\n \t\t\t\t\t<span id='{$md5id}_description'>{$span_description}</span><br>\n \t\t\t\t\tsize: <span id='{$md5id}_size'>{$span_size}</span> bytes <br>\n \t\t\t\t\tmime-type:<span id='{$md5id}_mime'>{$span_mime}</span>\n \t\t\t\t</span><br><br>"; echo "<script type='text/javascript'>\n\t\t \tvar file_select_{$md5id};\n\t\t \t\n\t\t function init_file_select_{$md5id}()\n\t\t {\n\t\t file_select_{$md5id} = new file_select('{$id}', '{$md5id}');\n\t\t {$start_path_condition}\n\t\t file_select_{$md5id}.generate();\n\t\t }\n\t\t \n\t\t function file_select_{$md5id}_insert_file(file)\n\t\t {\n\t\t \tfile_select_{$md5id}.insert_file(file);\n\t\t }\n\t\n\t\t function file_select_{$md5id}_get_file()\n\t\t {\n\t\t \treturn file_select_{$md5id}.get_file();\n\t\t }\n\t\t \n\t\t function file_reset_{$md5id}()\n\t\t {\n\t\t \tfile_select_{$md5id}.id_container.value = 0;\n\t\t \tinit_file_select_{$md5id}();\n\t\t }\n\t\t \n\t\t add_event(window, 'load', init_file_select_{$md5id});\n\t\t </script>"; echo "<input class='button' type='button' onclick='popup(\"/root/file_select?\", null, null, false, file_select_{$md5id}_insert_file, file_select_{$md5id}_get_file)' value='" . strings::get('select_file', 'file') . "'>"; echo ' '; echo "<input class='button' type='button' onclick='file_reset_{$md5id}()' value='" . strings::get('reset') . "'>"; }
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; } }
/** * Display a listing of miembros * * @return Response */ public function index() { $miembros = Miembro::where('familia_id', '=', session::get('familia_id'))->get(); $familia = Familia::where('usuario_id', '=', Session::get('id'))->get(); // $miembros=Miembro::orderBy('created_at','desc')->limit(2)->get(); return View::make('back.Miembros.index', compact('miembros', 'familia')); }
function render_image_select() { $id = $this->get_attribute('id'); $md5id = substr(md5($id), 0, 5); $image_node_id = $this->get_value(); $start_path = ''; if ($image_node_id && ($image_data = fetch_one_by_node_id($image_node_id))) { $span_name = $image_data['identifier']; $start_path = '/root?action=image_select&node_id=' . $image_data['parent_node_id']; } else { $span_name = ''; } if (!$start_path) { $start_path = $this->get_attribute('start_path'); if (!$start_path) { $start_path = session::get('limb_image_select_working_path'); } if (!$start_path) { $start_path = '/root/images'; } $start_path .= '?action=image_select'; } echo "<span id='{$md5id}_name'>{$span_name}</span><br><img id='{$md5id}_img' src='/shared/images/1x1.gif'/>\n <script type='text/javascript'>\n var image_select_{$md5id};\n\n function init_image_select_{$md5id}()\n {\n image_select_{$md5id} = new image_select('{$id}', '{$md5id}');\n image_select_{$md5id}.set_start_path('{$start_path}');\n image_select_{$md5id}.generate();\n }\n\n function image_select_{$md5id}_insert_image(image)\n {\n image_select_{$md5id}.insert_image(image);\n }\n\n function image_select_{$md5id}_get_image()\n {\n return image_select_{$md5id}.get_image();\n }\n\n function image_reset_{$md5id}()\n {\n image_select_{$md5id}.id_container.value = 0;\n init_image_select_{$md5id}();\n }\n\n add_event(window, 'load', init_image_select_{$md5id});\n </script>"; echo "<br><br><input class='button' type='button' onclick='popup(\"/root/tools/image_select?properties=0\", null, null, false, image_select_{$md5id}_insert_image, image_select_{$md5id}_get_image)' value='" . strings::get('select_image', 'image') . "'>"; echo ' '; echo "<input class='button' type='button' onclick='image_reset_{$md5id}()' value='" . strings::get('reset') . "'>"; }
function editdoc($titrfr, $titren, $titrar, $img, $id, $art, $typ) { global $db; $values["titrfr"] = MySQL::SQLValue($titrfr); $values["titren"] = MySQL::SQLValue($titren); $values["titrar"] = MySQL::SQLValue($titrar); $values["article"] = MySQL::SQLValue($art); $values["typ"] = MySQL::SQLValue($typ); if ($img != "") { $values["img"] = MySQL::SQLValue(changnom($img, $id, 'doc_')); } $where["id"] = MySQL::SQLValue($id); // Execute the insert $result = $db->UpdateRows("document", $values, $where); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill('Error Update'); return false; } else { if ($img != "") { $olddir = "upload/doc/"; $newdir = "../upload/doc/"; copyfile($img, $id, $newdir, "doc_"); autoarchive($newdir . changnom($img, $id, 'doc_'), "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
public function getMenu($menu) { //Llama a una funcion del ACL que carga los menus $menus['sidebar'] = $this->_registry->_acl->getMenusRole(); if (Session::get('autenticado')) { $titulos = array(array('id' => 'inicio', 'titulo' => 'Inicio', 'enlace' => BASE_URL, 'imagen' => 'icon-home'), array('id' => 'post', 'titulo' => 'Posts', 'enlace' => BASE_URL . 'post', 'imagen' => 'icon-flag')); // para la redcetpros if (Session::get('clave_cetpro') == 'redcetpros') { $nom_cetpro = 'Red CETPROS UGEL 04'; } else { throw new Exception('hola mucamos'); $nom_cetpro = 'CETPRO ' . implode($this->_modelo->getCetproFromClave(Session::get('clave_cetpro'))); } $menus['top'] = array('titulos' => $titulos, 'ruta_img' => BASE_URL . 'layouts/sigace/img/', 'usuario' => ucwords(strtolower(session::get('nombre') . " " . session::get('ape_pat') . " " . session::get('ape_mat'))), 'cetpro_clave' => Session::get('clave_cetpro'), 'cetpro' => $nom_cetpro, 'role' => implode($this->_modelo->getRole(session::get('id_role')))); } /* if(!Session::get('autenticado')){ $menus['top'][] = array( 'id' => 'registro', 'titulo' => 'Registro', 'enlace' => BASE_URL . 'usuarios/registro', 'imagen' => 'icon-book' ); } */ return $menus[$menu]; }
function admin() { global $CONF, $FORM, $LNG, $TMPL; $TMPL['header'] = $LNG['a_header']; if (!isset($_COOKIE['atsphp_sid_admin'])) { $this->login(); } else { require_once "{$CONF['path']}/sources/misc/session.php"; $session = new session(); list($type, $data) = $session->get($_COOKIE['atsphp_sid_admin']); if ($type == 'admin') { $session->update($_COOKIE['atsphp_sid_admin']); // Array containing the valid .php files from the sources/admin directory $action = array('approve' => 1, 'approve_edited' => 1, 'approve_reviews' => 1, 'backup_database' => 1, 'create_page' => 1, 'delete' => 1, 'delete_bad_word' => 1, 'delete_ban' => 1, 'delete_page' => 1, 'delete_review' => 1, 'edit' => 1, 'edit_page' => 1, 'edit_bad_word' => 1, 'edit_ban' => 1, 'edit_review' => 1, 'email' => 1, 'manage' => 1, 'manage_bad_words' => 1, 'manage_ban' => 1, 'manage_pages' => 1, 'manage_reviews' => 1, 'settings' => 1, 'skins' => 1); if (isset($FORM['b']) && isset($action[$FORM['b']])) { $page_name = $FORM['b']; require_once "{$CONF['path']}/sources/admin/{$page_name}.php"; $page = new $page_name(); $TMPL['content'] = $this->do_skin('admin'); } elseif (isset($FORM['b']) && $FORM['b'] == 'logout') { $this->logout(); } else { $this->main(); } } else { $this->login(); } } }
function editcollecte($idcontrat, $paiement, $date, $pj) { global $db; $usrid = $_SESSION['userid']; $nextid = getnextidtable('collecte'); //$date1=date_create($date); //$datep=date_format($date1,"Y-m-d"); $date_paiement = date('Y-m-d-', strtotime($date)); $values["mode_paiement"] = MySQL::SQLValue($paiement); $values["date_paiement"] = MySQL::SQLValue($date_paiement); $where["id"] = MySQL::SQLValue($idcontrat); if (!$db->UpdateRows("collecte", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("collecte", $values); logg('Enregistrement collecte ', 201, $nextid, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/collecte"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $nextid, $newdir, "collecte"); autoarchive($newdir . changnom($pj, $nextid, 'collecte'), "Fichier joint collecte {$nextid}", 201, $nextid, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
function setcontrat($id, $date, $pj) { global $db; $etat = "Résilié"; $nextid = getnextidtable('contrat_location_villa'); $date = date('Y-m-d-', strtotime($date)); $values["date_resiliation"] = MySQL::SQLValue($date); $values["etat"] = MySQL::SQLValue($etat); $where["id"] = MySQL::SQLValue($id); if (!$db->UpdateRows("contrat_location_villa", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("contrat_location_villa", $values); logg('Enregistrement Location Villa ', 233, $id, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/location"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $id, $newdir, "Attachement_location_"); autoarchive($newdir . changnom($pj, $id, 'Attachement_location_'), "Fichier joint location ville {$id}", 233, $id, "contrat_location_villa", "pj_resiliation", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
/** * Initializing i18n * * @param array $options */ public static function init($options = []) { $i18n = application::get('flag.global.i18n') ?? []; $i18n = array_merge_hard($i18n, $options ?? []); // determine final language $languages = factory::model('numbers_backend_i18n_languages_model_languages')->get(); $final_language = application::get('flag.global.__language_code') ?? session::get('numbers.entity.format.language_code') ?? $i18n['language_code'] ?? 'sys'; if (empty($languages[$final_language])) { $final_language = 'sys'; $i18n['rtl'] = 0; } // put settings into system if (!empty($languages[$final_language])) { foreach ($languages[$final_language] as $k => $v) { $k = str_replace('lc_language_', '', $k); if (in_array($k, ['code', 'inactive'])) { continue; } if (empty($v)) { continue; } $i18n[$k] = $v; } } $i18n['language_code'] = $final_language; self::$options = $i18n; session::set('numbers.entity.format.language_code', $final_language); application::set('flag.global.i18n', $i18n); self::$initialized = true; // initialize the module return factory::submodule('flag.global.i18n.submodule')->init($i18n); }
function addaemploi($id_aemploi, $montant, $date_paiement, $mode_paiement, $ref_pj, $pj) { global $db; $nextid = getnextidtable('autorisation_emploi'); $usrid = $_SESSION['userid']; $date = date('Y-m-d-', strtotime($date_paiement)); $values["pj"] = MySQL::SQLValue($pj); $values["ref_pj"] = MySQL::SQLValue($ref_pj); $values["id_aemploi"] = MySQL::SQLValue($id_aemploi); $values["mode_paiement"] = MySQL::SQLValue($mode_paiement); $values["date_paiement"] = MySQL::SQLValue($date); $values["montant"] = MySQL::SQLValue($montant); $values["addby"] = MySQL::SQLValue($usrid); if (!$db->InsertRow("autorisation_emploi", $values)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("autorisation_emploi", $values); logg('Enregistrement Autorisation Emploi ', 246, $nextid, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/Autorisation"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $nextid, $newdir, "Attachement_autorisation_"); autoarchive($newdir . changnom($pj, $nextid, 'Attachement_autorisation_'), "Fichier joint autorisation emploi {$nextid}", 246, $nextid, "autorisation_emploi", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0)); } } return true; }
public static function saveSession() { $engine = EngineAPI::singleton(); $localvars = localvars::getInstance(); $db = db::get($localvars->get('dbConnectionName')); $sql = "INSERT INTO `session`(username,sessionPages,ipAddr) VALUES(?,?,?)"; $validate = new validate(); $username = session::get('username'); $pages = session::get('loggedPages'); $pages = dbSanitize(implode(',', $pages)); $ip = $_SERVER['REMOTE_ADDR']; $sqlArray = array($username, $pages, $ip); $db->beginTransaction(); try { $sqlResult = $db->query($sql, $sqlArray); if ($sqlResult->error()) { throw new Exception("ERROR SQL" . $sqlResult->errorMsg()); } $db->commit(); } catch (Exception $e) { $db->rollback(); $localvars->set('feedback', $e->getMessage()); errorHandle::errorMsg($e->getMessage()); } }
/** * Check if user is logged in * @return boolean TRUE - if user is logged in or FALSE */ public static function is_logged() { // Get instance of authentification data interface $auth = data_interface::get_instance(AUTH_DI); if ($auth->is_logged) { return TRUE; } // Get values stored in session $sess = session::get(array('uid', 'ulogin', 'uhash'), NULL, AUTH_DI); // If session values not stored then return FALSE if (empty($sess)) { return FALSE; } // Get authentification`s data $data = $auth->get_by_hash($sess['uid'], $sess['ulogin'], $sess['uhash']); // If there is no authentification`s data then return FALSE if (!$data) { return FALSE; } $auth->is_logged = TRUE; // Define UID of logged user define('UID', $data['id']); // If account_id is given then define it in AID if ($data['account_id']) { define('AID', $data['account_id']); } return TRUE; }
function parse() { if ($phpbb_sid = session::get('phpbb_sid')) { $this->xml_string = str_replace('%phpbb_sid%', $phpbb_sid, $this->xml_string); } return parent::parse(); }
function add_contrat($nextid, $titre, $fournisseur, $date, $montant_global, $article, $paragraphe, $chapitre, $pj) { global $db; $usrid = $_SESSION['userid']; $date = date('Y-m-d-', strtotime($date)); $values["titre"] = MySQL::SQLValue($titre); $values["date"] = MySQL::SQLValue($date); $values["id_fournisseur"] = MySQL::SQLValue($fournisseur); $values["id_chapitre"] = MySQL::SQLValue($chapitre); $values["id_article"] = MySQL::SQLValue($article); $values["id_paragraphe"] = MySQL::SQLValue($paragraphe); $values["montant_global"] = MySQL::SQLValue($montant_global); $values["montant_paye"] = MySQL::SQLValue(0); $values["pourcentage"] = MySQL::SQLValue(0); $values["montant_rest"] = MySQL::SQLValue($montant_global); $values["addby"] = MySQL::SQLValue($usrid); if (!$db->InsertRow("contrat", $values)) { $db->Kill($db->Error()); return false; } else { logg('Enregistrement Contrat Fournisseur ', 254, $nextid, $_SESSION['userid']); // Save PJ to archive if ($pj != "") { $basedir = "upload/contrat"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $nextid, $newdir, "Attachement_contrat_"); autoarchive($newdir . changnom($pj, $nextid, 'Attachement_contrat_'), "Fichier joint contrat fournisseur {$nextid}", 254, $nextid, "contrat", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0)); } } return true; }
function editlocation($nextid, $nom, $adresse, $pj, $tel, $mail, $villa, $date_debut, $date_fin, $type_paiement, $montant_location, $agarantie_location) { global $db; $usrid = $_SESSION['userid']; $datedebut = date('Y-m-d-', strtotime($date_debut)); $datefin = date('Y-m-d-', strtotime($date_fin)); $values["nomlocataire"] = MySQL::SQLValue($nom); $values["adresse"] = MySQL::SQLValue($adresse); $values["tel"] = MySQL::SQLValue($tel); $values["mail"] = MySQL::SQLValue($mail); $values["idvilla"] = MySQL::SQLValue($villa); $values["date_debut"] = MySQL::SQLValue($datedebut); $values["date_fin"] = MySQL::SQLValue($datefin); $values["montant"] = MySQL::SQLValue($montant_location); $values["depot_garantie"] = MySQL::SQLValue($agarantie_location); $values["type_paiement"] = MySQL::SQLValue($type_paiement); $where["id"] = MySQL::SQLValue($nextid); if (!$db->UpdateRows("contrat_location_villa", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("contrat_location_villa", $values); logg('Enregistrement Location Villa ', 100, $nextid, $_SESSION['userid']); if ($pj != "") { $basedir = "upload/location"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($pj, $nextid, $newdir, "Attachement_location_"); autoarchive($newdir . changnom($pj, $nextid, 'Attachement_location_'), "Fichier joint location ville {$nextid}", 100, $nextid, "location_villa", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
function addevent($titrfr, $titren, $titrar, $contfr, $conten, $contar, $img, $id, $autfr, $auten, $autar, $dat) { global $db; $date = date('Y-m-d-', strtotime($dat)); $values["titrfr"] = MySQL::SQLValue($titrfr); $values["titren"] = MySQL::SQLValue($titren); $values["titrar"] = MySQL::SQLValue($titrar); $values["contfr"] = MySQL::SQLValue($contfr); $values["conten"] = MySQL::SQLValue($conten); $values["contar"] = MySQL::SQLValue($contar); $values["autfr"] = MySQL::SQLValue($autfr); $values["auten"] = MySQL::SQLValue($auten); $values["autar"] = MySQL::SQLValue($autar); $values["app"] = MySQL::SQLValue('?_tsk=event&id=' . $id); $values["dat"] = MySQL::SQLValue($date); // Execute the insert $result = $db->InsertRow("event", $values); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill('Error Insert'); return false; } else { if ($img != "") { $basedir = "upload/event"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = "../upload/event/"; copyfile($img, $id, $newdir, "event_"); autoarchive($newdir . changnom($img, $id, 'event_'), "Image Evénement {$id} ", 12, $id, "event", "img", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
public static function performChecks() { if (session::has('username')) { self::giftCheck(session::get('username')); } self::checkSession(); }
function addnews($titrfr, $titren, $titrar, $img, $id, $art, $typ) { global $db; $values["titrfr"] = MySQL::SQLValue($titrfr); $values["titren"] = MySQL::SQLValue($titren); $values["titrar"] = MySQL::SQLValue($titrar); $values["article"] = MySQL::SQLValue($art); $values["typ"] = MySQL::SQLValue($typ); // Execute the insert $result = $db->InsertRow("document", $values); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill($result); return false; } else { if ($img != "") { $basedir = "upload/doc"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = "../upload/doc/"; if (!file_exists($newdir)) { mkdir($newdir, 0, true); } $file = "./upload/doc/" . changnom($img, $id, 'doc_'); copyfile($img, $id, $newdir, "doc_"); autoarchive($file, "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0)); } return true; } }
function reset() { $this->_items =& session :: get('session_cart_' . $this->_cart_id . '_items'); if(!is_array($this->_items)) $this->_items = array(); }
public function init() { if ($this->_inited) { return; } $this->_inited = true; if (@application::get_instance()->config->resource->lang->type == 'session') { $lang_cookie = @$_COOKIE[$this->_key]; $lang_session = session::get('lang'); if ($lang_session) { if ($lang_session != $lang_cookie) { $this->set($lang_session); } $lang_param = $lang_session; } else { $lang_param = $lang_cookie; } } else { $lang_param = application::get_instance()->request->param->lang; } $ml = new model_lang(); $this->data = $ml->fetch_row(array('show_it' => '1'), array('(`stitle` = ' . $ml->adapter->quote($lang_param) . ')' => 'desc', '(`is_default` = 1)' => 'desc')); $this->default = $ml->fetch_row(array('is_default' => '1')); if (!$lang_param) { if (application::get_instance()->config->resource->lang->type == 'session') { session::set('lang', $this->default->stitle); } } }
/** * 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; }
function add_action() { if(front::post('submit') &&front::post('aid')) { if(config::get('verifycode')) { if(front::post('verify')<>session::get('verify')) { alertinfo('验证码错误。', front::$from); //front::redirect(front::$from); } } if(!front::post('username')) { /*front::flash(lang('请留下你的名字!')); front::redirect(front::$from);*/ alertinfo('请留下你的名字!', front::$from); } if(!front::post('content')) { /*front::flash(lang('请填写评论内容!')); front::redirect(front::$from);*/ alertinfo('请填写评论内容!', front::$from); } $this->manage->filter(); $comment=new comment(); $archive=new archive(); front::$post['state'] = '0'; front::$post['adddate']=date('Y-m-d H:i:s'); $comment->rec_insert(front::$post); $archive->rec_update('comment=comment+1',front::post('aid')); //front::flash(lang('提交成功!')); alertinfo('评论提交成功。', front::$from); //front::redirect(front::$from); }else { front::flash(lang('提交失败!')); front::redirect(front::$from); } }