-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
8,846 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
// 系统基本配置 ********************************************** | ||
|
||
$Config['HttpPath'] = false; // 是否开启 index.php/Controller/Action/name/value 模式 | ||
$Config['Filter'] = true; // 是否过滤 $_GET、$_POST、$_COOKIE、$_FILES | ||
$Config['XSS'] = true; // 是否开启 XSS防范 | ||
$Config['SessionStart'] = true; // 是否开启 SESSION | ||
$Config['DebugPhp'] = false; // 是否开启PHP运行报错信息 | ||
$Config['DebugSql'] = false; // 是否开启源码调试Sql语句 | ||
$Config['CharSet'] = 'utf-8'; // 设置网页编码 | ||
$Config['UrlControllerName'] = 'c'; // 自定义控制器名称 例如: index.php?c=index | ||
$Config['UrlActionName'] = 'a'; // 自定义方法名称 例如: index.php?c=index&a=IndexAction | ||
|
||
|
||
// 默认使用数据库配置 ***************************************** | ||
|
||
$Config['ConnectTag'] = 'default'; // Mysql连接标识 可同时进行多连接 | ||
$Config['Host'] = 'localhost'; // Mysql主机地址 | ||
$Config['User'] = 'root'; // Mysql用户 | ||
$Config['Password'] = 'MysqlPass'; // Mysql密码 | ||
$Config['DBname'] = 'amh'; // 数据库名称 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
<?php | ||
|
||
/************************************************ | ||
* Amysql Host - AMH 4.2 | ||
* Amysql.com | ||
* @param Object Functions 面板常用函数类 | ||
* Update:2013-11-01 | ||
* | ||
*/ | ||
|
||
class Functions | ||
{ | ||
// 过滤结果数据 | ||
function trim_result($result) | ||
{ | ||
$result = trim($result); | ||
$result = str_replace( | ||
array( | ||
'[LNMP/Nginx] Amysql Host - AMH 4.2', | ||
'http://Amysql.com', | ||
'=============================================================' | ||
), '', $result); | ||
|
||
Return $result; | ||
} | ||
|
||
// 命令过滤 | ||
function trim_cmd($cmd) | ||
{ | ||
$cmd = str_replace(array(';', '&', '|', '`'), ' ', trim($cmd)); | ||
$cmd = str_replace(array('#'), array('\\\\#'), trim($cmd)); | ||
$cmd = preg_replace("/[ ]+/", " ", $cmd); | ||
Return $cmd; | ||
} | ||
|
||
// 分页页码 | ||
function page ($name, $total_num, $total_page, $page, $set_url = null) | ||
{ | ||
$uri = explode('?', $_SERVER['REQUEST_URI']); | ||
$url = _Host . $uri[0] . '?'; | ||
|
||
if (!empty($set_url)) | ||
$url .= $set_url; | ||
else | ||
$url .= preg_replace("/[\&]{0,}page\=[0-9]+/i", '', $uri[1]); | ||
|
||
$data = NULL; | ||
$url_model = '<a id="$id" href="$url&page=$page">$txt</a>'; | ||
$replace_name = array('$url', '$page', '$name', '$txt', '$id'); | ||
|
||
if($page-3>0) | ||
{ | ||
$start=$page-3; | ||
if($page+3<$total_page) | ||
$end=$page+3; | ||
else | ||
{ | ||
if($total_page-6>0) | ||
$start=$total_page-6; | ||
else | ||
$start=1; | ||
$end=$total_page; | ||
} | ||
} | ||
else | ||
{ | ||
$start=1; | ||
if($total_page<7) | ||
$end=$total_page; | ||
else | ||
$end=7; | ||
} | ||
|
||
if($page>1) | ||
$data .= str_replace($replace_name, array($url, $page-1, $name, '<', ''), $url_model); | ||
|
||
if($start!=1) | ||
$data .= str_replace($replace_name, array($url, '1', $name, '1', ''), $url_model) . ' ...'; | ||
|
||
for($i=$start;$i<=$end;$i++) | ||
{ | ||
if ($i==$page) | ||
$data .= ' ' . str_replace($replace_name, array($url, $i, $name, $i, 'page_now'), $url_model) ; | ||
else | ||
$data .= ' ' . str_replace($replace_name, array($url, $i, $name, $i, ''), $url_model); | ||
} | ||
|
||
if($end!=$total_page) | ||
$data .= ' ... ' . str_replace($replace_name, array($url, $total_page, $name, $total_page, ''), $url_model) ; | ||
if($total_page > $page) | ||
$data .= ' ' . str_replace($replace_name, array($url, $page+1, $name, '>', ''), $url_model) ; | ||
|
||
Return str_replace('?&', '?', $data); | ||
} | ||
|
||
|
||
// 面板检查登录 | ||
function CheckLogin() | ||
{ | ||
if (!isset($_SESSION['amh_user_name']) || empty($_SESSION['amh_user_name'])) | ||
{ | ||
header('location:./index.php?c=index&a=login'); | ||
exit(); | ||
} | ||
else | ||
{ | ||
// CSRF防范 | ||
if(($_SESSION['amh_config']['OpenCSRF']['config_value'] == 'on') && (!isset($_REQUEST['amh_token']) || $_REQUEST['amh_token'] != $_SESSION['amh_token']) ) | ||
{ | ||
$_SESSION['CSRF_Url'] = trim(_Http, '/') . $_SERVER['REQUEST_URI']; | ||
header('location:./index.php?c=index&a=index_csrf'); | ||
exit(); | ||
} | ||
} | ||
} | ||
|
||
// 取得模块信息&评分 | ||
function get_module_score() | ||
{ | ||
if (isset($_SESSION['module_score'])) | ||
Return; | ||
$timeout = array( | ||
'http'=>array( | ||
'method'=>"GET", | ||
'timeout'=>8, | ||
) | ||
); | ||
|
||
$module_score = array(); | ||
$context = stream_context_create($timeout); | ||
$_module_list = unserialize(file_get_contents('http://amysql.com/AMH.htm?module_list=y&v=' . $_SESSION['amh_version'], false, $context)); | ||
if (is_array($_module_list)) | ||
{ | ||
foreach ($_module_list as $key=>$val) | ||
$module_score[$val['module_name']] = array('val' => number_format($val['module_stars'] / $val['module_starts_sum'], 2), 'sum' => $val['module_starts_sum']); | ||
unset($_module_list); | ||
} | ||
$_SESSION['module_score'] = $module_score; | ||
} | ||
|
||
// 取得已安装的模块 | ||
function get_module_available() | ||
{ | ||
// if (isset($_SESSION['module_available'])) Return; | ||
$cmd = 'amh ls_modules'; | ||
$result = trim(shell_exec($cmd), "\n"); | ||
|
||
if (empty($result)) Return array(); | ||
|
||
$data = array(); | ||
$run_list = explode("\n", $result); | ||
foreach ($run_list as $key=>$val) | ||
{ | ||
// Module Status | ||
$cmd = "amh module $val status"; | ||
$cmd = Functions::trim_cmd($cmd); | ||
exec($cmd, $tmp, $status); | ||
if (!$status) | ||
{ | ||
// Module Info | ||
$cmd = "amh module $val info"; | ||
$cmd = Functions::trim_cmd($cmd); | ||
$result = trim(shell_exec($cmd), "\n"); | ||
$result = Functions::trim_result($result); | ||
preg_match("/AMH-ModuleAdmin:(.*)/", $result, $ModuleAdmin); | ||
// preg_match("/AMH-ModuleIco:(.*)/", $result, $ModuleIco); | ||
$ModuleID = explode('-', $val); | ||
$data[] = array('ModuleID' => $ModuleID[0], 'ModuleName' => $val, 'ModuleAdmin' => $ModuleAdmin[1], /*'ModuleIco' => $ModuleIco[1]*/); | ||
} | ||
} | ||
$_SESSION['module_available'] = $data; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
/************************************************ | ||
* Amysql Host - AMH 4.2 | ||
* Amysql.com | ||
* @param Object VerifyCode 验证码控制器 | ||
* Update:2013-11-01 | ||
* | ||
*/ | ||
|
||
class VerifyCode extends AmysqlController | ||
{ | ||
function IndexAction() | ||
{ | ||
$str = "23456789ABCDEFGHJKMNPQRSTUVWXYZ"; | ||
$code_str = str_shuffle($str); | ||
$code = str_split(substr($code_str, 0,4)); | ||
|
||
$_SESSION['VerifyCode'] = strtolower(implode('',$code)); | ||
|
||
$width = 115; | ||
$height = 29; | ||
|
||
$im = ImageCreate($width,$height); // 创建图形 | ||
ImageColorAllocate($im,255,255,255); // 填充背景颜色为白色 | ||
|
||
// 用淡色给图形添加杂色 | ||
for ($i=0; $i<100; $i++) | ||
{ | ||
$pxcolor = ImageColorAllocate($im,230,104,66); | ||
ImageSetPixel($im,mt_rand(0,$width),mt_rand(0,$height),$pxcolor); | ||
} | ||
|
||
// 用深色调绘制边框 | ||
$bordercolor = ImageColorAllocate($im,255,255,255); | ||
ImageRectangle($im,0,0,$width-1,$height-1,$bordercolor); | ||
|
||
$offset = rand(10,30); | ||
$font = array('View/font/UniversityRomanStd.otf'); | ||
foreach ($code as $char) | ||
{ | ||
$textcolor = ImageColorAllocate($im,230,104,106); | ||
shuffle($font); | ||
imagettftext($im, 22, rand(-20,40), $offset, 26, $textcolor, $font[0], $char); | ||
$offset += $width/5-rand(0,2); | ||
} | ||
|
||
$code_str = str_shuffle($str); | ||
$code = str_split(substr($code_str, 0, 5)); | ||
|
||
// 干扰字符 | ||
$offset = rand(10,30); | ||
foreach ($code as $char) | ||
{ | ||
$textcolor = ImageColorAllocate($im,230,104,66); | ||
shuffle($font); | ||
imagettftext($im, 8, rand(-20,40), $offset, 26, $textcolor, $font[0], $char); | ||
$offset += rand(5,10); | ||
} | ||
|
||
// 禁止缓存 | ||
header("pragma:no-cache\r\n"); | ||
header("Cache-Control:no-cache\r\n"); | ||
header("Expires:0\r\n"); | ||
|
||
if (ImageTypes() & IMG_PNG) | ||
{ | ||
header('Content-Type:image/png'); | ||
ImagePNG($im); | ||
} | ||
elseif (ImageTypes() & IMG_JPEG) | ||
{ | ||
header('Content-Type:image/jpeg'); | ||
ImageJPEG($im); | ||
} | ||
else | ||
{ | ||
header('Content-Type:image/gif'); | ||
ImageGif($im); | ||
} | ||
} | ||
} |
Oops, something went wrong.