Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 function pagination($messageParPage, $table, $sscategorie)
 {
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Première entrée
     */
     $sscategorie = Utils::anti_injection($sscategorie);
     $pagination_array = array();
     $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . $table . " 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($_GET['page'])) {
         $pagination_array[2] = intval($_GET['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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 function pagination2($messageParPage, $table, $id)
 {
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Premiere entree
     */
     $id = Utils::anti_injection($id);
     $pagination_array = array();
     $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . $table . " where titre_txt_fr like '%" . $id . "%' or description_txtbox_fr like '%" . $id . "%'";
     $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($_GET['page'])) {
         $pagination_array[2] = intval($_GET['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;
 }
Ejemplo n.º 5
0
 function login()
 {
     $retour = false;
     $this->login = Db::escape($_POST[LOGIN]);
     $_SESSION['user'] = $this->login;
     $mdp = Db::escape($_POST['mdp']);
     $getAuth = Query::connexion($this->login, $mdp);
     if (Db::num_rows($getAuth) > 0) {
         $entry = Db::fetch_assoc($getAuth);
         // Mise en session de la connexion et des accès
         $_SESSION['key'] = true;
         $_SESSION[LOGIN] = $this->login;
         foreach ($entry as $column => $value) {
             if ($column == ACCESS) {
                 $_SESSION[ACCESS] = $value;
             }
         }
         // Sauve la transaction pour l'historique
         Db::add_transaction_execute(LOGIN, "4294967290", $_SESSION[LOGIN]);
         $retour = true;
     } else {
         $getLogin = Query::connexionLogin($this->login);
         if (Db::num_rows($getLogin) > 0) {
             $this->errors = "pwd";
         } else {
             $this->errors = LOGIN;
         }
         $retour = false;
     }
     return $retour;
 }
Ejemplo n.º 6
0
 /**
  * Find feeds from db
  *
  * @return array feeds
  */
 protected function getFeeds()
 {
     $feeds = array();
     $result = $this->dbh->query("SELECT id, title\n                FROM ttrss_feeds\n                WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title");
     while ($line = $this->dbh->fetch_assoc($result)) {
         $feeds[] = (object) $line;
     }
     return $feeds;
 }
Ejemplo n.º 7
0
 function sendNewsletter($titre, $contenu, $view)
 {
     $passage_ligne = "\r\n";
     //=====Déclaration des messages au format HTML
     $patterns = array();
     $replacements = array();
     $patterns[0] = '/<h1/';
     $replacements[0] = '<h1 style="width:770px;line-height:25px;font-size:18px;padding-left:5px;background-color:#f49f25;"';
     $string = preg_replace($patterns, $replacements, stripslashes($contenu));
     $string = str_replace('../albums', 'http://www.pcf-cdh.be/albums', $string);
     $string = str_replace("<a href=", "<a style=\"color:#f49f25;\" href=", $string);
     $message_html = "\n\t\t\t<div style=\"width:800px;min-height:600px;font-size:11px;font-family:Verdana;\">\n\t\t\t\t<div>\n\t\t\t\t\t<img src=\"http://www.pcf-cdh.be/images/header.jpg\" height=\"175px;\" />\n\t\t\t\t</div>\n\t\t\t\t<div style=\"margin-left:14px;width:770px;min-height:300px;\">\n\t\t\t\t" . $string . "\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<a style=\"text-decoration:none;\" href=\"http://www.pcf-cdh.be/deputy.php\"><img src=\"http://www.pcf-cdh.be/images/footer.jpg\" style=\"height:66px;border:none;\" /></a>\n\t\t\t\t\t<a style=\"text-decoration:none;\" href=\"http://www.pcf-cdh.be\"><img src=\"http://www.pcf-cdh.be/images/footer2.jpg\" style=\"height:50px;border:none;\" /></a>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"width:800px;text-align:center;\">\n\t\t\t\t\t<a style=\"text-decoration:none;font-size:8px;\" href=\"http://www.pcf-cdh.be/desincription.php\">Se désabonner de la newsletters</a>\n\t\t\t\t</div>\n\t\t\t</div>";
     //=====Création de la boundary
     $boundary = "-----=" . md5(rand());
     $boundary_alt = "-----=" . md5(rand());
     //=====Définition du sujet
     $sujet = "Newsletter du groupe cdH : " . $titre;
     //=========
     //=====Création du header de l'e-mail
     $header = "From: " . MAIL . "" . $passage_ligne;
     $header .= "Reply-to: " . MAIL . "" . $passage_ligne;
     $header .= "MIME-Version: 1.0" . $passage_ligne;
     $header .= "Content-Type: multipart/mixed;" . $passage_ligne . " boundary=\"{$boundary}\"" . $passage_ligne;
     //==========
     //=====Création du message
     $message = $passage_ligne . "--" . $boundary . $passage_ligne;
     $message .= "Content-Type: multipart/alternative;" . $passage_ligne . " boundary=\"{$boundary_alt}\"" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary_alt . $passage_ligne;
     //=====Ajout du message au format HTML
     $message .= "Content-Type: text/html; charset=\"ISO-8859-1\"" . $passage_ligne;
     $message .= "Content-Transfer-Encoding: 8bit" . $passage_ligne;
     $message .= $passage_ligne . $message_html . $passage_ligne;
     //=====On ferme la boundary alternative
     $message .= $passage_ligne . "--" . $boundary_alt . "--" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary . $passage_ligne;
     //=====Envoi de l'e-mail
     if ($view == true) {
         $sqlQuery = "SELECT email_txt FROM cdh_newsletter";
         $getEntries = Db::query($sqlQuery);
         if (Db::num_rows($getEntries) > 0) {
             $entry = Db::fetch_assoc($getEntries);
             while ($entry) {
                 foreach ($entry as $column => $value) {
                     $value = stripslashes(htmlentities($value, ENT_QUOTES, "iso-8859-1"));
                     mail($value, $sujet, $message, $header);
                 }
                 $entry = Db::fetch_assoc($getEntries);
             }
         }
         header("Location: http://www.pcf-cdh.be/admin/index.php?module=newsletter&categorie=5&sscategorie=14&send=true");
     } else {
         mail('', $sujet, $message, $header);
         mail('', $sujet, $message, $header);
         mail('', $sujet, $message, $header);
         header("Location: http://www.pcf-cdh.be/admin/index.php?module=newsletter&categorie=5&sscategorie=14&send=true");
     }
 }
Ejemplo n.º 8
0
 function sendNewsletter($titre, $contenu, $view)
 {
     $passage_ligne = "\r\n";
     //=====Declaration des messages au format HTML
     $patterns = array();
     $patterns[0] = '/<img src="../albums/';
     $replacements = array();
     $replacements[0] = '<img src="http://www.microniser.com/albums/';
     $string = preg_replace($patterns, $replacements, stripslashes($contenu));
     $string = str_replace("<a href=", "<a style=\"color:#f49f25;\" href=", $string);
     $message_html = "\r\n\t\t\t<div style=\"width:800px;min-height:600px;font-size:10px;font-family:Verdana;\">\r\n\t\t\t\t<div>\r\n\t\t\t\t\tIMAGE ENTETE\r\n\t\t\t\t</div>\r\n\t\t\t\t<div style=\"margin-left:14px;width:770px;min-height:300px;\">\r\n\t\t\t\t" . $string . "\r\n\t\t\t\t</div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\tIMAGE PIED DE PAGE\r\n\t\t\t\t</div>\r\n\t\t\t\t<div style=\"width:800px;text-align:center;\">\r\n\t\t\t\t\t<a style=\"text-decoration:none;font-size:8px;\" href=\"http://www.microniser.com/desincription.php\">Se d&eacute;sabonner de la newsletters</a>\r\n\t\t\t\t</div>\r\n\t\t\t</div>";
     //=====Creation de la boundary
     $boundary = "-----=" . md5(rand());
     $boundary_alt = "-----=" . md5(rand());
     //=====Definition du sujet
     $sujet = "Newsletter Microniser : " . $titre;
     //=========
     //=====Creation du header de l'e-mail
     $header = "From: " . MAIL . "" . $passage_ligne;
     $header .= "Reply-to: " . MAIL . "" . $passage_ligne;
     $header .= "MIME-Version: 1.0" . $passage_ligne;
     $header .= "Content-Type: multipart/mixed;" . $passage_ligne . " boundary=\"{$boundary}\"" . $passage_ligne;
     //==========
     //=====Creation du message
     $message = $passage_ligne . "--" . $boundary . $passage_ligne;
     $message .= "Content-Type: multipart/alternative;" . $passage_ligne . " boundary=\"{$boundary_alt}\"" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary_alt . $passage_ligne;
     //=====Ajout du message au format HTML
     $message .= "Content-Type: text/html; charset=\"ISO-8859-1\"" . $passage_ligne;
     $message .= "Content-Transfer-Encoding: 8bit" . $passage_ligne;
     $message .= $passage_ligne . $message_html . $passage_ligne;
     //=====On ferme la boundary alternative
     $message .= $passage_ligne . "--" . $boundary_alt . "--" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary . $passage_ligne;
     //=====Envoi de l'e-mail
     if ($view == true) {
         $sqlQuery = "SELECT email_txt FROM micro_newsletters";
         $getEntries = Db::query($sqlQuery);
         if (Db::num_rows($getEntries) > 0) {
             $entry = Db::fetch_assoc($getEntries);
             while ($entry) {
                 foreach ($entry as $column => $value) {
                     $value = stripslashes(htmlentities($value, ENT_QUOTES, "iso-8859-1"));
                     //mail($value, $sujet, $message, $header);
                 }
                 $entry = Db::fetch_assoc($getEntries);
             }
         }
         header("Location: http://www.microniser.com/admin/index.php?module=newsletters&categorie=7&sscategorie=41&send=true");
     } else {
         mail('', $sujet, $message, $header);
         header("Location: http://www.microniser.com/admin/index.php?module=newsletters&categorie=7&sscategorie=41");
     }
 }
Ejemplo n.º 9
0
 function sendNewsletter($groupe, $sujet, $contenu)
 {
     //=====Declaration des messages au format HTML
     $message_html = "\n\t\t\t<div style=\"width:800px;min-height:600px;font-size:10px;font-family:Verdana;\">\n\t\t\t\t<div>\n\t\t\t\t\tIMAGE ENTETE\n\t\t\t\t</div>\n\t\t\t\t<div style=\"margin-left:14px;width:770px;min-height:300px;\">\n\t\t\t\t" . $contenu . "\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\tIMAGE PIED DE PAGE\n\t\t\t\t</div>\n\t\t\t\t<div style=\"width:800px;text-align:center;\">\n\t\t\t\t\t<a style=\"text-decoration:none;font-size:8px;\" href=\"http://www.microniser.com/desincription.php\">Se d&eacute;sabonner de la newsletters</a>\n\t\t\t\t</div>\n\t\t\t</div>";
     //=====Envoi de l'e-mail
     $getEntries = Query::selectEmailNewslettersWithGroup($groupe);
     if (Db::num_rows($getEntries) > 0) {
         $entry = Db::fetch_assoc($getEntries);
         while ($entry) {
             foreach ($entry as $column => $email) {
                 //Mail::ConstructBoundary($email, $sujet, $message_html)
                 echo $email;
             }
             $entry = Db::fetch_assoc($getEntries);
         }
     }
     header("Location: " . SITE_URL . "/admin/webpassions.php?module=historiquenewsletters&categorie=130&sscategorie=130&send=send" . $groupe);
 }
Ejemplo n.º 10
0
 function getEnumValue($column, $val)
 {
     $sqlQuery = "SELECT " . $column . " FROM " . TABLE_PREFIX . CATEGORIE_NOM . "_" . $column;
     $getEntries = Db::query($sqlQuery);
     $tmp = '<select name="' . $column . '" class="jNiceSelectWrapper"><option></option>';
     if (Db::num_rows($getEntries) > 0) {
         $entry = Db::fetch_assoc($getEntries);
         while ($entry) {
             foreach ($entry as $column => $option) {
                 $selected = $val == $option ? 'selected="selected"' : '';
                 // are we selected?
                 $tmp .= '<option value="' . $option . '" ' . $selected . '>' . $option . '</option>';
             }
             $entry = Db::fetch_assoc($getEntries);
         }
     }
     $tmp .= '</select>';
     return $tmp;
 }
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
0
 function pagination($messageParPage, $sscategorie, $search, $searchColumn)
 {
     $pagination_array = array();
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Première entrée
     */
     $getTotal = Query::pagination($sscategorie, $search, $searchColumn);
     $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;
 }
Ejemplo n.º 13
0
 function login()
 {
     $retour = false;
     $login = Utils::anti_injection($_POST['login']);
     $getAuth = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'");
     if (Db::num_rows($getAuth) > 0) {
         $mdp = Utils::anti_injection($_POST['mdp']);
         $getMdp = 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($mdp) . "'");
         if (Db::num_rows($getMdp) > 0) {
             $_SESSION['key'] = true;
             // Mise en session de la connexion
             $retour = true;
         } else {
             $this->login = $login;
             $this->errors = "pwd";
             $retour = false;
         }
         $entry = Db::fetch_assoc($getMdp);
     } else {
         $this->errors = "login";
         $retour = false;
     }
     return $retour;
 }
Ejemplo n.º 14
0
 function displaySSMenu($lang)
 {
     $layout = "";
     $getssCategories = Query::sousCategories();
     $ssCategorie = Db::fetch_assoc($getssCategories);
     while ($ssCategorie) {
         $url = 'module=' . CATEGORIE_NOM . '&categorie=' . CATEGORIE_ID . '&sscategorie=' . $ssCategorie['id'];
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'' . $url . '\');return false;">' . $lang[WRAPPER][$ssCategorie['sscategorie']] . '</a>';
         $layout .= '</li>';
         $ssCategorie = Db::fetch_assoc($getssCategories);
     }
     if (empty($layout)) {
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'module=dashboard\');return false;">' . $lang[WRAPPER]['tableau'] . '</a>';
         $layout .= '</li>';
         if ($_SESSION[ACCESS] == FULL) {
             $layout .= '<li>';
             $layout .= '<a href="webpassions.php" onclick="formURL(\'module=statistique&categorie=110\');return false;">' . $lang[WRAPPER]['statistique'] . '</a>';
             $layout .= '</li>';
         }
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'module=document&categorie=100&folder=123456789cms\');return false;">' . $lang[WRAPPER]['help'] . '</a>';
         $layout .= '</li>';
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'module=contact\');return false;">' . $lang[WRAPPER]['contact'] . '</a>';
         $layout .= '</li>';
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'authenticate=out\');return false;">' . $lang[WRAPPER][LOGOUT] . '</a>';
         $layout .= '</li>';
     }
     return $layout;
 }
Ejemplo n.º 15
0
 public static function table_list_grid($request, $table, $field, $condition, $order = '', $bilrow = 10, $dbg = 'N')
 {
     $error = '';
     $x = 0;
     $cari = chk($request['cari']);
     $all = chk($request['fw_all']);
     $sql = "SELECT {$field} FROM {$table} WHERE {$condition}";
     list($data, $sts) = Db::query($sql);
     if ($sts != '1') {
         echo $sts;
     } else {
         if ($order == '') {
             $order = Db::field_name($data, 0);
         }
         if ($cari != '') {
             $cari = str_replace("'", "''", $cari);
             $bil_field = Db::num_fields($data);
             $carian = '';
             $array_field = explode(",", $field);
             //echo '<pre>'; print_r($array_field); echo '</pre>';
             $bil_field = count($array_field);
             for ($a = 0; $a < $bil_field; $a++) {
                 $nama_field = Db::field_name($data, $a);
                 //                            $nama_field_all = $array_field[$a];
                 //
                 //                            $pos = strpos($nama_field_all, '*');
                 //
                 //                                if ($pos === false) {
                 //                                    $nama_field = $nama_field_all;
                 //                                    switch (Db::$db)
                 //                                    {
                 //                                        case 'Pg':
                 //                                            $carian = "$carian CAST($nama_field AS TEXT) ILIKE '%$cari%' OR";
                 //                                            break;
                 //                                        case 'Mysql':
                 //                                            $carian = "$carian $nama_field LIKE '%$cari%' OR";
                 //                                            break;
                 //                                        case 'Oci':
                 //                                            $carian = "$carian lower($nama_field) LIKE lower('%$cari%') OR";
                 //                                            break;
                 //                                    }
                 //                                }
                 $type_field = Db::field_type($data, $a);
                 $array_type = array("timestamp", "float8", "int4");
                 foreach ($array_field as $fieldselect) {
                     if (strpos($fieldselect, $nama_field) !== false) {
                         $nama_field = $fieldselect;
                     }
                     $position = strpos($nama_field, ' as ');
                     if ($position != '') {
                         $nama_field = substr($nama_field, '0', $position);
                     }
                     $position = strpos($nama_field, ' AS ');
                     if ($position != '') {
                         $nama_field = substr($nama_field, '0', $position);
                     }
                     $nama_field = str_replace('DISTINCT ', '', $nama_field);
                 }
                 if (!in_array($type_field, $array_type)) {
                     switch (Db::$db) {
                         case 'Pg':
                             $carian = "{$carian} CAST({$nama_field} AS TEXT) ILIKE '%{$cari}%' OR";
                             break;
                         case 'Mysql':
                             $carian = "{$carian} {$nama_field} LIKE '%{$cari}%' OR";
                             break;
                         case 'Oci':
                             $carian = "{$carian} lower({$nama_field}) LIKE lower('%{$cari}%') OR";
                             break;
                     }
                 }
             }
             $carian = "(" . substr($carian, 1, -3) . ")";
             $condition = "{$condition} AND {$carian}";
         }
         $totalreturned = Db::num_rows($table, $field, $condition);
         $request = datagrid($request, $totalreturned, $bilrow);
         $request['fw_all'] = $all;
         $page_end = $request['page_end'];
         $bilrow = $request['bilrow'];
         $limit = $request['limit'];
         if ($totalreturned == $page_end) {
             $page_end = $page_end - $bilrow;
         }
         if ($page_end < '0') {
             $page_end = '0';
         }
         if (Db::$db == 'Oci') {
             $maxrow = $page_end + $bilrow;
             $sql = "SELECT * FROM (\n                                SELECT a.*, ROWNUM fw_bil FROM (\n                                  SELECT {$field}\n                                    FROM {$table}\n                                       WHERE {$condition}\n                                           ORDER BY {$order}\n                                ) a WHERE rownum <= {$maxrow}\n                              ) where fw_bil > {$page_end}";
             //  ORDER BY $order";
         } else {
             $condition = "{$condition} ORDER BY {$order} LIMIT {$bilrow} OFFSET {$page_end} ";
             $sql = "SELECT {$field} FROM {$table} WHERE {$condition}";
         }
         list($data, $sts) = Db::query($sql);
         if ($sts != '1') {
             echo $sts;
         } else {
             $datarow = Db::fetch_assoc($data);
             if (is_array($datarow)) {
                 foreach ($datarow as $row => $value) {
                     $datarow[$row]['fw_bil'] = $row + $page_end;
                 }
             }
         }
     }
     if ($dbg == 'Y') {
         echo "<br>DEBUG : " . $sql . "<br>";
     } elseif ($dbg == 'D') {
         echo "<br>DEBUG : " . $sql . "<br>";
         echo "<pre>";
         print_r($datarow);
         echo "</pre>";
     }
     return array('totalreturned' => $totalreturned, 'page_end' => $page_end, 'request' => $request, 'fw_senarai' => chk($datarow));
 }
Ejemplo n.º 16
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) . "'");
 }