• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utility\Misc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中nzedb\utility\Misc的典型用法代码示例。如果您正苦于以下问题:PHP Misc类的具体用法?PHP Misc怎么用?PHP Misc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __construct

 /**
  * @param Settings $pdo
  */
 public function __construct(Settings $pdo = null)
 {
     parent::__construct($pdo);
     $this->_git = new \nzedb\utility\Git();
     // Do not remove the full namespace/ PHP gets confused for some reason without it.
     $this->_vers = Misc::getValidVersionsFile();
     $this->_setColourMasks();
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:11,代码来源:TmuxOutput.php


示例2: fetchImage

 /**
  * Get a URL or file image and convert it to string.
  *
  * @param string $imgLoc URL or file location.
  *
  * @return bool|mixed|string
  */
 protected function fetchImage($imgLoc)
 {
     $img = false;
     if (strpos(strtolower($imgLoc), 'http:') === 0 || strpos(strtolower($imgLoc), 'https:') === 0) {
         $img = Misc::getUrl(['url' => $imgLoc]);
     } else {
         if (is_file($imgLoc)) {
             $img = @file_get_contents($imgLoc);
         }
     }
     if ($img !== false) {
         $im = @imagecreatefromstring($img);
         if ($im !== false) {
             imagedestroy($im);
             return $img;
         }
     }
     return false;
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:26,代码来源:ReleaseImage.php


示例3: realpath

<?php

require_once realpath(dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\Tmux;
use nzedb\db\Settings;
use nzedb\utility\Misc;
$pdo = new Settings();
$DIR = nZEDb_MISC;
// Check that Db patch level is current. Also checks nZEDb.xml is valid.
Misc::isPatched();
Misc::clearScreen();
$patch = $pdo->getSetting('sqlpatch');
$patch = $patch != '' ? $patch : 0;
$delaytimet = $pdo->getSetting('delaytime');
$delaytimet = $delaytimet ? (int) $delaytimet : 2;
$nntpproxy = $pdo->getSetting('nntpproxy');
echo "Starting Tmux...\n";
// Create a placeholder session so tmux commands do not throw server not found errors.
exec('tmux new-session -ds placeholder 2>/dev/null');
// Search for NNTPProxy session that might be running from a user threaded.php run. Setup a clean environment to run in.
exec("tmux list-session | grep NNTPProxy", $nntpkill);
if (count($nntpkill) !== 0) {
    exec("tmux kill-session -t NNTPProxy");
    echo $pdo->log->notice("Found NNTPProxy tmux session and killing it.");
} else {
    exec("tmux list-session", $session);
}
$t = new Tmux();
$tmux = $t->get();
$tmux_session = isset($tmux->tmux_session) ? $tmux->tmux_session : 0;
$seq = isset($tmux->sequential) ? $tmux->sequential : 0;
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:run.php


示例4: getValidVersionsFile

 public function getValidVersionsFile($filepath = null)
 {
     $filepath = empty($filepath) ? $this->_filespec : $filepath;
     $temp = libxml_use_internal_errors(true);
     $this->_xml = simplexml_load_file($filepath);
     libxml_use_internal_errors($temp);
     if ($this->_xml === false) {
         if (Misc::isCLI()) {
             $this->out->error("Your versions XML file ({$filepath}) is broken, try updating from git.");
         }
         throw new \Exception("Failed to open versions XML file '{$filepath}'");
     }
     if ($this->_xml->count() > 0) {
         $vers = $this->_xml->xpath('/nzedb/versions');
         if ($vers[0]->count() == 0) {
             $this->out->error("Your versions XML file ({nZEDb_VERSIONS}) does not contain version info, try updating from git.");
             throw new \Exception("Failed to find versions node in XML file '{$filepath}'");
         } else {
             $this->out->primary("Your versions XML file ({nZEDb_VERSIONS}) looks okay, continuing.");
             $this->_vers =& $this->_xml->versions;
         }
     } else {
         throw new \RuntimeException("No elements in file!\n");
     }
     return $this->_xml;
 }
开发者ID:zetas,项目名称:nZEDb,代码行数:26,代码来源:Versions.php


示例5: addFromXml

 public function addFromXml($releaseID, $xml)
 {
     $xmlObj = @simplexml_load_string($xml);
     $arrXml = Misc::objectsIntoArray($xmlObj);
     $containerformat = '';
     $overallbitrate = '';
     if (isset($arrXml['File']) && isset($arrXml['File']['track'])) {
         foreach ($arrXml['File']['track'] as $track) {
             if (isset($track['@attributes']) && isset($track['@attributes']['type'])) {
                 if ($track['@attributes']['type'] == 'General') {
                     if (isset($track['Format'])) {
                         $containerformat = $track['Format'];
                     }
                     if (isset($track['Overall_bit_rate'])) {
                         $overallbitrate = $track['Overall_bit_rate'];
                     }
                 } else {
                     if ($track['@attributes']['type'] == 'Video') {
                         $videoduration = $videoformat = $videocodec = $videowidth = $videoheight = $videoaspect = $videoframerate = $videolibrary = '';
                         if (isset($track['Duration'])) {
                             $videoduration = $track['Duration'];
                         }
                         if (isset($track['Format'])) {
                             $videoformat = $track['Format'];
                         }
                         if (isset($track['Codec_ID'])) {
                             $videocodec = $track['Codec_ID'];
                         }
                         if (isset($track['Width'])) {
                             $videowidth = preg_replace('/[^0-9]/', '', $track['Width']);
                         }
                         if (isset($track['Height'])) {
                             $videoheight = preg_replace('/[^0-9]/', '', $track['Height']);
                         }
                         if (isset($track['Display_aspect_ratio'])) {
                             $videoaspect = $track['Display_aspect_ratio'];
                         }
                         if (isset($track['Frame_rate'])) {
                             $videoframerate = str_replace(' fps', '', $track['Frame_rate']);
                         }
                         if (isset($track['Writing_library'])) {
                             $videolibrary = $track['Writing_library'];
                         }
                         $this->addVideo($releaseID, $containerformat, $overallbitrate, $videoduration, $videoformat, $videocodec, $videowidth, $videoheight, $videoaspect, $videoframerate, $videolibrary);
                     } else {
                         if ($track['@attributes']['type'] == 'Audio') {
                             $audioID = 1;
                             $audioformat = $audiomode = $audiobitratemode = $audiobitrate = $audiochannels = $audiosamplerate = $audiolibrary = $audiolanguage = $audiotitle = '';
                             if (isset($track['@attributes']['streamid'])) {
                                 $audioID = $track['@attributes']['streamid'];
                             }
                             if (isset($track['Format'])) {
                                 $audioformat = $track['Format'];
                             }
                             if (isset($track['Mode'])) {
                                 $audiomode = $track['Mode'];
                             }
                             if (isset($track['Bit_rate_mode'])) {
                                 $audiobitratemode = $track['Bit_rate_mode'];
                             }
                             if (isset($track['Bit_rate'])) {
                                 $audiobitrate = $track['Bit_rate'];
                             }
                             if (isset($track['Channel_s_'])) {
                                 $audiochannels = $track['Channel_s_'];
                             }
                             if (isset($track['Sampling_rate'])) {
                                 $audiosamplerate = $track['Sampling_rate'];
                             }
                             if (isset($track['Writing_library'])) {
                                 $audiolibrary = $track['Writing_library'];
                             }
                             if (isset($track['Language'])) {
                                 $audiolanguage = $track['Language'];
                             }
                             if (isset($track['Title'])) {
                                 $audiotitle = $track['Title'];
                             }
                             $this->addAudio($releaseID, $audioID, $audioformat, $audiomode, $audiobitratemode, $audiobitrate, $audiochannels, $audiosamplerate, $audiolibrary, $audiolanguage, $audiotitle);
                         } else {
                             if ($track['@attributes']['type'] == 'Text') {
                                 $subsID = 1;
                                 $subslanguage = 'Unknown';
                                 if (isset($track['@attributes']['streamid'])) {
                                     $subsID = $track['@attributes']['streamid'];
                                 }
                                 if (isset($track['Language'])) {
                                     $subslanguage = $track['Language'];
                                 }
                                 $this->addSubs($releaseID, $subsID, $subslanguage);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:98,代码来源:ReleaseExtra.php


示例6: yahooSearch

 /**
  * Try to find a IMDB id on yahoo.com
  *
  * @return bool
  */
 protected function yahooSearch()
 {
     $buffer = Misc::getUrl(['url' => "http://search.yahoo.com/search?n=10&ei=UTF-8&va_vt=title&vo_vt=any&ve_vt=any&vp_vt=any&vf=all&vm=p&fl=0&fr=fp-top&p=intitle:" . urlencode('intitle:' . implode(' intitle:', explode(' ', preg_replace('/\\s+/', ' ', preg_replace('/\\W/', ' ', $this->currentTitle)))) . ' intitle:' . $this->currentYear) . '&vs=' . urlencode('www.imdb.com/title/')]);
     if ($buffer !== false) {
         $this->yahooLimit++;
         if ($this->doMovieUpdate($buffer, 'Yahoo.com', $this->currentRelID) !== false) {
             return true;
         }
     }
     return false;
 }
开发者ID:advhamstrong,项目名称:nZEDb,代码行数:16,代码来源:Movie.php


示例7: resumeAll

 /**
  * Resume all NZB's in the SAB queue.
  *
  * @return bool|mixed
  */
 public function resumeAll()
 {
     return Misc::getUrl(['url' => $this->url . "api?mode=resume" . "&apikey=" . $this->apikey, 'verifycert' => false]);
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:9,代码来源:SABnzbd.php


示例8: isNFO

 /**
  * Confirm this is an NFO file.
  *
  * @param string $possibleNFO The nfo.
  * @param string $guid        The guid of the release.
  *
  * @return bool               True on success, False on failure.
  *
  * @access public
  */
 public function isNFO(&$possibleNFO, $guid)
 {
     if ($possibleNFO === false) {
         return false;
     }
     // Make sure it's not too big or small, size needs to be at least 12 bytes for header checking. Ignore common file types.
     $size = strlen($possibleNFO);
     if ($size < 65535 && $size > 11 && !preg_match('/\\A(\\s*<\\?xml|=newz\\[NZB\\]=|RIFF|\\s*[RP]AR|.{0,10}(JFIF|matroska|ftyp|ID3))|;\\s*Generated\\s*by.*SF\\w/i', $possibleNFO)) {
         // File/GetId3 work with files, so save to disk.
         $tmpPath = $this->tmpPath . $guid . '.nfo';
         file_put_contents($tmpPath, $possibleNFO);
         $result = Misc::fileInfo($tmpPath);
         if (!empty($result)) {
             // Check if it's text.
             if (preg_match('/(ASCII|ISO-8859|UTF-(8|16|32).*?)\\s*text/', $result)) {
                 @unlink($tmpPath);
                 return true;
                 // Or binary.
             } else {
                 if (preg_match('/^(JPE?G|Parity|PNG|RAR|XML|(7-)?[Zz]ip)/', $result) || preg_match('/[\\x00-\\x08\\x12-\\x1F\\x0B\\x0E\\x0F]/', $possibleNFO)) {
                     @unlink($tmpPath);
                     return false;
                 }
             }
         }
         // If above checks couldn't  make a categorical identification, Use GetId3 to check if it's an image/video/rar/zip etc..
         $check = (new \getid3())->analyze($tmpPath);
         @unlink($tmpPath);
         if (isset($check['error'])) {
             // Check if it's a par2.
             $par2info = new \Par2Info();
             $par2info->setData($possibleNFO);
             if ($par2info->error) {
                 // Check if it's an SFV.
                 $sfv = new \SfvInfo();
                 $sfv->setData($possibleNFO);
                 if ($sfv->error) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:egandt,项目名称:nZEDb,代码行数:54,代码来源:Nfo.php


示例9: setCovers

 public function setCovers()
 {
     $path = $this->getSetting(['section' => 'site', 'subsection' => 'main', 'name' => 'coverspath', 'setting' => 'coverspath']);
     Misc::setCoversConstant($path);
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:5,代码来源:Settings.php


示例10: isset

     $relData = $releases->searchbyRageId(isset($_GET['rid']) ? $_GET['rid'] : '-1', isset($_GET['season']) ? $_GET['season'] : '', isset($_GET['ep']) ? $_GET['ep'] : '', $offset, limit(), isset($_GET['q']) ? $_GET['q'] : '', categoryID(), $maxAge);
     addLanguage($relData, $page->settings);
     printOutput($relData, $outputXML, $page, $offset);
     break;
     // Search movie releases.
 // Search movie releases.
 case 'm':
     verifyEmptyParameter('q');
     verifyEmptyParameter('imdbid');
     $maxAge = maxAge();
     $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI']);
     $offset = offset();
     $imdbId = isset($_GET['imdbid']) ? $_GET['imdbid'] : '-1';
     $relData = $releases->searchbyImdbId($imdbId, $offset, limit(), isset($_GET['q']) ? $_GET['q'] : '', categoryID(), $maxAge);
     addCoverURL($relData, function ($release) {
         return Misc::getCoverURL(['type' => 'movies', 'id' => $release['imdbid']]);
     });
     addLanguage($relData, $page->settings);
     printOutput($relData, $outputXML, $page, $offset);
     break;
     // Get NZB.
 // Get NZB.
 case 'g':
     if (!isset($_GET['id'])) {
         showApiError(200, 'Missing parameter (id is required for downloading an NZB)');
     }
     $relData = $releases->getByGuid($_GET['id']);
     if ($relData) {
         header('Location:' . WWW_TOP . '/getnzb?i=' . $uid . '&r=' . $apiKey . '&id=' . $relData['guid'] . (isset($_GET['del']) && $_GET['del'] == '1' ? '&del=1' : ''));
     } else {
         showApiError(300, 'No such item (the guid you provided has no release in our database)');
开发者ID:advhamstrong,项目名称:nZEDb,代码行数:31,代码来源:api.php


示例11: _initiateYEncSettings

 /**
  * Check the Admin settings for yEnc and process them accordingly.
  *
  * @void
  *
  * @access protected
  */
 protected function _initiateYEncSettings()
 {
     // Check if the user wants to use yyDecode or the simple_php_yenc_decode extension.
     $this->_yyDecoderPath = $this->pdo->getSetting('yydecoderpath') != '' ? (string) $this->pdo->getSetting('yydecoderpath') : false;
     if (strpos((string) $this->_yyDecoderPath, 'simple_php_yenc_decode') !== false) {
         if (extension_loaded('simple_php_yenc_decode')) {
             $this->_yEncExtension = true;
         } else {
             $this->_yyDecoderPath = false;
         }
     } else {
         if ($this->_yyDecoderPath !== false) {
             $this->_yEncSilence = Misc::isWin() ? '' : ' > /dev/null 2>&1';
             $this->_yEncTempInput = nZEDb_TMP . 'yEnc' . DS;
             $this->_yEncTempOutput = $this->_yEncTempInput . 'output';
             $this->_yEncTempInput .= 'input';
             // Test if the user can read/write to the yEnc path.
             if (!is_file($this->_yEncTempInput)) {
                 @file_put_contents($this->_yEncTempInput, 'x');
             }
             if (!is_file($this->_yEncTempInput) || !is_readable($this->_yEncTempInput) || !is_writable($this->_yEncTempInput)) {
                 $this->_yyDecoderPath = false;
             }
             if (is_file($this->_yEncTempInput)) {
                 @unlink($this->_yEncTempInput);
             }
         }
     }
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:36,代码来源:NNTP.php


示例12: exit

<?php

require_once './config.php';
use nzedb\NZBExport;
use nzedb\Releases;
use nzedb\utility\Misc;
if (Misc::isCLI()) {
    exit('This script is only for exporting from the web, use the script in misc/testing' . PHP_EOL);
}
$page = new AdminPage();
$rel = new Releases(['Settings' => $page->settings]);
$folder = $group = $fromDate = $toDate = $gzip = $output = '';
if ($page->isPostBack()) {
    $folder = $_POST["folder"];
    $fromDate = isset($_POST["postfrom"]) ? $_POST["postfrom"] : '';
    $toDate = isset($_POST["postto"]) ? $_POST["postto"] : '';
    $group = $_POST["group"];
    $gzip = $_POST["gzip"];
    if ($folder != '') {
        $output = (new NZBExport(['Browser' => true, 'Settings' => $page->settings, 'Releases' => $rel]))->beginExport([$folder, $fromDate, $toDate, $_POST["group"] === '-1' ? 0 : (int) $_POST["group"], $_POST["gzip"] === '1' ? true : false]);
    } else {
        $output = 'Error, a path is required!';
    }
} else {
    $fromDate = $rel->getEarliestUsenetPostDate();
    $toDate = $rel->getLatestUsenetPostDate();
}
$page->title = "Export Nzbs";
$page->smarty->assign(['output' => $output, 'folder' => $folder, 'fromdate' => $fromDate, 'todate' => $toDate, 'group' => $group, 'gzip' => $gzip, 'gziplist' => [1 => 'True', 0 => 'False'], 'grouplist' => $rel->getReleasedGroupsForSelect(true)]);
$page->content = $page->smarty->fetch('nzb-export.tpl');
$page->render();
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:nzb-export.php


示例13: count

}
$total = count($data);
$predb = new PreDb();
$progress = $predb->progress(settings_array());
foreach ($data as $file) {
    if (preg_match("#^https://raw\\.githubusercontent\\.com/nZEDb/nZEDbPre_Dumps/master/dumps/{$filePattern}\$#", $file['download_url'])) {
        if (preg_match("#^{$filePattern}\$#", $file['name'], $match)) {
            $timematch = $progress['last'];
            // Skip patches the user does not want.
            if ($match[1] < $timematch) {
                echo 'Skipping dump ' . $match[2] . ', as your minimum unix time argument is ' . $timematch . PHP_EOL;
                --$total;
                continue;
            }
            // Download the dump.
            $dump = Misc::getUrl(['url' => $file['download_url']]);
            echo "Downloading: {$file['download_url']}\n";
            if (!$dump) {
                echo "Error downloading dump {$match[2]} you can try manually importing it." . PHP_EOL;
                continue;
            } else {
                if (nZEDb_DEBUG) {
                    echo "Dump {$match[2]} downloaded\n";
                }
            }
            // Make sure we didn't get an HTML page.
            if (strpos($dump, '<!DOCTYPE html>') !== false) {
                echo "The dump file {$match[2]} might be missing from GitHub." . PHP_EOL;
                continue;
            }
            // Decompress.
开发者ID:egandt,项目名称:nZEDb,代码行数:31,代码来源:predb_import_daily_batch.php


示例14: getJsonArray

 /**
  * Download JSON from Trakt, convert to array.
  *
  * @param string $URI URI to download.
  * @param string $extended Extended info from trakt tv.
  *                         Valid values:
  *                         'min'         Returns enough info to match locally. (Default)
  *                         'images'      Minimal info and all images.
  *                         'full'        Complete info for an item.
  *                         'full,images' Complete info and all images.
  *
  * @return bool|mixed
  */
 private function getJsonArray($URI, $extended = 'min')
 {
     if (!empty($this->clientID)) {
         $json = Misc::getUrl(['url' => $URI . "?extended={$extended}", 'requestheaders' => $this->requestHeaders]);
         if ($json !== false) {
             $json = json_decode($json, true);
             if (!is_array($json) || isset($json['status']) && $json['status'] === 'failure') {
                 return false;
             }
             return $json;
         }
     }
     return false;
 }
开发者ID:advhamstrong,项目名称:nZEDb,代码行数:27,代码来源:TraktTv.php


示例15: dirname

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (see LICENSE.txt in the base directory.  If
 * not, see:
 *
 * @link <http://www.gnu.org/licenses/>.
 * @author niel
 * @copyright 2015 nZEDb
 */
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'indexer.php';
use nzedb\db\DbUpdate;
use nzedb\utility\Git;
use nzedb\utility\Misc;
if (!Misc::isCLI()) {
    exit;
}
$error = false;
$git = new Git();
$branch = $git->active_branch();
if (in_array($branch, $git->mainBranches())) {
    // Only update patches, etc. on specific branches to lessen conflicts
    try {
        // Run DbUpdates to make sure we're up to date.
        $DbUpdater = new DbUpdate(['git' => $git]);
        $DbUpdater->newPatches(['safe' => false]);
    } catch (\Exception $e) {
        $error = 1;
        echo "Error while checking patches!\n";
        echo $e->getMessage() . "\n";
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:NewPatches.php


示例16: realpath

require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
require_once realpath(dirname(dirname(dirname(__DIR__))) . DS . 'libs' . DS . 'smarty' . DS . 'Autoloader.php');
Smarty_Autoloader::register();
use nzedb\ColorCLI;
use nzedb\Tmux;
use nzedb\db\Settings;
use nzedb\utility\Misc;
$pdo = new Settings();
$DIR = nZEDb_MISC;
$smarty = new Smarty();
$dbname = DB_NAME;
$cli = new ColorCLI();
if (isset($argv[1]) && ($argv[1] == "true" || $argv[1] == "safe")) {
    $restart = (new Tmux())->stopIfRunning();
    system("cd {$DIR} && git pull");
    if (Misc::hasCommand("php5")) {
        $PHP = "php5";
    } else {
        $PHP = "php";
    }
    echo $cli->header("Patching database - {$dbname}.");
    $safe = $argv[1] === "safe" ? true : false;
    system("{$PHP} " . nZEDb_ROOT . 'cli' . DS . "update_db.php true {$safe}");
    // Remove folders from smarty.
    $cleared = $smarty->clearCompiledTemplate();
    if ($cleared) {
        echo $cli->header("The smarty template cache has been cleaned for you");
    } else {
        echo $cli->header("You should clear your smarty template cache at: " . SMARTY_DIR . "templates_c");
    }
    if ($restart) {
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:autopatcher.php


示例17: realpath

<?php

require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\db\Settings;
use nzedb\utility\Misc;
$pdo = new Settings();
$covers = $updated = $deleted = 0;
if ($argc == 1 || $argv[1] != 'true') {
    exit($pdo->log->error("\nThis script will check all images in covers/games and compare to db->gamesinfo.\nTo run:\nphp {$argv['0']} true\n"));
}
$row = $pdo->queryOneRow("SELECT value FROM settings WHERE setting = 'coverspath'");
if ($row !== false) {
    Misc::setCoversConstant($row['value']);
} else {
    die("Unable to set Covers' constant!\n");
}
$path2covers = nZEDb_COVERS . 'games' . DS;
$dirItr = new \RecursiveDirectoryIterator($path2covers);
$itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($itr as $filePath) {
    if (is_file($filePath) && preg_match('/\\d+\\.jpg/', $filePath)) {
        preg_match('/(\\d+)\\.jpg/', basename($filePath), $match);
        if (isset($match[1])) {
            $run = $pdo->queryDirect("UPDATE gamesinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]);
            if ($run !== false) {
                if ($run->rowCount() >= 1) {
                    $covers++;
                } else {
                    $run = $pdo->queryDirect("SELECT id FROM gamesinfo WHERE id = " . $match[1]);
                    if ($run !== false && $run->rowCount() == 0) {
                        echo $pdo->log->info($filePath . " not found in db.");
开发者ID:kaibosh,项目名称:nZEDb,代码行数:31,代码来源:updateGamesImages.php


示例18: getUrl

 /**
  * Gets Raw Html
  *
  * @param string $fetchURL
  * @param bool $usePost
  *
  * @return bool
  */
 private function getUrl($fetchURL, $usePost = false)
 {
     if (isset($fetchURL)) {
         $this->_ch = curl_init($fetchURL);
     }
     if ($usePost === true) {
         curl_setopt($this->_ch, CURLOPT_POST, 1);
         curl_setopt($this->_ch, CURLOPT_POSTFIELDS, $this->_postParams);
     }
     curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($this->_ch, CURLOPT_HEADER, 0);
     curl_setopt($this->_ch, CURLOPT_VERBOSE, 0);
     curl_setopt($this->_ch, CURLOPT_USERAGENT, "Firefox/2.0.0.1");
     curl_setopt($this->_ch, CURLOPT_FAILONERROR, 1);
     if (isset($this->cookie)) {
         curl_setopt($this->_ch, CURLOPT_COOKIEJAR, $this->cookie);
         curl_setopt($this->_ch, CURLOPT_COOKIEFILE, $this->cookie);
     }
     curl_setopt_array($this->_ch, Misc::curlSslContextOptions());
     $this->_response = curl_exec($this->_ch);
     if (!$this->_response) {
         curl_close($this->_ch);
         return false;
     }
     curl_close($this->_ch);
     $this->_html->load($this->_response);
     return true;
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:36,代码来源:Steam.php


示例19: realpath

<?php

// Shitty script to check time/date in php mysql and system...
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\db\Settings;
use nzedb\utility\Misc;
$n = PHP_EOL;
// TODO change this to be able to use GnuWin
if (!nzedb\utility\Misc::isWin()) {
    echo 'These are the settings in your php.ini files:' . $n;
    echo 'CLI PHP timezone : ' . exec('cat /etc/php5/cli/php.ini | grep \'date.timezone =\' | cut -d \\  -f 3') . $n;
    echo 'apache2 timezone : ' . exec('cat /etc/php5/apache2/php.ini| grep \'date.timezone =\' | cut -d \\  -f 3') . $n;
}
$system = ' not supported on windows.';
$pdo = new Settings();
$MySQL = $pdo->queryOneRow('SELECT NOW() AS time, @@system_time_zone AS tz');
if (!Misc::isWin()) {
    $system = exec('date');
}
$php = date('D M d H:i:s T o');
$MySQL = date('D M d H:i:s T o', strtotime($MySQL['time'] . ' ' . $MySQL['tz']));
echo 'The various dates/times:' . $n;
echo 'System time      : ' . $system . $n;
echo 'MYSQL time       : ' . $MySQL . $n;
echo 'PHP time         : ' . $php . $n;
if ($MySQL === $system && $system === $php) {
    exit('Looks like all your dates/times are good.' . $n);
} else {
    exit('Looks like you have 1 or more dates/times set wrong.' . $n);
}
开发者ID:zetas,项目名称:nZEDb,代码行数:30,代码来源:verify_time_settings.php


示例20: getShowInfo

 /**
  * Main function for matching a releae searchname to a TvRage title
  * Returns basic show information array or -1 int if no match
  *
  * @param $showInfo
  *
  * @return array|int
  */
 public function getShowInfo($showInfo)
 {
     $matchedTitle = -1;
     $title = $showInfo['cleanname'];
     // Full search gives us the akas.
     $xml = Misc::getUrl(['url' => $this->xmlFullSearchUrl . urlencode(strtolower($title))]);
     if ($xml !== false) {
         $arrXml = @Misc::objectsIntoArray(simplexml_load_string($xml));
         // CheckXML Response is valid before processing
         if (isset($arrXml['show']) && is_array($arrXml)) {
             // We got exactly 1 match so lets convert it to an array so we can use it in the logic below.
             if (isset($arrXml['show']['showid'])) {
                 $newArr[] = $arrXml['show'];
                 unset($arrXml);
                 $arrXml['show'] = $newArr;
             }
             $highestPercent = 0;
             foreach ($arrXml['show'] as $show) {
                 if ($title == $show['name']) {
                     $matchedTitle = $show;
                     break;
                 }
                 // Get a match percentage based on our name and the name returned from tvr.
                 $matchPercent = $this->checkMatch($title, $show['name'], self::MATCH_PROBABILITY);
                 if ($matchPercent > $highestPercent) {
                     $matchedTitle = $show;
                     $highestPercent = $matchPercent;
                 }
                 // Check if there are any akas for this result and get a match percentage for them too.
                 if (isset($show['akas']['aka'])) {
                     if (is_array($show['akas']['aka'])) {
                         // Multiple akas.
                         foreach ($show['akas']['aka'] as $aka) {
                             $matchPercent = $this->checkMatch($title, $aka, self::MATCH_PROBABILITY);
                             if ($matchPercent > $highestPercent) {
                                 $matchedTitle = $show;
                                 $highestPercent = $matchPercent;
                             }
                         }
                     } else {
                         // One aka.
                         $matchPercent = $this->checkMatch($title, $show['akas']['aka'], self::MATCH_PROBABILITY);
                         if ($matchPercent > $highestPercent) {
                             $show['akas']['aka'][] = $show['akas']['aka'];
                             $matchedTitle = $show;
                             $highestPercent = $matchPercent;
                         }
                     }
                 }
             }
         } else {
             if ($this->echooutput) {
                 echo $this->pdo->log->primary('Nothing returned from tvrage.');
             }
         }
     }
     return $this->formatShowInfo($matchedTitle);
 }
开发者ID:zetas,项目名称:nZEDb,代码行数:66,代码来源:TvRage.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP service\ServiceManager类代码示例发布时间:2022-05-23
下一篇:
PHP db\Settings类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap