예제 #1
0
파일: cli.php 프로젝트: alerque/bibledit
 public static function not_yet_ready()
 {
     // While setup is not yet complete, it is not yet ready.
     $path = dirname(__DIR__) . "../setup";
     if (file_exists($path)) {
         return true;
     }
     // When client mode is prepared, but not yet enabled, it is not yet ready.
     if (Filter_Client::prepared()) {
         if (!Filter_Client::enabled()) {
             return true;
         }
     }
     // Ready to run.
     return false;
 }
예제 #2
0
파일: logic.php 프로젝트: alerque/bibledit
 function clientAccess()
 {
     // If client mode is prepared,
     // log in as the first username in the users database,
     // of as the admin in case no user have been set up yet.
     if (Filter_Client::prepared()) {
         $database_users = Database_Users::getInstance();
         $users = $database_users->getUsers();
         if (empty($users)) {
             $user = "******";
             $level = Filter_Roles::ADMIN_LEVEL;
         } else {
             $user = $users[0];
             $level = $database_users->getUserLevel($user);
         }
         $this->setUsername($user);
         $this->level = $level;
         $this->logged_in = true;
         return true;
     }
     return false;
 }
예제 #3
0
파일: main.php 프로젝트: alerque/bibledit
 private function settingsmenu()
 {
     $menu = array("users" => array("manage/users", Locale_Translate::_("Users"), NULL), array("manage/indexing", Locale_Translate::_("Indexing"), NULL), array("administration/language", Locale_Translate::_("Language"), NULL), array("administration/timezone", Locale_Translate::_("Timezone"), NULL), "mail" => array("administration/mail", Locale_Translate::_("Mail"), NULL), array("styles/indext", Locale_Translate::_("Styles"), $this->stylessubmenu()), array("versification/index", Locale_Translate::_("Versifications"), NULL), array("mapping/index", Locale_Translate::_("Verse mappings"), NULL), "collaboration" => array("administration/collaboration", Locale_Translate::_("Collaboration"), NULL), "client" => array("administration/client", Locale_Translate::_("Client"), NULL), array("fonts/index", Locale_Translate::_("Fonts"), NULL));
     // If the installation is not prepared for Client mode, disable the menu.
     // But keep the menu item in an open installation.
     include "config/open.php";
     if (!$open_installation) {
         if (!Filter_Client::prepared()) {
             unset($menu["client"]);
         }
     }
     // If Client mode is enabled, disable certain menu entries.
     if (Filter_Client::enabled()) {
         unset($menu["mail"]);
         unset($menu["users"]);
         unset($menu["collaboration"]);
     }
     return $menu;
 }
예제 #4
0
 private function __construct()
 {
     // Default encoding.
     mb_internal_encoding("UTF-8");
     // On shared hosting the temporal location may give read or write failures.
     // Set private temporal location for PHP.
     // Set private temporal location for SQLite.
     // http://stackoverflow.com/questions/10394517/setting-sqlite-temp-store-directory
     $tmpdir = realpath(__DIR__ . "/../tmp");
     putenv("TMPDIR={$tmpdir}");
     // Check whether to run the website setup script.
     // On Linux it is sufficient to check whether the "setup" folder exists.
     // But on Windows, this setup folder cannot be deleted, so it would exist always.
     // Therefore, to support Windows, it checks whether the index file in in the setup folder.
     if (file_exists("../setup/index.php")) {
         $setupfolder = realpath("../setup");
         $myfolder = realpath(".");
         if ($setupfolder != $myfolder) {
             include "../filter/url.php";
             Filter_Url::redirect("../setup/index.php");
             die;
         }
     }
     // Set the include path: Where to look for included files.
     $this->bibledit_root_folder = dirname(dirname(__FILE__));
     $include_path = get_include_path() . PATH_SEPARATOR . $this->bibledit_root_folder;
     set_include_path($include_path);
     ini_set('include_path', $include_path);
     // Autoloader.
     // Automatically include the file that contains the $class_name.
     // E.g. class Database_Bibles would require file database/bibles.php.
     // Thus the name of the class determines which file gets required.
     // The above implies that all classes translate to files and folders in lower case.
     // An exception is made for the Zend_* classes.
     function __autoload($class_name)
     {
         if (substr($class_name, 0, 4) != "Zend") {
             $class_name = strtolower($class_name);
         }
         $path = str_replace("_", "/", $class_name);
         require_once $path . ".php";
     }
     // Register the function.
     spl_autoload_register('__autoload');
     // Disable magic quotes.
     if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
         foreach ($_GET as $k => $v) {
             $_GET[$k] = stripslashes($v);
         }
         foreach ($_POST as $k => $v) {
             $_POST[$k] = stripslashes($v);
         }
         foreach ($_COOKIE as $k => $v) {
             $_COOKIE[$k] = stripslashes($v);
         }
     }
     // General configuration database.
     $database_config_general = Database_Config_General::getInstance();
     // The site's timezone.
     $timezone = $database_config_general->getTimezone();
     if ($timezone) {
         date_default_timezone_set($timezone);
     }
     // Client mode setup.
     // In case the client mode is prepared, but not enabled,
     // the bootstrap script forwards to the client mode setup page,
     // unless it is already going to that page.
     if (Filter_Client::prepared()) {
         if (!Filter_Client::enabled()) {
             @($uri = $_SERVER["REQUEST_URI"]);
             $path = parse_url($uri, PHP_URL_PATH);
             $folder = pathinfo($path, PATHINFO_DIRNAME);
             $folder = basename($folder);
             $page = pathinfo($path, PATHINFO_BASENAME);
             if ($folder != "setup") {
                 if ($page != "topbar.php") {
                     if ($page != "client.php") {
                         Filter_Url::redirect("../administration/client.php");
                         die;
                     }
                 }
             }
         }
     }
 }