public function step2() { if (IS_AJAX) { if (session('error')) { $this->error('环境检测没有通过,请调整环境后重试!'); } else { $this->success('恭喜您环境检测通过', U('step3')); } } else { if (session('step') !== '1') { $this->error("请按顺序安装", U('step1')); } else { session('step', '2'); session('error', false); //环境检测 $this->assign('check_env', check_env()); //目录文件读写检测 if (IS_WRITE) { $this->assign('check_dirfile', check_dirfile()); } //函数及扩展库检测 $this->assign('check_func_and_ext', check_func_and_ext()); $this->assign('meta_title', "step2"); $this->display(); } } }
public function step1() { if (IS_AJAX) { if (session('error')) { $this->error('环境检测没有通过,请调整环境后重试!'); } else { $this->success('恭喜您环境检测通过', U('step2')); } } else { session('error', false); //环境检测 $env = check_env(); //目录文件读写检测 if (IS_WRITE) { $dirfile = check_dirfile(); $this->assign('dirfile', $dirfile); } //函数检测 $func = check_func(); session('step', 1); $this->assign('env', $env); $this->assign('func', $func); $this->display(); } }
function fastpick_manage() { global $head_url, $header_config; $page = $_GET['page'] ? intval($_GET['page']) : 1; $perpage = 25; $start = ($page - 1) * $perpage; $mpurl .= '&perpage=' . $perpage; $perpages = array($perpage => ' selected'); $mpurl = '?' . PICK_GO . 'fast_pick&myac=fastpick_manage'; $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_fastpick')), 0); if ($count) { $query = DB::query("SELECT * FROM " . DB::table('strayer_fastpick') . " ORDER BY id DESC LIMIT {$start},{$perpage} "); while ($v = DB::fetch($query)) { $v['rule_desc'] = cutstr(trim($v['rule_desc']), 245); $info['rs'][] = $v; } } $info['multipage'] = multi($count, $perpage, $page, $mpurl); $info['count'] = $count; $info['is_lan'] = check_env(2, 0) ? 'no' : 'yes'; if (!submitcheck('submit')) { $info['header'] = pick_header_output($header_config, $head_url); return $info; } else { $set = $_GET['set']; $set['member_field'] = serialize($_REQUEST['member_field']); pick_common_set($set); cpmsg(milu_lang('op_success'), PICK_GO . "member", 'succeed'); } }
/** +---------------------------------------------------------- * 探针模式 +---------------------------------------------------------- */ public function checkEnv() { load('pointer', THINK_PATH . '/Tpl/Autoindex'); //载入探针函数 $env_table = check_env(); //根据当前函数获取当前环境 echo $env_table; }
public function step1() { session('error', false); //环境检测 $env = check_env(); //目录文件读写检测 $dirfile = check_dirfile(); //函数检测 $func = check_func(); session('step', 1); $this->assign('env', $env); $this->assign('dirfile', $dirfile); $this->assign('func', $func); $this->display(); }
public function __construct($sess_start = true) { check_env(); if (@($this->db = mysql_connect(BABEL_DB_HOSTNAME . ':' . BABEL_DB_PORT, BABEL_DB_USERNAME, BABEL_DB_PASSWORD))) { mysql_select_db(BABEL_DB_SCHEMATA); mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $rs = mysql_query('SELECT nod_id FROM babel_node WHERE nod_id = 1'); if (@mysql_num_rows($rs) == 1) { } else { exception_message('world'); } } else { exception_message('db'); } if ($sess_start) { session_start(); } $this->URL = new URL(); $this->User = new User('', '', $this->db); if (!isset($GLOBALS['SET_LANG'])) { if ($this->User->vxIsLogin()) { define('BABEL_LANG', $this->User->usr_lang); } else { include BABEL_PREFIX . '/res/supported_languages.php'; if (isset($_SESSION['babel_lang'])) { if (in_array($_SESSION['babel_lang'], array_keys($_languages))) { define('BABEL_LANG', $_SESSION['babel_lang']); } else { define('BABEL_LANG', BABEL_LANG_DEFAULT); } } else { define('BABEL_LANG', BABEL_LANG_DEFAULT); } } $GLOBALS['SET_LANG'] = true; } $this->Validator = new Validator($this->db, $this->User); if (!isset($_SESSION['babel_ua'])) { $_SESSION['babel_ua'] = LividUtil::parseUserAgent(); } global $CACHE_LITE_OPTIONS_SHORT; $this->cs = new Cache_Lite($CACHE_LITE_OPTIONS_SHORT); global $CACHE_LITE_OPTIONS_LONG; $this->cl = new Cache_Lite($CACHE_LITE_OPTIONS_LONG); }
public function __construct() { check_env(); $this->db = mysql_connect(BABEL_DB_HOSTNAME . ':' . BABEL_DB_PORT, BABEL_DB_USERNAME, BABEL_DB_PASSWORD); mysql_select_db(BABEL_DB_SCHEMATA); mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); session_set_cookie_params(2592000); session_start(); $this->User = new User('', '', $this->db); $this->Validator = new Validator($this->db, $this->User); if (!isset($_SESSION['babel_ua'])) { $_SESSION['babel_ua'] = $this->Validator->vxGetUserAgent(); } $this->URL = new URL(); global $CACHE_LITE_OPTIONS_SHORT; $this->cs = new Cache_Lite($CACHE_LITE_OPTIONS_SHORT); global $CACHE_LITE_OPTIONS_LONG; $this->cl = new Cache_Lite($CACHE_LITE_OPTIONS_LONG); }
public function __construct() { check_env(); header('Content-type: text/html; charset=utf-8'); header('Cache-control: no-cache, must-revalidate'); $this->db = mysql_connect(BABEL_DB_HOSTNAME . ':' . BABEL_DB_PORT, BABEL_DB_USERNAME, BABEL_DB_PASSWORD); mysql_select_db(BABEL_DB_SCHEMATA); mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); session_set_cookie_params(2592000); session_start(); $this->User = new User('', '', $this->db); $this->Validator = new Validator($this->db, $this->User); if (!isset($_SESSION['babel_ua'])) { $_SESSION['babel_ua'] = $this->Validator->vxGetUserAgent(); } $sql = 'DELETE FROM babel_online WHERE onl_lastmoved < ' . (time() - BABEL_USR_ONLINE_DURATION); mysql_query($sql, $this->db); $sql = "SELECT onl_hash FROM babel_online WHERE onl_hash = '" . session_id() . "'"; $rs = mysql_query($sql, $this->db); if (isset($_SERVER['HTTP_REFERER'])) { $referer = mysql_real_escape_string($_SERVER['HTTP_REFERER']); } else { $referer = ''; } if (mysql_num_rows($rs) == 1) { $s = mysql_fetch_object($rs); mysql_free_result($rs); $sql = "UPDATE babel_online SET onl_nick = '" . $this->User->usr_nick . "', onl_ua = '" . $_SESSION['babel_ua']['ua'] . "', onl_ip = '" . $_SERVER['REMOTE_ADDR'] . "', onl_uri = '" . mysql_real_escape_string($_SERVER['REQUEST_URI']) . "', onl_ref = '" . $referer . "', onl_lastmoved = " . time() . " WHERE onl_hash = '" . session_id() . "'"; mysql_query($sql, $this->db); } else { mysql_free_result($rs); $sql = "INSERT INTO babel_online(onl_hash, onl_nick, onl_ua, onl_ip, onl_uri, onl_ref, onl_created, onl_lastmoved) VALUES('" . session_id() . "', '" . mysql_real_escape_string($this->User->usr_nick) . "', '" . $_SESSION['babel_ua']['ua'] . "', '" . $_SERVER['REMOTE_ADDR'] . "', '" . mysql_real_escape_string($_SERVER['REQUEST_URI']) . "', '" . $referer . "', " . time() . ', ' . time() . ')'; mysql_query($sql, $this->db); } $this->URL = new URL(); }
<?php define('ENTRY_PATH', dirname(dirname(__FILE__))); define('INSTALL_PATH', ENTRY_PATH . '/install'); require ENTRY_PATH . "/vendor/autoload.php"; require ENTRY_PATH . "/Data/Migrations/0_install.php"; require INSTALL_PATH . '/common.php'; require ENTRY_PATH . '/Application/Common/Common/function.php'; require ENTRY_PATH . '/Application/Account/Common/function.php'; echo file_get_contents(INSTALL_PATH . '/Guide.md'); echo "\n"; display_loading('checking environment', 5); // 检测基本环境 if (!check_env()) { return; } // 数据库连接配置 $db_config = ['adapter' => 'mysql', 'host' => '127.0.0.1', 'port' => '3306', 'user' => '', 'pass' => '', 'name' => 'ones_v1']; foreach ($db_config as $k => $v) { $need_key = $k; if ($v) { $need_key .= " (default is {$v})"; } printf('Your database %s:', $need_key); $input_value = trim(fgets(STDIN)); $check_func = sprintf('check_input_for_' . $k); if (function_exists($check_func)) { $check_result = $check_func($input_value); if (true !== $check_result) { send_exit_single($check_result); return;
* You should have received a copy of the GNU Affero General Public License * along with WEIPDCRM. If not, see <http://www.gnu.org/licenses/>. */ header('Content-Type: text/html; charset=utf-8'); define("DCRM", true); error_reporting(E_ALL ^ E_WARNING); require_once 'function.php'; $header_title = __('Installer'); // 检查数据库配置文件 if (!file_exists(CONF_PATH . 'connect.inc.php')) { header('location: setup-config.php?' . $step_language); exit; } // 检查环境 $disabled = true; $env_vars = check_env($disabled); $dir_file_vars = check_dir($disabled); $func_vars = check_func($disabled); $notice = check_notice(true); $step = isset($_GET['step']) ? $_GET['step'] : 0; require_once CONF_PATH . 'connect.inc.php'; // Test Connect $con = mysql_connect(DCRM_CON_SERVER . ':' . (defined("DCRM_CON_SERVER_PORT") ? DCRM_CON_SERVER_PORT : '3306'), DCRM_CON_USERNAME, DCRM_CON_PASSWORD); if (!$con) { $inst_alert = mysql_error(); _e('<strong>ERROR</strong>: Can’t connect database server.') . '<br/>' . $inst_alert; exit; } // Make sure DCRM is not already installed. // Check installed.lock file. if (!defined("DEVELOP_ENABLED")) {
<?php namespace meteor\database; check_env(); use meteor\core\Config; use meteor\exceptions\DatabaseException; class Database { private static $tables = ["users" => "meteor_users", "users.settings" => "meteor_user_settings", "users.permissions" => "meteor_user_permissions", "users.assignments" => "meteor_users_assignments", "users.scores" => "meteor_users_scores", "users.question.scores" => "meteor_users_question_scores", "groups" => "meteor_groups", "groups.settings" => "meteor_group_settings", "groups.permissions" => "meteor_group_permissions", "groups.users" => "meteor_group_users", "groups.assignments" => "meteor_groups_assignments", "tokens" => "meteor_tokens", "assignment" => "meteor_assignments", "assessment" => "meteor_assessments", "assessment.questions" => "meteor_assessment_questions", "assessment.answers" => "meteor_assessment_answers"]; private static $queryCache = []; private static $connected; private static $connection; /** * Initialise the database from the config settings. */ public static function init() { if (self::$connected) { return; } self::$connection = mysqli_connect(Config::getDatabaseHost(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabaseName()); if (mysqli_connect_errno() != 0) { throw new DatabaseException(mysqli_error(self::$connection)); } self::$connected = true; } /** * Execute a SQL query to this database. * * @param $query string the sql query to execute
case '': $cat_arr = pick_category_list(); foreach ($cat_arr as $k_c => $v_c) { $query = DB::query("SELECT * FROM " . DB::table('strayer_picker') . " WHERE pick_cid='{$v_c['cid']}' ORDER BY displayorder ASC,pid DESC"); while ($rs = DB::fetch($query)) { $rs['article_count'] = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_article_title') . " WHERE pid =" . $rs['pid'] . ""), 0); $rs['url_count'] = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_url') . " WHERE pid =" . $rs['pid'] . " "), 0); $rs['no_import_count'] = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_article_title') . " WHERE pid =" . $rs['pid'] . " AND status=0"), 0); $rs['is_cron_show'] = $rs['is_auto_pick'] > 0 ? milu_lang('can_use') : ''; $rs['lastrun_show'] = $rs['lastrun'] ? dgmdate($rs['lastrun']) : ''; $rs['nextrun_show'] = $rs['nextrun'] ? dgmdate($rs['nextrun']) : ''; $data[$v_c['cid']][] = $rs; } } $info['header'] = pick_header_output($header_config, $head_url); $info['is_lan'] = check_env(2, 0) ? 'no' : 'yes'; if ($_GET['submit']) { $pid_arr = $_GET['pid']; $pick_op = $_GET['pick_op']; $move_cid = $_GET['move_cid']; if ($pick_op == 'del' || $pick_op == 'move') { foreach ((array) $pid_arr as $k => $pid) { if ($pick_op == 'del') { del_picker($pid); } else { if ($pick_op == 'move') { move_picker($pid, $move_cid); } } } } else {
public function __construct() { session_start(); if (BABEL_DEBUG) { $this->timer = new Benchmark_Timer(); $this->timer->start(); if (!isset($_SESSION['babel_debug_log'])) { $_SESSION['babel_debug_log'] = array(); } } else { error_reporting(0); } check_env(); if (@($this->db = mysql_connect(BABEL_DB_HOSTNAME . ':' . BABEL_DB_PORT, BABEL_DB_USERNAME, BABEL_DB_PASSWORD))) { mysql_select_db(BABEL_DB_SCHEMATA); mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8"); mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'"); $rs = mysql_query('SELECT nod_id FROM babel_node WHERE nod_id = 1'); if (@mysql_num_rows($rs) == 1) { mysql_free_result($rs); } else { mysql_free_result($rs); exception_message('world'); } } else { exception_message('db'); } global $CACHE_LITE_OPTIONS_SHORT; $this->cs = new Cache_Lite($CACHE_LITE_OPTIONS_SHORT); /* legacy long cache: global $CACHE_LITE_OPTIONS_LONG; $this->cl = new Cache_Lite($CACHE_LITE_OPTIONS_LONG); */ global $ZEND_CACHE_OPTIONS_LONG_FRONTEND; global $ZEND_CACHE_OPTIONS_LONG_BACKEND; global $ZEND_CACHE_OPTIONS_MEMCACHED; if (ZEND_CACHE_MEMCACHED_ENABLED == 'yes') { $this->cl = Zend_Cache::factory('Core', 'Memcached', $ZEND_CACHE_OPTIONS_LONG_FRONTEND, $ZEND_CACHE_OPTIONS_MEMCACHED); } else { $this->cl = Zend_Cache::factory('Core', ZEND_CACHE_TYPE_LONG, $ZEND_CACHE_OPTIONS_LONG_FRONTEND, $ZEND_CACHE_OPTIONS_LONG_BACKEND[ZEND_CACHE_TYPE_LONG]); } if (BABEL_DEBUG) { $_SESSION['babel_debug_profiling'] = true; mysql_query("SET PROFILING = 1") or $_SESSION['babel_debug_profiling'] = false; mysql_query("SET PROFILING_HISTORY_SIZE = 100") or $_SESSION['babel_debug_profiling'] = false; } else { $_SESSION['babel_debug_profiling'] = false; } $this->User = new User('', '', $this->db); if ($this->User->vxIsLogin()) { define('BABEL_LANG', $this->User->usr_lang); } else { include BABEL_PREFIX . '/res/supported_languages.php'; if (isset($_SESSION['babel_lang'])) { if (in_array($_SESSION['babel_lang'], array_keys($_languages))) { define('BABEL_LANG', $_SESSION['babel_lang']); } else { define('BABEL_LANG', BABEL_LANG_DEFAULT); } } else { define('BABEL_LANG', BABEL_LANG_DEFAULT); } } $GLOBALS['SET_LANG'] = true; require_once BABEL_PREFIX . '/lang/' . BABEL_LANG . '/lang.php'; $this->lang = new lang(); if ($this->User->vxIsLogin()) { $sql = "SELECT usr_id, usr_gender, usr_nick, usr_portrait FROM babel_user, babel_friend WHERE usr_id = frd_fid AND frd_uid = {$this->User->usr_id} ORDER BY frd_created ASC"; $rs = mysql_query($sql); $_friends = array(); while ($_friend = mysql_fetch_array($rs)) { $_friends[$_friend['usr_id']] = $_friend; } mysql_free_result($rs); $this->User->usr_friends = $_friends; } $this->Validator = new Validator($this->db, $this->User); if (!isset($_SESSION['babel_ua'])) { $_SESSION['babel_ua'] = LividUtil::parseUserAgent(); } $sql = 'DELETE FROM babel_online WHERE onl_lastmoved < ' . (time() - BABEL_USR_ONLINE_DURATION); mysql_query($sql, $this->db); $sql = "SELECT onl_hash FROM babel_online WHERE onl_hash = '" . mysql_real_escape_string(session_id()) . "'"; $rs = mysql_query($sql, $this->db); if (isset($_SERVER['HTTP_REFERER'])) { $referer = mysql_real_escape_string($_SERVER['HTTP_REFERER']); } else { $referer = ''; } if (mysql_num_rows($rs) == 1) { $s = mysql_fetch_object($rs); mysql_free_result($rs); $sql = "UPDATE babel_online SET onl_nick = '" . mysql_real_escape_string($this->User->usr_nick, $this->db) . "', onl_ua = '" . mysql_real_escape_string($_SESSION['babel_ua']['ua'], $this->db) . "', onl_ip = '" . $_SERVER['REMOTE_ADDR'] . "', onl_uri = '" . mysql_real_escape_string($_SERVER['REQUEST_URI']) . "', onl_ref = '" . $referer . "', onl_lastmoved = " . time() . " WHERE onl_hash = '" . mysql_real_escape_string(session_id()) . "'"; mysql_query($sql, $this->db); } else { mysql_free_result($rs); $sql = "INSERT INTO babel_online(onl_hash, onl_nick, onl_ua, onl_ip, onl_uri, onl_ref, onl_created, onl_lastmoved) VALUES('" . mysql_real_escape_string(session_id()) . "', '" . mysql_real_escape_string($this->User->usr_nick) . "', '" . mysql_real_escape_string($_SESSION['babel_ua']['ua']) . "', '" . $_SERVER['REMOTE_ADDR'] . "', '" . mysql_real_escape_string($_SERVER['REQUEST_URI']) . "', '" . $referer . "', " . time() . ', ' . time() . ')'; mysql_query($sql, $this->db); } $this->URL = new URL(); $this->Geo = new Geo($this->User->usr_geo); if ($count_a = $this->cs->get('count')) { $count_a = unserialize($count_a); $this->pst_count = $count_a['pst_count']; $this->tpc_count = $count_a['tpc_count']; $this->fav_count = $count_a['fav_count']; $this->svp_count = $count_a['svp_count']; $this->usr_count = $count_a['usr_count']; $this->ing_count = $count_a['ing_count']; $this->blg_count = $count_a['blg_count']; } else { $sql = "SELECT COUNT(pst_id) FROM babel_post"; $rs = mysql_query($sql, $this->db); $this->pst_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $sql = "SELECT COUNT(tpc_id) FROM babel_topic"; $rs = mysql_query($sql, $this->db); $this->tpc_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $sql = "SELECT COUNT(fav_id) FROM babel_favorite"; $rs = mysql_query($sql, $this->db); $this->fav_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $sql = "SELECT COUNT(svp_id) FROM babel_savepoint"; $rs = mysql_query($sql, $this->db); $this->svp_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $sql = "SELECT COUNT(usr_id) FROM babel_user"; $rs = mysql_query($sql, $this->db); $this->usr_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $sql = "SELECT COUNT(ing_id) FROM babel_ing_update"; $rs = mysql_query($sql, $this->db); $this->ing_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $sql = "SELECT COUNT(blg_id) FROM babel_weblog"; $rs = mysql_query($sql, $this->db); $this->blg_count = mysql_result($rs, 0, 0); mysql_free_result($rs); $count_a = array(); $count_a['pst_count'] = $this->pst_count; $count_a['tpc_count'] = $this->tpc_count; $count_a['fav_count'] = $this->fav_count; $count_a['svp_count'] = $this->svp_count; $count_a['usr_count'] = $this->usr_count; $count_a['ing_count'] = $this->ing_count; $count_a['blg_count'] = $this->blg_count; $this->cs->save(serialize($count_a), 'count'); } $sql = "SELECT onl_hash FROM babel_online WHERE onl_nick = ''"; $rs_a = mysql_query($sql, $this->db); $sql = "SELECT onl_hash, onl_nick FROM babel_online WHERE onl_nick != ''"; $rs_b = mysql_query($sql, $this->db); $this->online_count_anon = mysql_num_rows($rs_a); $this->online_count_reg = mysql_num_rows($rs_b); mysql_free_result($rs_a); mysql_free_result($rs_b); $this->online_count = $this->online_count_anon + $this->online_count_reg; $this->restricted = get_restricted($this->cs); preg_match('/([0-9]+)/', '$Revision$', $z); $this->ver = '0.5.' . $z[1]; header('Content-Type: text/html; charset=UTF-8'); header('Cache-control: no-cache, must-revalidate'); }
function rules_list() { global $_G, $head_url, $header_config; $page = $_GET['page'] ? intval($_GET['page']) : 1; $perpage = 35; $start = ($page - 1) * $perpage; $mpurl .= '&perpage=' . $perpage; $perpages = array($perpage => ' selected'); $mpurl = '?' . PICK_GO . 'system_rules&myac=rules_list'; $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_rules')), 0); if ($count) { $query = DB::query("SELECT * FROM " . DB::table('strayer_rules') . " ORDER BY rid DESC LIMIT {$start},{$perpage} "); while ($v = DB::fetch($query)) { $v['rule_desc'] = cutstr(trim($v['rule_desc']), 245); $data['rs'][] = $v; } } $data['header'] = pick_header_output($header_config, $head_url); $data['is_lan'] = check_env(2, 0) ? 'no' : 'yes'; $data['multipage'] = multi($count, $perpage, $page, $mpurl); return $data; }
show_error('database_nonexistence', '', true); } if (empty($dbcharset) && in_array(strtolower($charset), array('gbk', 'big5', 'utf-8'))) { $dbcharset = str_replace('-', '', $charset); } $uchidden = ''; if (getgpc('ucapi', 'p')) { $uchidden = var_to_hidden('ucapi', getgpc('ucapi', 'p')); $uchidden .= var_to_hidden('appurl', getgpc('appurl', 'p')); $uchidden .= var_to_hidden('ucfounderpw', getgpc('ucfounderpw', 'p')); } if ($step == 0) { show_license(); } elseif ($step == 1) { @touch(DISCUZ_ROOT . './uc_server/data/upgrade.lock'); $errors = check_env(); $quit = $errors['quit']; unset($errors['quit']); if ($errors) { show_error('error_env', $errors, $quit); } show_tips('tips_env_check'); show_error('', $errors); show_setting('start'); echo '<div class="desc"><input type="button" name="button" onclick="window.location=\'index.php?step=2\'" value="' . $lang['check_pass_next_step'] . '" /></desc>'; show_setting('hidden', 'step', $step); show_setting('end'); show_footer(); } elseif ($step == 2) { $error_config = $error_admin = $adminuser = array(); $showforceinstall = false;