PHP versions 4 and 5 BaserCMS : Based Website Development Project Copyright 2008 - 2011, Catchup, Inc. 1-19-4 ikinomatsubara, fukuoka-shi fukuoka, Japan 819-0055
Inheritance: extends AppModel
Exemplo n.º 1
0
 static function includeFileFromDir($path, $fileExclude = array())
 {
     $file = ThemeFile::scanDir($path);
     if ($file === false) {
         return false;
     }
     foreach ($file as $value) {
         if (in_array($value, $fileExclude)) {
             continue;
         }
         self::includeFile($path . $value);
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Before delete event
  */
 public function beforeDelete()
 {
     // Delete all theme files first
     ThemeFile::model()->deleteAll('theme_id=:id', array(':id' => $this->id));
     // Delete theme folder with all files
     $path = Yii::getPathOfAlias('application.www.themes');
     $themeDir = $path . '/' . $this->dirname;
     if (is_dir($themeDir)) {
         recursiveDirRemove($themeDir);
     }
     return parent::beforeDelete();
 }
Exemplo n.º 3
0
 function getIcon()
 {
     $file = ThemeFile::scanDir(THEME_PATH_MEDIA . 'image/public/icon_menu/');
     return $file;
 }
Exemplo n.º 4
0
 function createMultisitePath()
 {
     $data = array(THEME_PATH_MULTISITE_SITE, THEME_PATH_MULTISITE_SITE_STYLE);
     foreach ($data as $path) {
         if (!ThemeFile::dirExist($path)) {
             @mkdir($path);
         }
         if (!ThemeFile::dirExist($path)) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 5
0
 public function delete()
 {
     $request = $this->getRequest();
     $tfh = ThemeFile::getNewInstance($request->get('theme'));
     $tfh->removeFile($request->get('file'));
 }
Exemplo n.º 6
0
 /**
  * set file content
  */
 public function actionAjaxSetThemeFileContent()
 {
     // Init
     $fileId = getPostParam('fileId');
     $content = getPostParam('content');
     // Access check
     if (!checkAccess('op_theme_file_edit')) {
         echoJson(array('error' => at('Sorry, You are not allowed to edit theme files.')));
     }
     // Check to make sure the theme file exists
     $themeFile = ThemeFile::model()->with(array('theme'))->findByPk($fileId);
     if (!$themeFile) {
         echoJson(array('error' => at('Sorry, We could not located that file.')));
     }
     // Update theme content
     $themeFile->content = $content;
     $themeFile->update();
     // Log
     alog(at("Updated Theme '{name}', File {file}", array('{name}' => $themeFile->theme->name, '{file}' => $themeFile->file_location)));
     // Sync theme to save changes
     $themeFile->theme->syncTheme();
     echoJson(array('html' => at('Theme File Saved!')));
 }