当前位置: 首页>>代码示例>>PHP>>正文


PHP Settings::version方法代码示例

本文整理汇总了PHP中newznab\db\Settings::version方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::version方法的具体用法?PHP Settings::version怎么用?PHP Settings::version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在newznab\db\Settings的用法示例。


在下文中一共展示了Settings::version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initiateForWrite

    /**
     * Initiate class vars when writing NZB's.
     *
     * @param int $groupID
     *
     * @access public
     */
    public function initiateForWrite($groupID)
    {
        $this->groupid = $groupID;
        // Set table names
        if ($this->tablePerGroup === true) {
            if ($this->groupid == '') {
                exit("{$this->groupid} is missing\n");
            }
            $bName = 'binaries_' . $this->groupid;
            $pName = 'parts_' . $this->groupid;
        } else {
            $bName = 'binaries';
            $pName = 'parts';
        }
        $this->_binariesQuery = sprintf('SELECT %s.*, UNIX_TIMESTAMP(%s.date) AS udate, groups.name AS groupname
			FROM %s
			INNER JOIN groups ON %s.groupid = groups.id
			WHERE %s.releaseid = ', $bName, $bName, $bName, $bName, $bName);
        $this->_partsQuery = 'SELECT DISTINCT(messageid), size, partnumber FROM ' . $pName . ' WHERE binaryid = %d ORDER BY partnumber';
        $this->_nzbHeadString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n<!-- NZB Generated by: newznab " . $this->pdo->version() . ' ' . htmlspecialchars(date('F j, Y, g:i a O'), ENT_QUOTES, 'utf-8') . " -->\n<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n<head>\n <meta type=\"category\">%s</meta>\n <meta type=\"name\">%s</meta>\n</head>\n\n";
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:28,代码来源:Enzebe.php

示例2: encodePost

 public function encodePost($message, $reftime = Null, $debug = False, $prvkey = Null, $passphrase = Null, $encrypt = True, $msgtype = SpotNab::FETCH_COMMENT_TYPE, $user = Null, $email = Null, $group = Null)
 {
     /*
     
     Assembles and encodes a message ready to be posted onto
     a usenet server.
     
     false is returned if the function fails,
     
     If a reftime is specified, it is presumed that it will be in
     an integer format and it will be localtime
     
     If the debug is set to true, then a third part of the
     article is returned containing header information that would
     look as though _get_header() returned it
     */
     // Assumed to be in Y-m-d H:i:s format or int
     // convert local time into UTC
     $reftime = $this->local2utc($reftime, "YmdHis");
     $s = new Settings();
     $msgid = sprintf('<%s.%s.%d@%s>', $this->getRandomStr(30), $msgtype, time(), SpotNab::SEGID_DOMAIN);
     if (!is_string($message)) {
         // If message is not already in string format, then
         // it's in it's assembled mixed array format... we
         // need to convert it to json before proceeding
         $message = json_encode($message, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
         if ($message === false) {
             // Fail
             return false;
         }
     }
     // nntp posting expects an array as follows:
     //	array(
     //		[0] => 'Message Header'
     //		[1] => 'Message	Body'
     //	);
     if ($encrypt) {
         // Encrypt Message
         $message = $this->encrypt($message, $prvkey, $passphrase);
         if ($message === false) {
             // fail
             return false;
         }
     } else {
         // Convert to base64
         $message = base64_encode($message);
     }
     // Compress Messsage
     $message = @gzcompress($message, 9);
     // Yenc Binary Content
     $message = $this->_nntp->encodeYenc2($message, md5($message));
     //
     // Prepare Header
     //
     // Checksum id
     $checksum = sha1($message);
     // Prepare Subject
     $subject = sprintf("%s-%s", $checksum, $reftime);
     if ($user === Null) {
         $user = trim($this->_post_user);
     }
     if ($email === Null) {
         $email = trim($this->_post_email);
     }
     if ($group === Null) {
         $group = trim($this->_post_group);
     }
     $header = "Subject: " . $subject . "\r\n";
     $header .= "Newsgroups: " . $group . "\r\n";
     $header .= "Message-ID: {$msgid}\r\n";
     $header .= "X-Newsreader: NewzNab v" . $s->version() . "\r\n";
     $header .= "X-No-Archive: yes\r\n";
     $header .= "From: " . $user . " <" . $email . ">\r\n";
     // Binary Content
     $header .= 'Content-Type: text/plain; charset=ISO-8859-1' . "\r\n";
     $header .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
     // Assemble Article in structure NNTP expects
     $article = [$header, $message];
     if ($debug) {
         // Append some debug data to the article
         $article[] = ['Number' => 1234, 'Subject' => $subject, 'From' => sprintf('%s <%s>', $user, $email), 'Date' => date(DATE_RFC822, strtotime($this->utc2local($reftime))), 'Message-ID' => $msgid, 'Bytes' => strlen($message), 'Lines' => '1', 'Epoch' => strtotime($this->utc2local($reftime)), 'Group' => $group];
     }
     return $article;
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:84,代码来源:SpotNab.php


注:本文中的newznab\db\Settings::version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。