/** * 读配置 * * @param array * @return array * @throws none */ public static function get_configs($keys = array()) { $values = array(); foreach ($keys as $current_key) { pm_db::query("select fl_value from `pm_config` where `fl_name` = '" . $current_key . "'"); $current_row = pm_db::fetch_one(); $values[$current_key] = $current_row['fl_value']; } return $values; }
public static function get_user_msg($username, $start, $perpage = 20) { $condition = ''; if ($start > -1 && $perpage > 0) { $condition = "ORDER BY id DESC LIMIT {$start}, {$perpage}"; } $query = pm_db::query("SELECT SQL_CALC_FOUND_ROWS * FROM gamebi_usermsg WHERE touser='******' {$condition}"); $ndata = array(); while ($row = pm_db::fetch_one($query)) { pm_db::query("UPDATE gamebi_usermsg SET is_read=1 WHERE id='{$row['id']}'"); $ndata[] = $row; } $data = array(); if ($ndata) { $data['data'] = $ndata; $data['total'] = pm_db::result_first("SELECT FOUND_ROWS() AS rows"); return $data; } else { return null; } }
public static function get_menu_list() { $data = array(); $query = pm_db::query("SELECT * FROM pm_menu WHERE parent_id=0 AND level=1 AND status=1 ORDER BY sort ASC"); while ($row = pm_db::fetch_one($query)) { $data[] = $row; $secondquery = pm_db::query("SELECT * FROM pm_menu WHERE parent_id='{$row['menu_id']}' AND level=2 ORDER BY sort ASC"); while ($second = pm_db::fetch_one($secondquery)) { if (!$second) { continue; } else { $data[] = $second; $query1 = pm_db::query("SELECT * FROM pm_menu WHERE parent_id='{$second['menu_id']}' AND level=3 AND status=1 ORDER BY sort ASC"); while ($row1 = pm_db::fetch_one($query1)) { $data[] = $row1; } } } } return $data; }
/** * 系统信息 * */ public static function system_info() { define("YES", "<span class='resYes'>YES</span>"); define("NO", "<span class='resNo'>NO</span>"); // 系统基本信息 $serverapi = strtoupper(php_sapi_name()); $phpversion = PHP_VERSION; $systemversion = explode(" ", php_uname()); $sysReShow = 'none'; switch (PHP_OS) { case "Linux": $sysReShow = false !== ($sysInfo = self::sys_linux()) ? "show" : "none"; $sysinfo = $systemversion[0] . ' ' . $systemversion[2]; break; case "FreeBSD": $sysReShow = false !== ($sysInfo = self::sys_freebsd()) ? "show" : "none"; $sysinfo = $systemversion[0] . ' ' . $systemversion[2]; break; default: $sysinfo = $systemversion[0] . ' ' . $systemversion[1] . ' ' . $systemversion[3] . $systemversion[4] . $systemversion[5]; break; } if ($sysReShow == 'show') { $pmemory = '共' . $sysInfo['memTotal'] . 'M, 已使用' . $sysInfo['memUsed'] . 'M, 空闲' . $sysInfo['memFree'] . 'M, 使用率' . $sysInfo['memPercent'] . '%'; $pmemorybar = $sysInfo['memPercent']; $swapmomory = '共' . $sysInfo['swapTotal'] . 'M, 已使用' . $sysInfo['swapUsed'] . 'M, 空闲' . $sysInfo['swapFree'] . 'M, 使用率' . $sysInfo['swapPercent'] . '%'; $swapmemorybar = $sysInfo['swapPercent']; $syslaodavg = $sysInfo['loadAvg']; } pm_db::query("SELECT VERSION() AS dbversion"); $mysql = pm_db::fetch_one(); $mysql = $mysql['dbversion']; $phpsafe = self::getcon("safe_mode"); $dispalyerror = self::getcon("display_errors"); $allowurlopen = self::getcon("allow_url_fopen"); $registerglobal = self::getcon("register_globals"); $maxpostsize = self::getcon("post_max_size"); $maxupsize = self::getcon("upload_max_filesize"); $maxexectime = self::getcon("max_execution_time") . 's'; $mqqsp = get_magic_quotes_gpc() === 1 ? YES : NO; $mprsp = get_magic_quotes_runtime() === 1 ? YES : NO; $zendoptsp = get_cfg_var("zend_optimizer.optimization_level") || get_cfg_var("zend_extension_manager.optimizer_ts") || get_cfg_var("zend_extension_ts") ? YES : NO; $iconvsp = self::isfun('iconv'); $curlsp = self::isfun('curl_init'); $gdsp = self::isfun('gd_info'); $zlibsp = self::isfun('gzclose'); $eaccsp = self::isfun('eaccelerator_info'); $xcachesp = extension_loaded('XCache') ? YES : NO; $sessionsp = self::isfun("session_start"); $cookiesp = isset($_COOKIE) ? YES : NO; $serverip = @gethostbyname($_SERVER['SERVER_NAME']); $serverip = $serverip == '' ? '' : " ({$serverip})"; $systime = gmdate("Y年n月j日 H:i:s", time() + 8 * 3600); $phpversionsp = $phpversion > '5.0' ? YES : NO; $mysqlversionsp = $mysql['dbversion'] > '4.1' ? YES : NO; $dbasp = extension_loaded('dba') ? YES : NO; // 数据库大小 $databasesize = 0; pm_db::query("SHOW TABLE STATUS"); while ($rs = pm_db::fetch_one()) { $databasesize += $rs['Data_length'] + $rs['Index_length']; } $databasesize = bytes_to_string($databasesize); //站点统计 pm_db::query("SELECT count(*) as sum FROM gh_ghinfo"); $rt = pm_db::fetch_one(); $ghsum = $rt['sum']; //系统日志大小超过限制提示 $noticemsg = ''; if (@filesize(PATH_DATA . '/log/admin_log.php') > 409600) { $noticemsg = '后台记录日志'; } if (@filesize(PATH_DATA . '/log/php_error.log') > 409600) { $data['noticemsg'] = 'PHP错误日志'; } if (@filesize(PATH_DATA . '/log/mysql_error.php') > 409600) { $data['noticemsg'] = 'mysql日志'; } $data['serverip'] = $serverip; $data['systime'] = $systime; $data['sysinfo'] = $sysinfo; $data['phpversion'] = $phpversion; $data['dbversion'] = $mysql; $data['dispalyerror'] = $dispalyerror; $data['serverapi'] = $serverapi; $data['phpsafe'] = $phpsafe; $data['sessionsp'] = $sessionsp; $data['cookiesp'] = $cookiesp; $data['phpsafe'] = $phpsafe; $data['zendoptsp'] = $zendoptsp; $data['eaccsp'] = $eaccsp; $data['xcachesp'] = $xcachesp; $data['registerglobal'] = $registerglobal; $data['mqqsp'] = $mqqsp; $data['mprsp'] = $mprsp; $data['maxupsize'] = $maxupsize; $data['maxpostsize'] = $maxpostsize; $data['maxexectime'] = $maxexectime; $data['allowurlopen'] = $allowurlopen; $data['curlsp'] = $curlsp; $data['iconvsp'] = $iconvsp; $data['zlibsp'] = $zlibsp; $data['gdsp'] = $gdsp; $data['dbasp'] = $dbasp; $data['datasize'] = $databasesize; $data['ghsum'] = $ghsum; return $data; }
public static function get_right_by_parentid($parent_id) { $data = array(); $query1 = pm_db::query("SELECT * FROM iosadm_admin_action WHERE parent_id='{$row['action_id']}' AND status=1 ORDER BY action_id ASC, sort ASC"); while ($row1 = pm_db::fetch_one($query1)) { $data[] = $row1; } return $data; }
public static function get_ghzc_data_channel($channel, $starttime = '', $endtime = '') { $sql = "SELECT gz.thedate,SUM(gz.charge) AS c,SUM(gz.registernum) AS rn,SUM(gz.chargenum) AS cn FROM pm_ghzcdata AS gz WHERE 1=1"; $sql .= " AND gz.channelid='{$channel}'"; if ($starttime) { $sql .= " AND thedate>='{$starttime}'"; } if ($endtime) { $sql .= " AND thedate<='{$endtime}'"; } $sql .= "GROUP BY gz.thedate ORDER BY gz.thedate ASC"; $query = pm_db::query($sql); $data = array(); while ($row = pm_db::fetch_one($query)) { $row['thedate'] = date('Y-m-d', strtotime($row['thedate'])); $data[] = $row; } return $data; }
public static function get_soplog($start, $opuser = false, $ctrl = false, $act = false, $aday = false, $stime = false, $etime = false) { $data = array(); $condition = ''; if ($keyword && $cols) { $condition1 = " WHERE {$cols}='{$keyword}'"; } if ($start > -1 && $page > 0) { $condition2 = " ORDER BY timestamp DESC LIMIT {$start}, {$page}"; } $condition = $condition1 . $condition2; $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM pm_oplog {$condition}"; //debug($sql); $query = pm_db::query($sql); while ($row = pm_db::fetch_one($query)) { $data[$row['oplid']] = $row; } if ($data) { $output = array(); $total = pm_db::query('SELECT FOUND_ROWS() AS rows'); $total = pm_db::fetch_one(); $output['total'] = $total['rows']; $output['data'] = $data; return $output; } else { return false; } }
public static function loginhistory_list($start, $ip, $start_dateunix, $end_dateunix, $username, $perpage = PAGE_ROWS) { $where = ''; if (!empty($ip)) { $where .= " AND ip LIKE '%{$ip}%' "; } if (!empty($start_dateunix)) { $where .= " AND logintime >= '{$start_dateunix}' "; } if (!empty($end_dateunix)) { $where .= " AND logintime <= '{$end_dateunix}' "; } if ($start > -1 && $perpage > 0) { $where .= "ORDER BY logintime DESC LIMIT {$start}, {$perpage}"; } $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM iosadm_loginhistory WHERE 1=1 AND username = '******' {$where} "; $query = pm_db::query($sql); $total = pm_db::fetch_result("SELECT FOUND_ROWS() AS rows"); $data = array(); while ($row = pm_db::fetch_one($query)) { $ipcent = 0; $row['ip_count'] = self::get_count_oneip($username, $row['ip']); $ipcent = floatval($row['ip_count'] / (double) $total['rows']); if ($ipcent < 0.1) { $row['ip'] = "<font color = 'PINK' ><strong>" . $row['ip'] . "</strong></font>"; } $row['ipcent'] = $ipcent; $row['ipcent'] = number_format($row['ipcent'], 2, '.', ','); $data[$row['id']] = $row; } if ($data) { $output = array(); $output['data'] = $data; $output['total'] = $total['rows']; return $output; } else { return null; } }