function entry_app_feed_list() { $feed_mod = model::load('feed'); $fields = array('feed_id', 'url', 'title', 'top_image', 'ups', 'downs', 'add_time', 'domain', 'user_id'); $feed_list = $feed_mod->select_feeds($fields, $_GET); include TEMPLATES_PATH . 'app_feed_list.html'; }
function entry_password_edit() { $model = model::load('user'); $_POST['user_id'] = $this->user_id; if (is_post() && $model->edit_password($_POST) === false) { $this->assign['message'] = $model->message; } $this->display('password_edit'); }
function entry_comment() { $feed_mod = model::load('feed'); $feed_mod->init('comments'); if (is_post()) { $feed_mod->edit($_POST); } $this->assign['comment'] = $feed_mod->get($_GET); $this->display('comment_edit'); }
/** * Checks whether the user has the permission to perform a particular action. * * @param string $permission The permission to be tested * @param integer $role_id The role for which the permission should be tested * * @return boolean */ public static function getPermission($permission, $role_id = null) { $role_id = $role_id === null ? $_SESSION["role_id"] : $role_id; if ($role_id == 1) { return true; } else { $model = model::load("system.permissions"); $data = $model->get(array("fields" => array("value"), "conditions" => "role_id = {$role_id} AND permission='{$permission}'"), Model::MODE_ASSOC, false, false); return $data[0]["value"]; } }
public static function defaultGetPermission($permission, $role_id) { $role_id = $role_id === null ? $_SESSION["role_id"] : $role_id; if ($role_id == 1) { return true; } else { $model = model::load("system.permissions"); $data = $model->get(array("fields" => array("value"), "filter" => "role_id =? AND permission=?", "bind" => array($role_id, $permission)), Model::MODE_ASSOC, false, false); return $data[0]["value"]; } }
function entry_unsubscribe() { $node_id = intval($_REQUEST['node_id']); if ($node_id <= 0) { return; } $node_mod = model::load('node'); $node_mod->init('user_node_relation'); $res = $node_mod->delete(array('node_id' => $node_id, 'user_id' => $this->user_id)); $node_mod->delete_select_cache(array('node_id'), array('user_id' => $this->user_id), null, 5000); echo $res; }
function entry_register() { $model = model::load('user'); if (is_post()) { if ($model->register($_POST)) { header('Location: /'); } else { $this->assign['message'] = $model->message; $this->display('message'); exit; } } $this->display('register'); }
public function __construct($path = null, $value = null) { if ($path != null) { $info = Model::resolvePath($path); if ($value == "") { $value = $info["field"]; } $this->model = model::load($info["model"]); $field = $this->model->getFields(array($value)); $this->setLabel($field[0]["label"]); $this->setDescription($field[0]["description"]); $this->setName($info["field"]); $this->addSearchField($value); $this->storedField = $info["field"]; } }
public static function getPermission($permission, $role_id = null, $user_id = null) { if ($role_id === null) { $user_id = $user_id == null ? $_SESSION['user_id'] : $user_id; $userRoleModel = model::load("auth.users_roles"); $usersRolesData = $userRoleModel->get(array("filter" => "user_id =?", "bind" => array($user_id)), Model::MODE_ASSOC, false, false); foreach ($usersRolesData as $rolesData) { if (User::defaultGetPermission($permission, $rolesData['role_id'])) { //if any of the permissions for that role exists return true to calling function return true; } } //return false to calling function, if none of the permissions returns true return false; } else { return User::defaultGetPermission($permission, $role_id); } }
function __construct() { $this->session = new SessionStorageDb(); $this->session->setConf(DB_HOST . ':' . DB_PORT, DB_USER, DB_PASSWORD, DB_NAME); session_set_save_handler($this->session, true); session_start(); if (!$_SESSION['user_id']) { $user_mod = model::load('user'); $user_mod->check_login(); } $this->user_id = $_SESSION['user_id']; $this->is_admin = isset($_SESSION['is_admin']) ? 1 : 0; $sys_model = model::load('sys_config'); $sys_config = $sys_model->make_assoc($sys_model->select_cache(array($sys_model->pkey, 'v')), 'v'); $this->assign['sys_config'] = $sys_config; //if($sys_config['rewrite']) // define('REWRITE',1); }
<?php if (tp('verif') == 1) { model::load('synthese', 'editsynthese'); if (!editsyn(tp('titrfr'), tp('titren'), tp('titrar'), tp('contfr'), tp('conten'), tp('contar'), tp('id'), tp('dat'))) { exit("0"); } else { exit("1"); } } else { view::load('synthese', 'editsynthese'); }
<?php if (tp('verif') == 1) { global $db; //Check if id corespond nom $datedebut = new DateTime(tp('date_debut')); $datefin = new DateTime(tp('date_fin')); if ($datedebut >= $datefin) { exit("0"); } model::load('recette', 'editlocation'); if (!editlocation(tp('id'), tp('nom'), tp('adresse'), tp('pjid'), tp('tel'), tp('email'), tp('villa'), tp('date_debut'), tp('date_fin'), tp('type_paiement'), tp('montant_location'), tp('agarantie_location'))) { exit("1"); } else { exit("2"); } } else { view::load('recette', 'editlocation'); }
public static function session_autoclosed() { global $db; if (isset($_SESSION['ssid'])) { $ssid = $_SESSION['ssid']; $expired = $db->QuerySingleValue0("select expir from session where id='{$ssid}'"); if ($expired != NULL) { Cookie::close_session_open(); model::load('login', 'login'); //Stop session stop_session(); token::delimda(); $msg = "Vous êtes déconnecté automatiquement pour inactivité de 5 min {$expired} {$ssid} , redirection vers page login.... "; exit(msgbox($msg, 0, './', 5)); } } }
<?php if (isset($_POST['verif']) && $_POST['verif'] == 1) { //verif si il y a une image. if (tp('photoid') != '') { $img = tp('photoid'); } else { $img = ''; } model::load('page', 'editpage'); if (!editpage(tp('titrfr'), tp('titren'), tp('titrar'), tp('contfr'), tp('conten'), tp('contar'), tp('parent'), $img, tp('id'), tp('titrimgfr'), tp('titrimgar'), tp('ximg'), tp('yimg'))) { exit("0"); } else { exit("1"); } } else { view::load('page', 'editpage'); }
$router = false; $fields = array(); if ($model = model::load(array('self' => array('reference' => $reference)), $route, $router)) { $fields = $router->runner->backend_context['model']['fields']; } if (!$model && $parent !== false) { if ($prev !== false && ($router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_TREE || $router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_TREE_DESC)) { $SQL_SP = 'CALL `{PREFIX}tree_insert`(?, ?, ?, ?)'; \db::query($SQL_SP, array($reference, $parent, $prev, $lang)); } elseif ($order_no !== false && ($router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_INDEX || $router->runner->model_context['orderBy'] === \Routerunner\Routerunner::BY_INDEX_DESC)) { $SQL_SP = 'CALL `{PREFIX}order_insert`(?, ?, ?, ?)'; \db::query($SQL_SP, array($reference, $parent, $order_no, $lang)); } $router = false; \Routerunner\Routerunner::$static->config('mode', 'blank'); if ($model = model::load(array('self' => array('reference' => $reference)), $route, $router, true)) { $fields = $router->runner->backend_context['model']['fields']; } \Routerunner\Routerunner::$static->config('mode', 'cms'); } $SQL = <<<SQL SELECT models.model_class, models.table_from, models.table_id FROM `{PREFIX}models` AS models WHERE models.reference = :reference SQL; $update = array(); if ($result = \db::query($SQL, array(':reference' => $reference))) { $model_data = array_shift($result); $pk = false; if (is_array($change)) { $SQL = <<<SQL
<?php //Suppression ligne if (tg('del') != 0) { $sqladdby = "Select addby from noteservice where noteservice.id=" . tg('del'); $userss = $_SESSION['userid']; $useradd = $db->QuerySingleValue0($sqladdby); if ($userss != $useradd) { // Autorisation test exit("2"); } model::load('note', 'note'); if (!delet(tg('del'))) { //Function error exit("1"); } // Succes function exit("0"); } if (tg('srch') == 0) { view::load('note', 'note'); } else { view::load('note', 'notesrch'); }
<?php if (isset($_REQUEST['del']) && $_REQUEST['del'] == 1) { model::load('mail', 'mail'); if (!suppuser($_REQUEST['usrid'])) { $reponse = 'Erreur Opération'; } else { $reponse = 'ok'; } } else { view::load('mail', 'mail'); } view::load('mail', 'mail');
<?php if (tp('verif') == 1) { //verif si il y a une image. model::load('album', 'editalbum'); if (!editalbum(tp('titrfr'), tp('titren'), tp('titrar'), tp('imgid'), tp('id'))) { $reponse = 0; } else { $reponse = 1; } echo $reponse; } else { view::load('album', 'editalbum'); }
<?php model::load('login', 'login'); //Stop session token::delimda(); stop_session(); // Aller Page d'index //header ('location:./'); view::load('login', 'error');
<?php if (tp('verif') == 1) { model::load('admin', 'editcompteuser'); $iduser = tp('iduser'); if (!edituser($iduser, tp('firstname'), tp('lastname'), tp('password'), tp('username'), tp('service'), tp('agence'), tp('tel'), tp('email'))) { exit("2"); } else { exit("1"); } } else { view::load('admin', 'editcompteuser'); }
case "Bimensuel": $cycle_v = 2; break; case "Trimestriel": $cycle_v = 3; break; case "Semestriel": $cycle_v = 6; break; case "Annuel": $cycle_v = 12; break; } $rest_devision = ($diff_year * 12 + ($diff_month + 1)) % $cycle_v; $nbr_collecte = ($diff_year * 12 + ($diff_month + 1)) / $cycle_v; model::load('gestionvilla', 'addcontrat'); if (strtotime(tp('datef')) > strtotime(tp('dated'))) { $rest2 = $depot_garantie % $cycle_v; if ($rest_devision != 0) { exit("4"); } else { if ($rest2 != 0) { exit("5"); } else { if ($depot_garantie > $diff_month + 1) { exit("5"); } else { if ($dat1 != $dat11) { exit("6"); } else { if ($dat2 != $dat22) {
<?php if (tp('verif') == 1) { model::load('villa', 'addvilla'); if (!addvilla(tp('nom'), tp('adresse'), tp('prix'))) { exit("0"); } else { exit("1"); } } else { view::load('villa', 'addvilla'); }
<?php if (tp('verif') == 1) { //verif si il y a une image. if (tp('photoid') != '') { $img = tp('photoid'); } else { $img = ''; } $nextid = getnextidtable('contenu'); model::load('contenu', 'addcontenu'); if (!addcontenu(tp('titrfr'), tp('titren'), tp('titrar'), tp('contfr'), tp('conten'), tp('contar'), tp('modul'), $img, $nextid, tp('vod'), tp('fileuploadid'), tp('dat'))) { exit("0"); } else { exit("1"); } } else { view::load('contenu', 'addcontenu'); }
<?php if (tp('verif') == 1) { $if = tp('if'); $rs = tp('rs'); //Check if have same Titre and same Chapitre $exist = $db->QuerySingleValue0("select count(id) from fournisseur where `if` = '{$if}' "); if ($exist > 0) { exit("Ce bénificaire existe dans la base de donnée"); } model::load('benificaire', 'benificaire'); if (!add_fournisseur(tp('rs'), tp('nom'), tp('prenom'), tp('adr'), tp('if'), tp('ville'), tp('pays'), tp('tel'), tp('mail'), tp('mobile'), tp('fax'))) { exit("2"); } else { exit("1"); } } else { view::load('benificaire', 'addbenificaire'); }
//Success Opération } } else { if (tp('show') == 1) { $id_news = tp('lin'); model::load('news', 'news'); //Execute Model if (!shownews($id_news)) { exit("2#Erreur Système"); //Error opération } else { exit("1#Suppression réussie"); //Success Opération } } else { if (tp('arch') == 1) { $id_news = tp('lin'); model::load('news', 'news'); //Execute Model if (!archnews($id_news)) { exit("2#Erreur Système"); //Error opération } else { exit("1#Suppression réussie"); //Success Opération } } else { view::load('news', 'news'); } } }
//Success Opération } } else { if (tp('show') == 1) { $id_vod = tp('lin'); model::load('vod', 'vod'); //Execute Model if (!showvod($id_vod)) { exit("2#Erreur Système"); //Error opération } else { exit("1#Suppression réussie"); //Success Opération } } else { if (tp('arch') == 1) { $id_vod = tp('lin'); model::load('vod', 'vod'); //Execute Model if (!archvod($id_vod)) { exit("2#Erreur Système"); //Error opération } else { exit("1#Suppression réussie"); //Success Opération } } else { view::load('vod', 'vod'); } } }
<?php //addnews($titrfr,$titren,$titrar,$contfr,$conten,$contar,$img,$id,$autfr,$auten,$autar,$slider) if (tp('verif') == 1) { //verif si il y a une image. $nextid = getnextidtable('contenu'); if (tp('slider') == "1" && tp('photoid') == NULL) { exit("2#Pour afficher cette actualité dans le slider il faut insérer une photo !"); } /*if(tp('photoid')!="" ) { $slider=tp('slider'); } else{ $slider=''; }*/ model::load('news', 'addnews'); if (!addnews(tp('titrfr'), tp('titren'), tp('titrar'), tp('contfr'), tp('conten'), tp('contar'), tp('photoid'), $nextid, tp('autfr'), tp('auten'), tp('autar'), tp('slider'), tp('dat'), tp('flash'), tp('vod'), tp('phototid'))) { exit("2#Erreur système"); } else { exit("1#Opération réussie"); } } else { view::load('news', 'addnews'); }
addcollecte($id_contrat, date('Y-m-d-', strtotime($date_start)), date('Y-m-d-', strtotime($date_end)), $montant, "Payé", date('Y-m-d-', strtotime($date_start))); } else { addcollecte($id_contrat, date('Y-m-d-', strtotime($date_start)), date('Y-m-d-', strtotime($date_end)), $montant, "Non Payé", ''); } } // $reponse = 'ok'; exit("1#Opération réussie"); //Success Opération } } if (tp('del') == 1) { global $db; $id_contrat = tp('lin'); $idvil = tg('id'); $nbr_collecte = $db->QuerySingleValue0("select count(id) from collecte where id_location={$id_contrat}"); model::load('gestionvilla', 'contralocatvila'); if ($nbr_collecte > 0) { if (!deletcollecte($id_contrat)) { exit("2#Erreur Système COL"); } if (!deletcontrat($id_contrat)) { exit("2#Erreur Système CON"); } if (!$db->Query("update villa set contrat=0,statut=0 where id=" . $idvil)) { exit("2#Erreur Système VIL"); } exit("1#Opération réussie"); } else { if (!deletcontrat($id_contrat)) { exit("2#Erreur Système"); } else {
<?php if (tp('verif') == 1) { model::load('gestionvilla', 'resiliercontrat'); if (!compare_date(tp('idcontrat'), tp('date'))) { exit("3"); } else { if (!setcontrat(tp('idcontrat'), tp('date'), tp('pjid'))) { exit("2"); } else { setvilla(tp('villa')); exit("1"); } } } else { view::load('gestionvilla', 'resiliercontrat'); }
<?php global $db; if (tp('del') == 1) { $id_villa = tp('lin'); //Check if have contrat $nbr_contrat = $db->QuerySingleValue0("select count(id) from contrat_location_villa where idvilla= {$id_villa} "); if ($nbr_contrat > 0) { exit("2#{$nbr_contrat}"); } model::load('gestionvilla', 'gestionvilla'); //Execute Model if (!delet($id_villa)) { exit("3"); //Error opération } else { exit("1"); //Success Opération } } $nextid = getnextidtable('contrat_location_villa'); $session = new session(); $session->set('nextid', $nextid); view::load('gestionvilla', 'gestionvilla');