Ejemplo n.º 1
0
			LEFT JOIN produits p USING (id_avion)
			LEFT JOIN documents d USING (id_doc)
			WHERE a.clef ='kHtE5D9r' AND (SELECT clef FROM serveur)='koKbghjdkI55'
			LIMIT 1
*/
require 'falcon.php';
require 'classes/db.class.php';
require 'classes/FirePHP.class.php';
require 'classes/FB.class.php';
require 'classes/httpQueryStr.class.php';
require 'classes/locale.class.php';
require 'classes/access.class.php';
require 'classes/AdminMediaAccess.class.php';
require 'classes/AdminImageAccess.class.php';
require 'classes/AdminArchiveAccess.class.php';
Locale::set();
$httpQS = new httpQueryStr();
session_start();
try {
    $db = new db(DSN, USER, PASSW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
    $user_id = isset($_SESSION) && isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null;
    if ($httpQS->has('userK')) {
        $acces_key = $httpQS->userK;
        $access = $db->checkAccessInfos();
        // Enregistrer la statistique de consultation du document (preview seulement)
        $db->registerUserAccess('document', 'preview', $access->id, $user_id);
    } else {
        if ($httpQS->has('userMediaK')) {
            $acces_key = $httpQS->userMediaK;
Ejemplo n.º 2
0
				case 6: return _t("테이블 생성에 실패했습니다."); break;
				case 7: return _t("설정파일(config.php)을 찾을 수 없어 업그레이드를 진행할 수 없습니다."); break;
				case 8: return _t("데이터베이스 서버에 접속할 수 없습니다. 설정파일(config.php) 내용을 확인해주세요."); break;
				case 9: return _t("필수 테이블이 존재하지 않아 업그레이드를 진행할 수 없습니다. 새로 설치해 주세요."); break;
				case 10: return _t("관리자 정보를 입력해주세요."); break;
				case 11: return _t("관리자 정보를 확인할 수 없습니다."); break;
				case 12: return _t("관리자 비밀번호가 잘못되었습니다."); break;
				case 13: return _t("관리자가 아닙니다."); break;
				default: return false;
		}
	}

	function errorPrintForConfigMake($error) {
		switch($error) {
				case 1: return _t("잘못된 접근입니다."); break;
				case 2: return _t("입력항목 중 빠진 내용이 있습니다."); break;
				case 3: return _t("테이블 식별자에 사용할 수 없는 문자 혹은 숫자가 포함되어 있습니다."); break;
				case 4: return _t("데이터베이스 서버에 접속할 수 없습니다. 입력하신 내용을 확인해주세요."); break;
				case 5: return _t("설정파일(config.php)을 생성할 수 없습니다. 이미 존재하는 파일이라면 삭제하셔야 새로 설치를 진행하실 수 있습니다."); break;							
				default: return false;
		}
	}

	requireComponent('Eolin.PHP.UnifiedEnvironment'); 
	requireComponent('LZ.PHP.Core');
	requireComponent('LZ.DB.Core');
	requireComponent('LZ.PHP.Locale');

	Locale::setDirectory(ROOT . '/language/locale');
	Locale::set('auto'); // set locale by accept-language header
?>
Ejemplo n.º 3
0
 /**
  * The function sets current localization.
  * 
  * @static
  * @access private
  */
 private static function initLocale()
 {
     $locales = explode(',', Config::get('l10n', 'en_US'));
     $current = isset($locales[0]) ? $locales[0] : 'en_US';
     $arr = explode(',', Request::get('HTTP_ACCEPT_LANGUAGE', '', 'SERVER'));
     foreach ($arr as $locale) {
         if (strlen($locale) == 5) {
             $locale = strtolower(substr($locale, 0, 2)) . '_' . strtoupper(substr($locale, 3, 2));
             if (in_array($locale, $locales)) {
                 $current = $locale;
                 break;
             }
         }
         if (strlen($locale) == 2) {
             foreach ($locales as $item) {
                 if (strtolower($locale) == substr($item, 0, 2)) {
                     $current = $item;
                     break;
                 }
             }
         }
     }
     Locale::set($current);
     Locale::$TEST_MODE = !Config::get('l10n@smooth', false);
     ISO_Table::setLocale(Locale::get());
     Locale::load('Common');
 }
Ejemplo n.º 4
0
 /**
  * Entry point for installation.  The reason there is a begin_install
  * method to handle is that conceivably, the user can stop installation
  * mid-install and need an alternate entry point action at a later time.
  */
 public function act_begin_install()
 {
     // Create a new theme to handle the display of the installer
     $this->theme = Themes::create('installer', 'RawPHPEngine', HABARI_PATH . '/system/installer/');
     /**
      * Set user selected Locale or default
      */
     $this->theme->locales = Locale::list_all();
     if (isset($_POST['locale']) && $_POST['locale'] != null) {
         Locale::set($_POST['locale']);
     } else {
         Locale::set(Config::get('locale', 'en-us'));
     }
     $this->theme->locale = Locale::get();
     $this->handler_vars['locale'] = Locale::get();
     /**
      * Check .htaccess first because ajax doesn't work without it.
      */
     if (!$this->check_htaccess()) {
         $this->handler_vars['file_contents'] = htmlentities(implode("\n", $this->htaccess()));
         $this->display('htaccess');
     }
     // Dispatch AJAX requests.
     if (isset($_POST['ajax_action'])) {
         switch ($_POST['ajax_action']) {
             case 'check_mysql_credentials':
                 self::ajax_check_mysql_credentials();
                 exit;
                 break;
             case 'check_pgsql_credentials':
                 self::ajax_check_pgsql_credentials();
                 exit;
                 break;
             case 'check_sqlite_credentials':
                 self::ajax_check_sqlite_credentials();
                 exit;
                 break;
         }
     }
     // set the default values now, which will be overriden as we go
     $this->form_defaults();
     if (!$this->meets_all_requirements()) {
         $this->display('requirements');
     }
     /**
      * Add the AJAX hooks
      */
     Plugins::register(Method::create('\\Habari\\InstallHandler', 'ajax_check_mysql_credentials'), 'ajax_', 'check_mysql_credentials');
     Plugins::register(Method::create('\\Habari\\InstallHandler', 'ajax_check_pgsql_credentials'), 'ajax_', 'check_pgsql_credentials');
     /**
      * Let's check the config.php file if no POST data was submitted
      */
     if (!file_exists(Site::get_dir('config_file')) && !isset($_POST['admin_username'])) {
         // no config file, and no HTTP POST
         $this->display('db_setup');
     }
     // try to load any values that might be defined in config.php
     if (file_exists(Site::get_dir('config_file'))) {
         include Site::get_dir('config_file');
         // check for old style config (global variable, pre-dates registry based config
         if (!Config::exists('db_connection') && isset($db_connection)) {
             // found old style config...
             // set up registry:
             Config::set('db_connection', $db_connection);
             // assign handler vars (for config file write)
             $this->set_handler_vars_from_db_connection();
             // write new config file
             if ($this->write_config_file(true)) {
                 // successful, so redirect:
                 Utils::redirect(Site::get_url('site'));
             }
         }
         if (Config::exists('db_connection')) {
             $this->set_handler_vars_from_db_connection();
         }
         // if a $blog_data array exists in config.php, use it
         // to pre-load values for the installer
         // ** this is completely optional **
         if (Config::exists('blog_data')) {
             $blog_data = Config::get('blog_data');
             foreach ($blog_data as $blog_datum => $value) {
                 $this->handler_vars[$blog_datum] = $value;
             }
         }
     }
     // now merge in any HTTP POST values that might have been sent
     // these will override the defaults and the config.php values
     $this->handler_vars = $this->handler_vars->merge($_POST);
     // we need details for the admin user to install
     if ('' == $this->handler_vars['admin_username'] || '' == $this->handler_vars['admin_pass1'] || '' == $this->handler_vars['admin_pass2'] || '' == $this->handler_vars['admin_email']) {
         // if none of the above are set, display the form
         $this->display('db_setup');
     }
     $db_type = $this->handler_vars['db_type'];
     if ((!Config::exists('db_connection') || Config::get('db_connection')->connection_string == '') && ($db_type == 'mysql' || $db_type == 'pgsql')) {
         $this->handler_vars['db_host'] = $_POST["{$db_type}_db_host"];
         $this->handler_vars['db_user'] = $_POST["{$db_type}_db_user"];
         $this->handler_vars['db_pass'] = $_POST->raw("{$db_type}_db_pass");
         $this->handler_vars['db_schema'] = $_POST["{$db_type}_db_schema"];
     }
     // we got here, so we have all the info we need to install
     // make sure the admin password is correct
     if ($this->handler_vars['admin_pass1'] !== $this->handler_vars['admin_pass2']) {
         $this->theme->assign('form_errors', array('password_mismatch' => _t('Password mis-match.')));
         $this->display('db_setup');
     }
     // don't accept emails with control characters
     if (!ctype_print($this->handler_vars['admin_email'])) {
         $this->theme->assign('form_errors', array('admin_email' => _t('Only printable characters are allowed.')));
         $this->display('db_setup');
     }
     // check whether prefix is valid
     if (isset($this->handler_vars['table_prefix']) && preg_replace('/[^a-zA-Z_]/', '', $this->handler_vars['table_prefix']) !== $this->handler_vars['table_prefix']) {
         $this->theme->assign('form_errors', array('table_prefix' => _t('Allowed characters are A-Z, a-z and "_".')));
         $this->display('db_setup');
     }
     // Make sure we still have a valid connection
     if (!call_user_func(array($this, "check_{$db_type}"))) {
         $this->display('db_setup');
     }
     // try to write the config file
     if (!$this->write_config_file()) {
         $this->theme->assign('form_errors', array('write_file' => _t('Could not write config.php file…')));
         $this->display('db_setup');
     }
     // try to install the database
     if (!$this->install_db()) {
         // the installation failed for some reason.
         // re-display the form
         $this->display('db_setup');
     }
     // Try activating plugins and themes
     $this->activate_plugins();
     $this->activate_theme();
     // Installation complete. Secure sqlite if it was chosen as the database type to use
     if ($db_type == 'sqlite') {
         if (!$this->secure_sqlite()) {
             $this->theme->sqlite_contents = implode("\n", $this->sqlite_contents());
             $this->display('sqlite');
         }
     }
     EventLog::log(_t('Habari successfully installed.'), 'info', 'default', 'habari');
     Utils::redirect(Site::get_url('site'));
 }
Ejemplo n.º 5
0
<?php	
	if (!isset($service['path']) || empty($service['path'])) $service['path'] = '';
	if (!isset($service['timeout']) || empty($service['timeout'])) $service['timeout'] = 3600;
	if (!isset($database['type'])) $database['type'] = 'mysql'; 
	
	function requireComponent($name) {
		include_once(ROOT . '/components/'.$name.'.php');
	}

	requireComponent('Eolin.PHP.UnifiedEnvironment'); 
	requireComponent('LZ.PHP.Core');
	requireComponent('LZ.DB.Core');
	$db = DB::start($database['type']);

	requireComponent('LZ.PHP.Locale');
	requireComponent('LZ.PHP.XMLStruct');
	requireComponent('LZ.PHP.Feeder');
	requireComponent('LZ.PHP.Functions');

	requireComponent('Bloglounge.Data.Settings');
	requireComponent('Bloglounge.Data.Category'); // ncloud
	requireComponent('Bloglounge.Model.Event');
	$event = new Event;

	Locale::setDirectory(ROOT . '/language/locale');
	Locale::set('ko'); // temporarily fix to korean
?>
Ejemplo n.º 6
0
}
// Send the Content-Type HTTP header.
// @todo Find a better place to put this.
header('Content-Type: text/html;charset=utf-8');
// Load and upgrade all the active plugins.
spl_autoload_register(Method::create('\\Habari\\Plugins', '_autoload'));
Plugins::load_active();
// All plugins loaded, tell the plugins.
Plugins::act('plugins_loaded');
// Start the session.
Session::init();
// Set the locale from the user info else config, database, then default english locale
if (User::identify()->loggedin && User::identify()->info->locale_lang) {
    Locale::set(User::identify()->info->locale_lang);
} else {
    Locale::set(Config::get('locale', Options::get('locale', 'en-us')));
}
if (Options::get('system_locale')) {
    Locale::set_system_locale(Options::get('system_locale'));
}
// Replace the $_COOKIE superglobal with an object representation
SuperGlobal::process_c();
// Initiating request handling, tell the plugins.
Plugins::act('init');
// Load Stack Items
Stack::load_stackitems();
if (defined('SUPPRESS_REQUEST')) {
    return;
}
// Parse and handle the request.
Controller::parse_request();