Пример #1
0
 function login()
 {
     $retour = false;
     $login = Db::escape($_POST['login']);
     $getAuth = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `mdp_txt` = '" . Db::escape(md5($_POST['mdp'])) . "'");
     if (Db::num_rows($getAuth) > 0) {
         $_SESSION['key'] = true;
         // Mise en session de la connexion
         $entry = Db::fetch_assoc($getAuth);
         $retour = true;
     } else {
         $getLogin = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'");
         if (Db::num_rows($getLogin) > 0) {
             $this->login = $login;
             $getPwd = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `mdp_txt` = '" . Db::escape(md5($_POST['mdp'])) . "'");
             if (Db::num_rows($getPwd) <= 0) {
                 $this->errors = "pwd";
             }
         } else {
             $this->errors = "login";
         }
         $retour = false;
     }
     return $retour;
 }
Пример #2
0
 function changepwd()
 {
     $retour = true;
     $oldpwd = Db::escape($_POST['old']);
     $newpwd = Db::escape($_POST['new']);
     $verifpwd = Db::escape($_POST['verif']);
     $login = Db::escape($_POST['login']);
     $getLogin = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'");
     if (Db::num_rows($getLogin) > 0) {
         $this->login = $login;
         $getPwd = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `mdp_txt` = '" . md5($oldpwd) . "'");
         if (Db::num_rows($getPwd) > 0) {
             if ($newpwd != $verifpwd) {
                 $this->errors = "changeVerif";
                 $retour = false;
             } else {
                 Db::query("UPDATE " . TABLE_PREFIX . "admin SET mdp_txt = '" . md5($newpwd) . "' WHERE login_txt = '" . $login . "'");
             }
         } else {
             $this->errors = "pwd";
             $retour = false;
         }
     } else {
         $this->errors = "login";
         $retour = false;
     }
     return $retour;
 }
 function changepwd()
 {
     $retour = true;
     $oldpwd = Db::escape($_POST['old']);
     $newpwd = Db::escape($_POST['new']);
     $verifpwd = Db::escape($_POST['verif']);
     $login = Db::escape($_POST['login']);
     $getLogin = Query::connexionLogin($login);
     if (Db::num_rows($getLogin) > 0) {
         $this->login = $login;
         $getPwd = Query::connexion($login, $oldpwd);
         if (Db::num_rows($getPwd) > 0) {
             if ($newpwd != $verifpwd) {
                 $this->errors = "changeVerif";
                 $retour = false;
             } else {
                 Query::updatePassword($newpwd, $login);
             }
         } else {
             $this->errors = "pwd";
             $retour = false;
         }
     } else {
         $this->errors = "login";
         $retour = false;
     }
     return $retour;
 }
Пример #4
0
 function index($ctx)
 {
     $page = $_GET['page'] ? intval($_GET['page']) : 0;
     $size = $_GET['size'] ? intval($_GET['size']) : 10;
     $s = $_GET['s'];
     $keyword_type = $_GET['keyword_type'];
     $ctx->s = $s;
     $ctx->page = $page;
     $ctx->size = $size;
     $ctx->keyword_type = $keyword_type;
     $where = "1";
     if ($s || $keyword_type) {
         $s2 = Db::escape_like_string($s);
         $where .= " and id in(\n\t\t\t\tselect item_id from wx_reply_keywords where 1";
         if ($s) {
             $where .= " and keyword like '%{$s2}%'";
         }
         if ($keyword_type) {
             $keyword_type = Db::escape($keyword_type);
             $where .= " and type='{$keyword_type}'";
         }
         $where .= ")";
     }
     $ds = WxReplyItem::paginate($page, $size, $where, 'id desc');
     $ctx->ds = $ds;
 }
Пример #5
0
 public function testQuote()
 {
     $vm_ret = $this->db->escape("Editeur d'item de liste");
     $this->assertEquals("Editeur d\\'item de liste", $vm_ret);
     $vm_ret = $this->db->escape('bar "foo"');
     $this->assertEquals('bar \\"foo\\"', $vm_ret);
 }
Пример #6
0
 function reset_keywords($new_kws_str, $type = 'equal')
 {
     $ks = $this->keywords();
     $old_kws = array();
     foreach ($ks as $k) {
         $old_kws[] = $k->keyword;
     }
     $ps = explode(',', $new_kws_str);
     $kws = array();
     foreach ($ps as $p) {
         $p = trim($p);
         if (strlen($p)) {
             $kws[$p] = $p;
         }
     }
     $to_del = array_diff($old_kws, $kws);
     foreach ($to_del as $k) {
         Db::escape($k);
         $sql = "delete from wx_reply_keywords where item_id='{$this->id}' and keyword='{$k}'";
         Db::query($sql);
     }
     $to_add = array_diff($kws, $old_kws);
     foreach ($to_add as $k) {
         WxReplyKeyword::save(array('type' => $type, 'keyword' => $k, 'item_id' => $this->id));
     }
     $sql = "update " . WxReplyKeyword::table() . " set type='{$type}' where item_id='{$this->id}'";
     Db::update($sql);
 }
Пример #7
0
 function pagination($messageParPage, $sscategorie, $search, $searchColumn)
 {
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Première entrée
     */
     $pagination_array = array();
     if (!empty($search)) {
         $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . CATEGORIE_NOM . " WHERE sscat_radio = '" . $sscategorie . "' AND ";
         for ($i = 0; $i < sizeof($searchColumn); $i++) {
             if ($i != 0 && $i != sizeof($searchColumn)) {
                 $sqlQuery .= "OR ";
             }
             $sqlQuery .= $searchColumn[$i] . " like '%" . Db::escape($search) . "%' ";
         }
     } else {
         $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . CATEGORIE_NOM . " WHERE sscat_radio = '" . $sscategorie . "'";
     }
     $getTotal = Db::query($sqlQuery);
     $donnees_total = Db::fetch_assoc($getTotal);
     $pagination_array[0] = $donnees_total['total'];
     $pagination_array[1] = ceil($pagination_array[0] / $messageParPage);
     if (isset($_POST['page'])) {
         $pagination_array[2] = intval($_POST['page']);
         if ($pagination_array[2] > $pagination_array[1] && $pagination_array[1] > 0) {
             $pagination_array[2] = $pagination_array[1];
         }
     } else {
         $pagination_array[2] = 1;
     }
     $pagination_array[3] = ($pagination_array[2] - 1) * $messageParPage;
     return $pagination_array;
 }
Пример #8
0
 public static function escapeArray($arr)
 {
     $escaped = array();
     foreach ($arr as $item) {
         array_push($escaped, Db::escape($item));
     }
     return $escaped;
 }
Пример #9
0
 /**
  * Logs an activity.
  * @param string $activity
  * @param string $data
  */
 public static function log($activity, $data = null)
 {
     $db = Db::get();
     $data = Db::escape(json_encode($data));
     if (ENABLE_AUDIT_TRAILS === true && class_exists("SystemAuditTrailModel", false)) {
         SystemAuditTrailModel::log(array('item_id' => 0, 'item_type' => 'system_activity', 'description' => $activity, 'type' => SystemAuditTrailModel::AUDIT_TYPE_SYSTEM));
     }
 }
Пример #10
0
 /**
  * {@inheritDoc}
  */
 public function getContextoId($espacialidade, $id)
 {
     $_id = Db::escape($id);
     $tab = MapaTabela::getTabela($espacialidade);
     $fk = MapaTabela::getChaveEstrangeira(ESP_REGIAOMETROPOLITANA, $espacialidade);
     $sql = sprintf("SELECT \n                e.id AS id\n            FROM \n                estado AS e,\n                %s AS t\n            WHERE \n                t.id=%d \n                AND t.%s=e.id", $tab, $_id, $fk);
     $this->bd->execSql($sql);
     if ($row = $this->bd->proximo()) {
         return $row->id;
     }
     return null;
 }
Пример #11
0
 public function write($sessionId, $data)
 {
     if ($this->new) {
         Db::query(sprintf("INSERT into system.sessions(id, data, expires, lifespan) VALUES('%s', '%s', %d, %d)", $sessionId, Db::escape($data), time() + $this->lifespan, $this->lifespan), 'main');
     } else {
         if ($_GET['no_extend'] == true) {
             return true;
         } else {
             Db::query(sprintf("UPDATE system.sessions SET data = '%s', expires = %d WHERE id = '%s'", db::escape($data), time() + $this->lifespan, $sessionId), 'main');
         }
     }
     return true;
 }
Пример #12
0
 function pagination($sscategorie, $search, $searchColumn)
 {
     if (!empty($search)) {
         $sqlQuery = "SELECT COUNT(*) AS total FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE sscat_radio = '" . $sscategorie . "' AND ";
         for ($i = 0; $i < sizeof($searchColumn); $i++) {
             if ($i != 0 && $i != sizeof($searchColumn)) {
                 $sqlQuery .= "OR ";
             }
             $sqlQuery .= $searchColumn[$i] . " like '%" . Db::escape($search) . "%' ";
         }
     } else {
         $sqlQuery = "SELECT COUNT(*) AS total FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE sscat_radio = '" . $sscategorie . "'";
     }
     return Query::executeQuery($sqlQuery);
 }
Пример #13
0
 /**
  * Generates suggestions for searches based upon input
  */
 public static function suggest($ps_phrase, $pa_table_nums = null, $pn_max_suggestions = 1, $pa_options = null)
 {
     $o_db = new Db();
     $va_sql = array();
     if ($pa_table_nums && !is_array($pa_table_nums)) {
         $pa_table_nums = array(intval($pa_table_nums));
     } else {
         if (!$pa_table_nums) {
             $pa_table_nums = array();
         }
     }
     if (sizeof($pa_table_nums)) {
         $va_sql[] = "(p.table_num IN (" . join(', ', $pa_table_nums) . "))";
     }
     $vs_phrase = preg_replace("![^A-Za-z\\-_0-9]+!", " ", $ps_phrase);
     $va_words = preg_split("#[ ]+#", $vs_phrase);
     while (sizeof($va_words)) {
         $vn_len = strlen($vs_phrase);
         $vn_ngram_len = $vn_len - 8;
         if ($vn_ngram_len < 3) {
             $vn_ngram_len = 3;
         }
         $va_gen_ngrams = caNgrams($vs_phrase, $vn_ngram_len, false);
         $va_ngrams = array();
         foreach ($va_gen_ngrams as $vs_ngram) {
             if ($vs_ngram) {
                 $va_ngrams[] = "'" . $o_db->escape($vs_ngram) . "'";
             }
         }
         if (sizeof($va_ngrams)) {
             $qr_res = $o_db->query("\n\t\t\t\t\t\tSELECT p.table_num, p.phrase, (count(*) + (sum(n.endpoint) * 2)) score \n\t\t\t\t\t\tFROM ca_did_you_mean_ngrams n \n\t\t\t\t\t\tINNER JOIN ca_did_you_mean_phrases AS p ON p.phrase_id = n.phrase_id WHERE \n\t\t\t\t\t\t\tn.ngram IN (" . join(',', $va_ngrams) . ") " . (sizeof($va_sql) ? ' AND ' . join(' AND ', $va_sql) : '') . "\n\t\t\t\t\t\tGROUP BY p.phrase_id \n\t\t\t\t\t\tORDER BY score DESC, p.num_words DESC, ABS(length(p.phrase) - " . $vn_len . ") ASC\n\t\t\t\t\t\tLIMIT " . intval($pn_max_suggestions));
             if ($qr_res->numRows()) {
                 $va_suggestions = array();
                 while ($qr_res->nextRow()) {
                     if (isset($pa_options['groupByTableNum']) && $pa_options['groupByTableNum']) {
                         $va_suggestions[$qr_res->get('table_num')][] = $qr_res->get('phrase');
                     } else {
                         $va_suggestions[$qr_res->get('phrase')] = $qr_res->get('score');
                     }
                 }
                 return $va_suggestions;
             }
         }
         array_pop($va_words);
         $vs_phrase = join(' ', $va_words);
     }
     return array();
 }
Пример #14
0
 function insert($table, $language)
 {
     $getColumns = mysql_query("SELECT * FROM " . $table);
     $column = mysql_fetch_field($getColumns);
     while ($column) {
         $column = $column->name;
         $columnTmp = Utils::findColumn($column, $language);
         if (isset($_POST[$columnTmp])) {
             Utils::manipulateValues($columnTmp);
             //Mise en forme des données pour la BD
             $fields[$column] = "'" . Db::escape($_POST[$columnTmp]) . "'";
         }
         $column = mysql_fetch_field($getColumns);
     }
     $sql = "INSERT INTO `" . $table . "` (`" . implode("`, `", array_keys($fields)) . "`) VALUES (" . implode(", ", $fields) . ")";
     return mysql_query($sql);
 }
Пример #15
0
 function select($table, $id = null)
 {
     if ($id != "0" && empty($id)) {
         $sql = "SELECT * FROM `" . $table . "` ORDER BY `id`";
     } elseif (is_array($id)) {
         $sql = "SELECT * FROM `" . $table . "` WHERE ";
         $first = true;
         foreach ($id as $col => $val) {
             if ($first) {
                 $first = false;
             } else {
                 $sql .= " AND ";
             }
             $sql .= "`" . Db::escape($col) . "` = '" . Db::escape($val) . "'";
         }
     } else {
         $sql = "SELECT * FROM `" . $table . "` WHERE `id` = '" . Db::escape($id) . "'";
     }
     return mysql_query($sql);
 }
Пример #16
0
 function login()
 {
     $retour = false;
     $login = Db::escape($_POST['login']);
     $mdp = Db::escape($_POST['mdp']);
     $getAuth = Query::connexion($login, $mdp);
     if (Db::num_rows($getAuth) > 0) {
         // Mise en session de la connexion
         $_SESSION['key'] = true;
         $entry = Db::fetch_assoc($getAuth);
         $retour = true;
     } else {
         $getLogin = Query::connexionLogin($login);
         if (Db::num_rows($getLogin) > 0) {
             $this->login = $login;
             $this->errors = "pwd";
         } else {
             $this->errors = "login";
         }
         $retour = false;
     }
     return $retour;
 }
Пример #17
0
 public static function escape($vars)
 {
     return Db::escape($vars);
 }
Пример #18
0
 function pagination($sscategorie, $search, $searchColumn)
 {
     if (!empty($search)) {
         if ($sscategorie == 122) {
             // Affichage de tous les abonnées astuce pour éviter les sscategorie des abonnées newsletters
             $sqlQuery = "SELECT COUNT(*) AS total FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE ";
         } else {
             $sqlQuery = "SELECT COUNT(*) AS total FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE sscat_radio = '" . $sscategorie . "' AND ";
         }
         for ($i = 0; $i < sizeof($searchColumn); $i++) {
             if ($i != 0 && $i != sizeof($searchColumn)) {
                 $sqlQuery .= "OR ";
             }
             $sqlQuery .= $searchColumn[$i] . " like '%" . Db::escape($search) . "%' ";
         }
         $sqlQuery .= "AND `delete_logical` = '0'";
     } else {
         if ($sscategorie == 122) {
             // Affichage de tous les abonnées astuce pour éviter les sscategorie des abonnées newsletters
             $sqlQuery = "SELECT COUNT(*) AS total FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE `delete_logical` = '0'";
         } else {
             $sqlQuery = "SELECT COUNT(*) AS total FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE sscat_radio = '" . $sscategorie . "' AND `delete_logical` = '0'";
         }
     }
     return Query::executeQuery($sqlQuery);
 }
Пример #19
0
 public function toString()
 {
     $sql = '';
     switch ($this->action) {
         case 'select':
             $sql = 'select ' . ($this->distinct ? 'distinct ' : '');
             $sql .= empty($this->fields) ? '*' : implode(', ', $this->fields);
             $sql .= ' from ' . implode(', ', $this->tables) . ' ';
             if (!empty($this->joins)) {
                 foreach ($this->joins as $join) {
                     $sql .= $join['type'] . ' join ' . $join['table'] . ' on ' . $join['conditions'] . ' ';
                 }
             }
             $sql .= empty($this->conditions) ? '' : ' where ' . implode(' ', $this->conditions);
             $sql .= empty($this->groupBy) ? '' : ' group by ' . implode(', ', $this->groupBy);
             $sql .= empty($this->orderBy) ? '' : ' order by ' . implode(', ', $this->orderBy);
             $sql .= $this->limit ? $this->offset ? ' limit ' . $this->offset . ', ' . $this->limit : ' limit ' . $this->limit : ($this->offset ? 'limit ' . $this->offset . ', -1' : '');
             break;
         case 'insert':
             $sql = ' insert into ' . $this->tables[0] . ' (';
             $fields = array_keys($this->data);
             $sql .= implode(', ', $fields);
             $sql .= ') values (';
             $values = array_values($this->data);
             foreach ($values as $value) {
                 $sql .= '"' . Db::escape($value) . '", ';
             }
             $sql = substr($sql, 0, -2);
             $sql .= ')';
             break;
         case 'update':
             $sql = 'update ' . $this->tables[0] . ' set';
             foreach ($this->data as $field => $value) {
                 $sql .= ' ' . $field . '="' . Db::escape($value) . '", ';
             }
             $sql = substr($q, 0, -2);
             $sql .= empty($this->conditions) ? '' : implode(' ', $this->conditions);
             break;
     }
     return $sql;
 }
Пример #20
0
 function delete($id)
 {
     return Db::executeQuery("DELETE FROM `" . TABLE_PREFIX . CATEGORIE_NOM . "` WHERE `id` = '" . Db::escape($id) . "'");
 }
Пример #21
0
				</li>
				<li><a href="fr/pre-contact.php" title="" alt="" class="menu">Contact</a></li>
			</ul>
		</div>
		<!-- end #bloc_menu -->
		
		<div class="clear"></div>
		<div id="page">
			<div id="bloc_unis">
				<h2 class="title">Newsletters</h2>
				<div class="text">
				<?php 
if (!empty($_GET['desincription'])) {
    if (!empty($_POST['email'])) {
        if (preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\\.[a-z]{2,4}\$#", $_POST['email'])) {
            $sql = "DELETE FROM `micro_newsletters` WHERE `email_txt` = '" . Db::escape($_POST['email']) . "'";
            $resultat = $Db->query($sql);
            if ($resultat == true) {
                echo '<span class="title">Votre adresse email (' . $_POST['email'] . ') a bien';
                echo htmlentities("&eacute;t&eacute; effac&eacute;e, merci.</span>");
            } else {
                echo '<span class="title">Une erreur s\'est produite durant la suppression de l\'adresse email (' . $_POST['email'] . '). <br />Veuillez r&eacute;essayer plus tard.</span>';
            }
        } else {
            echo '<span class="error">Votre adresse email est invalide.(exemple@microniser.com)</span>';
        }
    } else {
        echo '<span class="error">Aucune adresse email n\'a &eacute;t&eacute; entr&eacute;e.</span>';
    }
} else {
    if (!empty($_POST['email'])) {
Пример #22
0
 function delete($id, $categ)
 {
     $title = "";
     $getEntries = Query::selectById($id);
     if (Db::num_rows($getEntries)) {
         $entry = Db::fetch_assoc($getEntries);
         foreach ($entry as $column => $value) {
             if (CATEGORIE_NOM == "news") {
                 if ($column == "titre_txt") {
                     $title = $value;
                 }
             } elseif (CATEGORIE_NOM == "membre") {
                 if ($column == "nom_txt" || $column == "nom_txt") {
                     $title .= $value;
                 }
             } elseif (CATEGORIE_NOM == "newsletters") {
                 if ($column == "email_txt") {
                     $title = $value;
                 }
             } elseif (CATEGORIE_NOM == "users") {
                 $title = $value;
             }
         }
         $entry = Db::fetch_assoc($getEntries);
     }
     Db::add_transaction_execute(DELETE, $categ, $title);
     return Db::executeQuery("UPDATE  `" . TABLE_PREFIX . CATEGORIE_NOM . "` SET  `delete_logical` =  '1' WHERE  `id` = '" . Db::escape($id) . "'");
 }
Пример #23
0
 /**
  * 
  * 
  * @param type $conditionArray
  * @return string
  */
 public static function condition($conditionArray)
 {
     foreach ($conditionArray as $field => $condition) {
         if (is_array($condition)) {
             foreach ($condition as $clause) {
                 $conditions[] = "{$field} = '{$clause}'";
             }
         } else {
             preg_match("/(?<field>[a-zA-Z1-9_.]*)\\w*(?<operator>\\>=|\\<=|\\<\\>|\\<|\\>)?/", $field, $matches);
             $databaseField = $matches['field'];
             //$this->resolveName($matches["field"]);
             if ($condition === null) {
                 $operator = 'is';
             } else {
                 $operator = $matches["operator"] == "" ? "=" : $matches["operator"];
             }
             $condition = $condition === null ? 'NULL' : "'" . Db::escape($condition) . "'";
             $conditions[] = "{$databaseField} {$operator} {$condition}";
         }
     }
     if (is_array($conditions)) {
         $compiled = implode(" AND ", $conditions);
     }
     return $compiled;
 }
Пример #24
0
     * Specifies which theme to use for the user interface
     */            
    'theme' => 'default'
);
CONFIG;
create_file($home . 'app/config.php', $config);
create_file($home . 'app/includes.php', "<?php\n");
create_file($home . 'app/bootstrap.php', "<?php\n");
// Try to initialize the wyf framework.
require "vendor/ekowabaka/wyf/wyf_bootstrap.php";
echo "\nSetting up the database ...\n";
Db::query(file_get_contents("lib/setup/schema.sql"));
$username = get_response("Enter a name for the superuser account", 'super', null, true);
$email = get_response('Provide your email address', null, null, true);
Db::query("INSERT INTO system.roles(role_id, role_name) VALUES(1, 'Super User')");
Db::query(sprintf("INSERT INTO system.users\n    \t\t(user_name, password, role_id, first_name, last_name, user_status, email) \n    \tVALUES\n    \t \t('%s', '%s', 1, 'Super', 'User', 2, '%s')", Db::escape($username), Db::escape($username), Db::escape($email)));
Db::query("\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'can_log_in_to_web', 1, '/dashboard');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_audit_trail_can_add', 1, '/system/audit_trail');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_audit_trail_can_edit', 1, '/system/audit_trail');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_audit_trail_can_delete', 1, '/system/audit_trail');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_audit_trail_can_view', 1, '/system/audit_trail');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_audit_trail_can_export', 1, '/system/audit_trail');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_audit_trail_can_import', 1, '/system/audit_trail');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_roles_can_add', 1, '/system/roles');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_roles_can_edit', 1, '/system/roles');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_roles_can_delete', 1, '/system/roles');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_roles_can_view', 1, '/system/roles');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_roles_can_export', 1, '/system/roles');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_roles_can_import', 1, '/system/roles');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_users_can_add', 1, '/system/users');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_users_can_edit', 1, '/system/users');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_users_can_delete', 1, '/system/users');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_users_can_view', 1, '/system/users');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_users_can_export', 1, '/system/users');\n    INSERT INTO permissions (role_id, permission, value, module) VALUES (1, 'system_users_can_import', 1, '/system/users');\n");
echo "\nDone! Happy programming ;)\n\n";
/**
 * A utility function for creating files. Checks if the files are writable and
 * goes ahead to create them. If they are not it just dies!
 */
function create_file($file, $contents)
{
    if (is_writable(dirname($file))) {
        file_put_contents($file, $contents);
        return true;
    } else {
        fputs(STDERR, "Error writing to file {$file}. Please ensure you have the correct permissions");
        return false;
    }
Пример #25
0
 function auto_reply($xml)
 {
     $from = $xml->FromUserName;
     $to = $xml->ToUserName;
     $type = $xml->MsgType;
     $item = null;
     if ($type == 'text') {
         $t = trim($xml->Content);
         $t = Db::escape($t);
         $kw = WxReplyKeyword::findOne("type='equal' and keyword='{$t}'", 'id desc');
         if ($kw) {
             $item = WxReplyItem::get($kw->item_id);
         } else {
             $kws = WxReplyKeyword::find(0, 1000, "type='contain'", 'id desc');
             foreach ($kws as $kw) {
                 if (stripos($t, $kw->keyword) !== false) {
                     $item = WxReplyItem::get($kw->item_id);
                     break;
                 }
             }
         }
     } else {
         if ($type == 'event') {
             $t = $xml->Event;
             $t = Db::escape($t);
             if ($t == 'CLICK') {
                 $t = $xml->EventKey;
                 $t = Db::escape($t);
                 $kw = WxReplyKeyword::findOne("type='click' and keyword='{$t}'", 'id desc');
             } else {
                 $kw = WxReplyKeyword::findOne("type='event' and keyword='{$t}'", 'id desc');
             }
             if ($kw) {
                 $item = WxReplyItem::get($kw->item_id);
             }
         }
     }
     if ($item) {
         $wrap = $item->type == 'news' ? true : false;
         $str = $item->content;
         $reply_list = @json_decode($str, 1);
         if ($reply_list) {
             $this->send_reply_list($to, $from, $reply_list, $wrap);
         }
         return true;
     }
     return false;
 }
Пример #26
0
 function archive($id)
 {
     return Db::executeQuery("UPDATE  `" . DB_PREFIX . CATEGORIE_NOM . "` SET  `sscat_radio` =  '999' WHERE  `id` = '" . Db::escape($id) . "'");
 }
Пример #27
0
* GeniXCMS - Content Management System
* 
* PHP Based Content Management System and Framework
*
* @package GeniXCMS
* @since 0.0.1 build date 20141006
* @version 0.0.6
* @link https://github.com/semplon/GeniXCMS
* @link http://genixcms.org
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
$post = "";
$cat = Db::escape(Typo::Xclean($_GET['cat']));
$data['max'] = Options::get('post_perpage');
if (isset($_GET['paging'])) {
    $paging = Typo::int($_GET['paging']);
    if ($paging > 0) {
        $offset = ($paging - 1) * $data['max'];
    } else {
        $offset = 0;
    }
    $pagingtitle = " - Page {$paging}";
} else {
    $offset = 0;
    $paging = 1;
    $pagingtitle = "";
}
$data['sitetitle'] = "Category: " . Categories::name($cat) . $pagingtitle;