public function setitem($id, $item) { if (isset($this->items[$id]) && $this->items[$id] == $item) { return; } $this->items[$id] = $item; if ($this->owner->dbversion) { $item['id'] = $id; $this->db->addupdate($item); } else { tfilestorage::savevar($this->getfilename($id), $item); } }
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; }
public function set_tml($id_tml, array $item) { $this->tml_items[$id_tml] = $item; tfilestorage::savevar($this->getfilename($id_tml), $item); }
public function parsehtml() { $html = getinstance('tadminhtml'); $html->ini = array(); foreach ($this->html as $filename) { $realfilename = $this->getrealfilename($filename); if (!file_exists($realfilename)) { $this->error(sprintf('The file "%s" not found', $realfilename)); } if (!($parsed = parse_ini_file($realfilename, true))) { $this->error(sprintf('Error parse "%s" ini file', $realfilename)); } if (count($html->ini) == 0) { $html->ini = $parsed; } else { foreach ($parsed as $section => $itemsini) { $html->ini[$section] = isset($html->ini[$section]) ? $itemsini + $html->ini[$section] : $itemsini; } } } tfilestorage::savevar(tlocal::getcachedir() . 'adminhtml', $html->ini); }
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; } }