예제 #1
0
파일: NNTP.php 프로젝트: Jay204/nZEDb
 /**
  * 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 = nzedb\utility\isWindows() ? '' : ' > /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);
             }
         }
     }
 }
예제 #2
0
파일: check_time.php 프로젝트: Jay204/nZEDb
<?php

// Shitty script to check time/date in php mysql and system...
require_once dirname(__FILE__) . '/../../../www/config.php';
use nzedb\db\Settings;
use nzedb\utility;
$n = PHP_EOL;
// TODO change this to be able to use GnuWin
if (!nzedb\utility\isWindows()) {
    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 (!nzedb\utility\isWindows()) {
    $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);
}