コード例 #1
0
ファイル: panels.php プロジェクト: ar-framework-labs/panel
 public static function index()
 {
     if (Auth::check()) {
         $view = array("bundle_name" => 'panel', "view" => 'panel.index', "backend" => false, "panel" => true, "roles" => ["User", "Administrateur"]);
         return View::make($view, ["users" => User::getListUsers("users")]);
     } else {
         $redirection = Config::get('app.base_url') . Config::get('panel.route') . "/users";
         header("Location: {$redirection}");
     }
 }
コード例 #2
0
ファイル: bundles.php プロジェクト: ar-framework-labs/panel
 public static function importBundleData()
 {
     if (Auth::check()) {
         $target_dir = Application::$root . "app/storage/file/app/";
         $target_file = $target_dir . basename($_FILES["file"]["name"]);
         $FileType = pathinfo($target_file, PATHINFO_EXTENSION);
         if (0 < $_FILES['file']['error']) {
             echo 'Error: ' . $_FILES['file']['error'] . '<br>';
         } elseif (file_exists($target_file)) {
             echo "Sorry, file already exists.";
         } elseif ($_FILES["file"]["size"] > 500000) {
             echo "Sorry, your file is too large.";
         } elseif ($FileType != "zip") {
             echo "Sorry, only Zip files are allowed.";
         } else {
             if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
                 if (file_exists($target_file)) {
                     if (self::Extractor("app/storage/file/app/" . basename($_FILES["file"]["name"]), "app/bundles/", basename($_FILES["file"]["name"], ".zip")) === true) {
                         echo "Success";
                         unlink($target_file);
                     } else {
                         echo self::Extractor("app/storage/file/app/" . basename($_FILES["file"]["name"]), "app/bundles/", basename($_FILES["file"]["name"], ".zip"));
                         unlink($target_file);
                     }
                 } else {
                     echo "Not found Package";
                 }
             } else {
                 echo "Erreur de telechargement du package";
             }
         }
     } else {
         $redirection = Config::get('app.base_url') . Config::get('panel.route') . "/users";
         header("Location: {$redirection}");
     }
 }
コード例 #3
0
ファイル: Views.php プロジェクト: ar-framework-labs/kernel
 public static function get($value_DGFSrtfg5, $data_kGdfgdf = null)
 {
     if (is_array($value_DGFSrtfg5)) {
         if ($value_DGFSrtfg5['panel']) {
             if (!is_null($data_kGdfgdf)) {
                 foreach ($data_kGdfgdf as $_key_ => $_value2_) {
                     ${$_key_} = $_value2_;
                 }
             }
             //getFile
             $name_fgdfgdf = str_replace('.', '/', $value_DGFSrtfg5['view']);
             if (Auth::checkRoles($value_DGFSrtfg5['roles'])) {
                 $link1 = Application::$root . Config::get("panel.path") . 'ressources/views/' . $name_fgdfgdf . '.php';
                 $link2 = Application::$root . Config::get("panel.path") . 'ressources/views/' . $name_fgdfgdf . '.tpl.php';
             } else {
                 $link1 = "";
                 $link2 = Application::$root . Config::get("panel.path") . 'ressources/views/error/401.tpl.php';
             }
         } else {
             if ($value_DGFSrtfg5['backend']) {
                 if (!is_null($data_kGdfgdf)) {
                     foreach ($data_kGdfgdf as $key => $value2) {
                         ${$key} = $value2;
                     }
                 }
                 //
                 ob_start();
                 // start output buffering
                 //get File
                 //
                 $name_fgdfgdf = str_replace('.', '/', $value_DGFSrtfg5['view']);
                 if (Auth::checkRoles($value_DGFSrtfg5['roles'])) {
                     $link1 = Application::$root . 'app/themes/' . Config::get("theme.name") . '/bundles/' . $value_DGFSrtfg5['bundle_name'] . '/' . $name_fgdfgdf . '.php';
                     $link2 = Application::$root . 'app/themes/' . Config::get("theme.name") . '/bundles/' . $value_DGFSrtfg5['bundle_name'] . '/' . $name_fgdfgdf . '.tpl.php';
                     $link3 = '';
                 } else {
                     $link1 = '';
                     $link2 = Application::$root . 'app/themes/' . Config::get("theme.name") . '/error/401.tpl.php';
                     $link3 = '';
                 }
             } else {
                 if (!is_null($data_kGdfgdf)) {
                     foreach ($data_kGdfgdf as $key => $value2) {
                         ${$key} = $value2;
                     }
                 }
                 //
                 ob_start();
                 // start output buffering
                 //get File
                 //
                 $name_fgdfgdf = str_replace('.', '/', $value_DGFSrtfg5['view']);
                 if (Auth::checkRoles($value_DGFSrtfg5['roles'])) {
                     $link1 = Application::$root . 'themes/' . Config::get("theme.nameFrontEnd") . '/bundles/' . $value_DGFSrtfg5['bundle_name'] . '/' . $name_fgdfgdf . '.php';
                     $link2 = Application::$root . 'themes/' . Config::get("theme.nameFrontEnd") . '/bundles/' . $value_DGFSrtfg5['bundle_name'] . '/' . $name_fgdfgdf . '.tpl.php';
                     $link3 = '';
                 } else {
                     $link1 = '';
                     $link2 = Application::$root . 'themes/' . Config::get("theme.nameFrontEnd") . '/error/401.tpl.php';
                     $link3 = '';
                 }
             }
         }
         //
         $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);
         } else {
             self::$showed = "smpl";
             \Connector::need($link3);
         }
         //
         $returned_value = ob_get_contents();
         // get contents from the buffer
         ob_end_clean();
         //
         return $returned_value;
     }
 }
コード例 #4
0
 /**
  * Init Framework classes
  */
 protected static function ini()
 {
     Alias::ini(self::$root);
     Sys::ini();
     Url::ini();
     Path::ini();
     Template::run();
     Faker::ini();
     Links::ini();
     Errors::ini(self::$root);
     License::ini(self::$page);
     //langues
     Lang::setReplaceBlankTranslationBy(Lang::REPLACE_BY_BLANK);
     Lang::setReplaceNonExistingTranslationBy(Lang::REPLACE_BY_KEY_TRANSLATE_ME);
     Lang::initLanguage();
     Database::ini();
     Auth::ini();
     Plugins::ini();
     Widgets::ini();
 }