Esempio n. 1
0
 function init_config()
 {
     global $i_model, $_lang, $_K;
     $this->_basic_arr = $basic_arr = db_factory::query('select config_id,k,v,type,listorder from ' . TABLEPRE . 'witkey_basic_config');
     $config_arr = array();
     $size = sizeof($basic_arr);
     for ($i = 0; $i < $size; $i++) {
         $config_arr[$basic_arr[$i]['k']] = trim($basic_arr[$i]['v']);
         if ($basic_arr[$i]['k'] == 'ban_content' || $basic_arr[$i]['k'] == 'ban_users') {
             $config_arr[$basic_arr[$i]['k']] = trim(trim($basic_arr[$i]['v']), '|');
         }
     }
     $mtime = explode(' ', microtime());
     $nav_list = kekezu::get_table_data('*', 'witkey_nav', 'ishide!=1', 'listorder', '', '', "nav_id", null);
     $this->_nav_list = $nav_list;
     $_K['autoshop'] = $config_arr['autoshop'];
     $_K['timestamp'] = $mtime[1];
     $_K['charset'] = CHARSET;
     $_K['sitecss'] = $config_arr['sitecss'];
     $_K['css_auto_fit'] = $config_arr['css_auto_fit'];
     $_K['theme'] = $config_arr['theme'];
     $_K['sitename'] = $config_arr['website_name'];
     $_K['siteurl'] = $config_arr['website_url'];
     $_K['inajax'] = 0;
     $_K['block_search'] = array();
     $_K['is_rewrite'] = $config_arr['is_rewrite'];
     $_K['timespan'] = '600';
     $_K['i'] = 0;
     if (isset($_SERVER['HTTP_REFERER'])) {
         $_K['refer'] = $_SERVER['HTTP_REFERER'];
     }
     $_K['block_search'] = $_K['block_replace'] = array();
     $_lang = array();
     @(include S_ROOT . '/config/lic.php');
     $config_arr['seo_title'] and $_K['html_title'] = $config_arr['seo_title'] or $_K['html_title'] = $config_arr['website_name'];
     define('SKIN_PATH', 'tpl/default');
     define("EXP_NAME", $config_arr['exp_rename'] ? $config_arr['exp_rename'] : $_lang['experience']);
     define('FORMHASH', kekezu::formhash());
     define('SITEURL', $config_arr['website_url']);
     define('SITENAME', $config_arr['website_name']);
     $this->_sys_config = $config_arr;
     if ((int) KEKE_DEBUG == 1) {
         set_error_handler(array('keke_core_class', 'error_handler'));
         set_exception_handler(array('keke_exception', 'handler'));
     }
     register_shutdown_function(array('keke_core_class', 'shutdown_handler'));
 }
Esempio n. 2
0
 public function admin_login($username, $password, $allow_times, $formhash = '')
 {
     global $_lang;
     global $kekezu;
     if (!kekezu::submitcheck($formhash, true)) {
         $hash = kekezu::formhash();
         $kekezu->echojson($_lang['repeat_form_submit'], 6, array('formhash' => $hash));
         die;
     }
     $user_info = keke_user_class::user_login($username, $password);
     $hash = kekezu::formhash();
     if ($user_info == -1) {
         $kekezu->echojson($_lang['username_input_error'], "6", array('formhash' => $hash));
         die;
     } else {
         if ($user_info == -2) {
             $kekezu->echojson($_lang['username_password_input_error'], "5", array('formhash' => $hash));
             die;
         }
     }
     if (!$user_info) {
         $kekezu->echojson($_lang['login_fail'], "4", array('formhash' => $hash));
         die;
     } else {
         $user_info = kekezu::get_user_info($user_info['uid']);
     }
     if (!$user_info) {
         $kekezu->echojson($_lang['no_rights_login_backstage'], "3", array('formhash' => $hash));
         die;
     } else {
         if (!$user_info['group_id'] && $user_info['uid'] != ADMIN_UID) {
             $kekezu->echojson($_lang['no_rights_login_backstage'], "2", array('formhash' => $hash));
             die;
         } else {
             $_SESSION['auid'] = $_SESSION['uid'] = $user_info['uid'];
             $_SESSION['username'] = $user_info['username'];
             kekezu::admin_system_log($user_info['username'] . date('Y-m-d H:i:s', time()) . $_lang['login_system']);
             $kekezu->echojson($_lang['login_success'], "1");
             die;
         }
     }
 }