コード例 #1
0
ファイル: log.php プロジェクト: Ermile/Saloos
 /**
  * Writes a line in the log file
  *
  * @param string $line
  */
 public function write($line)
 {
     file::append($this->filepath, date($this->date_format) . ' - ' . $line . "\n");
     // If the max size is exceeded
     if (file::getSize($this->filepath) >= $this->max_size) {
         file::delete($this->filepath . '.' . $this->nb_old_logs);
         for ($i = $this->nb_old_logs; $i >= 1; $i--) {
             if (file::exists($this->filepath . ($i == 1 ? '' : '.' . ($i - 1)))) {
                 file::rename($this->filepath . ($i == 1 ? '' : '.' . ($i - 1)), $this->filepath . '.' . $i);
             }
         }
     }
 }
コード例 #2
0
ファイル: template.php プロジェクト: dalinhuang/zotop
 public function actionRename($file = '')
 {
     $file = empty($file) ? zotop::get('file') : $file;
     $file = trim(url::decode($file), '/');
     $filepath = site::template($file);
     if (form::isPostBack()) {
         $newname = zotop::post('newname');
         if (file::rename($filepath, $newname)) {
             msg::success('重命名成功');
         }
         msg::error('重命名失败');
     }
     $page = new dialog();
     $page->title = zotop::t('模板编辑器');
     $page->set('file', $file);
     $page->set('filepath', $filepath);
     $page->display();
 }
コード例 #3
0
ファイル: media.php プロジェクト: Nnamso/tbox
 function rename()
 {
     $path = $this->input->post('path');
     $tree = $this->input->post('folder');
     $check = strripos($path, '/');
     $ds = '/';
     if ($check === false) {
         $check = strripos($path, '\\');
         $ds = '\\';
     }
     if ($check === false) {
         echo lang('media_folder_found');
         exit;
     }
     $folders = explode($ds, $path);
     if ($folders > 1) {
         $src = '';
         $n = count($folders) - 1;
         for ($i = 0; $i < $n; $i++) {
             if ($i == 0) {
                 $src = $folders[$i];
             } else {
                 $src .= $ds . $folders[$i];
             }
         }
         $src .= $ds . $tree;
     }
     $this->load->library('file');
     $file = new file();
     echo $file->rename($this->root . $path, $this->root . $src);
     exit;
 }