<?php
if(!defined('CORE_ROOT')) exit();
require CORE_ROOT.'include/admin.inc.php';
!isset($get_action) && $get_action = '';
if($get_action == 'phpinfo') {
if(function_exists('phpinfo')) {
phpinfo();exit;
} else {
exit('phpinfo() is disabled');
}
} elseif($get_action == 'checkwritable') {
$array_files = array(
FORE_ROOT,
'cache',
'templates',
'cache/templates',
'cache/foretemplates',
'configs',
);
$message = '';
foreach($array_files as $file) {
if(!is_writable($file)) $message .= '"'.$file.'"'.$lan['isunwritable'].'<br>';
}
if(!empty($message)) {
adminmsg($lan['writableerror'].'<br>'.$message, 'index.php?file=welcome', 3, 1);
} else {
adminmsg($lan['writableok'], 'index.php?file=welcome');
}
} elseif($get_action == 'updatecache') {
updatecache();
deletecache('categoryselect');
adminmsg($lan['operatesuccess'], 'index.php?file=welcome');
} elseif($get_action == 'copyfront') {
createfore();
adminmsg($lan['operatesuccess'], 'index.php?file=welcome');
} elseif($get_action == 'checknew') {
include(CORE_ROOT.'repair.php');
$apiurl = 'http://www.akcms.com/api/checknew2.php?ver='.$sysedition;
$result = readfromurl($apiurl);
$apiurl = 'http://www.akcms.com/api/changelog4.php?ver='.$sysedition.'&akpath=http://'.$_SERVER['HTTP_HOST'].substr(AK_URL, 0, -1);
if($result == '1') {
aexit("$('#newversion').html('<a href=\"$apiurl\" target=\"_self\">{$lan['findnew']}</a>');");
}
} elseif($get_action == 'checklicense') {
writetofile('#', AK_ROOT.'configs/license.php');
akheader('location:index.php?file=welcome');
} elseif($get_action == 'checkmessage') {
$message = array();
$result = $db->get_by('password', 'admins' , "editor='admin'");
if($result == 'd7afde3e7059cd0a0fe09eec4b0008cd') $message[] = $lan['simplepw'];
if(!empty($ifdebug)) $message[] = $lan['opendebugmode'];
foreach($message as $k => $v) {
$message[$k] = toutf8($v);
}
aexit(json_encode($message));
} else {
if(!empty($_GET['updated'])) writetofile("<?php//{$sysedition}?>", AK_ROOT.'configs/version.php');
$theme = '';
if(isset($setting_theme)) $theme = $setting_theme;
$infos = getcache('infos');
$servertime = date('Y-m-d H:i:s', time());
$correcttime = date('Y-m-d H:i:s', $thetime);
isset($_ENV['TERM']) && $os = $_ENV['TERM'];
$max_upload = ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'Disabled';
$maxexetime = ini_get('max_execution_time');
$alreadyinstalled = $db->query_by('*', 'apps');
while($v = $db->fetch_array($alreadyinstalled)) {
$installtime = date('y-m-d', $v['updatetime']);
$html .= "<div class='welcome_app'>
<div class='welcome_appicon'><a href='index.php?app={$v['key']}' target='_self'><img border=0 src='{$v['picture']}' /></a></div>
<ul class='welcome_appdetail'>
<li class='appname'>{$v['app']}</li>
</ul>
</div>";
}
$variables = array(
'items' => $infos['items'],
'pvs' => $infos['pvs'],
'editors' => $infos['editors'],
'attachmentsizes' => empty($infos['attachmentsizes']) ? 0 : $infos['attachmentsizes'],
'attachments' => $infos['attachments'],
'admin_id' => $admin_id,
'os' => $os,
'phpversion' => PHP_VERSION,
'dbversion' => $db->version(),
'akversion' => $sysedition,
'theme' => $theme,
'authsuccess' => $licensesuccess,
'iscreator' => iscreator(),
'maxupload' => $max_upload,
'maxexetime' => $maxexetime,
'servertime' => $servertime,
'correcttime' => $correcttime,
'dbtype' => $dbtype,
'app' => $html
);
displaytemplate('admincp_welcome.htm', $variables);
}
runinfo();
aexit();
?>