Exemple #1
0
 public static function start()
 {
     // Gets current time, next update, and expiration.
     // Note: i'm  making the last two digits to zero. for rounding purposes.
     self::$_NOW = BMK;
     self::$_TTU = (int) substr((string) self::$_NOW + self::$_TTU, 0, -2) . '00';
     self::$_EXP = (int) substr((string) self::$_NOW + self::$_EXP, 0, -2) . '00';
     // set the session id with the IP, User-agent and the fingerkey
     // TODO: Add username for login based frameworks
     session_id(self::$_ID = md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . Core::config('sess_finger')));
     // set the XML dom document, or create it if non existent.
     if (file_exists(SESS . 'session')) {
         XML::load(SESS . 'session');
     } else {
         XML::set(SESS . 'session');
     }
     // if we can't find the ID set, create it in the index..
     if (!($element = XML::get_id(self::$_ID))) {
         XML::append(array('tagname' => 'session', 'id' => self::$_ID, 'exp' => self::$_EXP));
     }
     // remove all expired sessions
     self::gc(0);
     // start session
     session_start();
 }
Exemple #2
0
 /**
  * @param string $xrds
  */
 protected function parse($xrds)
 {
     $xml = XML::load($xrds);
     if (count(XML::errors()) > 0) {
         return false;
     }
     $l = $xml->getElementsByTagName('Service');
     if ($l->length == 0) {
         return false;
     }
     $priority = 100000;
     $index = 0;
     foreach ($l as $ind => $service) {
         $p = (int) $service->getAttribute('priority');
         if ($p < $priority) {
             $priority = $p;
             $index = $ind;
         }
     }
     $el = $l->item($index);
     return $this->parse_service($el);
 }
Exemple #3
0
if (empty($_REQUEST['id'])) {
    jieqi_printfail(LANG_ERROR_PARAMETER);
}
jieqi_getconfigs(JIEQI_MODULE_NAME, 'sort');
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
$opf_file = jieqi_uploadpath($jieqiConfigs['article']['opfdir'], 'article') . jieqi_getsubdir($_REQUEST['id']) . '/' . $_REQUEST['id'] . '/index' . $jieqi_file_postfix['opf'];
if (!is_file($opf_file)) {
    jieqi_printfail($jieqiLang['article']['article_not_exists']);
}
//文章最后更新时间
$lastupdate = filemtime($opf_file);
//打包大小类型标志
$vsflags = array('0' => 1, '64' => 2, '128' => 4, '256' => 8, '512' => 16, '1024' => 32);
include_once JIEQI_ROOT_PATH . '/lib/xml/xml.php';
$opf_xml = new XML();
$opf_xml->load($opf_file);
$opf_metas = array();
$tmpary = explode('-', $opf_xml->firstChild->attributes['unique-identifier']);
$tmpvar = count($tmpary);
if ($tmpvar >= 3 && is_numeric($tmpary[$tmpvar - 1]) && is_numeric($tmpary[$tmpvar - 2])) {
    $opf_metas['dc:Sortid'] = $tmpary[$tmpvar - 1];
}
$meta = $opf_xml->firstChild->firstChild->firstChild->firstChild;
while ($meta) {
    $opf_metas[$meta->nodeName] = $meta->firstChild->nodeValue;
    $meta = $meta->nextSibling;
}
unset($meta);
if (intval($opf_metas['dc:Display']) > 0) {
    jieqi_printfail($jieqiLang['article']['article_not_exists']);
}
 /**
  * This function checks whether the specified token is a reserved keyword.
  *
  * @access public
  * @static
  * @param string $token                         the token to be cross-referenced
  * @return boolean                              whether the token is a reserved keyword
  *
  * @see http://www.postgresql.org/docs/7.3/static/sql-keywords-appendix.html
  */
 public static function is_keyword($token)
 {
     if (static::$xml === NULL) {
         static::$xml = XML::load('config/sql/postgresql.xml');
     }
     $token = strtoupper($token);
     $nodes = static::$xml->xpath("/sql/dialect[@name='postgresql' and @version='7.3']/keywords[keyword = '{$token}']");
     return !empty($nodes);
 }
Exemple #5
0
 /**
  * Выполняет разбор документа ленты
  *
  * @param string $xml
  *
  * @return XML_Feed_Feed
  */
 public function parse($xml, $path = null)
 {
     $document = XML::load(str_replace('xmlns=', 'ns=', $xml));
     if (!$document instanceof DOMDocument) {
         throw new XML_Feed_BadFileException($path);
     }
     return new XML_Feed_Feed($document, $this->detect_protocol_for($document));
 }