public function setNewServer($host, $user, $password, $database, $faild = self::EXCEPTION_FAILD_MODE) { //$this->server=null; // if ($host == "" and $user == "" and $database == "") { throw new DatabaseArgumentsException(); } else { Database::$server = mysqli_connect($host, $user, $password, $database); // if (!Database::$server) { if ($faild == 2) { throw new DatabaseConnectionException(); } else { if ($faild == 1) { \Errors::r_db(); } } } // mysqli_query(Database::$server, "SET NAMES " . Config::get("database.charset")); // Database::$serverData = ['host' => $host, "username" => $user, "password" => $password, "database" => $database]; // // return Database::$server; } }
public static function getMenuByGroup($group) { if (!is_array($group)) { $files = glob("../app/modules/*", GLOB_ONLYDIR); $T = array(); foreach ($files as $key => $filename) { $F = (include $filename . "/config.php"); if (count($F['menu']) > 0) { if ($F['container'] == $group) { if ($F['etat'] == "active") { $T[$key] = $F['menu']; } } } } return array_values($T); } else { if (Config::get('database.prefixing')) { $data = Database::read("select * from " . Config::get('database.prefixe') . $group['table'] . " where id='" . $group['id'] . "'", 1); $data = $data[0]; $menu = unserialize(base64_decode($data["content"])); } else { $data = Database::read("select * from " . $group['table'] . " where id='" . $group['id'] . "'", 1); $data = $data[0]; $menu = unserialize(base64_decode($data["content"])); } if (count($menu) > 0) { return $menu; } else { return "Error"; } } }
protected function setTable($table) { if (Config::get('database.prefixing')) { $this->DBtable = Config::get('database.prefixe') . $table; } else { $this->DBtable = $table; } }
public static function show() { $date_fin = Config::get("maintenance.date_fin"); $firstLine = Config::get("maintenance.firstLine"); $secondLine = Config::get("maintenance.secondLine"); $mapText = Config::get("maintenance.mapText"); $mapCoord = Config::get("maintenance.mapCoord"); $view = array("view" => 'maintenance.index', "backend" => true); $data = array('date_fin' => $date_fin, 'firstLine' => $firstLine, 'secondLine' => $secondLine, 'mapText' => $mapText, 'mapCoord' => $mapCoord); View::make($view, $data); }
/** * Display a listing of the resource. * * * @return Response */ public static function index() { $data = array("appOwner" => Base::full(Config::get("app.owner"))); $panelConfigurated = Config::get("panel.configurated"); if (!$panelConfigurated) { $view = array("view" => 'welcom.index', "backend" => true); View::make($view, $data); } else { $view = array("view" => 'welcom.home', "backend" => true); View::make($view, $data); } }
public static function redirect($url) { $link = ""; if ($url[0] == "@") { $link = Config::get('app.url') . substr($url, 1); echo $link . "<br>"; echo $url; } else { $link = $url; echo $link; } header("location:" . $link); }
public static function checkModule($name, $backend = true) { $themename = Config::get('themes.name'); $themenameFront = Config::get('themes.nameFrontEnd'); if ($backend) { if (is_dir("../app/themes/{$themename}/modules/{$name}/shortcode")) { return true; } return false; } else { if (is_dir("../themes/{$themenameFront}/modules/{$name}/shortcode")) { return true; } return false; } }
protected static function driver() { $option = Config::get('cache.options'); $default = Config::get('cache.default'); // switch ($default) { case 'file': return new FileCache(); break; case 'database': return new DatabaseCache(); break; default: throw new DriverNotFoundException(); break; } }
public static function getDriver() { switch (Config::get('database.default')) { case 'sqlite': # code... break; case 'mysql': return new MysqlDatabase(); break; case 'pgsql': # code... break; case 'sqlsrv': # code... break; } }
public static function ini($root = "") { require_once $root . '../core/Associates/Smarty/Smarty.class.php'; // self::$smarty = new \Smarty(); // self::$smarty->compile_check = true; self::$smarty->force_compile = true; self::$smarty->debugging = false; self::$smarty->caching = false; self::$smarty->use_sub_dirs = false; self::$smarty->cache_lifetime = 120; self::$smarty->left_delimiter = '{'; self::$smarty->right_delimiter = '}'; self::$smarty->smarty_debug_id = 'SMARTY_DEBUG'; self::$smarty->clearAllCache(3600); // Smarty::muteExpectedErrors(); self::$smarty->setCompileDir($root . '../app/storage/view/template'); self::$smarty->setCacheDir($root . '../app/storage/view/cache'); self::$smarty->setPluginsDir(array($root . '../app/themes/' . Config::get('themes.name') . '/_plugins', $root . '../core/Associates/Smarty/plugins')); }
public static function rememberToken($array = null) { $str = ""; // if (is_array($array)) { foreach ($array as $key => $value) { $str = $key . $value; } } else { if (is_string($array) || is_numeric($array)) { $str = str_shuffle("Youssef Had" . $array . time() . "token" . Config::get('security.key1')); } else { if (is_null($array) || empty($array)) { $str = "Youssef Had" . $array . time() . "token" . Config::get('security.key1') . "Fiesta" . Config::get('security.key2') . time() . self::random(); $str = str_shuffle($str); } } } // $token = self::make($str); return $token; }
public static function ini($root = null) { // self::$r_400 = Config::get("error.400"); self::$r_401 = Config::get("error.401"); self::$r_402 = Config::get("error.402"); self::$r_403 = Config::get("error.403"); self::$r_404 = Config::get("error.404"); self::$r_405 = Config::get("error.405"); self::$r_406 = Config::get("error.406"); self::$r_407 = Config::get("error.407"); self::$r_408 = Config::get("error.408"); self::$r_409 = Config::get("error.409"); self::$r_410 = Config::get("error.410"); self::$r_411 = Config::get("error.411"); self::$r_412 = Config::get("error.412"); self::$r_413 = Config::get("error.413"); self::$r_414 = Config::get("error.414"); self::$r_415 = Config::get("error.415"); self::$r_416 = Config::get("error.416"); self::$r_417 = Config::get("error.417"); self::$r_418 = Config::get("error.418"); self::$r_422 = Config::get("error.422"); self::$r_423 = Config::get("error.423"); self::$r_424 = Config::get("error.424"); self::$r_425 = Config::get("error.425"); self::$r_426 = Config::get("error.426"); // self::$r_500 = Config::get("error.500"); self::$r_501 = Config::get("error.501"); self::$r_502 = Config::get("error.502"); self::$r_503 = Config::get("error.503"); self::$r_504 = Config::get("error.504"); self::$r_505 = Config::get("error.505"); self::$r_507 = Config::get("error.507"); self::$r_509 = Config::get("error.509"); self::$r_db = Config::get("error.database"); // }
public static function ini($root = "") { require $root . "../core/Associates/Whoops/vendor/autoload.php"; // if (Config::get('loggin.debug')) { $whoops = new \Whoops\Run(); $errorPage = new \Whoops\Handler\PrettyPageHandler(); // $errorPage->setPageTitle(Config::get('loggin.msg')); // Set the page's title $errorPage->setEditor("sublime"); // $whoops->pushHandler($errorPage); $whoops->register(); } else { $whoops = new \Whoops\Run(); $errorPage = new \Whoops\Handler\PlainTextHandler(); $errorPage->msg = Config::get('loggin.msg'); $errorPage->bg_color = Config::get('loggin.bg'); $errorPage->handle(); $whoops->pushHandler($errorPage); $whoops->register(); } }
public function clearOld() { $all = (new Filesystem())->files("../app/" . Config::get('cache.options')["file"]['location']); // foreach ($all as $value) { // $cont = (new Filesystem())->get($value); $parts = $this->unpacking($cont); // $time = $parts["time"]; // if (time() > $time) { (new Filesystem())->delete($value); } } return true; }
public static function check() { if (Session::existe('auths')) { return true; } else { if (Cookie::existe(Config::get('auth.rememeber_cookie'))) { $y = Database::countS('select * from ' . Config::get('auth.table') . ' where rememberToken="' . Cookie::get(Config::get('auth.rememeber_cookie')) . '"'); if ($y == 1) { return true; } else { return false; } } else { return false; } } }
protected static function showMaintenance() { if (Config::get("maintenance.maintenanceEvent") == "string") { echo Config::get("maintenance.maintenanceResponse"); } else { if (Config::get("maintenance.maintenanceEvent") == "link") { Url::redirect(Config::get("maintenance.maintenanceResponse")); } } }
public static function listFolderFilesFront($dir, $dirName) { $data = null; $name = Config::get('themes.name'); $base_url = Config::get('app.base_url'); $data .= '<ul id="browser" class="filetree">'; $data .= "<li><img src='" . $base_url . "app/themes/" . $name . "/assets/medias/js/tree/images/folder.gif'/> {$dirName}"; $data .= "<ul>"; foreach (glob($dir . "/*") as $value) { $r = explode('/', $value); if (stristr($r[5], '.') == '.tpl') { $data .= "<li><img src='" . $base_url . "app/themes/" . $name . "/assets/medias/js/tree/images/smarty-icon.gif' /> <strong>" . $r[5] . "</strong></li>"; } elseif (stristr($r[5], '.') == '.php') { $data .= "<li><img src='" . $base_url . "app/themes/" . $name . "/assets/medias/js/tree/images/page_white_php.png' /> <strong>" . $r[5] . "</strong></li>"; } else { $data .= "<li><img src='" . $base_url . "app/themes/" . $name . "/assets/medias/js/tree/images/folder.gif'/> " . $r[5]; $data .= "<ul>"; foreach (glob($value . "/*") as $v) { $r2 = explode('/', $v); if (stristr($r2[6], '.') == '.tpl') { $data .= "<li><img src='" . $base_url . "app/themes/" . $name . "/assets/medias/js/tree/images/smarty-icon.gif' /> <strong>" . $r2[6] . "</strong></li>"; } elseif (stristr($r2[6], '.') == '.php') { $data .= "<li><img src='" . $base_url . "app/themes//assets/medias/js/tree/images/page_white_php.png' /> <strong>" . $r2[6] . "</strong></li>"; } } $data .= "</ul>"; } } $data .= "</ul></li>"; $data .= "</ul>"; return $data; }
public static function get($value_DGFSrtfg5, $data_kGdfgdf, $items = null) { if (is_array($data_kGdfgdf)) { foreach ($data_kGdfgdf as $key => $value2) { ${$key} = $value2; } } if (is_array($value_DGFSrtfg5)) { if ($value_DGFSrtfg5['backend']) { $themename = Config::get('themes.name'); $simpleFile = Config::get('themes.path'); $simpleFile = str_replace('{themeName}', $themename, $simpleFile); $smartyFile = Config::get('themes.path'); $smartyFile = str_replace('{themeName}', $themename, $smartyFile); } else { $themename = Config::get('themes.nameFrontEnd'); //PHP VIEW $simpleFile = Config::get('themes.pathFront'); $simpleFile = str_replace('{themeName}', $themename, $simpleFile); //TPL VIEW $smartyFile = Config::get('themes.pathFront'); $smartyFile = str_replace('{themeName}', $themename, $smartyFile); } ob_start(); // start output buffering //get File $name_fgdfgdf = str_replace('.', '/', $value_DGFSrtfg5['view']); $simpleFile = str_replace('{viewName}', $name_fgdfgdf, $simpleFile); $simpleFile = str_replace('{fileExtention}', "php", $simpleFile); $smartyFile = str_replace('{viewName}', $name_fgdfgdf, $smartyFile); $smartyFile = str_replace('{fileExtention}', "tpl", $smartyFile); $link1 = $simpleFile; $link2 = $smartyFile; $tpl = false; if (file_exists($link1)) { $link3 = $link1; $tpl = false; } else { if (file_exists($link2)) { $link3 = $link2; $tpl = true; } else { $link3 = $name_fgdfgdf; $tpl = false; } } //Show the output if ($tpl) { self::$showed = "tpl"; Template::show($link3, $data_kGdfgdf, $items); } else { self::$showed = "smpl"; include $link3; } $returned_value = ob_get_contents(); // get contents from the buffer ob_end_clean(); return $returned_value; } else { return false; } }
public static function existe($nom, $table = null) { $nom = self::tableName($nom); // $tab = is_null($table) ? Config::get('database.database') : $table; $i = Database::countS("select * FROM information_schema.tables WHERE table_schema ='" . $tab . "' AND table_name = '" . $nom . "' LIMIT 1;"); if ($i > 0) { return true; } else { return false; } }
public static function send($view, $array, $callback) { //include "../core/Associates/PHPMailer/class.phpmailer.php"; include "../core/Associates/SwiftMailer/vendor/autoload.php"; // $selfmail = new self(); $callback($selfmail); // //get The View if ($selfmail->type == "text") { $body = $view; $type = "text/plain"; } else { if ($selfmail->type == "html") { $body = View::get($view, $array); $type = "text/html"; } else { $body = $view; $type = "text/plain"; } } // if (!self::configured($selfmail)) { $selfmail->host = Config::get("mail.host"); $selfmail->port = Config::get("mail.port"); $selfmail->secure = Config::get("mail.encryption"); $selfmail->type = "html"; $selfmail->username = Config::get("mail.username"); $selfmail->password = Config::get("mail.password"); $selfmail->from['adresse'] = Config::get("mail.from")['adresse']; $selfmail->from['name'] = Config::get("mail.from")['name']; } // self::check($selfmail); // $selfmail->transport = \Swift_SmtpTransport::newInstance($selfmail->host, $selfmail->port, $selfmail->secure)->setUsername($selfmail->username)->setPassword($selfmail->password); // $message = Swift_Message::newInstance('Activation de compte Touhfat Al Arouss') // ->setFrom(array('*****@*****.**' => 'Équipe Touhfat Al Arouss')) // ->setTo(array('*****@*****.**')) // ->setBody($body , "text/html"); //var_dump($selfmail->transport); $mailer = \Swift_Mailer::newInstance($selfmail->transport); $subject = is_null($selfmail->subject) ? Config::get('mail.subject') : $selfmail->subject; // //The Message $message = \Swift_Message::newInstance($subject); $message->setBody($body, $type); $message->setFrom(array($selfmail->from['adresse'] => $selfmail->from['name'])); // Check to // if (!is_null($selfmail->too) && !empty($selfmail->too)) { $message->setTo($selfmail->too); } else { throw new \InvalidArgumentException("Missing mail to", 1); } // // Attaches if (!is_null($selfmail->attachmnt) && count($selfmail->attachmnt) > 0) { foreach ($selfmail->attachmnt as $key => $value) { $name = ""; $filee = ""; // foreach ($value as $key2 => $value2) { if ($key2 == 0) { $filee = $value2; } else { if ($key2 == 1) { $name = $value2; } } } if (empty($name)) { $message->attach(\Swift_Attachment::fromPath($filee)); } else { $message->attach(\Swift_Attachment::fromPath($filee)->setFilename($name)); } } } // // CC if (!is_null($selfmail->cc) && count($selfmail->cc) > 0) { $r = array(); // foreach ($selfmail->cc as $key => $value) { $name = ""; $mail = ""; // foreach ($value as $key2 => $value2) { if ($key2 == "mail") { $mail = $value2; } else { if ($key2 == "name") { $name = $value2; } } } // if (empty($name)) { $r[] = $mail; } else { $r[$mail] = $name; } } // $message->setCC($r); } // // CCI if (!is_null($selfmail->cci) && count($selfmail->cci) > 0) { $r = array(); // foreach ($selfmail->cci as $key => $value) { $name = ""; $mail = ""; // foreach ($value as $key2 => $value2) { if ($key2 == "mail") { $mail = $value2; } else { if ($key2 == "name") { $name = $value2; } } } // if (empty($name)) { $r[] = $mail; } else { $r[$mail] = $name; } } // $message->setBcc($r); } // // Send $result = $mailer->send($message); return $result; // $mail->IsSMTP(); // $mail->SMTPDebug=1; // $mail->SMTPAuth=true; // $mail->SMTPSecure=Config::get("mail.encryption"); // $mail->Host=Config::get("mail.host"); // $mail->Port=Config::get("mail.port"); // $mail->Username=Config::get("mail.username"); // $mail->Password=Config::get("mail.password"); // if(is_null($selfmail->froms)) $selfmail->froms=Config::get("mail.from.adresse"); // $mail->SetFrom($selfmail->froms); // $mail->Subject=$selfmail->subject; // $mail->Body=$view2; // // // foreach ($selfmail->too as $key => $value) // { // $name=""; // $maile=""; // // // foreach ($value as $key2 => $value2) { // if($key2=="name") $name=$value2; // else if($key2=="mail") $maile=$value2; // } // // // if(empty($name)) { $mail->AddAddress($maile); } // else { $mail->AddAddress($maile,$name); } // } // // // // atachement // if(!is_null($selfmail->atachmnt) && count($selfmail->atachmnt)>0) // foreach ($selfmail->atachmnt as $key => $value) // { // $name=""; // $filee=""; // // // foreach ($value as $key2 => $value2) { // if($key2==1) $name=$value2; // else if($key2==0) $filee=$value2; // } // // // if(empty($name)) { $mail->addAttachment($filee); } // else { $mail->addAttachment($filee,$name); } // } // // // // CC // if(!is_null($selfmail->cc)) // foreach ($selfmail->cc as $key => $value) // { // $mail->addCC($value); // } // // // // CCB // if(!is_null($selfmail->cci)) // foreach ($selfmail->cci as $key => $value) // { // $mail->addBCC($value); // } // if(!$mail->Send()) // { // self::$error=$mail->ErrorInfo; // return false; // } // else return true; }
protected function hash($value) { return md5($value . Config::get("security.key1") . md5($value)); }
public static function getXmlData($typePage) { if (preg_match("/^[a-z\\s]+\$/", $typePage)) { $type = isset($typePage) ? $typePage : "post"; $page = isset($_POST['page']) ? $_POST['page'] : 1; $rp = isset($_POST['rp']) ? $_POST['rp'] : 10; $sortname = isset($_POST['sortname']) ? $_POST['sortname'] : 'ID'; $sortorder = isset($_POST['sortorder']) ? $_POST['sortorder'] : 'desc'; $query = isset($_POST['query']) ? $_POST['query'] : false; $qtype = isset($_POST['qtype']) ? $_POST['qtype'] : false; $sort = "ORDER BY {$sortname} {$sortorder}"; $start = ($page - 1) * $rp; $limit = "LIMIT {$start}, {$rp}"; $where = ""; if ($query) { $where = " post_type='" . $type . "' and {$qtype} LIKE '%" . $query . "%' "; } else { $where = " post_type='" . $type . "'"; } $result = get_object_vars(Page::where("{$where} {$sort} {$limit}")); $total = count($result); $rows = array(); foreach ($result['data'] as $row) { $rows[] = get_object_vars($row); } header("Content-type: text/xml"); $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $xml .= "<rows>"; $xml .= "<page>{$page}</page>"; $xml .= "<total>{$total}</total>"; $date = null; $typeofpage = null; $bydefault = null; $definedPage = null; foreach ($rows as $vl) { $date = new DateTime($vl['post_date']); $date = date_format($date, 'd-m-Y'); $post_modified = new DateTime($vl['post_modified']); $post_modified = date_format($post_modified, 'd-m-Y'); $post_status = isset($vl['post_status']) ? $vl['post_status'] : "Draft"; $post_password = isset($vl['post_password']) ? "*****" : ""; if ($type === "page") { if (count(Config::get('app.page_on_front')) > 0) { $definedPage = Config::get('app.page_on_front')['id']; } else { $definedPage = 0; } $bydefault = "<strong>[ Home Page ]</strong>"; if ($definedPage == $vl['ID']) { $typeofpage = $bydefault; } else { $typeofpage = ''; } } elseif ($type === "post") { if (count(Config::get('app.page_for_posts')) > 0) { $definedPage = Config::get('app.page_for_posts')['id']; } else { $definedPage = 0; } $bydefault = "<strong>[ Blog ]</strong>"; if ($definedPage == $vl['ID']) { $typeofpage = $bydefault; } else { $typeofpage = ''; } } $xml .= "<row id='" . $vl['ID'] . "'>"; $xml .= "<cell><![CDATA[" . $vl['ID'] . "]]></cell>"; $xml .= "<cell><![CDATA[" . utf8_encode($vl['post_title']) . " {$typeofpage}]]></cell>"; $xml .= "<cell><![CDATA[" . utf8_encode($vl['post_author']) . "]]></cell>"; $xml .= "<cell><![CDATA[" . utf8_encode($post_status) . "]]></cell>"; $xml .= "<cell><![CDATA[" . utf8_encode($post_password) . "]]></cell>"; $xml .= "<cell><![CDATA[" . $date . "]]></cell>"; $xml .= "<cell><![CDATA[" . $post_modified . "]]></cell>"; $xml .= "</row>"; } $xml .= "</rows>"; echo $xml; } else { echo "Impossible de definir le format de fichier"; } }
public function links($range = -1, $OtherGets = false, $previous = "", $nexte = "") { // Pagination Style $pagination = true; if (Config::get('view.pagination_style') == "simple") { $pagination = !true; if (empty($nexte)) { $nexte = Config::get('view.paginationSimpleNext'); } if (empty($previous)) { $previous = Config::get('view.paginationSimplePrevious'); } } // // Pagination class if (Config::get('view.pagination_class') == "{bootstrap}") { if ($pagination) { echo '<nav style="display:inline-block"><ul class="pagination">'; } else { echo '<nav style="display:inline-block"><ul class="pager">'; } } else { echo '<nav style="display:inline-block"><ul class="' . Config::get('view.pagination_class') . '">'; } //previous page if ($this->CurntPage - 1 > 1) { $prev = $this->CurntPage - 1; } else { $prev = 1; } // //other gets if ($OtherGets && isset($_GET) && !empty($_GET)) { $Prevgets = "?"; $i = 0; foreach ($_GET as $key => $value) { if ($key != "url" && $key != Config::get('view.pagination_param')) { if ($i > 0) { $Prevgets .= "&"; } $Prevgets .= $key . "=" . $value; $i++; } } if ($i > 0) { $Prevgets .= '&'; } $Prevgets .= Config::get('view.pagination_param') . '=' . $prev; } else { $Prevgets = '?' . Config::get('view.pagination_param') . '=' . $prev; } // // ?> <li> <a href="<?php echo $Prevgets; ?> " aria-label="Previous"> <?php if ($pagination) { ?> <span aria-hidden="true">«</span> <?php } else { ?> <span aria-hidden="true"><?php echo $previous; ?> </span> <?php } ?> </a> </li> <?php // Range $cntAll = 1 + $range * 2; if ($range > 0 && $cntAll < $this->NbrPages) { $cntAll = 1 + $range * 2; $max = $this->CurntPage + $range <= $this->NbrPages ? $this->CurntPage + $range : $this->NbrPages; $min = $this->CurntPage - $range >= 1 ? $this->CurntPage - $range : 1; $showedBtn = $max - $min; // if ($max - $this->CurntPage < $range) { $dif = $max - $cntAll + 1; if ($dif > 1) { $min = $dif; } } elseif ($this->CurntPage - $min < $range) { $dif = $cntAll; if ($dif < $this->NbrPages) { $max = $dif; } } } else { $max = $this->NbrPages; $min = 1; } // Pagination if ($pagination) { for ($i = $min; $i <= $max; $i++) { if ($i == $this->CurntPage) { ?> <li class="active"><?php } else { ?> <li><?php } // //other gets if ($OtherGets && isset($_GET) && !empty($_GET)) { $Numgets = "?"; $j = 0; foreach ($_GET as $key => $value) { if ($key != "url" && $key != Config::get('view.pagination_param')) { if ($j > 0) { $Numgets .= "&"; } $Numgets .= $key . "=" . $value; $j++; } } if ($j > 0) { $Numgets .= '&'; } $Numgets .= Config::get('view.pagination_param') . '=' . $i; } else { $Numgets = '?' . Config::get('view.pagination_param') . '=' . $i; } // echo "<a href='" . $Numgets . "'>" . $i . "</a>"; ?> </li><?php } } // //next page if ($this->CurntPage + 1 < $this->NbrPages) { $next = $this->CurntPage + 1; } else { $next = $this->NbrPages; } //other gets if ($OtherGets && isset($_GET) && !empty($_GET)) { $Nextgets = "?"; $i = 0; foreach ($_GET as $key => $value) { if ($key != "url" && $key != Config::get('view.pagination_param')) { if ($i > 0) { $Nextgets .= "&"; } $Nextgets .= $key . "=" . $value; $i++; } } if ($i > 0) { $Nextgets .= '&'; } $Nextgets .= Config::get('view.pagination_param') . '=' . $next; } else { $Nextgets = '?' . Config::get('view.pagination_param') . '=' . $next; } // ?> <li> <a href="<?php echo $Nextgets; ?> " aria-label="Next"> <?php if ($pagination) { ?> <span aria-hidden="true">»</span> <?php } else { ?> <span aria-hidden="true"><?php echo $nexte; ?> </span> <?php } ?> </a> </li> <?php // echo '</ul></nav>'; }
public static function ini($page = null) { if (self::execut() == "ok" and Config::get('license.pageblock') == "true") { self::access($page); } }
public function paginate($RowsPerPage) { // count data $sql = "select count(*) as nbRows from " . $this->name; $var = Database::read($sql); $this->RowsPerPage = $RowsPerPage; $this->nbRows = $var[0]['nbRows']; $this->nbPages = ceil($this->nbRows / $RowsPerPage); //if isset get $this->CurrentPage = 1; if (isset($_GET[Config::get('view.pagination_param')]) && !empty($_GET[Config::get('view.pagination_param')])) { if ($_GET[Config::get('view.pagination_param')] > 0 && $_GET[Config::get('view.pagination_param')] <= $this->nbPages) { $this->CurrentPage = Res::get(Config::get('view.pagination_param')); } } //get Data $r = array(); $sql = "select * from " . $this->name . " Limit " . ($this->CurrentPage - 1) * $this->RowsPerPage . ",{$this->RowsPerPage}"; $this->data = Database::read($sql); // return $this; }