static function get($key = null, $default = null, $showNotice = true) { if ($key === null) { return $_GET; } if (!isset($_GET[$key])) { if ($showNotice) { trigger_error(Locale::get('core.error.getNotFound')); } return $default; } return $_GET[$key]; }
/** * The function returns translation for current key. * Can be used extra arguments for patters {arg1}, {arg2}, {argN}. * * @param string $key The translation key. * @return string The translated string. */ function _t($key) { $str = Locale::get($key); if (func_num_args() > 1) { $args = func_get_args(); for ($i = 1; $i < count($args); $i++) { $repl['{arg' . $i . '}'] = $args[$i]; } $str = strtr($str, $repl); } return $str; }
$appMessage = readAppMessage(); clearAppMessage(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo BLOGLOUNGE;?> :: <?php echo _t('관리페이지');?></title> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/admin.css" type="text/css" /> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/box.css" type="text/css" /> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/modal.css" type="text/css" /> <link rel="shortcut icon" href="<?php echo $service['path'];?>/images/favicon.ico" /> <script type="text/javascript"> var _path = '<?php echo $service['path'];?>'; var _lang = '<?php echo Locale::get();?>'; var _nowid = 'menu_<?php echo $action;?>'; </script> <script type="text/javascript" src="<?php echo $service['path'];?>/scripts/jquery.js"></script> <script type="text/javascript" src="<?php echo $service['path'];?>/scripts/admin.js"></script> <script type="text/javascript" src="<?php echo $service['path'];?>/scripts/modal.js"></script> <script type="text/javascript"> /* function updateGlobalFeed(type) { addMessage("<?php echo _t('블로그 업데이트를 시작합니다.');?>"); $.ajax({ type: "POST", url: _path +'/service/update/?type=' + type, success: function(msg){
<?php if(!empty($checkupDesc)) { ?> <div class="updateDesc"> <div class="title"><?php echo _t('처리결과');?></div> <?php echo $checkupDesc;?> </div> <?php } ?> <div class="indesc"> <?php echo _t('아래의 "관리자" 버튼을 눌러 관리자 모드로 이동하거나');?>,<br /> <?php echo _t('"홈" 버튼을 눌러 첫페이지로 이동할 수 있습니다.');?><br /> </div> <div class="installButtons"> <a href="<?php echo $path;?>/admin/"><img src="<?php echo $path;?>/images/setup/<?php echo Locale::get();?>/bt_admin.jpg" alt="<?php echo _t('관리자페이지');?>" /></a> <a href="<?php echo $path;?>/"><img src="<?php echo $path;?>/images/setup/<?php echo Locale::get();?>/bt_home.jpg" alt="<?php echo _t('홈');?>" /></a> </div> <?php break; case 'uninstall_do': ?> <div id="title"> <span class="stepNum"><?php echo _t('삭제완료');?></span> <div class="stepDesc"><?php echo _t('블로그라운지 삭제가 완료되었습니다.');?></div> </div> <div class="indesc"> <?php echo _t('나머지 파일들은 직접 삭제해주세요.');?><br /> <?php echo _t('감사합니다.');?> </div>
/** * 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'); }
/** * display the content in HTML moden for debug * * @access protected * @param string $content */ protected function _vueHTML($content) { $content = preg_replace('/<page_header([^>]*)>/isU', '<hr>' . Locale::get('vue01') . ' : $1<hr><div$1>', $content); $content = preg_replace('/<page_footer([^>]*)>/isU', '<hr>' . Locale::get('vue02') . ' : $1<hr><div$1>', $content); $content = preg_replace('/<page([^>]*)>/isU', '<hr>' . Locale::get('vue03') . ' : $1<hr><div$1>', $content); $content = preg_replace('/<\\/page([^>]*)>/isU', '</div><hr>', $content); $content = preg_replace('/<bookmark([^>]*)>/isU', '<hr>bookmark : $1<hr>', $content); $content = preg_replace('/<\\/bookmark([^>]*)>/isU', '', $content); $content = preg_replace('/<barcode([^>]*)>/isU', '<hr>barcode : $1<hr>', $content); $content = preg_replace('/<\\/barcode([^>]*)>/isU', '', $content); $content = preg_replace('/<qrcode([^>]*)>/isU', '<hr>qrcode : $1<hr>', $content); $content = preg_replace('/<\\/qrcode([^>]*)>/isU', '', $content); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>' . Locale::get('vue04') . ' HTML</title> <meta http-equiv="Content-Type" content="text/html; charset=' . $this->_encoding . '" > </head> <body style="padding: 10px; font-size: 10pt;font-family: Verdana;"> ' . $content . ' </body> </html>'; exit; }
/** * 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')); }
<div id="logo"> <a href="<?php echo $service['path'];?>/"><img src="<?php echo $service['path'];?>/images/admin/<?php echo Locale::get();?>/login_bloglounge_logo.gif" alt="<?php echo BLOGLOUNGE;?>" /></a> </div> <hr class="line" /> <div id="login_wrap"> <img src="<?php echo $service['path'];?>/images/admin/<?php echo Locale::get();?>/login_title.gif" alt="<?php echo _t('회원로그인');?>" /> <form method="post" onsubmit="return checkLogin();"> <table cellspacing="0" cellpadding="0"> <tr> <td class="input_td"> <input type="text" id="member_id" name="useridin" tabindex="1" value="<?php echo htmlspecialchars(empty($_POST['userid']) ? (empty($_COOKIE['BLOGLOUNGE_LOGINID']) ? '' : $_COOKIE['BLOGLOUNGE_LOGINID']) : $_POST['userid']);?>" class="input faderInput" /> </td> <td class="bt_td" rowspan="2"> <input type="image" src="<?php echo $service['path'];?>/images/admin/<?php echo Locale::get();?>/login_bt.gif" alt="<?php echo _t('로그인');?>" tabindex="3" /> </td> </tr> <tr> <td class="input_td"><input type="password" id="member_password" name="userpwin" tabindex="2" class="input faderInput" /></td> </tr> </table> <div class="save_id"> <input type="checkbox" name="saveId" id="saveId" value="y" <?php echo (empty($_COOKIE['BLOGLOUNGE_LOGINID']) ? '' : 'checked="checked"');?>/><label for="saveId"><?php echo _t('아이디 저장');?></label> </div> </form> <div class="join_message"> <a href="<?php echo $service['path'];?>/join/"><?php echo _t('지금 회원가입 하실 수 있습니다.');?></a> </div>
public function getPageTitle() { // Set page and site title together if (is_null($this->content)) { //return; } $title = $this->getVar("meta.title.0"); $title .= $this->printIfSet(array(Locale::get("Frontend.Server" . $this->content->getServerID() . ".Title"), $this->getVar("meta.title.0")), " | "); $title .= Locale::get("Frontend.Server" . $this->content->getServerID() . ".Title"); return $title; }
/** * This function is call automatically by TCPDF at the end of a page * It takes no parameters * * @access public */ public function Footer() { // prepare the text from the tranlated text $txt = ''; if ($this->_footerParam['form']) { $txt = Locale::get('pdf05'); } if ($this->_footerParam['date'] && $this->_footerParam['hour']) { $txt .= ($txt ? ' - ' : '') . Locale::get('pdf03'); } if ($this->_footerParam['date'] && !$this->_footerParam['hour']) { $txt .= ($txt ? ' - ' : '') . Locale::get('pdf01'); } if (!$this->_footerParam['date'] && $this->_footerParam['hour']) { $txt .= ($txt ? ' - ' : '') . Locale::get('pdf02'); } if ($this->_footerParam['page']) { $txt .= ($txt ? ' - ' : '') . Locale::get('pdf04'); } if (strlen($txt) > 0) { // replace some values $toReplace = array('[[date_d]]' => date('d'), '[[date_m]]' => date('m'), '[[date_y]]' => date('Y'), '[[date_h]]' => date('H'), '[[date_i]]' => date('i'), '[[date_s]]' => date('s'), '[[page_cu]]' => $this->getMyNumPage(), '[[page_nb]]' => $this->getMyAliasNbPages()); $txt = str_replace(array_keys($toReplace), array_values($toReplace), $txt); // draw the footer parent::SetY(-11); $this->SetFont('helvetica', 'I', 8); $this->Cell(0, 10, $txt, 0, 0, 'R'); } }
/** * generate a Html2Pdf exception * * @param int $err error number * @param mixed $other additionnal informations * @param string $html additionnal informations * * @return Html2PdfException */ public final function __construct($err = 0, $other = null, $html = '') { // read the error switch ($err) { case 1: // Unsupported tag $msg = Locale::get('err01'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_tag = $other; break; case 2: // too long sentence $msg = Locale::get('err02'); $msg = str_replace('[[OTHER_0]]', $other[0], $msg); $msg = str_replace('[[OTHER_1]]', $other[1], $msg); $msg = str_replace('[[OTHER_2]]', $other[2], $msg); break; case 3: // closing tag in excess $msg = Locale::get('err03'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_tag = $other; break; case 4: // tags closed in the wrong order $msg = Locale::get('err04'); $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); break; case 5: // unclosed tag $msg = Locale::get('err05'); $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); break; case 6: // image can not be loaded $msg = Locale::get('err06'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_image = $other; break; case 7: // too big TD content $msg = Locale::get('err07'); break; case 8: // SVG tag not in DRAW tag $msg = Locale::get('err08'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_tag = $other; break; case 9: // deprecated $msg = Locale::get('err09'); $msg = str_replace('[[OTHER_0]]', $other[0], $msg); $msg = str_replace('[[OTHER_1]]', $other[1], $msg); $this->_tag = $other[0]; break; case 0: // specific error // specific error default: $msg = $other; break; } // create the HTML message $this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">' . "\n"; $this->_messageHtml .= Locale::get('txt01', 'error: ') . $err . '</span><br>' . "\n"; $this->_messageHtml .= Locale::get('txt02', 'file:') . ' ' . $this->file . '<br>' . "\n"; $this->_messageHtml .= Locale::get('txt03', 'line:') . ' ' . $this->line . '<br>' . "\n"; $this->_messageHtml .= '<br>' . "\n"; $this->_messageHtml .= $msg . "\n"; // create the text message $msg = Locale::get('txt01', 'error: ') . $err . ' : ' . strip_tags($msg); // add the optionnal html content if ($html) { $this->_messageHtml .= "<br><br>HTML : ..." . trim(htmlentities($html)) . '...'; $this->_html = $html; $msg .= ' HTML : ...' . trim($html) . '...'; } // save the other informations $this->_other = $other; // construct the exception parent::__construct($msg, $err); }
function printError($str, $type = 'normal', $button = 'logout') { global $service; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo BLOGLOUNGE;?> :: <?php echo $str;?></title> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/login.css" type="text/css" /> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/box.css" type="text/css" /> <script type="text/javascript">var _path = '<?php echo $service['path'];?>';</script> <script type="text/javascript" src="<?php echo $service['path'];?>/scripts/jquery.js"></script> <script type="text/javascript" src="<?php echo $service['path'];?>/scripts/login.js"></script> </head> <body> <div id="container"> <div class="box"> <div class="box_l"><div class="box_r"><div class="box_t"><div class="box_b"> <div class="box_lt"><div class="box_rt"><div class="box_lb"><div class="box_rb"> <div class="box_data"> <img src="<?php echo $service['path'];?>/images/admin/<?php echo Locale::get();?>/login_bloglounge_logo.gif" alt="<?php echo BLOGLOUNGE;?>" /> <hr class="line" /> <div id="login_wrap"> <div class="messages"> <div class="<?php echo $type;?>"> <?php switch($type) { case 'error': ?> <strong>오류 :</strong> <?php break; } ?> <?php echo $str; ?> </div> </div> <div class="toolbar"> <?php switch($button) { case 'admin': ?> <a href="#" class="normalbutton" onclick="history.back(); return false;"><span><?php echo _t('뒤로');?></span></a> <a href="<?php echo $service['path'];?>/admin/" class="normalbutton"><span class="boldbutton"><?php echo _t('관리자');?></span></a> <?php break; case 'loglout': default: ?> <a href="#" class="normalbutton" onclick="history.back(); return false;"><span><?php echo _t('뒤로');?></span></a> <a href="<?php echo $service['path'];?>/logout/" class="normalbutton"><span class="boldbutton"><?php echo _t('로그아웃');?></span></a> <?php break; } ?> </div> </div> <div id="temp_images"> <a href="http://itcanus.net" target="_blank"><img src="<?php echo $service['path'];?>/images/admin/login_itcanus.gif" alt="ITcanus" /></a> </div> <div class="clear"></div> </div> </div></div></div></div> </div></div></div></div> </div> </div> </body> </html> <? exit; }
/** * Handles get requests for the system information page. */ public function get_sysinfo() { $sysinfo = array(); $siteinfo = array(); // Assemble Site Info $siteinfo[_t('Habari Version')] = Version::get_habariversion(); if (Version::is_devel()) { $siteinfo[_t('Habari Version')] .= " " . Version::get_git_short_hash(); } $theme_info = Themes::get_active_data(true); $siteinfo[_t('Habari API Version')] = Version::get_apiversion(); $siteinfo[_t('Habari DB Version')] = Version::get_dbversion(); $siteinfo[_t('Active Theme')] = $theme_info['name'] . ' ' . $theme_info['version']; $siteinfo[_t('System Locale')] = Locale::get(); $siteinfo[_t('Cache Class')] = Cache::get_class(); $this->theme->siteinfo = $siteinfo; // Assemble System Info $sysinfo[_t('PHP Version')] = phpversion(); $sysinfo[_t('Server Software')] = $_SERVER['SERVER_SOFTWARE']; $sysinfo[_t('Database')] = DB::get_driver_name() . ' - ' . DB::get_driver_version(); $sysinfo[_t('PHP Extensions')] = implode(', ', get_loaded_extensions()); $sysinfo[_t('PHP Configuration Settings')] = implode("<br>", Utils::get_ini_settings()); $sysinfo[_t('Browser')] = $_SERVER['HTTP_USER_AGENT']; $this->theme->sysinfo = $sysinfo; // Assemble Class Info $classinfo = Utils::glob(HABARI_PATH . "/user/classes/*.php"); if (count($classinfo)) { $classinfo = array_map('realpath', $classinfo); } $this->theme->classinfo = $classinfo; // Assemble Plugin Info $raw_plugins = Plugins::get_active(); $plugins = array('system' => array(), 'user' => array(), '3rdparty' => array(), 'other' => array()); $all_plugins = Plugins::list_all(); foreach ($raw_plugins as $plugin) { $file = $plugin->get_file(); // Catch plugins that are symlinked from other locations as ReflectionClass->getFileName() only returns the ultimate file path, not the symlink path, and we really want the symlink path $filename = basename($file); if (array_key_exists($filename, $all_plugins) && $all_plugins[$filename] != $file) { $file = $all_plugins[$filename]; } if (preg_match('%[\\\\/](system|3rdparty|user)[\\\\/]plugins[\\\\/]%i', $file, $matches)) { // A plugin's info is XML, cast the element to a string. See #1026. $plugins[strtolower($matches[1])][(string) $plugin->info->name] = array('file' => $file, 'version' => (string) $plugin->info->version); } else { // A plugin's info is XML, cast the element to a string. $plugins['other'][(string) $plugin->info->name] = array('file' => $file, 'version' => (string) $plugin->info->version); } } $this->theme->plugins = $plugins; $this->theme->admin_page = _t('System Information'); $this->display('sysinfo'); }
<body> <div id="container"> <div class="box"> <div class="box_l"><div class="box_r"><div class="box_t"><div class="box_b"> <div class="box_lt"><div class="box_rt"><div class="box_lb"><div class="box_rb"> <div class="box_data"> <div id="logo"> <a href="<?php echo $service['path'];?>/"><img src="<?php echo $service['path'];?>/images/admin/<?php echo Locale::get();?>/login_bloglounge_logo.gif" alt="<?php echo BLOGLOUNGE;?>" /></a> </div> <hr class="line" /> <form method="post" action="" onsubmit="return onJoin(this);"> <div id="join_wrap"> <img src="<?php echo $service['path'];?>/images/admin/<?php echo Locale::get();?>/join_title.gif" alt="<?php echo _t('회원가입');?>" align="absmiddle" /> <input type="hidden" name="posted" value="true"/> <?php if (!empty($_GET['requestURI'])) {?><input type="hidden" name="requestURI" value="<?php echo $_GET['requestURI'];?>"><?}?> <table class="join_table" cellspacing="0" cellpadding="0"> <?php $is_error = func::array_keys_exist(array('username'), $errors); ?> <tr> <td class="title"><label for="username"><?php echo _t('이름');?></label></td> <td> <input type="text" id="username" name="username" tabindex="1" class="input <?php echo $is_error?'errorInput':'faderInput';?>" value="<?php echo isset($_POST['username'])?$_POST['username']:'';?>" /> </td> </tr> <?php if($is_error) {