Example #1
0
 /**
  * 项目生成
  */
 public function action_generator()
 {
     //检查来源
     if (!($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1')) {
         FYTOOL::error_ctrl('你所在的主机不允许调用此方法。');
     }
     if (FYTOOL::get_gp_value('submit')) {
         //通过按钮提交
         $path = realpath(FYSCU_ROOT . '/../');
         $project = isset($_POST['project']) ? $_POST['project'] : '';
         if ($project != '') {
             $project = str_replace(array('/', '\\'), '', $project);
             $path = $path . '/' . $project;
             if (!file_exists($path)) {
                 //创建目录
                 $fp = mkdir($path);
                 $sig = FYTOOL::r_copy(FYSCU_ROOT . './pro_tpl/', $path);
                 $fp_fyscu = mkdir($path . '/fyscu');
                 $sig_core = FYTOOL::r_copy(FYSCU_ROOT . './core/', $path . '/fyscu/core');
                 $sig_init = copy(FYSCU_ROOT . './fyscu.init.php', $path . './fyscu/fyscu.init.php');
                 $sig_dic = FYTOOL::r_copy(FYSCU_ROOT . './dic/', $path . '/fyscu/dic');
                 $ct = file_get_contents($path . '/index.php');
                 $ct = str_replace('UNAME', $project, $ct);
                 file_put_contents($path . '/index.php', $ct);
             }
             header('location:/' . $project);
         }
     }
 }
Example #2
0
 public static function init()
 {
     $conf = CONFIG::get('i18n');
     self::$_dic_path = $conf['dic_path'];
     self::$_support_list = explode(',', trim($conf['support_list'], ','));
     self::$_lang = self::_check_lang();
     if (is_file(self::$_dic_path . self::$_lang . '.dic.php')) {
         self::$_dic = (include self::$_dic_path . self::$_lang . '.dic.php');
     } else {
         if (is_dir(self::$_dic_path)) {
             //新建字典
             copy(FYSCU_ROOT . 'dic/tpl.dic.php', self::$_dic_path . self::$_lang . '.dic.php');
         } else {
             //新建目录
             FYTOOL::r_copy(FYSCU_ROOT . 'core/modules/i18n/dic/', self::$_dic_path);
             copy(FYSCU_ROOT . 'dic/tpl.dic.php', self::$_dic_path . self::$_lang . '.dic.php');
         }
     }
 }