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


PHP Settings::escapestring方法代码示例

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


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

示例1: updateEpInfo

 public function updateEpInfo($show, $relid)
 {
     $this->pdo = new newznab\db\Settings();
     if (empty($show['airdate']) || !strtotime($show['airdate'])) {
         $tvairdate = "null";
     } else {
         $tvairdate = $this->pdo->escapestring($show['airdate']);
     }
     $this->pdo->queryExec(sprintf("update releases set seriesfull = %s, season = %s, episode = %s, tvairdate=%s where id = %d", $this->pdo->escapeString($show['seriesfull']), $this->pdo->escapeString($show['season']), $this->pdo->escapeString($show['episode']), $tvairdate, $relid));
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:10,代码来源:TvRage.php

示例2: writeNZBforReleaseId

    /**
     * Write an NZB to the hard drive for a single release.
     *
     * @param int    $relID   The id of the release in the DB.
     * @param string $relGuid The guid of the release.
     * @param string $name    The name of the release.
     * @param string $cTitle  The name of the category this release is in.
     *
     * @return bool Have we successfully written the NZB to the hard drive?
     *
     * @access public
     */
    public function writeNZBforReleaseId($relID, $relGuid, $name, $cTitle)
    {
        $path = $this->buildNZBPath($relGuid, $this->nzbSplitLevel, true) . $relGuid . '.nzb.gz';
        $fp = gzopen($path, 'wb7');
        if ($fp) {
            $nzb_guid = '';
            gzwrite($fp, sprintf($this->_nzbHeadString, htmlspecialchars($cTitle, ENT_QUOTES, 'utf-8'), htmlspecialchars($name, ENT_QUOTES, 'utf-8')));
            $binaries = $this->pdo->queryDirect($this->_binariesQuery . $relID . ' ORDER BY name');
            if ($binaries instanceof \Traversable) {
                foreach ($binaries as $binary) {
                    $poster = htmlspecialchars($binary['fromname'], ENT_QUOTES, 'utf-8');
                    if ($binary instanceof \Traversable) {
                        foreach ($binary as $bin) {
                            // Buffer segment writes, increases performance.
                            $string = '';
                            $parts = $this->pdo->queryDirect(sprintf($this->_partsQuery, $bin['id']));
                            if ($parts instanceof \Traversable) {
                                foreach ($parts as $part) {
                                    if ($nzb_guid === '') {
                                        $nzb_guid = $part['messageid'];
                                    }
                                    $string .= '  <segment bytes="' . $part['size'] . '" number="' . $part['partnumber'] . '">' . htmlspecialchars($part['messageid'], ENT_QUOTES, 'utf-8') . "</segment>\n";
                                }
                            }
                            gzwrite($fp, '<file poster="' . $poster . '" date="' . $bin['udate'] . '" subject="' . htmlspecialchars($bin['name'], ENT_QUOTES, 'utf-8') . ' (1/' . $bin['totalparts'] . ")\">\n <groups>\n  <group>" . $bin['groupname'] . "</group>\n </groups>\n <segments>\n" . $string . " </segments>\n</file>\n");
                        }
                    }
                }
            }
            gzwrite($fp, '</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";
            }
        }
        return false;
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:55,代码来源:Enzebe.php

示例3: create_guids

function create_guids($live, $delete = false)
{
    $pdo = new Settings();
    $consoletools = new \ConsoleTools(['ColorCLI' => $pdo->log]);
    $timestart = TIME();
    $relcount = $deleted = $total = 0;
    $relrecs = false;
    if ($live == "true") {
        $relrecs = $pdo->queryDirect(sprintf("SELECT id, guid FROM releases WHERE nzbstatus = 1 AND nzb_guid IS NULL ORDER BY id DESC"));
    } else {
        if ($live == "limited") {
            $relrecs = $pdo->queryDirect(sprintf("SELECT id, guid FROM releases WHERE nzbstatus = 1 AND nzb_guid IS NULL ORDER BY id DESC LIMIT 10000"));
        }
    }
    if ($relrecs) {
        $total = $relrecs->rowCount();
    }
    if ($total > 0) {
        echo $pdo->log->header("Creating nzb_guids for " . number_format($total) . " releases.");
        $releases = new \Releases(['Settings' => $pdo]);
        $nzb = new \NZB($pdo);
        $releaseImage = new \ReleaseImage($pdo);
        $reccnt = 0;
        if ($relrecs instanceof \Traversable) {
            foreach ($relrecs as $relrec) {
                $reccnt++;
                $nzbpath = $nzb->getNZBPath($relrec['guid']);
                if ($nzbpath !== false) {
                    $nzbfile = Utility::unzipGzipFile($nzbpath);
                    if ($nzbfile) {
                        $nzbfile = @simplexml_load_string($nzbfile);
                    }
                    if (!$nzbfile) {
                        if (isset($delete) && $delete == 'delete') {
                            //echo "\n".$nzb->NZBPath($relrec['guid'])." is not a valid xml, deleting release.\n";
                            $releases->deleteSingle(['g' => $relrec['guid'], 'i' => $relrec['id']], $nzb, $releaseImage);
                            $deleted++;
                        }
                        continue;
                    }
                    $binary_names = [];
                    foreach ($nzbfile->file as $file) {
                        $binary_names[] = $file["subject"];
                    }
                    if (count($binary_names) == 0) {
                        if (isset($delete) && $delete == 'delete') {
                            //echo "\n".$nzb->NZBPath($relrec['guid'])." has no binaries, deleting release.\n";
                            $releases->deleteSingle(['g' => $relrec['guid'], 'i' => $relrec['id']], $nzb, $releaseImage);
                            $deleted++;
                        }
                        continue;
                    }
                    asort($binary_names);
                    foreach ($nzbfile->file as $file) {
                        if ($file["subject"] == $binary_names[0]) {
                            $segment = $file->segments->segment;
                            $nzb_guid = md5($segment);
                            $pdo->queryExec("UPDATE releases set nzb_guid = UNHEX(" . $pdo->escapestring($nzb_guid) . ") WHERE id = " . $relrec["id"]);
                            $relcount++;
                            $consoletools->overWritePrimary("Created: [" . $deleted . "] " . $consoletools->percentString($reccnt, $total) . " Time:" . $consoletools->convertTimer(TIME() - $timestart));
                            break;
                        }
                    }
                } else {
                    if (isset($delete) && $delete == 'delete') {
                        //echo $pdo->log->primary($nzb->NZBPath($relrec['guid']) . " does not have an nzb, deleting.");
                        $releases->deleteSingle(['g' => $relrec['guid'], 'i' => $relrec['id']], $nzb, $releaseImage);
                    }
                }
            }
        }
        if ($relcount > 0) {
            echo "\n";
        }
        echo $pdo->log->header("Updated " . $relcount . " release(s). This script ran for " . $consoletools->convertTime(TIME() - $timestart));
    } else {
        echo $pdo->log->info('Query time: ' . $consoletools->convertTime(TIME() - $timestart));
        exit($pdo->log->info("No releases are missing the guid."));
    }
}
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:80,代码来源:populate_nzb_guid.php


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