示例#1
0
 public static function title($value = NULL)
 {
     if (empty($value)) {
         $value = Config::get('app.title');
     }
     echo "\r\n" . '<title>' . $value . '</title>' . "\r\n";
 }
示例#2
0
 public static function store($text)
 {
     foreach (Config::get('smiley.codes') as $key => $value) {
         $text = str_replace($key, $value, $text);
     }
     return $text;
 }
示例#3
0
 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 && Config::get('panel.configured')) {
                 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;
     }
 }
示例#4
0
 public static function show()
 {
     $msg = Config::get("maintenance.msg");
     $bg_color = Config::get("maintenance.bg");
     //include 'View.php';
     $view = array("bundle_name" => 'maintenance', "view" => 'maintenance.index', "backend" => true, "panel" => false, "roles" => ["Administrateur", "User", "Guest"]);
     View::make($view, ['msg' => $msg, 'bg_color' => $bg_color]);
 }
示例#5
0
 protected static function setParams()
 {
     self::$smarty->force_compile = false;
     self::$smarty->debugging = false;
     self::$smarty->caching = false;
     self::$smarty->cache_lifetime = 120;
     self::$smarty->use_sub_dirs = false;
     self::$smarty->left_delimiter = '{';
     self::$smarty->right_delimiter = '}';
     self::$smarty->setPluginsDir(array(Application::$root . 'app/themes/' . Config::get('theme.name') . '/_plugins', Application::$root . 'themes/' . Config::get('theme.nameFrontEnd') . '/_plugins', Application::$root . Config::get("panel.path") . 'ressources/_plugins', Application::$root . 'vendor/smarty/smarty/libs/plugins'));
     //Smarty::muteExpectedErrors();
 }
示例#6
0
 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);
 }
示例#7
0
 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;
     }
 }
示例#8
0
 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;
     }
 }
示例#9
0
 function __construct($disk = null)
 {
     if (empty($disk)) {
         if ($this->checkDiskExiste(Config::get('storage.default'))) {
             $this->disk = Config::get('storage.default');
             $this->basePath = Sys::$app . "/storage/file";
             $this->storagePath = $this->basePath . "/" . Config::get('storage.default');
         } else {
             throw new \invalidArgumentException("There is no disk call's " . Config::get('storage.default'));
         }
     } else {
         if ($this->checkDiskExiste($disk)) {
             $this->disk = $disk;
             $this->basePath = Sys::$app . "/storage/file";
             $this->storagePath = $this->basePath . "/" . $disk;
         } else {
             throw new \invalidArgumentException("There is no disk call's " . $disk);
         }
     }
 }
示例#10
0
 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");
     //
 }
示例#11
0
 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("Amine Abri" . $array . time() . "token" . Config::get('security.key1'));
         } else {
             if (is_null($array) || empty($array)) {
                 $str = "Amine Abri" . $array . time() . "token" . Config::get('security.key1') . "ARFramework" . Config::get('security.key2') . time() . self::random();
                 $str = str_shuffle($str);
             }
         }
     }
     //
     $token = self::make($str);
     return $token;
 }
示例#12
0
 protected function hash($value)
 {
     return md5($value . Config::get("security.key1") . md5($value));
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.exec_seed');
     $this->description = 'Execute Seeder';
 }
示例#14
0
 /**
  * Require files of Console
  */
 protected static function commands($routes)
 {
     foreach (self::fetch("console/commands") as $file) {
         Connector::need($file);
     }
     if ($routes) {
         foreach (self::fetch("bundles/" . Application::getCurrentModule() . "/console/commands") as $file_md) {
             Connector::need($file_md);
         }
         foreach (self::fetch(Application::$root . Config::get('panel.path') . "console/commands") as $file_pnlmd) {
             Connector::need($file_pnlmd);
         }
     }
 }
示例#15
0
    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">&laquo;</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">&raquo;</span>
	    	<?php 
        } else {
            ?>
	    		<span aria-hidden="true"><?php 
            echo $nexte;
            ?>
</span>
	    	<?php 
        }
        ?>
	      </a>
	    </li>
	    <?php 
        //
        echo '</ul></nav>';
    }
示例#16
0
 protected function setTable($table)
 {
     $table = is_null($table) ? !isset(static::$table) ? get_class($this) : static::$table : $table;
     //
     if (Config::get('database.prefixing')) {
         $this->DBtable = Config::get('database.prefixe') . $table;
     } else {
         $this->DBtable = $table;
     }
 }
示例#17
0
 public static function ini($page = null)
 {
     if (self::execut() == "ok" and Config::get('license.pageblock') == "true") {
         self::access($page);
     }
 }
示例#18
0
 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;
     }
 }
示例#19
0
 /**
  * set framework Timezone 
  */
 public static function setTimezone()
 {
     date_default_timezone_set(Config::get('app.timezone'));
 }
示例#20
0
 protected static function CreateDireView($name, $location)
 {
     if ($location === "backend") {
         if (!file_exists(Application::$root . "app/themes/" . Config::get("theme.name") . "/bundles/{$name}")) {
             mkdir(Application::$root . "app/themes/" . Config::get("theme.name") . "/bundles/{$name}", 0777, true);
             mkdir(Application::$root . "app/themes/" . Config::get("theme.name") . "/bundles/{$name}/{$name}", 0777, true);
             return true;
         } else {
             return false;
         }
     } else {
         if (!file_exists(Application::$root . "themes/" . Config::get("theme.nameFrontEnd") . "/bundles/{$name}")) {
             mkdir(Application::$root . "themes/" . Config::get("theme.nameFrontEnd") . "/bundles/{$name}", 0777, true);
             mkdir(Application::$root . "themes/" . Config::get("theme.nameFrontEnd") . "/bundles/{$name}/{$name}", 0777, true);
             return true;
         } else {
             return false;
         }
     }
 }
示例#21
0
 /**
  * Test on load Config params
  */
 public function testLoadConfig()
 {
     $ret = Config::load();
     //
     return $this->assertTrue($ret);
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.new_controller') . ' {fileName : what\'s the name of the file?} {className : what\'s the name of the controller class?} {bundleName : what\'s the bundleName ?} {--route : If set, a router for this controller will created in routes file}';
     $this->description = 'New Controller';
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.file_lang') . " {fileName : what's the name of the file?} {dirName : which directory?}";
     $this->description = "Make new translator file";
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.get_routes') . ' {http : what\'s the http of route?} {bundle : what\'s the bundle of route?}';
     $this->description = 'Add new get route to Routes file';
 }
示例#25
0
 public static function ini()
 {
     $path = "../" . Config::get("loggin.log");
     ini_set("log_errors", 1);
     ini_set("error_log", $path);
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.new_schema') . ' {name : what\'s the name of the schema?} {bundle : what\'s the name of the bundle?}';
     $this->description = 'Make new schema file';
 }
示例#27
0
 /**
  * the name of dataTable of migrations
  */
 protected static function getMigrationTable()
 {
     if (Config::get('database.prefixing')) {
         return Config::get('database.prefixe') . Config::get('database.migration');
     } else {
         return Config::get('database.migration');
     }
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.new_link') . ' {name : what\'s the name of the file?}';
     $this->description = 'New file for links';
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.dir_lang') . " {name : what's the name of the directory?}";
     $this->description = "Make new translator directory";
 }
 /**
  * Configure the command
  */
 public function set()
 {
     $this->key = Config::get('console.new_bundle_command') . ' {file : what\'s the name of the file?} {bundle : what\'s the name of the bundle?} {--command=greeting : the command}';
     $this->description = "New User Console Cammand";
 }