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


PHP Sites::version方法代码示例

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


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

示例1: writeNZBforReleaseId

 function writeNZBforReleaseId($relid, $relguid, $name, $catId, $path, $echooutput = false)
 {
     $db = new DB();
     $binaries = array();
     $cat = new Category();
     $catrow = $cat->getById($catId);
     $site = new Sites();
     $fp = gzopen($path, "w");
     if ($fp) {
         gzwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
         gzwrite($fp, "<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n");
         gzwrite($fp, "<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n\n");
         gzwrite($fp, "<head>\n");
         if ($catrow) {
             gzwrite($fp, " <meta type=\"category\">" . htmlspecialchars($catrow["title"], ENT_QUOTES, 'utf-8') . "</meta>\n");
         }
         if ($name != "") {
             gzwrite($fp, " <meta type=\"name\">" . htmlspecialchars($name, ENT_QUOTES, 'utf-8') . "</meta>\n");
         }
         gzwrite($fp, "</head>\n\n");
         $result = $db->queryDirect(sprintf("SELECT binaries.*, UNIX_TIMESTAMP(date) AS unixdate, groups.name as groupname FROM binaries inner join groups on binaries.groupID = groups.ID WHERE binaries.releaseID = %d ORDER BY binaries.name", $relid));
         while ($binrow = mysql_fetch_assoc($result)) {
             $groups = array();
             $groupsRaw = explode(' ', $binrow['xref']);
             foreach ($groupsRaw as $grp) {
                 if (preg_match('/^([a-z0-9\\.\\-_]+):(\\d+)?$/i', $grp, $match) && strtolower($grp) !== 'xref') {
                     $groups[] = $match[1];
                 }
             }
             if (count($groups) == 0) {
                 $groups[] = $binrow["groupname"];
             }
             gzwrite($fp, "<file poster=\"" . htmlspecialchars($binrow["fromname"], ENT_QUOTES, 'utf-8') . "\" date=\"" . $binrow["unixdate"] . "\" subject=\"" . htmlspecialchars($binrow["name"], ENT_QUOTES, 'utf-8') . " (1/" . $binrow["totalParts"] . ")\">\n");
             gzwrite($fp, " <groups>\n");
             foreach ($groups as $group) {
                 gzwrite($fp, "  <group>" . $group . "</group>\n");
             }
             gzwrite($fp, " </groups>\n");
             gzwrite($fp, " <segments>\n");
             $resparts = $db->queryDirect(sprintf("SELECT DISTINCT(messageID), size, partnumber FROM parts WHERE binaryID = %d ORDER BY partnumber", $binrow["ID"]));
             while ($partsrow = mysql_fetch_assoc($resparts)) {
                 gzwrite($fp, "  <segment bytes=\"" . $partsrow["size"] . "\" number=\"" . $partsrow["partnumber"] . "\">" . htmlspecialchars($partsrow["messageID"], ENT_QUOTES, 'utf-8') . "</segment>\n");
             }
             gzwrite($fp, " </segments>\n</file>\n");
         }
         gzwrite($fp, "<!-- generated by newznab " . $site->version() . " -->\n</nzb>");
         gzclose($fp);
     }
 }
开发者ID:nubzzz,项目名称:newznab,代码行数:49,代码来源:nzb.php

示例2: writeNZBforReleaseId

    /**
     * Writes out the nzb when processing releases. Performed outside of smarty due to memory issues
     * of holding all parts in an array.
     */
    function writeNZBforReleaseId($relid, $name, $catId, $path, $groupID)
    {
        $db = new Settings();
        $cat = new Category();
        $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';
        }
        $catrow = $cat->getById($catId);
        $site = new Sites();
        $fp = gzopen($path, "w");
        if ($fp) {
            $nzb_guid = '';
            gzwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
            gzwrite($fp, "<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n");
            gzwrite($fp, "<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n\n");
            gzwrite($fp, "<head>\n");
            if ($catrow) {
                gzwrite($fp, " <meta type=\"category\">" . htmlspecialchars($catrow["title"], ENT_QUOTES, 'utf-8') . "</meta>\n");
            }
            if ($name != "") {
                gzwrite($fp, " <meta type=\"name\">" . htmlspecialchars($name, ENT_QUOTES, 'utf-8') . "</meta>\n");
            }
            gzwrite($fp, "</head>\n\n");
            $result = $db->queryDirect(sprintf("SELECT %s.*, UNIX_TIMESTAMP(date) AS unixdate, groups.name as groupname FROM %s inner join groups on %s.groupid = groups.id WHERE %s.releaseid = %d ORDER BY %s.name", $bName, $bName, $bName, $bName, $relid, $bName));
            while ($binrow = $this->pdo->getAssocArray($result)) {
                $groups = array();
                $groupsRaw = explode(' ', $binrow['xref']);
                foreach ($groupsRaw as $grp) {
                    if (preg_match('/^([a-z0-9\\.\\-_]+):(\\d+)?$/i', $grp, $match) && strtolower($grp) !== 'xref') {
                        $groups[] = $match[1];
                    }
                }
                if (count($groups) == 0) {
                    $groups[] = $binrow["groupname"];
                }
                gzwrite($fp, "<file poster=\"" . htmlspecialchars($binrow["fromname"], ENT_QUOTES, 'utf-8') . "\" date=\"" . $binrow["unixdate"] . "\" subject=\"" . htmlspecialchars($binrow["name"], ENT_QUOTES, 'utf-8') . " (1/" . $binrow["totalparts"] . ")\">\n");
                gzwrite($fp, " <groups>\n");
                foreach ($groups as $group) {
                    gzwrite($fp, "  <group>" . $group . "</group>\n");
                }
                gzwrite($fp, " </groups>\n");
                gzwrite($fp, " <segments>\n");
                $resparts = $db->queryDirect(sprintf("SELECT DISTINCT(messageid), size, partnumber FROM %s WHERE binaryid = %d ORDER BY partnumber", $pName, $binrow["id"]));
                while ($partsrow = $db->getAssocArray($resparts)) {
                    if ($nzb_guid === '') {
                        $nzb_guid = $partsrow['messageid'];
                    }
                    gzwrite($fp, "  <segment bytes=\"" . $partsrow["size"] . "\" number=\"" . $partsrow["partnumber"] . "\">" . htmlspecialchars($partsrow["messageid"], ENT_QUOTES, 'utf-8') . "</segment>\n");
                }
                gzwrite($fp, " </segments>\n</file>\n");
            }
            gzwrite($fp, "<!-- generated by newznab " . $site->version() . " -->\n</nzb>");
            gzclose($fp);
            if (is_file($path)) {
                $this->pdo->queryExec(sprintf('
						UPDATE releases SET nzbstatus = %d %s WHERE id = %d', NZB::NZB_ADDED, $nzb_guid === '' ? '' : ', nzb_guid = UNHEX( ' . $this->pdo->escapestring(md5($nzb_guid)) . ' )', $relid));
                // Chmod to fix issues some users have with file permissions.
                chmod($path, 0777);
                return true;
            } else {
                echo "ERROR: {$path} does not exist.\n";
            }
        }
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:77,代码来源:NZB.php


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