コード例 #1
0
 /**
  * returns favicon html
  * @return string $html 
  */
 public static function getFaviconHTML()
 {
     $favicon = conf::getMainIni('favicon');
     $domain = conf::getDomain();
     $rel_path = "/files/{$domain}/favicon/{$favicon}";
     $full_path = conf::pathHtdocs() . "/{$rel_path}";
     if (!is_file($full_path)) {
         $rel_path = '/favicon.ico';
     }
     $str = "<link rel=\"shortcut icon\" href=\"{$rel_path}\" type=\"image/x-icon\" />\n";
     return $str;
 }
コード例 #2
0
 /**
  * 
  * wrapper method for uploading an image from a id, destination folder,
  * and a post field, e.g. image
  * @param int     $id the id of the path to save image to
  *                e.g. 10 for /files/default/campaign/10
  * @param string  $post_field name of $_POST element to upload, e.g campaign
  * @return mixed  $res false on failure.
  *                String containing base filname on success
  *                e.g. /files/default/campagin/10/file.jpg or false
  *                If false then errors can be found in upload::$errors  
  */
 public function uploadFromPost($id, $folder = null, $post_field = 'image')
 {
     if (!$folder) {
         die('Developer: Set a folder when uploading');
     }
     $domain = conf::getDomain();
     $options = array('upload_dir' => "/htdocs/files/{$domain}/{$folder}/{$id}");
     $this->setOptions($options);
     $res = $this->moveFile($post_field);
     return $res;
 }
コード例 #3
0
ファイル: assets.php プロジェクト: gpawlik/suited-php-classes
 /**
  * sets js as a single file in js-all file 
  */
 public static function setJsAsSingleFile()
 {
     $str = self::getJsAsSingleStr();
     $md5 = md5($str);
     $domain = conf::getDomain();
     $web_path = "/files/{$domain}/cached_assets";
     $file = "/js_all-{$md5}.js";
     $full_path = conf::pathFilesBase() . "/{$web_path}";
     $full_file_path = $full_path . $file;
     // create file if it does not exist
     if (!file_exists($full_file_path)) {
         file_put_contents($full_file_path, $str, LOCK_EX);
     }
     self::setJs($web_path . $file);
 }
コード例 #4
0
ファイル: files.php プロジェクト: gpawlik/suited-php-classes
/**
 * function for removing all files in htdocs/files/*, htdocs/logo/*
 * when doing an install
 *
 * @return int  value from exec command
 */
function cos_create_files()
{
    $files_path = conf::pathBase() . '/logs/coscms.log';
    if (!file_exists($files_path)) {
        $command = "touch {$files_path}";
        common::execCommand($command);
    }
    $files_path = conf::pathBase() . '/htdocs/files';
    if (!file_exists($files_path)) {
        $command = "mkdir {$files_path}";
        common::execCommand($command);
    }
    $domain = conf::getDomain();
    $files_path = conf::pathBase() . "/htdocs/files/{$domain}";
    if (!file_exists($files_path)) {
        $command = "mkdir {$files_path}";
        common::execCommand($command);
    }
}