Esempio n. 1
0
function main()
{
    global $log;
    //this script can take a long time to run
    //we don't want it ending early
    set_time_limit(0);
    $timer = new timer();
    $log->writeLine("============================================");
    $log->writeLine("Begin upload processing.");
    $timer->start();
    //process all files in the upload directory
    do_process();
    $timer->stop();
    $log->writeLine("--------------------------------------------");
    $log->writeLine("End upload processing. Took " . $timer->taken() . " seconds.");
    $log->writeLine("============================================");
    $log->saveLog("blah.txt");
}
Esempio n. 2
0
 public function __construct()
 {
     require BASEPATH . '/lang/' . core::$config->server->lang . '/nickserv.php';
     self::$help =& $help;
     if (isset(core::$config->nickserv)) {
         ircd::introduce_client(core::$config->nickserv->nick, core::$config->nickserv->user, core::$config->nickserv->host, core::$config->nickserv->real);
     } else {
         return;
     }
     // connect the bot
     foreach (core::$config->nickserv_modules as $id => $module) {
         modules::load_module('ns_' . $module, $module . '.ns.php');
     }
     // load the nickserv modules
     timer::add(array('nickserv', 'check_expire', array()), 300, 0);
     // set a timer!
 }
Esempio n. 3
0
 public function __construct()
 {
     modules::init_module('mysql_driver', self::MOD_VERSION, self::MOD_AUTHOR, 'driver', 'static');
     // these are standard in module constructors
     if (!(self::$link = @mysql_connect(core::$config->database->server, core::$config->database->user, core::$config->database->pass))) {
         core::alog('database(): failed to connect to ' . core::$config->database->server . ' ' . core::$config->database->user . ':' . core::$config->database->pass, 'BASIC');
         core::save_logs();
         // force a log save
     }
     // can we connect to sql?
     if (!@mysql_select_db(core::$config->database->name, self::$link)) {
         core::alog('database(): failed to select database ' . core::$config->database->name, 'BASIC');
         core::save_logs();
         // force a log save
     }
     // can we select the database?
     core::alog('database(): connection to database sucessful', 'BASIC');
     // log the sucessful connection
     if (core::$config->database->optimize) {
         timer::add(array('database', 'optimize', array()), 86399, 0);
     }
     // add a timer to optimize the db every day.
 }
Esempio n. 4
0
        echo $L->say['tabel_sz'];
        ?>
</b></td>
<?php 
        echo (isset($_COOKIE["showAll"]) && $_COOKIE["showAll"] == 1 && $options['show_column_sfile']["md5"] ? '<td><b>' . 'MD5' . '</b></td>' : '') . (!isset($_COOKIE["showAll"]) || isset($_COOKIE["showAll"]) && $_COOKIE['showAll'] != 1 ? ($options['show_column_sfile']["downloadlink"] ? '<td><b>' . $L->say['tabel_dl'] . '</b></td>' : '') . ($options['show_column_sfile']["comments"] ? '<td><b>' . $L->say['tabel_cmt'] . '</b></td>' : '') : '') . ($options['show_column_sfile']["date"] ? '<td><b>' . $L->say['tabel_dt'] . '</b></td>' : '') . ($options['show_column_sfile']["age"] ? '<td><b class="sorttable_nosort">' . $L->say['tabel_age'] . '</b></td>' : '') . ($feat_ajax["ajax_delete"] == '1' ? '<td><b class="sorttable_nosort">' . $L->say['act_del'] . '</b></td>' : '');
        ?>
</tr>
</thead>
<tbody id='flcontainer' style='width:100%; height:<?php 
        echo count($list) < 13 ? "100%" : "280px";
        ?>
; white-space:nowrap; overflow:auto;'>

<?php 
        //Initiate Counter load time
        $tabletimer = new timer();
        $tabletimer->timer();
        $total_files = 0;
        $total_size = 0;
        $kumulatifsz = true;
        if (isset($list["files"]["totalsize"])) {
            $total_size = $list["files"]["totalsize"];
            $kumulatifsz = false;
        }
        foreach ($list as $key => $file) {
            if (isset($file["name"]) && @file_exists($file["name"])) {
                $total_files++;
                $rnd = rand(11, 99);
                $_fdkey = str_replace("=", "", rotN(base64_encode($file["date"] . ':' . '4puZ'), $rnd)) . "-" . $rnd;
                if ($kumulatifsz) {
                    $total_size += getfilesize($file["name"]);
Esempio n. 5
0
 public static function flood_check(&$ircdata)
 {
     if (trim($ircdata[0]) == '') {
         return true;
     }
     // the data is empty, omgwtf..
     if (ircd::on_msg(&$ircdata) && $ircdata[2][0] == '#' && $ircdata[3][1] != self::$config->chanserv->fantasy_prefix) {
         return true;
     }
     // this is just here to instantly ignore any normal channel messages
     // otherwise we get lagged up on flood attempts
     if (ircd::on_notice(&$ircdata)) {
         return true;
     }
     // and ignore notices, since we shouldnt respond to any
     // notices what so ever, just saves wasting cpu cycles when we get a notice
     if (ircd::on_msg(&$ircdata) && $ircdata[2][0] != '#') {
         if (self::$config->settings->flood_msgs == 0 || self::$config->settings->flood_time == 0) {
             return false;
         }
         // check if it's disabled.
         $nick = self::get_nick(&$ircdata, 0);
         $time_limit = time() - self::$config->settings->flood_time;
         self::$nicks[$nick]['commands'][] = time();
         $from = self::get_nick(&$ircdata, 2);
         if (self::$nicks[$nick]['ircop']) {
             return false;
         }
         // ignore ircops
         $inc = 0;
         foreach (self::$nicks[$nick]['commands'] as $index => $timestamp) {
             if ($timestamp > $time_limit) {
                 $inc = 1;
             }
         }
         if ($inc == 1) {
             self::$nicks[$nick]['floodcmds']++;
         }
         // we've ++'d the floodcmds, if this goes higher than self::flood_trigger
         // they're flooding, floodcmds is cleared every 100 seconds.
         if (self::$nicks[$nick]['floodcmds'] > self::$config->settings->flood_msgs) {
             if (services::check_mask_ignore($nick) === true) {
                 return false;
             }
             if (self::$nicks[$nick]['offences'] == 0 || self::$nicks[$nick]['offences'] == 1) {
                 self::$nicks[$nick]['offences']++;
                 database::insert('ignored_users', array('who' => '*!*@' . self::$nicks[$nick]['host'], 'time' => core::$network_time));
                 timer::add(array('core', 'remove_ignore', array('*!*@' . self::$nicks[$nick]['host'])), 120, 1);
                 // add them to the ignore list.
                 // also, add a timer to unset it in 2 minutes.
                 $message = self::$nicks[$nick]['offences'] == 1 ? 'This is your first offence' : 'This is your last warning';
                 // compose a message.
                 services::communicate($from, $nick, operserv::$help->OS_COMMAND_LIMIT_1);
                 services::communicate($from, $nick, operserv::$help->OS_COMMAND_LIMIT_2, array('message' => $message));
                 self::alog(self::$config->operserv->nick . ': Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick) . ' being ignored for 2 minutes');
                 self::alog('flood_check(): Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick), 'BASIC');
                 return true;
             } elseif (self::$nicks[$nick]['offences'] >= 2) {
                 self::alog(self::$config->operserv->nick . ': Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick) . ' being glined for 10 minutes');
                 self::alog('flood_check(): Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick), 'BASIC');
                 ircd::gline(self::$config->operserv->nick, '*@' . self::$nicks[$nick]['oldhost'], 600, 'Flooding services, 10 minute ban.');
                 // third offence, wtf? add a 10 minute gline.
                 return true;
             }
         }
         // they're flooding
     }
 }
Esempio n. 6
0
 while (!$throttled && ($plugin = current($GLOBALS['plugins']))) {
     $throttled = $plugin->throttleSend($msgdata, $user);
     if ($throttled) {
         if (!isset($counters['send throttled by plugin ' . $plugin->name])) {
             $counters['send throttled by plugin ' . $plugin->name] = 0;
         }
         ++$counters['send throttled by plugin ' . $plugin->name];
         $failure_reason .= 'Sending throttled by plugin ' . $plugin->name;
     }
     next($GLOBALS['plugins']);
 }
 if (!$throttled) {
     if (VERBOSE) {
         processQueueOutput($GLOBALS['I18N']->get('Sending') . ' ' . $messageid . ' ' . $GLOBALS['I18N']->get('to') . ' ' . $useremail);
     }
     $emailSentTimer = new timer();
     ++$counters['batch_count'];
     $success = sendEmail($messageid, $useremail, $userhash, $htmlpref);
     // $rssitems Obsolete by rssmanager plugin
     if (!$success) {
         ++$counters['sendemail returned false total'];
         ++$counters['sendemail returned false'];
     } else {
         $counters['sendemail returned false'] = 0;
     }
     if ($counters['sendemail returned false'] > 10) {
         foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
             $plugin->processError(s('Warning: a lot of errors while sending campaign %d', $messageid));
         }
     }
     if (VERBOSE) {
Esempio n. 7
0
    exit;
}
// Be sure that the user is not already defined by PHP on hosts that still have the php.ini config "register_globals = On"
unset($user);
require_once 'lib/setup/third_party.php';
// Enable Versioning
include_once 'lib/setup/twversion.class.php';
$TWV = new TWVersion();
$num_queries = 0;
$elapsed_in_db = 0.0;
$server_load = '';
$area = 'tiki';
$crumbs = array();
require_once 'lib/setup/tikisetup.class.php';
require_once 'lib/setup/timer.class.php';
$tiki_timer = new timer();
$tiki_timer->start();
require_once 'tiki-setup_base.php';
// Attempt setting locales. This code is just a start, locales should be set per-user.
// Also, different operating systems use different locale strings. en_US.utf8 is valid on POSIX systems, maybe not on Windows, feel free to add alternative locale strings.
setlocale(LC_ALL, '');
// Attempt changing the locale to the system default.
// Since the system default may not be UTF-8 but we may be dealing with multilingual content, attempt ensuring the collations are intelligent by forcing a general UTF-8 collation.
// This will have no effect if the locale string is not valid or if the designated locale is not generated.
foreach (array('en_US.utf8') as $UnicodeLocale) {
    if (setlocale(LC_COLLATE, $UnicodeLocale)) {
        break;
    }
}
if ($prefs['feature_tikitests'] == 'y') {
    require_once 'tiki_tests/tikitestslib.php';
Esempio n. 8
0
 * Author: Vati Child
 * E-mail: vatia0@gmail.com
 * URL: www.it-solutions.ge
 *
 */
require_once 'config.php';
if ($antiddos) {
    require_once 'lib/antiddos.class.php';
    $ad = new antiDdos(false);
    $ad->dir = 'tmp/';
    $ad->ddos = 2;
    $ad->start();
}
if ($timer_generate) {
    require_once 'lib/timer.class.php';
    $timer = new timer();
    $timer->start_timer();
}
require_once 'sys/functions.php';
require_once 'sys/functions.cms.php';
if (count($_GET) > 0 or count($_POST) > 0) {
    require_once 'sys/get.control.php';
}
require_once 'lib/access.class.php';
require_once 'lib/mail.class.php';
require_once 'lib/dbsql.class.php';
require_once 'lib/class.get.image.php';
require_once 'lib/markhtml.php';
require_once 'lib/osrLogs.php';
require_once 'lib/Mobile_Detect.php';
require_once 'vendor/autoload.php';
Esempio n. 9
0
 /**
  * Constructor
  */
 function __construct($name, $timeoutms = 5000)
 {
     if (!function_exists('shm_has_var')) {
         throw new BaseException("No mutex support on this platform");
     }
     $this->_lockname = $name;
     // Block until lock can be acquired
     if (Mutex::$instance == 0) {
         Console::debug("Creating mutex manager");
         Mutex::$resource = shm_attach(Mutex::SHM_KEY);
         if (!shm_has_var(Mutex::$resource, Mutex::SHM_LOCKS)) {
             shm_put_var(Mutex::$resource, Mutex::SHM_LOCKS, array());
         }
     }
     $this->enterCriticalSection();
     Console::debug("Waiting for lock %s", $this->_lockname);
     $t = new timer(true);
     while (true) {
         $ls = shm_get_var(Mutex::$resource, Mutex::SHM_LOCKS);
         if (!isset($ls[$name])) {
             break;
         }
         usleep(100000);
         if ($t->getElapsed() > $timeoutms / 1000) {
             $this->exitCriticalSection();
             throw new MutexException("Timed out waiting for lock");
         }
     }
     Console::debug("Acquiring lock %s", $this->_lockname);
     $ls = shm_get_var(Mutex::$resource, Mutex::SHM_LOCKS);
     $ls[$name] = true;
     shm_put_var(Mutex::$resource, Mutex::SHM_LOCKS, $ls);
     Mutex::$instance++;
     $this->_lockstate = true;
     $this->exitCriticalSection();
 }
Esempio n. 10
0
 public static function _registered_nick($nick, $user)
 {
     database::update('users', array('identified' => 0), array('display', '=', $nick));
     // set them to identified 0, this might fix that long term bug.
     ircd::on_user_logout($nick);
     // they shouldn't really have registered mode
     if (is_array(nickserv::$help->NS_REGISTERED_NICK)) {
         foreach (nickserv::$help->NS_REGISTERED_NICK as $line) {
             services::communicate(core::$config->nickserv->nick, $nick, $line);
         }
     } else {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_REGISTERED_NICK);
     }
     // this is just a crappy function, basically just parses the NS_REGISTERED thing
     // we check for arrays and single lines, even though the default is array
     // someone might have changed it.
     if (nickserv::check_flags($nick, array('S')) && isset(modules::$list['ns_flags'])) {
         timer::add(array('ns_identify', 'secured_callback', array($nick)), core::$config->nickserv->secure_time, 1);
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SECURED_NICK, array('seconds' => core::$config->nickserv->secure_time));
     }
     // if the nickname has secure enabled, we let them know that we're watching them :o
 }
Esempio n. 11
0
define('ROOT_DIR', realpath("./") . PATH_SPLITTER);
define('HOST_DIR', 'pluginz/');
define('STATIC_DIR', 'static/');
define('BINARY_DIR', 'binary/');
define('CLASS_DIR', 'classes/');
define('CONFIG_DIR', 'configs/');
define('LANG_DIR', CLASS_DIR . 'languages/');
//check config.php is exist or not, run setup file only if needed
require_once CONFIG_DIR . 'setup.php';
// Load function and class
require_once CLASS_DIR . "other.php";
// Set server timezone; TIME_NOW will set here
$tzone = getNowzone();
define("TIME_NOW", $tzone);
require_once CLASS_DIR . "timers.class.php";
$maintimer = new timer();
$maintimer->timer();
// $download_dir should always end with '/'
if (substr($options["download_dir"], -1) != '/') {
    $options["download_dir"] .= '/';
}
define('DOWNLOAD_DIR', substr($options["download_dir"], 0, 6) == "ftp://" ? '' : $options["download_dir"]);
define('TEMPLATE_DIR', 'tpl/' . $options['template_used'] . '/');
define('IMAGE_DIR', TEMPLATE_DIR . 'skin/' . $options["csstype"] . '/');
// Language initialisation
require_once CLASS_DIR . "lang.class.php";
$L = new RxLang();
$charSet = $L->settings["charset"];
// Check DOWNLOAD_DIR and FILES_LST
$czFlst = checkExistence();
// Strict check firbidden file in DOWNLOAD_DIR
Esempio n. 12
0
if ($irmod == 1) {
    echo "checked='checked'";
}
?>
 name="irmod"/>高级搜索
		&nbsp;&nbsp;<input type="checkbox" name="light" value="1">开启高亮<br>
		<input id="word" type="text" name="word" value="<?php 
echo $keyword;
?>
">
		<!--input class="a" type="submit" value="名单搜素" name="button1"-->
		<input class="a" type="submit" value="Search" name="button2" onclick="validation();">
	</form>
	<div id="content" class="content">
<?php 
$Timer1 = new timer();
//计时器
$Timer1->start();
$sphinx = new SphinxClient();
$sphinx->SetServer("localhost", 9312);
if ($irmod == '1') {
    $sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
}
//	else if($irmod == '2')
//		$sphinx->SetMatchMode(SPH_MATCH_PHRASE);
#$sphinx->SetSortMode(SPH_SORT_RELEVANCE);
//	$sphinx->SetSortMode(SPH_SORT_EXTENDED,"@weight DESC");###########
$sphinx->SetSortMode(SPH_SORT_EXPR, "hits*0.1+@weight*5");
$sphinx->setLimits(0, 1000, 1000);
$sphinx->SetIndexWeights(array("title" => 50, "keywords" => 10, "description" => 5));
$result = $sphinx->query($keyword, "mysql");
Esempio n. 13
0
//=====
// MAIN
//=====
if (trim($_POST['url']) != '') {
    $audl_sect = false;
    $buflinks = $_POST['url'];
    if (getParam('|_curl', $buflinks) == 'on') {
        $fgc = 0;
        // use cURL mode ON
    }
    //locate section
    if (getParam('|_section', $buflinks) == 'audl') {
        $audl_sect = true;
    }
    if (!$audl_sect) {
        $lnk_timer = new timer();
        $lnk_timer->timer();
    }
    $valLink = getParam('|_url', $buflinks);
    $buflinks = urlcleaner(utf8_strrev(base64_decode($valLink)));
    $alllinks = array();
    $alllinks = explode(" ", $buflinks);
    $alllinks = implode(";", $buflinks);
    $alllinks = explode(";", trim($buflinks));
    //$alllinks = implode("\n", $buflinks);
    $l = 1;
    $x = 1;
    //$alllinks = array_unique($alllinks); //removes duplicates
    if (!count($alllinks)) {
        die('<p><br /><span style="color:red; background-color:#fec; padding:3px; border:2px solid #FFaa00"><b>Not LINK</b></span><br />');
    }
Esempio n. 14
0
<?php 
$timer = new timer();
if (isset($_POST['action']) && !empty($_POST['action'])) {
    $action = $_POST['action'];
    switch ($action) {
        case 'currTime':
            $timer->currTime();
            break;
    }
}
//startPHP
//////////////////
class timer
{
    function currTime()
    {
        echo date("G : i : s");
    }
}
?>









Esempio n. 15
0
 public function main(&$ircdata, $startup = false)
 {
     if (ircd::on_mode(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, 0);
         $chan = core::get_chan(&$ircdata, 2);
         $mode_queue = core::get_data_after(&$ircdata, 4);
         if (strpos($nick, '.') !== false && core::$config->server->ircd != 'inspircd12') {
             $server = $nick;
         } elseif (strlen($nick) == 3 && core::$config->server->ircd == 'inspircd12') {
             $server = core::$servers[$nick]['sid'];
         } else {
             $server = '';
         }
         // we've found a.in nick, which means it's a server? And it's NOT insp1.2
         // OR we've noticed $nick is 3 chars long, which is a SID and it's insp1.2
         if ($server == core::$config->ulined_servers || is_array(core::$config->ulined_servers) && in_array($server, core::$config->ulined_servers)) {
             return false;
         }
         // ignore mode changing from ulined servers.
         if (!($channel = services::chan_exists($chan, array('channel')))) {
             return false;
         }
         // channel isnt registered
         $modelock = chanserv::get_flags($chan, 'm');
         // get the modelock
         if ($modelock != null) {
             $nmodelock = explode(' ', $modelock);
             foreach (str_split($nmodelock[0]) as $mode) {
                 if (strstr($mode_queue, $mode)) {
                     ircd::mode(core::$config->chanserv->nick, $chan, $modelock);
                 }
                 // reset the modes
             }
         }
         // modelock?
     }
     // we need to check for any modechanges here, for modelocking
     if (ircd::on_part(&$ircdata)) {
         $chan = core::get_chan(&$ircdata, 2);
         // get the channel
         if (chanserv::check_flags($chan, array('L'))) {
             timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1);
             // add a timer to update the limit, in 15 seconds
         }
         // is there auto-limit enabled?
     }
     // on part we check for
     if (ircd::on_quit(&$ircdata)) {
         foreach (core::$chans as $chan => $data) {
             if (chanserv::check_flags($chan, array('L'))) {
                 timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1);
                 // add a timer to update the limit, in 15 seconds
             }
             // is there auto-limit enabled?
         }
     }
     // on part we check for
     if (ircd::on_join(&$ircdata)) {
         $nick = core::get_nick(&$ircdata, 0);
         $chans = explode(',', $ircdata[2]);
         // find the nick & chan
         foreach ($chans as $chan) {
             if (!($channel = services::chan_exists($chan, array('channel')))) {
                 return false;
             }
             // channel isnt registered
             if (chanserv::check_flags($chan, array('I'))) {
                 if (chanserv::check_levels($nick, $chan, array('k', 'q', 'a', 'o', 'h', 'v', 'F'), true, false) === false) {
                     ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']);
                     ircd::kick(core::$config->chanserv->nick, $nick, $chan, '+k only channel.');
                     return false;
                 }
                 // they don't have +k, KICKEM
             }
             // is the channel +I, eg, +k users only?
             $welcome = chanserv::get_flags($chan, 'w');
             // get the welcome msg
             if ($welcome != null) {
                 ircd::notice(core::$config->chanserv->nick, $nick, '(' . $chan . ') ' . $welcome);
                 // we give them the welcome msg
             }
             // is there any welcome msg? notice it to them
             if (chanserv::check_flags($chan, array('L'))) {
                 timer::add(array('cs_flags', 'increase_limit', array($chan)), 10, 1);
                 // add a timer to update the limit, in 15 seconds
             }
             // is there auto-limit enabled?
         }
     }
     // on_join entry msg
     // this is just a basic JOIN trigger
     if (ircd::on_chan_create(&$ircdata)) {
         $chans = explode(',', $ircdata[2]);
         // chan
         foreach ($chans as $chan) {
             $nusers_str = implode(' ', $ircdata);
             $nusers_str = explode(':', $nusers_str);
             // right here we need to find out where the thing is
             $nusers = ircd::parse_users($chan, $nusers_str, 1);
             if (!($channel = services::chan_exists($chan, array('channel')))) {
                 return false;
             }
             // channel isnt registered
             if (chanserv::check_flags($chan, array('I'))) {
                 foreach ($nusers as $nick => $mode) {
                     if (chanserv::check_levels($nick, $chan, array('k', 'q', 'a', 'o', 'h', 'v', 'F'), true, false) === false) {
                         ircd::mode(core::$config->chanserv->nick, $chan, '+b *@' . core::$nicks[$nick]['host']);
                         ircd::kick(core::$config->chanserv->nick, $nick, $chan, '+k only channel.');
                     }
                     // they don't have +k, KICKEM
                 }
             }
             // is the channel +I, eg, +k users only?
             $welcome = chanserv::get_flags($chan, 'w');
             // get the welcome msg
             if ($welcome != null) {
                 foreach ($nusers as $nick => $mode) {
                     if ($nick == core::$config->chanserv->nick) {
                         continue;
                     }
                     // skip if it's chanserv
                     ircd::notice(core::$config->chanserv->nick, $nick, '(' . $chan . ') ' . $welcome);
                     // we give them the entrymsg
                 }
             }
             // check for a welcome msg, if so
             // message it to the joining users.
             if (chanserv::check_flags($chan, array('L'))) {
                 cs_flags::increase_limit($chan, 1);
                 // add a timer to update the limit, in 15 seconds
             }
             // is there auto-limit enabled?
         }
     }
     // on channel create, we send out the welcome message
     // if there is one.
 }
Esempio n. 16
0
 function list_raw_items($calIds, $user, $tstart, $tstop, $offset, $maxRecords, $sort_mode = 'start_asc', $find = '')
 {
     global $user, $tikilib;
     $dc = $tikilib->get_date_converter($user);
     if (sizeOf($calIds) == 0) {
         return array();
     }
     $tstart = $dc->getServerDateFromDisplayDate($tstart);
     /* user time -> server time */
     $tstop = $dc->getServerDateFromDisplayDate($tstop);
     $where = array();
     $bindvars = array();
     $time = new timer();
     $time->start();
     foreach ($calIds as $calendarId) {
         $where[] = "i.`calendarId`=?";
         $bindvars[] = (int) $calendarId;
     }
     $cond = "(" . implode(" or ", $where) . ") and ";
     $cond .= " ((i.`start` > ? and i.`end` < ?) or (i.`start` < ? and i.`end` > ?))";
     $bindvars[] = (int) $tstart;
     $bindvars[] = (int) $tstop;
     $bindvars[] = (int) $tstop;
     $bindvars[] = (int) $tstart;
     $cond .= " and ((c.`personal`='y' and i.`user`=?) or c.`personal` != 'y')";
     $bindvars[] = $user;
     $query = "select i.`calitemId` as `calitemId`, i.`name` as `name`, i.`description` as `description`, i.`start` as `start`, i.`end` as `end`, ";
     $query .= "i.`url` as `url`, i.`status` as `status`, i.`priority`  as `priority`, c.`name` as `calname`, i.`calendarId` as `calendarId`, ";
     $query .= "i.`locationID` as `locationID`, i.`categoryID` as `categoryID`, i.`nlId` as `nlId`  ";
     $query .= "from `tiki_calendar_items` as i left join `tiki_calendars` as c on i.`calendarId`=c.`calendarId` where ({$cond})  order by " . $this->convert_sortmode("{$sort_mode}");
     $result = $this->query($query, $bindvars, $maxRecords, $offset);
     $ret = array();
     while ($res = $result->fetchRow()) {
         $ret[] = $this->get_item($res["calitemId"]);
     }
     return $ret;
 }
Esempio n. 17
0
 public static function loop()
 {
     if (substr(time(), -1, 1) != substr(self::$last_time, -1, 1)) {
         self::$last_time = time();
         core::$network_time++;
         // new time, also network time gets ++'d
         core::$uptime++;
         // another second added.
         foreach (self::$timers as $tid => $data) {
             $class = $data['class'];
             $method = $data['method'];
             $params = $data['params'];
             // set up some variables.
             if (self::$timers[$tid]['count_timer'] == $data['timer']) {
                 if (is_callable(array($class, $method), true) && method_exists($class, $method)) {
                     if ($params == '') {
                         call_user_func_array(array($class, $method));
                     } else {
                         call_user_func_array(array($class, $method), $params);
                     }
                 }
                 // execute the callback, with parameters if defined.
                 self::$timers[$tid]['count_timer'] = 0;
                 self::$timers[$tid]['count_times']++;
                 // reset the counter back to 0, so it's executed again
                 // and ++ our count_times
                 if (self::$timers[$tid]['count_times'] == $data['times'] && $data['times'] != 0) {
                     unset(self::$timers[$tid]);
                     continue;
                 }
                 // check if it's the last time we're to execute it
                 // if so, cut the timer off.
                 // if times is 0, which means indefinatly, just keep running it.
             }
             self::$timers[$tid]['count_timer']++;
             // ++
         }
         // loop though the set timers.
         // ++'ng each one of them, then checking against their
         // execution time.
     }
 }
Esempio n. 18
0
require_once 'data/Tracker.php';
require_once 'include/utils/utils.php';
//require_once ('modules/Accounts/Accounts.php');
//require_once ('modules/Products/Products.php');
//require_once ('modules/SalesOrder/SalesOrder.php');
require_once 'user_privileges/seqprefix_config.php';
require_once 'modules/Synchronous/Synfunction.php';
require_once 'modules/Synchronous/time.php';
require_once 'modules/Synchronous/Syn_fun.php';
require_once 'modules/Synchronous/config.php';
global $adb;
global $current_user;
//$focus_pro = new Products();
//$focus_so = new SalesOrder();
//执行时间类
$timer = new timer();
$timer->start();
$timemessage = '';
$start_created = '';
$end_created = '';
$id = $_REQUEST['record'];
if (empty($id)) {
    die("No Selected One AppKey!");
}
$query = "select * from ec_appkey where id='" . $id . "'";
$row = $adb->getFirstLine($query);
$appKey = $row['appkey'];
$appSecret = $row['appsecret'];
$nick = $row['nick'];
$session = $row['topsession'];
if ($nick == '') {
Esempio n. 19
0
 function doMonitor($id)
 {
     $time = new timer();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->args['url']);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     //post
     if ($this->args['type'] == 'POST' && $this->args['data'] != NULL) {
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $this->args['data']);
     }
     //cookie
     if (isset($this->args['cookie']) && $this->args['cookie'] != NULL) {
         curl_setopt($ch, CURLOPT_COOKIE, $this->args['cookie']);
     }
     $time->start();
     $res_content = curl_exec($ch);
     $time->stop();
     //$curl_close($ch);
     global $db;
     $max_time = $time->spent();
     $sql = "select * from history_record where data_id = {$id} order by time desc limit 1";
     $result = mysql_query($sql, $db);
     if ($result) {
         $row = mysql_fetch_array($result);
         if ($row != NULL && $max_time < $row['max_time']) {
             $max_time = $row['max_time'];
         } else {
             $update_sql = "update history_record set max_time='" . $max_time . "' where id=" . $row['id'];
             mysql_query($update_sql, $db);
         }
     }
     echo "最大响应时间:" . $max_time . "秒<br>";
     echo "当前响应时间:" . $time->spent() . "秒";
     echo "<br>返回内容<br>";
     #echo "<xmp>".$res_content."</xmp>";
     echo "<br>" . $res_content . "<br>";
 }
Esempio n. 20
0
 public function introduce_callback($nick)
 {
     ircd::introduce_client($nick, 'enforcer', core::$config->server->name, $nick, true);
     self::$held_nicks[$nick] = core::$network_time;
     // introduce the client, set us as a held nick
     timer::add(array('ns_recover', 'remove_callback', array($nick)), self::$expiry_time, 1);
     // add a timer.
 }
Esempio n. 21
0
 * 		- php get_strings.php baseDir=lib/ excludeDirs=lib/core/Zend,lib/captcha includeFiles=captchalib.php,index.php fileName=language_r.php
 *
 * Note: baseDir and fileName parameters are available in command line mode only
 *
 *
 * If you want to know the translation progression for your language, just visit : http://i18n.tiki.org/status
 * which is made with http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/trunk/doc/devtools/get_translation_percentage.php?view=markup
 *
 */
if (php_sapi_name() != 'cli') {
    require_once 'tiki-setup.php';
    $access->check_permission('tiki_p_admin');
}
require_once 'lib/init/initlib.php';
require_once 'lib/setup/timer.class.php';
$timer = new timer();
$timer->start();
$options = array();
$request = new Tiki_Request();
if ($request->hasProperty('lang')) {
    $options['lang'] = $request->getProperty('lang');
}
if ($request->hasProperty('outputFiles')) {
    $options['outputFiles'] = $request->getProperty('outputFiles');
}
$excludeDirs = array('dump', 'img', 'lang', 'vendor', 'vendor_extra', 'lib/test', 'temp', 'temp/cache', 'templates_c');
$includeFiles = array('./lang/langmapping.php', './img/flags/flagnames.php');
// command-line only options
if (php_sapi_name() == 'cli') {
    if ($request->hasProperty('baseDir')) {
        $options['baseDir'] = $request->getProperty('baseDir');
Esempio n. 22
0
 public static function _join_channel(&$channel)
 {
     database::update('chans', array('last_timestamp' => core::$network_time), array('channel', '=', $channel->channel));
     // lets update the last used timestamp
     if (self::check_flags($channel->channel, array('G')) && $channel->suspended == 0 && isset(modules::$list['cs_fantasy']) && !isset(core::$chans[$channel->channel]['users'][core::$config->chanserv->nick])) {
         ircd::join_chan(core::$config->chanserv->nick, $channel->channel);
         // join the chan.
         if (ircd::$protect) {
             ircd::mode(core::$config->chanserv->nick, $channel->channel, '+ao ' . core::$config->chanserv->nick . ' ' . core::$config->chanserv->nick);
         } else {
             ircd::mode(core::$config->chanserv->nick, $channel->channel, '+o ' . core::$config->chanserv->nick);
         }
         // +o its self.
     }
     // check if guard is on
     $modelock = self::get_flags($channel->channel, 'm');
     // store some flag values in variables.
     if ($modelock != null && $channel->suspended == 0) {
         ircd::mode(core::$config->chanserv->nick, $channel->channel, $modelock);
         // Going to have to do some fuffing around here, basically if the channel
         // in question is mlocked +i, and somebody has joined it, while its empty
         // +i will be set after they have joined the channel, so here we're gonna
         // have to kick them out, same applies for +O and +k
         $mode_array = mode::sort_modes($modelock);
         if (strstr($mode_array['plus'], 'i') || strstr($mode_array['plus'], 'k')) {
             foreach (core::$chans[$channel->channel]['users'] as $nick => $modes) {
                 if (count(core::$chans[$channel->channel]['users']) == 2 && isset(core::$chans[$channel->channel]['users'][core::$config->chanserv->nick])) {
                     if (self::check_levels($nick, $channel->channel, array('k', 'v', 'h', 'o', 'a', 'q', 'F'), true, false) === false) {
                         if (strstr($mode_array['plus'], 'i') && $nick != core::$config->chanserv->nick) {
                             ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, 'Invite only channel');
                             timer::add(array('chanserv', 'part_chan_callback', array($channel->channel)), 1, 1);
                         }
                         if (strstr($mode_array['plus'], 'k') && $nick != core::$config->chanserv->nick) {
                             ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, 'Passworded channel');
                             timer::add(array('chanserv', 'part_chan_callback', array($channel->channel)), 1, 1);
                         }
                     }
                 }
                 // if the user isn't on the access list
                 // we kick them out ^_^
             }
         }
         // is mode i in the modelock?
         if (strstr($mode_array['plus'], 'O')) {
             foreach (core::$chans[$channel->channel]['users'] as $nick => $modes) {
                 if (!core::$nicks[$nick]['ircop']) {
                     ircd::kick(core::$config->chanserv->nick, $nick, $channel->channel, 'IRCop only channel');
                     timer::add(array('chanserv', 'part_chan_callback', array($channel->channel)), 1, 1);
                 }
                 // if the user isn't on the access list
                 // we kick them out ^_^
             }
         }
         // how about +O?
     }
     // any modelocks?
     if (self::check_flags($channel->channel, array('K')) && !self::check_flags($channel->channel, array('T')) && isset(modules::$list['cs_flags']) && isset(modules::$list['cs_topic'])) {
         if (trim($channel->topic) != trim(core::$chans[$channel->channel]['topic']) || $channel->topic != '') {
             ircd::topic(core::$config->chanserv->nick, $channel->channel, $channel->topic);
         }
         // set the previous topic
     }
     // set the topic to the last known topic
 }
Esempio n. 23
0
 /**
  * @param $mod_reference
  * @return bool|mixed|string
  */
 function execute_module($mod_reference)
 {
     global $user, $prefs, $tiki_p_admin;
     $smarty = TikiLib::lib('smarty');
     $tikilib = TikiLib::lib('tiki');
     try {
         $defaults = array('style' => '', 'nonums' => 'n');
         $module_params = isset($mod_reference['params']) ? (array) $mod_reference['params'] : array();
         $module_params = array_merge($defaults, $module_params);
         // not sure why style doesn't get set sometime but is used in the tpl
         $mod_reference = array_merge(array('moduleId' => null, 'ord' => 0, 'position' => 0, 'rows' => 10), $mod_reference);
         $module_rows = $mod_reference["rows"];
         $info = $this->get_module_info($mod_reference);
         $cachefile = $this->get_cache_file($mod_reference, $info);
         foreach ((array) $info['prefs'] as $preference) {
             if ($prefs[$preference] != 'y') {
                 $smarty->loadPlugin('smarty_block_remarksbox');
                 return smarty_block_remarksbox(array('type' => 'warning', 'title' => tr('Failed to execute "%0" module', $mod_reference['name'])), tr('Missing dependencies'), $smarty, $repeat);
             }
         }
         if (!$cachefile || $this->require_cache_build($mod_reference, $cachefile) || $this->is_admin_mode()) {
             if ($this->is_admin_mode()) {
                 require_once 'lib/setup/timer.class.php';
                 $timer = new timer('module');
                 $timer->start('module');
             }
             if ($info['type'] == "function") {
                 // Use the module name as default module title. This can be overriden later. A module can opt-out of this in favor of a dynamic default title set in the TPL using clear_assign in the main module function. It can also be overwritten in the main module function.
                 $smarty->assign('tpl_module_title', tra($info['name']));
             }
             $smarty->assign('nonums', $module_params['nonums']);
             if ($info['type'] == 'include') {
                 $phpfile = 'modules/mod-' . $mod_reference['name'] . '.php';
                 if (file_exists($phpfile)) {
                     include $phpfile;
                 }
             } elseif ($info['type'] == 'function') {
                 $function = 'module_' . $mod_reference['name'];
                 $phpfuncfile = 'modules/mod-func-' . $mod_reference['name'] . '.php';
                 if (file_exists($phpfuncfile)) {
                     include_once $phpfuncfile;
                 }
                 if (function_exists($function)) {
                     $function($mod_reference, $module_params);
                 }
             }
             $ck = getCookie('mod-' . $mod_reference['name'] . $mod_reference['position'] . $mod_reference['ord'], 'menu', 'o');
             $smarty->assign('module_display', $prefs['javascript_enabled'] == 'n' || $ck == 'o');
             $smarty->assign_by_ref('module_rows', $mod_reference['rows']);
             $smarty->assign_by_ref('module_params', $module_params);
             // module code can unassign this if it wants to hide params
             $smarty->assign('module_ord', $mod_reference['ord']);
             $smarty->assign('module_position', $mod_reference['position']);
             $smarty->assign('moduleId', $mod_reference['moduleId']);
             if (isset($module_params['title'])) {
                 $smarty->assign('tpl_module_title', tra($module_params['title']));
             }
             $smarty->assign('tpl_module_name', $mod_reference['name']);
             $tpl_module_style = empty($mod_reference['module_style']) ? '' : $mod_reference['module_style'];
             if ($tiki_p_admin == 'y' && $this->is_admin_mode() && (!$this->filter_active_module($mod_reference) || $prefs['modhideanonadmin'] == 'y' && (empty($mod_reference['groups']) || $mod_reference['groups'] == serialize(array('Anonymous'))))) {
                 $tpl_module_style .= 'opacity: 0.5;';
             }
             if (isset($module_params['overflow']) && $module_params['overflow'] === 'y') {
                 $tpl_module_style .= 'overflow:visible !important;';
             }
             $smarty->assign('tpl_module_style', $tpl_module_style);
             $template = 'modules/mod-' . $mod_reference['name'] . '.tpl';
             if (file_exists('templates/' . $template)) {
                 $data = $smarty->fetch($template);
             } else {
                 $data = $this->get_user_module_content($mod_reference['name'], $module_params);
             }
             $smarty->clear_assign('module_params');
             // ensure params not available outside current module
             $smarty->clear_assign('tpl_module_title');
             $smarty->clear_assign('tpl_module_name');
             $smarty->clear_assign('tpl_module_style');
             if ($this->is_admin_mode() && $timer) {
                 $elapsed = round($timer->stop('module'), 3);
                 $data = preg_replace('/<div /', '<div title="Module Execution Time ' . $elapsed . 's" ', $data, 1);
             }
             if (!empty($cachefile) && !$this->is_admin_mode()) {
                 file_put_contents($cachefile, $data);
             }
         } else {
             $data = file_get_contents($cachefile);
         }
         return $data;
     } catch (Exception $e) {
         $smarty->loadPlugin('smarty_block_remarksbox');
         if ($tiki_p_admin == 'y') {
             $message = $e->getMessage();
         } else {
             $message = tr('Contact the system administrator');
         }
         $repeat = false;
         return smarty_block_remarksbox(array('type' => 'warning', 'title' => tr('Failed to execute "%0" module', $mod_reference['name'])), html_entity_decode($message), $smarty, $repeat);
     }
 }
Esempio n. 24
0
<?php

class timer
{
    public static $timer = array();
    function set($key = '_global')
    {
        if (c::get('timer') === false) {
            return false;
        }
        $time = explode(' ', microtime());
        self::$timer[$key] = (double) $time[1] + (double) $time[0];
    }
    function get($key = '_global')
    {
        if (c::get('timer') === false) {
            return false;
        }
        $time = explode(' ', microtime());
        $time = (double) $time[1] + (double) $time[0];
        $timer = a::get(self::$timer, $key);
        return round($time - $timer, 5);
    }
}
timer::set();
Esempio n. 25
0
 public static function get_information(&$ircdata)
 {
     if (isset($ircdata[0]) && $ircdata[0] == 'CAPAB' && $ircdata[1] == 'MODULES') {
         if (strpos($ircdata[2], 'm_services_account.so') === false) {
             timer::add(array('core', 'check_services', array()), 1, 1);
         } else {
             core::$services_account = true;
         }
         // we have services_account
         if (strpos($ircdata[2], 'm_globops.so') !== false) {
             self::$globops = true;
         }
         // we have globops!
         if (strpos($ircdata[2], 'm_chghost.so') !== false) {
             self::$chghost = true;
         }
         // we have chghost
         if (strpos($ircdata[2], 'm_chgident.so') !== false) {
             self::$chgident = true;
         }
         // and chgident
     }
     // only trigger when our modules info is coming through
     if (isset($ircdata[0]) && $ircdata[0] == 'CAPAB' && $ircdata[1] == 'CAPABILITIES') {
         $data = explode('=', $ircdata[16]);
         $data = $data[1];
         $new_mdata = isset($mdata) ? explode('=', $mdata) : '';
         $rmodes = '';
         if (strpos($data, 'q') !== false) {
             self::$owner = true;
             self::$status_modes[] .= 'q';
             $rmodes .= 'q';
         }
         // check if +q is there
         if (strpos($data, 'a') !== false) {
             self::$protect = true;
             self::$status_modes[] .= 'a';
             $rmodes .= 'a';
         }
         // and +a
         $hdata = implode(' ', $ircdata);
         if (strpos($hdata, 'HALFOP=1') !== false) {
             self::$halfop = true;
             self::$status_modes[] .= 'h';
             $rmodes .= 'h';
         }
         // we check halfop differently
         self::$status_modes[] .= 'o';
         self::$status_modes[] .= 'v';
         $modes = str_replace(',', '', $data);
         self::$modes = $rmodes . $modes . 'ov';
     }
     // only trigger when the capab capabilities is coming through
     return true;
 }
                 }
                 #output("Running throttle delay: ".$running_throttle_delay);
             } elseif (VERBOSE) {
                 output(sprintf($GLOBALS['I18N']->get('%s is currently over throttle limit of %d per %d seconds') . ' (' . $domainthrottle[$domainname]['sent'] . ')', $domainname, DOMAIN_BATCH_SIZE, DOMAIN_BATCH_PERIOD));
             }
         }
     }
 }
 if ($cansend) {
     $success = 0;
     if (!TEST) {
         if (!$throttled) {
             if (VERBOSE) {
                 output($GLOBALS['I18N']->get('Sending') . ' ' . $messageid . ' ' . $GLOBALS['I18N']->get('to') . ' ' . $useremail);
             }
             $timer = new timer();
             $success = sendEmail($messageid, $useremail, $userhash, $htmlpref, $rssitems);
             if (VERBOSE) {
                 output($GLOBALS['I18N']->get('It took') . ' ' . $timer->elapsed(1) . ' ' . $GLOBALS['I18N']->get('seconds to send'));
             }
         } else {
             $throttlecount++;
         }
     } else {
         $success = sendEmailTest($messageid, $useremail);
     }
     if ($success) {
         if (USE_DOMAIN_THROTTLE) {
             list($mailbox, $domainname) = explode('@', $useremail);
             if ($domainthrottle[$domainname]['interval'] != $interval) {
                 $domainthrottle[$domainname]['interval'] = $interval;
Esempio n. 27
0
<?php

require_once 'include/CRMSmarty.php';
require_once 'data/Tracker.php';
require_once 'include/utils/utils.php';
require_once 'user_privileges/seqprefix_config.php';
require_once 'modules/Synchronous/Synfunction.php';
require_once 'modules/Synchronous/time.php';
require_once 'modules/Synchronous/Syn_fun.php';
require_once 'modules/Synchronous/config.php';
global $adb;
global $current_user;
//执行时间类
$timer = new timer();
$timer->start();
$timemessage = '';
$banyue0_begin = date("Y-m-d") . " 00:00:00";
$banyue0_end = date("Y-m-d") . " 23:59:59";
$banyue1_begin = date("Y-m-d", strtotime("-3 month")) . " 00:00:00";
$banyue1_end = date("Y-m-d", strtotime("+15 days", strtotime("-3 month"))) . " 23:59:59";
$banyue2_begin = date("Y-m-d", strtotime("+16 days", strtotime("-3 month"))) . " 00:00:00";
$banyue2_end = date("Y-m-d", strtotime("-1 days", strtotime("-2 month"))) . " 23:59:59";
$banyue3_begin = date("Y-m-d", strtotime("-2 month")) . " 00:00:00";
$banyue3_end = date("Y-m-d", strtotime("+15 days", strtotime("-2 month"))) . " 23:59:59";
$banyue4_begin = date("Y-m-d", strtotime("+16 days", strtotime("-2 month"))) . " 00:00:00";
$banyue4_end = date("Y-m-d", strtotime("-1 days", strtotime("-1 month"))) . " 23:59:59";
$banyue5_begin = date("Y-m-d", strtotime("-1 month")) . " 00:00:00";
$banyue5_end = date("Y-m-d", strtotime("+15 days", strtotime("-1 month"))) . " 23:59:59";
$banyue6_begin = date("Y-m-d", strtotime("+16 days", strtotime("-1 month"))) . " 00:00:00";
$banyue6_end = date("Y-m-d") . " 23:59:59";
$banyue7_begin = '';
Esempio n. 28
0
/*
 * Runner script that runs the web tests
 */
// set the path for where simpletest is
$path = '/usr/share/php' . PATH_SEPARATOR;
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
/* simpletest includes */
require_once '/usr/local/simpletest/unit_tester.php';
require_once '/usr/local/simpletest/web_tester.php';
require_once '/usr/local/simpletest/reporter.php';
require_once '../../../tests/TestEnvironment.php';
require_once '../../../tests/testClasses/timer.php';
global $URL;
global $USER;
global $PASSWORD;
$start = new timer();
$Svn = `svnversion`;
$date = date('Y-m-d');
$time = date('h:i:s-a');
print "\nStarting Site Tests on: " . $date . " at " . $time . "\n";
print "Using Svn Version:{$Svn}\n";
$test =& new TestSuite('Fossology Repo Site UI tests');
$test->addTestFile('AboutMenuTest.php');
$test->addTestFile('login.php');
$test->addTestFile('SearchMenuTest.php');
$test->addTestFile('OrgFoldersMenuTest-Create.php');
$test->addTestFile('OrgFoldersMenuTest-Delete.php');
$test->addTestFile('OrgFoldersMenuTest-Edit.php');
$test->addTestFile('OrgFoldersMenuTest-Move.php');
$test->addTestFile('OrgUploadsMenuTest-Delete.php');
$test->addTestFile('OrgUploadsMenuTest-Move.php');
Esempio n. 29
0
 public function testStart()
 {
     timer::start();
     // not much to test here
     $this->assertTrue(is_float(timer::stop()));
 }