Пример #1
0
 public function loadfile($name)
 {
     if (tfilestorage::loadvar($this->getfilename($name), $v)) {
         return $v;
     }
     return false;
 }
Пример #2
0
 public function getsame($id)
 {
     if (dbversion) {
         $items = $this->db->getvalue($id, 'items');
         if (is_string($items)) {
             return $items == '' ? array() : explode(',', $items);
         } else {
             $result = $this->findsame($id);
             $this->db->add(array('id' => $id, 'items' => implode(',', $result)));
             return $result;
         }
     } else {
         $filename = litepublisher::$paths->data . 'posts' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . 'same.php';
         $data = null;
         if (tfilestorage::loadvar($filename, $data)) {
             if ($data['revision'] == $this->revision) {
                 return $data['items'];
             }
         }
         $result = $this->findsame($id);
         $data = array('revision' => $this->revision, 'items' => $result);
         tfilestorage::savevar($filename, $data);
         return $result;
     }
 }
Пример #3
0
 public function getitem($id)
 {
     if (isset($this->items[$id])) {
         return $this->items[$id];
     }
     $item = array('description' => '', 'keywords' => '', 'head' => '', 'content' => '', 'rawcontent' => '');
     if ($this->owner->dbversion) {
         if ($r = $this->db->getitem($id)) {
             $item = $r;
         }
     } else {
         tfilestorage::loadvar($this->getfilename($id), $item);
     }
     $this->items[$id] = $item;
     return $item;
 }
Пример #4
0
 public static function cacheini($filename)
 {
     if (isset(self::$inifiles[$filename])) {
         return self::$inifiles[$filename];
     }
     $datafile = tlocal::getcachedir() . sprintf('cacheini.%s.php', md5($filename));
     if (!tfilestorage::loadvar($datafile, $ini) || !is_array($ini)) {
         if (file_exists($filename)) {
             $ini = parse_ini_file($filename, true);
             tfilestorage::savevar($datafile, $ini);
         } else {
             $ini = array();
         }
     }
     if (!isset(self::$inifiles)) {
         self::$inifiles = array();
     }
     self::$inifiles[$filename] = $ini;
     return $ini;
 }
Пример #5
0
 public function loadfile($name)
 {
     $this->loaded[] = $name;
     $filename = self::getcachedir() . $name;
     if (tfilestorage::loadvar($filename, $v) && is_array($v)) {
         $this->ini = $v + $this->ini;
         if (isset($v['searchsect'])) {
             $this->joinsearch($v['searchsect']);
         }
     } else {
         $merger = tlocalmerger::i();
         $merger->parse($name);
     }
 }
Пример #6
0
 public function load()
 {
     $filename = tlocal::getcachedir() . 'adminhtml';
     if (tfilestorage::loadvar($filename, $v) && is_array($v)) {
         $this->ini = $v + $this->ini;
     } else {
         $merger = tlocalmerger::i();
         $merger->parsehtml();
     }
 }