示例#1
0
 public static function error($message, $object = NULL)
 {
     if (Hybrid_Auth::$config["debug_mode"]) {
         $datetime = new DateTime();
         $datetime = $datetime->format(DATE_ATOM);
         safe_put_contents(Hybrid_Auth::$config["debug_file"], "ERROR -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . " -- " . print_r($object, true) . "\n", FILE_APPEND);
     }
 }
示例#2
0
 /**
  * Try to save the file data from request
  * @return JS for AJAX
  */
 function saveFile()
 {
     if ($this->request('hash') == $this->hash()) {
         $content = $this->request('w_code');
         $fn = $this->request('f');
         $search = array('@micros@', '@maintemplates@', '@mail@');
         $replace = array(MICROSPATH, MAINTEMPLATESPATH, MAILTEMPLATESPATH);
         $fn = str_replace($search, $replace, $fn);
         if ($fn[0] == '@') {
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         } else {
             //simple security
             $fn = str_replace('..@', '', $fn);
             $fn = str_replace('@', '/', $fn);
             if (is_file($fn) and is_writable($fn)) {
                 safe_put_contents($fn, stripslashes($content));
                 echo 'RADFoldersTree.message("' . $this->lang('-saved') . '");';
                 echo 'RADFolders.cancelWindowClick();';
             } else {
                 echo 'alert("' . $this->lang('filenotwritable.system.error') . '");';
             }
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
示例#3
0
 /**
  * Makes the file in File System and write the $filestring into it
  * Method is binary-safe
  * @param string $filename
  * @param binary-safe string $filestring
  * @param integer $mode
  * @access public
  */
 public function mkFile($filename, $filestring, $mode = 0777)
 {
     safe_put_contents($filename, $filestring);
     @chmod($filename, $mode);
 }
示例#4
0
 public function get3DBinFile($params)
 {
     if (empty($params['cat_id']) or !(int) $params['cat_id']) {
         throw new rad_exception('Cat id can\'t be empty when getting file!!! Some error!');
     }
     set_time_limit($this->config('partners.3dbin.time'));
     $params['action'] = 'getfile';
     $params['lang'] = $this->getCurrentLangID();
     $params['email'] = $this->config('taberna.user');
     $params['pass'] = $this->config('taberna.pass');
     $params['url'] = SITE_URL;
     $file = $this->_getURL($this->_threeDBinService, $params);
     $destination = DOWNLOAD_FILES_DIR . '3dbin' . DS . $params['cat_id'] . '_' . md5(time() . '3dbin') . '.swf';
     if (!is_dir(dirname($destination))) {
         recursive_mkdir(dirname($destination), 0777);
     }
     safe_put_contents($destination, $file);
     return $destination;
 }
示例#5
0
 /**
  * Makes the file in File System and write the $filestring into it
  * Method is binary-safe
  * @param string $filename
  * @param binary-safe string $filestring
  * @param integer $mode
  * @access public
  */
 public function mkFile($filename, $filestring, $mode = '0770')
 {
     if (!is_dir(dirname($filename))) {
         $this->mkDir(dirname($filename));
     }
     safe_put_contents($filename, $filestring);
     /*@chmod($filename, $mode);*/
 }
示例#6
0
 protected function getValValuesCache()
 {
     $file = self::getCacheFileName($this->_catIds, $this->_cat->tre_id);
     $result = NULL;
     if (is_file($file)) {
         $data = unserialize(file_get_contents($file));
         if ($data['date'] >= time() - rad_config::getParam('cache.power.time')) {
             $result = $data['rows'];
         }
     }
     if (!$result) {
         $result = $this->getValValues();
         $data = array('date' => time(), 'rows' => $result);
         safe_put_contents($file, serialize($data));
     }
     return $result;
 }
示例#7
0
 /**
  * Create the xml file from array
  * Сдесь xml файл генерируется без помощи библиотек для лучшей совместимости.
  *
  * @param array $params - array of fieldnames and fieldvalues
  * @param string $module - module name
  * @return boolean
  */
 function createParamsForTemplate($params, $module, $fn)
 {
     $file = $this->_getFN($module, $fn, false, false);
     if (!is_dir(dirname($file))) {
         if (!recursive_mkdir(dirname($file))) {
             return false;
         }
     }
     if (!is_writable(dirname($file))) {
         return false;
     }
     if (file_exists($file) and !is_writable($file)) {
         return false;
     }
     //CREATE THE DEFAULT STRUCTURE
     $s = '<?xml version="1.0" encoding="UTF-8"?>' . '<metadata>' . '<names>' . '<title>' . $this->_getLangValue($params['names.title']) . '</title>' . '<description>' . $this->_getLangValue($params['names.description']) . '</description>' . '<author>' . $this->_getLangValue($params['names.author']) . '</author>' . '<date>' . time() . '</date>' . '<url>' . $this->_getLangValue($params['names.url']) . '</url>' . '</names>' . '<system>' . '<ver>' . stripslashes($params['system.ver']) . '</ver>' . '<prelogic>' . $this->_getItems($params['system.prelogic']) . '</prelogic>' . '<themes>' . $this->_getItems($params['system.themes']) . '</themes>' . '<module>' . '<name>' . $this->_getLangValue($params['system.module.name']) . '</name>' . '<folder>' . stripslashes($params['system.module.folder']) . '</folder>' . '<ver>' . stripslashes($params['system.module.ver']) . '</ver>' . '<ident>' . $this->genereModuleIdent() . '</ident>' . '</module>' . '<name>' . stripslashes($params['system.name']) . '</name>' . '<ident>' . $this->genereTmplIdent($params['system.name'], $params['system.module.folder'], rad_config::getParam('loader_class')) . '</ident>' . '<template>' . '<lower>' . (!empty($params['system.ver']) ? $params['system.ver'] : '0.1') . '</lower>' . '<name>' . rad_config::getParam('loader_class') . '</name>' . '</template>' . '<access>' . stripslashes($params['system.access']) . '</access>' . '</system>' . '<params>' . $this->_getLangValue($params['params']) . '</params>' . '</metadata>';
     return safe_put_contents($file, $s);
 }