read())) { if ($entry == '.' || $entry == '..') continue; $a[] = substr($entry, 0, 2); } } return $a; } function getLangsXml () { return '' . array2xml($this->getLangs(), 'lang') . ''; } function getUrlsXml () { global $gConf; $ret = ''; $ret .= ""; $ret .= "{$gConf['xsl_mode']}"; $ret .= "{$gConf['url']['icon']}"; $ret .= "{$gConf['url']['img']}"; $ret .= "{$gConf['url']['css']}"; $ret .= "{$gConf['url']['xsl']}"; $ret .= "{$gConf['url']['js']}"; $ret .= "{$gConf['url']['editor']}"; $ret .= "\n"; return $ret; } function addHeaderFooter (&$li, $content) { global $gConf; global $glHeader; global $glFooter; $ret = ''; $ret .= "\n"; $ret .= '' . (int)getConfigParam('disable_boonex_footers') . ''; $ret .= '
'; $ret .= ''; $ret .= "{$gConf['min_point']}\n"; $ret .= "{$gConf['url']['base']}\n"; $ret .= "{$gConf['def_title']}\n"; $integration_xml = ''; @include ($gConf['dir']['base'] . 'xml/xml.php'); $ret .= $integration_xml; $ret .= $this->getUrlsXml (); if (is_array($li)) { $ret .= ""; reset ($li); while (list($k,$v) = each($li)) { $ret .= "<$k>$v"; } $ret .= ""; if (1 == $li['admin']) { $ret .= $this->getLangsXml(); } } $ret .= "\n"; $ret .= $content; $ret .= "\n"; $ret .= "
\n"; return $ret; } /** * returns page XML */ function getPageXML (&$li) { return $this->addHeaderFooter ($li, $this->content); } /** * write cache to a file * @param $fn filename to write to * @param $s string to write */ function cacheWrite ($fn, $s) { global $gConf; if (!$gConf['cache']['on']) return; $f = fopen ($gConf['dir']['xmlcache'] . $fn, "w"); if (!$f) { $mk = new Mistake (); $mk->log ("ThingPage::readCache - can not open file({$gConf['dir']['xmlcache']}$fn) for writing"); $mk->displayError ("[L[Site is unavailable]]"); } fwrite ($f, $s); fclose ($f); } /** * read cache from a file * @param $fn filename to read from * @param return string from a file */ function cacheRead ($fn) { global $gConf; $f = fopen ($gConf['dir']['xmlcache'] . $fn, "r"); if (!$f) { $mk = new Mistake (); $mk->log ("ThingPage::readCache - can not open file({$gConf['dir']['xmlcache']}$fn) for reading"); $mk->displayError ("[L[Site is unavailable]]"); } $s = ''; while ($st = fread ($f, 1024)) $s .= $st; fclose ($f); return $s; } /** * check if cache is available * @param $fn filename to check * @param return true if cache is available */ function cacheExists ($fn) { global $gConf; return file_exists ($gConf['dir']['xmlcache'] . $fn); } /** * check if cache is enabled */ function cacheEnabled () { global $gConf; return $gConf['cache']['on']; } // private functions } ?>