Пример #1
0
 function cleardir($dir, $forceclear = false)
 {
     if (!is_dir($dir)) {
         return;
     }
     $directory = dir($dir);
     while ($entry = $directory->read()) {
         $filename = $dir . '/' . $entry;
         if (is_file($filename)) {
             @unlink($filename);
         } elseif (is_dir($filename) && $forceclear && $entry != '.' && $entry != '..') {
             chmod($filename, 0777);
             file::cleardir($filename, $forceclear);
             rmdir($filename);
         }
     }
     $directory->close();
 }
Пример #2
0
 function doeditlang()
 {
     switch ($this->get[3]) {
         case 0:
             $langname = 'front.php';
             break;
         case 1:
             $langname = 'back.php';
             break;
     }
     if (!$this->get[3]) {
         template::setlang('zh', 'front');
         $this->view->lang = $this->lang;
     }
     $lang = array_merge($this->view->lang, $this->post['lang']);
     if (is_file(HDWIKI_ROOT . '/lang/zh/' . $langname)) {
         if (copy(HDWIKI_ROOT . '/lang/zh/' . $langname, HDWIKI_ROOT . '/lang/zh/bak_' . $langname)) {
             $data = "<?php\r\n";
             foreach ($lang as $key => $value) {
                 $data .= '$lang[\'' . $key . "']='" . str_replace("'", "\\'", str_replace("\\", "\\\\", stripslashes($value))) . "';\r\n";
                 //只需要把\换成 \\, 把' 换成\' 即可
                 $lang[$key] = $value;
             }
             if ($this->get[3] == 1) {
                 $data .= '$lang[\'timeoffset\']' . " = array(\r\n\t\t\t\t\t\t\t'-12'=>'(标准时-12:00) 日界线西',\r\n\t\t\t\t\t\t\t'-11'=>'(标准时-11:00) 中途岛、萨摩亚群岛',\r\n\t\t\t\t\t\t\t'-10'=>'(标准时-10:00) 夏威夷',\r\n\t\t\t\t\t\t\t'-9'=>'(标准时-9:00) 阿拉斯加',\r\n\t\t\t\t\t\t\t'-8'=>'(标准时-8:00) 太平洋时间(美国和加拿大)',\r\n\t\t\t\t\t\t\t'-7'=>'(标准时-7:00) 山地时间(美国和加拿大)',\r\n\t\t\t\t\t\t\t'-6'=>'(标准时-6:00) 中部时间(美国和加拿大)、墨西哥城',\r\n\t\t\t\t\t\t\t'-5'=>'(标准时-5:00) 东部时间(美国和加拿大)、波哥大',\r\n\t\t\t\t\t\t\t'-4'=>'(标准时-4:00) 大西洋时间(加拿大)、加拉加斯',\r\n\t\t\t\t\t\t\t'-3.5'=>'(标准时-3:30) 纽芬兰',\r\n\t\t\t\t\t\t\t'-3'=>'(标准时-3:00) 巴西、布宜诺斯艾利斯、乔治敦',\r\n\t\t\t\t\t\t\t'-2'=>'(标准时-2:00) 中大西洋',\r\n\t\t\t\t\t\t\t'-1'=>'(标准时-1:00) 亚速尔群岛、佛得角群岛',\r\n\t\t\t\t\t\t\t'0'=>'(格林尼治标准时) 西欧时间、伦敦、卡萨布兰卡',\r\n\t\t\t\t\t\t\t'1'=>'(标准时+1:00) 中欧时间、安哥拉、利比亚',\r\n\t\t\t\t\t\t\t'2'=>'(标准时+2:00) 东欧时间、开罗,雅典',\r\n\t\t\t\t\t\t\t'3'=>'(标准时+3:00) 巴格达、科威特、莫斯科',\r\n\t\t\t\t\t\t\t'3.5'=>'(标准时+3:30) 德黑兰',\r\n\t\t\t\t\t\t\t'4'=>'(标准时+4:00) 阿布扎比、马斯喀特、巴库',\r\n\t\t\t\t\t\t\t'4.5'=>'(标准时+4:30) 喀布尔',\r\n\t\t\t\t\t\t\t'5'=>'(标准时+5:00) 叶卡捷琳堡、伊斯兰堡、卡拉奇',\r\n\t\t\t\t\t\t\t'5.5'=>'(标准时+5:30) 孟买、加尔各答、新德里',\r\n\t\t\t\t\t\t\t'6'=>'(标准时+6:00) 阿拉木图、 达卡、新亚伯利亚',\r\n\t\t\t\t\t\t\t'7'=>'(标准时+7:00) 曼谷、河内、雅加达',\r\n\t\t\t\t\t\t\t'8'=>'(标准时+8:00)北京、重庆、香港、新加坡',\r\n\t\t\t\t\t\t\t'9'=>'(标准时+9:00) 东京、汉城、大阪、雅库茨克',\r\n\t\t\t\t\t\t\t'9.5'=>'(标准时+9:30) 阿德莱德、达尔文',\r\n\t\t\t\t\t\t\t'10'=>'(标准时+10:00) 悉尼、关岛',\r\n\t\t\t\t\t\t\t'11'=>'(标准时+11:00) 马加丹、索罗门群岛',\r\n\t\t\t\t\t\t\t'12'=>'(标准时+12:00) 奥克兰、惠灵顿、堪察加半岛');\r\n";
             }
             $data .= "?>";
             file::writetofile(HDWIKI_ROOT . '/lang/zh/' . $langname, $data);
         }
     }
     file::cleardir(HDWIKI_ROOT . '/data/cache');
     file::cleardir(HDWIKI_ROOT . '/data/view');
     $this->view->assign("langtype", $this->get[3]);
     $this->view->assign("langtag", $this->get[3]);
     $this->view->assign("lang", $lang);
     $this->message('语言文件修改成功!', 'index.php?admin_language-default-' . $this->get[3]);
 }
Пример #3
0
 function doremove()
 {
     @($advids = $this->post['advid']);
     if (is_array($advids)) {
         if ($_ENV['adv']->removeadv($advids)) {
             file::cleardir(HDWIKI_ROOT . '/data/cache');
             file::cleardir(HDWIKI_ROOT . '/data/view');
             $this->message($this->view->lang['del_adv_sucess'], 'index.php?admin_adv');
         } else {
             $this->message($this->view->lang['del_adv_faile'], 'index.php?admin_adv');
         }
     } else {
         $this->message($this->view->lang['docRemoveAdvNull']);
     }
 }
Пример #4
0
 function doremovecache()
 {
     file::cleardir(HDWIKI_ROOT . '/data/cache');
     file::cleardir(HDWIKI_ROOT . '/data/view');
     $this->message($this->view->lang['cacheDelSuccess'], 'index.php?admin_setting-cache');
 }