예제 #1
0
파일: serverinfo.php 프로젝트: PoppyLi/PCMS
 public function index()
 {
     $vdata['title'] = lang('nav_serverinfo');
     //检查环境
     $vdata['extension'] = array('gd' => array("title" => lang('ext_gd'), 'enable' => 0), 'mysql' => array("title" => "Mysql", 'enable' => 0), 'mysqli' => array("title" => "Mysqli", 'enable' => 0), 'xml' => array("title" => "XML", 'enable' => 0), 'iconv' => array("title" => "iconv", 'enable' => 0), 'json' => array("title" => "json", 'enable' => 0), 'zip' => array("title" => "Zip", 'enable' => 0), 'curl' => array("title" => "CURL", 'enable' => 0));
     foreach ($vdata['extension'] as $e => $v) {
         if (extension_loaded($e)) {
             $vdata['extension'][$e]['enable'] = 1;
         }
     }
     // TODO 检测系统服务
     $vdata['env'] = array('serverip' => array("title" => lang('env_serverip'), 'enable' => $_SERVER['SERVER_ADDR']), 'serverport' => array("title" => lang('env_serverport'), 'enable' => $_SERVER['SERVER_PORT']), 'app' => array("title" => lang('env_app'), 'enable' => " <a href='" . GLOBAL_URL . "' target='_blank'>" . GLOBAL_URL . "</a>"), 'dbtype' => array("title" => lang('env_dbtype'), 'enable' => strtoupper(DB_TYPE)), 'cache' => array("title" => lang('env_cache'), 'enable' => 0), 'upload' => array("title" => lang('env_upload'), 'enable' => 0), 'memory_limit' => array("title" => lang('memory_limit'), 'enable' => ini_get('memory_limit')), 'upload_max_filesize' => array("title" => lang('upload_max_filesize'), 'enable' => ini_get('upload_max_filesize')));
     // 加载公用文件帮助函数
     $this->load->helper('file');
     if (new_is_writeable(UPLOAD_PATH)) {
         $vdata['env']['upload']['enable'] = "OK";
     }
     // 检测缓存文件夹可写
     if (new_is_writeable(APPPATH . 'cache')) {
         $vdata['env']['cache']['enable'] = "OK";
     }
     // 当前IP
     $vdata['server']['ip'] = get_ip();
     $this->load->view('inc_header.php', $vdata);
     $this->load->view('serverinfo_index.php');
     $this->load->view('inc_footer.php');
 }
예제 #2
0
파일: welcome.php 프로젝트: PoppyLi/PCMS
 public function index()
 {
     $vdata['title'] = lang('wel_title');
     $vdata['extension']['gd'] = 0;
     $this->load->model('manager_model', 'mmger');
     $ginfo = $this->mmger->get_group($this->session->userdata('gid'));
     $vdata['user_group'] = $ginfo['title'];
     $this->load->language('serverinfo');
     $vdata['env'] = array('serverip' => array("title" => lang('env_serverip'), 'enable' => $_SERVER['SERVER_ADDR']), 'serverport' => array("title" => lang('env_serverport'), 'enable' => $_SERVER['SERVER_PORT']), 'cache' => array("title" => lang('env_cache'), 'enable' => 0), 'upload' => array("title" => lang('env_upload'), 'enable' => 0), 'upload_max_filesize' => array("title" => lang('upload_max_filesize'), 'enable' => ini_get('upload_max_filesize')));
     // 加载公用文件帮助函数
     $this->load->helper('file');
     if (new_is_writeable(UPLOAD_PATH)) {
         $vdata['env']['upload']['enable'] = "OK";
     }
     // 检测缓存文件夹可写
     if (new_is_writeable(APPPATH . 'cache')) {
         $vdata['env']['cache']['enable'] = "OK";
     }
     // 当前IP
     $vdata['server']['ip'] = get_ip();
     $this->load->view('inc_header.php', $vdata);
     $this->load->view('welcome.php');
     $this->load->view('inc_footer.php');
 }
예제 #3
0
파일: backup.php 프로젝트: PoppyLi/PCMS
 /**
  *  数据备份
  * @return [type] [description]
  */
 public function data()
 {
     $this->load->helper('file');
     // when the cache dir can't write
     if (!new_is_writeable(APPPATH . 'cache')) {
         $vdata = array('msg' => "cache文件夹没有写入权限");
         header('HTTP/1.1 500 Internal Server Error');
         $this->output->set_content_type('application/json')->set_output(json_encode($vdata));
         return false;
     }
     if (file_exists($this->tmpsql)) {
         unlink($this->tmpsql);
     }
     $this->db->set_dbprefix('');
     $this->_wfile("-- START TIME: " . date('Y-m-d H:i:s', time()));
     $this->_wfile("-- DATABASE NAME: " . $this->db->database);
     $this->_wfile();
     // $tables_test = $this->db->query('SHOW CREATE DATABASE bocms')->result_array();
     // 表处理
     foreach ($this->db->list_tables() as $table) {
         $this->_wfile("-- Table structure for {$table} ");
         $this->_wfile("DROP TABLE IF EXISTS `{$table}`;");
         $this->_wfile("/*!40101 SET @saved_cs_client     = @@character_set_client */;");
         $this->_wfile("/*!40101 SET character_set_client = utf8 */;");
         $tableCreate = $this->db->query("SHOW CREATE TABLE `{$table}`")->row_array();
         $this->_wfile($tableCreate['Create Table'] . ';');
         $this->_wfile("/*!40101 SET character_set_client = @saved_cs_client */;");
         $this->_wfile();
         $this->_wfile("-- Dumping data for table `{$table}`");
         $this->_wfile("LOCK TABLES `{$table}` WRITE;");
         $this->_wfile("/*!40000 ALTER TABLE `{$table}` DISABLE KEYS */;");
         // 数据处理
         $tableList = $this->db->query("SELECT * FROM `{$table}`")->result_array();
         $countList = count($tableList);
         if ($countList) {
             $this->_wfile("INSERT INTO `{$table}` (`" . implode("`,`", $this->db->list_fields($table)) . "`) VALUES");
             foreach ($tableList as $k => $v) {
                 $tmp_str = "(";
                 $v_k_end = end(array_keys($v));
                 foreach ($v as $k2 => $u) {
                     if (is_null($u)) {
                         $tmp_str .= "NULL";
                     } else {
                         $tmp_str .= "'{$u}'";
                     }
                     // 最后一条
                     $tmp_str .= $v_k_end == $k2 ? "" : ",";
                 }
                 // 结束插入
                 $tmp_str .= $countList - 1 == $k ? ");" : "),";
                 $this->_wfile($tmp_str);
                 unset($tmp_str);
             }
         }
         $this->_wfile("/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;");
         $this->_wfile("UNLOCK TABLES;");
         $this->_wfile();
     }
     $this->_wfile("-- END TIME: " . date('Y-m-d H:i:s', time()));
     // 压缩下载
     $this->load->library('zip');
     $this->zip->read_file($this->tmpsql);
     $this->zip->archive(APPPATH . 'cache/' . $this->filename . '.zip');
     unlink($this->tmpsql);
     $this->zip->download($this->filename . '.zip');
 }
예제 #4
0
<h3>备份数据</h3>

<p></p>

<?php 
if (!new_is_writeable(APPPATH . 'cache')) {
    ?>
<div class="alert alert-error">
<?php 
    echo APPPATH . 'cache';
    ?>
 没有写入权限! 请给予权限!	
</div>	
<?php 
}
?>

<div class="btn-group">
	<a href="<?php 
echo site_url('backup/data');
?>
" class='btn btn-primary js-down' > <i class="fa fa-database"></i> 导出数据 </a>
</div>

<p></p>
<div class="clearfix"></div>
<div class="boxed span3" >
	<div class="boxed-inner">
	<h3> 备份列表 </h3>
	<ul class="boxed-list" id="list">
예제 #5
0
    echo L("not_writable_install") . '<br>';
    $go = 0;
}
if (!new_is_writeable("../Public/Uploads")) {
    echo L("not_writable_upload") . '<br>';
    $go = 0;
}
if (!new_is_writeable("../Application/Runtime")) {
    echo L("not_writable_runtime") . '<br>';
    $go = 0;
}
if (!new_is_writeable("../Application/Common/Conf/config.php")) {
    echo L("not_writable_config") . '<br>';
    $go = 0;
}
if (!new_is_writeable("../Application/Home/Conf/config.php")) {
    echo L("not_writable_home_config") . '<br>';
    $go = 0;
}
//检查扩展
if (!extension_loaded("gd")) {
    echo '请安装php-gd<br>';
    $go = 0;
}
if (!extension_loaded("mcrypt")) {
    echo '请安装php-mcrypt<br>';
    $go = 0;
}
if (!extension_loaded("mbstring")) {
    echo '请安装php-mbstring<br>';
    $go = 0;
예제 #6
0
파일: ajax.php 프로젝트: star7th/showdoc
}
if (!new_is_writeable("../Application/Runtime")) {
    ajax_out(L("not_writable_runtime"), 10095);
}
if (!new_is_writeable("../Application/Common/Conf/config.php")) {
    ajax_out(L("not_writable_config"), 10094);
}
if (!new_is_writeable("../Application/Home/Conf/config.php")) {
    ajax_out(L("not_writable_home_config"), 10098);
}
$db_type = $_POST["db_type"] ? $_POST["db_type"] : "sqlite";
if ($db_type == "sqlite") {
    if (!new_is_writeable("../Sqlite")) {
        ajax_out(L("not_writable_sqlite"), 10097);
    }
    if (!new_is_writeable("../Sqlite/showdoc.db.php")) {
        ajax_out(L("not_writable_sqlite_db"), 10096);
    }
    user_sqlite();
} elseif ($db_type == "mysql") {
    //showdoc不再支持mysql http://www.showdoc.cc/help?page_id=31990
}
function user_sqlite()
{
    clear_runtime();
    //清除缓存
    write_home_config();
    $config = <<<EOD
<?php
return array(
    //'配置项'=>'配置值'