本文整理汇总了PHP中dprint函数的典型用法代码示例。如果您正苦于以下问题:PHP dprint函数的具体用法?PHP dprint怎么用?PHP dprint使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dprint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: arraySelect
function arraySelect(&$arr, $select_name, $select_attribs, $selected, $translate = false, $filteruser = false)
{
global $AppUI;
if (!is_array($arr)) {
dprint(__FILE__, __LINE__, 0, 'arraySelect called with no array');
return '';
}
reset($arr);
$s = "\n" . '<select name="' . $select_name . '" ' . $select_attribs . '>';
$did_selected = 0;
foreach ($arr as $k => $v) {
if ($filteruser) {
if ($AppUI->acl()->checkLogin($k) == false && $k > 0) {
continue;
}
}
if ($translate) {
$v = @$AppUI->_($v);
// This is supplied to allow some Hungarian characters to
// be translated correctly. There are probably others.
// As such a more general approach probably based upon an
// array lookup for replacements would be a better approach. AJD.
$v = str_replace('ű', '�', $v);
$v = str_replace('ő', '�', $v);
}
$s .= "\n\t" . '<option value="' . $AppUI->___($k) . '"' . ($k == $selected && !$did_selected ? ' selected="selected"' : '') . ">" . ($translate ? $v : $AppUI->___($v)) . '</option>';
if ($k == $selected) {
$did_selected = 1;
}
}
$s .= "\n</select>\n";
return $s;
}
示例2: checkAttempt
function checkAttempt()
{
global $gbl, $sgbl, $login, $ghtml;
$match = 0;
try {
$att = $gbl->getFromList("loginattempt", $ip);
$att->count++;
$att->dbaction = "update";
} catch (Exception $e) {
$att = new Loginattempt(null, null, $ip);
$att->count = 1;
$att->dbaction = "add";
$gbl->addToList("loginattempt", $att);
}
if ($att->count >= 5) {
$att->delete();
$bl = new BlockedIp(null, null, $ip);
$bl->dbaction = "add";
try {
$gbl->addToList("blockedip", $bl);
} catch (Exception $e) {
dprint("Blocked up already exists. This is weird\n");
}
$ghtml->print_redirect("/login/?frm_emessage=blocked");
} else {
$ghtml->print_redirect("/login/?frm_emessage=login_error");
}
$gbl->was();
}
示例3: updateSwitchProgram
function updateSwitchProgram($param)
{
global $gbl, $sgbl, $login, $ghtml;
if_demo_throw_exception('switchprog');
$this->web_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'web');
$this->dns_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'dns');
$this->spam_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'spam');
$a['web'] = $this->web_driver;
$a['dns'] = $this->dns_driver;
$a['spam'] = $this->spam_driver;
foreach ($param as $k => $v) {
if ($this->{$k} === $v) {
dprint("No change for {$k}: {$v}\n");
} else {
$class = strtilfirst($k, "_");
$drstring = "{$class}_driver";
rl_exec_get(null, $this->nname, array($class, 'switchDriver'), array($class, $this->{$drstring}, $v));
changeDriver($this->nname, $class, $v);
$fixc = $class;
if ($class === 'spam') {
$fixc = "mmail";
}
lxshell_return("__path_php_path", "../bin/fix/fix{$fixc}.php", "--server={$this->nname}");
$a[$class] = $v;
rl_exec_get(null, $this->nname, 'slave_save_db', array('driver', $a));
}
}
}
示例4: readsmtpLog
static function readsmtpLog()
{
$date = time() - 24 * 3600 * 2;
$logfile = "/var/log/kloxo/smtp.log";
$fp = fopen($logfile, "r");
$fsize = lxfile_size($logfile);
$pos = lxlabsFindRightPosition($fp, $fsize, $date, time());
if ($pos === -1) {
return;
}
$s = fgets($fp);
dprint("The correct pos here: {$s}\n");
while (!feof($fp)) {
$s = fgets($fp);
$s = trim($s);
if (!csa($s, "client allowed to relay")) {
continue;
}
$v = strfrom($s, "rcpt: from <");
$v = strtilfirst($v, ">");
$s = explode(":", $v);
$id = $s[1];
if (!isset($total[$id])) {
$total[$id] = 1;
} else {
$total[$id]++;
}
}
return $total;
}
示例5: w2PsessionRead
function w2PsessionRead($id)
{
$q = new DBQuery();
$q->addTable('sessions');
$q->addQuery('session_data');
$q->addQuery('UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_created) as session_lifespan');
$q->addQuery('UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_updated) as session_idle');
$q->addWhere('session_id = \'' . $id . '\'');
$qid =& $q->exec();
if (!$qid || $qid->EOF) {
dprint(__FILE__, __LINE__, 11, 'Failed to retrieve session ' . $id);
$data = '';
} else {
$max = w2PsessionConvertTime('max_lifetime');
$idle = w2PsessionConvertTime('idle_time');
// dprint(__file__, __line__, 11, "Found session $id, max=$max/" . $qid->fields['session_lifespan'] . ", idle=$idle/" . $qid->fields['session_idle']);
// If the idle time or the max lifetime is exceeded, trash the
// session.
if ($max < $qid->fields['session_lifespan'] || $idle < $qid->fields['session_idle']) {
dprint(__FILE__, __LINE__, 11, "session {$id} expired");
w2PsessionDestroy($id);
$data = '';
} else {
$data = $qid->fields['session_data'];
}
}
$q->clear();
return $data;
}
示例6: read
public function read($id)
{
$q = new w2p_Database_Query();
$q->addTable('sessions');
$q->addQuery('session_data');
$q->addQuery('UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_created) as session_lifespan');
$q->addQuery('UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_updated) as session_idle');
$q->addWhere('session_id = \'' . $id . '\'');
$qid =& $q->exec();
if (!$qid || $qid->EOF) {
dprint(__FILE__, __LINE__, 11, 'Failed to retrieve session ' . $id);
$data = '';
} else {
$max = $this->convertTime('max_lifetime');
$idle = $this->convertTime('idle_time');
// If the idle time or the max lifetime is exceeded, trash the
// session.
if ($max < $qid->fields['session_lifespan'] || $idle < $qid->fields['session_idle']) {
dprint(__FILE__, __LINE__, 11, "session {$id} expired");
$this->destroy($id);
$data = '';
} else {
$data = $qid->fields['session_data'];
}
}
$q->clear();
return $data;
}
示例7: getEachfileqouta
static function getEachfileqouta($file, $domainname, $oldtime, $newtime)
{
$fp = @fopen($file, "r");
print "Opening File name is :{$file}\n";
error_reporting(0);
if (!$fp) {
return 0;
}
$fsize = filesize($file);
print "Here U are in Mail log file Size is:{$fsize}\n";
if ($fsize <= 5) {
return 0;
}
$total = 0;
$ret = FindRightPosition($fp, $fsize, $oldtime, $newtime, array("ftpusertraffic__pureftp", "getTimeFromString"));
if ($ret < 0) {
dprint("Could not find position\n");
return null;
}
$total = 0;
while (!feof($fp)) {
$string = fgets($fp);
if (csa($string, $domainname)) {
$total += self::LogConvertString($string);
}
if (self::getTimeFromString($string) > $newtime) {
break;
}
}
$total = $total / (1024 * 1024);
$total = round($total, 1);
fclose($fp);
dprint("Returning Total From OUT SIDE This File: for {$domainname} {$total} \n");
return $total;
}
示例8: dbactionUpdate
function dbactionUpdate($subaction)
{
$obj = new COM("winmgmts:{impersonationLevel=impersonate}//./root/cimv2");
$serv = $obj->execQuery("select * from Win32_Service where Name = '{$this->main->servicename}'");
switch ($subaction) {
case "toggle_boot_state":
if ($this->main->isOn('boot_state')) {
foreach ($serv as $s) {
$s->changeStartMode('Automatic');
}
} else {
foreach ($serv as $s) {
$s->changeStartMode('Disabled');
}
}
break;
case "toggle_state":
if ($this->main->isOn('state')) {
foreach ($serv as $s) {
$s->startService();
}
} else {
foreach ($serv as $s) {
dprint("{$s->Properties_("name")}\n");
$s->stopService();
}
}
break;
}
}
示例9: load_gd
static function load_gd()
{
if (!extension_loaded("gd")) {
dprint("Warning No gd <br> ");
dl("gd." . PHP_SHLIB_SUFFIX);
}
}
示例10: arraySelect
function arraySelect(&$arr, $select_name, $select_attribs, $selected, $translate = false)
{
global $AppUI;
if (!is_array($arr)) {
dprint(__FILE__, __LINE__, 0, "arraySelect called with no array");
return '';
}
reset($arr);
$s = "\n<select name=\"{$select_name}\" {$select_attribs}>";
$did_selected = 0;
foreach ($arr as $k => $v) {
if ($translate) {
$v = @$AppUI->_($v);
// This is supplied to allow some Hungarian characters to
// be translated correctly. There are probably others.
// As such a more general approach probably based upon an
// array lookup for replacements would be a better approach. AJD.
$v = str_replace('ű', 'û', $v);
$v = str_replace('ő', 'õ', $v);
}
$s .= "\n\t<option value=\"" . $k . "\"" . ($k == $selected && !$did_selected ? " selected=\"selected\"" : '') . ">" . $v . "</option>";
if ($k == $selected) {
$did_selected = 1;
}
}
$s .= "\n</select>\n";
return $s;
}
示例11: GetLocationsByDayByType
function GetLocationsByDayByType($date, $type)
{
dprint("GetLocationsByDayByType() Start.");
try {
$db = new DatabaseTool();
if ($date == "") {
$date = date("Y-m-d");
}
// create the query
$query = 'SELECT DISTINCT itemid,event,fulladdress,lat,lng FROM incidents JOIN eventtypes ON incidents.event = eventtypes.eventtype WHERE pubdate = ? AND lat <> "" AND lng <> "" AND eventtypes.eventtypeid = ? GROUP BY itemid ORDER BY pubtime DESC;';
$mysqli = $db->Connect();
$stmt = $mysqli->prepare($query);
$stmt->bind_param("ss", $date, $type);
// bind the varibale
$results = $db->Execute($stmt);
// create an array to put our results into
$incidents = array();
// decode the rows
foreach ($results as $result) {
$incident = (object) array('itemid' => $result['itemid'], 'incident' => $result['event'], 'fulladdress' => $result['fulladdress'], 'lat' => $result['lat'], 'lng' => $result['lng']);
$incidents[] = $incident;
}
// close our DB connection
$db->Close($mysqli, $stmt);
} catch (Exception $e) {
dprint("Caught exception: " . $e->getMessage());
}
dprint("GetLocationsByDayByType() Done.");
return $incidents;
}
示例12: get_deny_list
function get_deny_list($total)
{
$lxgpath = "__path_home_root/lxguard";
$rmt = lfile_get_unserialize("{$lxgpath}/config.info");
$wht = lfile_get_unserialize("{$lxgpath}/whitelist.info");
$wht = $wht->data;
$disablehit = null;
if ($rmt) {
$disablehit = $rmt->data['disablehit'];
}
if (!($disablehit > 0)) {
$disablehit = 20;
}
$deny = null;
foreach ($total as $k => $v) {
if (array_search_bool($k, $wht)) {
dprint("{$k} found in whitelist... not blocking..\n");
continue;
}
if ($v > $disablehit) {
$deny[$k] = $v;
}
}
return $deny;
}
示例13: resource_postsave
/**
* postsave functions are only called after a succesful save. They are
* used to perform database operations after the event.
*/
function resource_postsave()
{
global $other_resources;
global $obj;
$task_id = $obj->task_id;
dprint(__FILE__, __LINE__, 5, "saving resources, {$other_resources}");
if (isset($other_resources)) {
$value = array();
$reslist = explode(';', $other_resources);
foreach ($reslist as $res) {
if ($res) {
list($resource, $perc) = explode('=', $res);
$value[] = array($task_id, $resource, $perc);
}
}
// first delete any elements already there, then replace with this
// list.
$q = new DBQuery();
$q->setDelete('resource_tasks');
$q->addWhere('task_id = ' . $obj->task_id);
$q->exec();
$q->clear();
if (count($value)) {
foreach ($value as $v) {
$q->addTable('resource_tasks');
$q->addInsert('task_id,resource_id,percent_allocated', $v, true);
$q->exec();
$q->clear();
}
}
}
}
示例14: getTrafficInfo
static function getTrafficInfo($name)
{
$oldtime = time() - 40 * 3600;
$newtime = time();
$file = "__path_httpd_root/{$name}/stats/{$name}-custom_log";
$file = expand_real_root($file);
$fp = @lfopen($file, "r");
$total = 0;
dprint("\n{$file}: " . @date('Y-m-d-H-i-s', $oldtime) . " {$newtime} " . @date('Y-m-d-H-i-s', $newtime) . "\n");
if (!$fp) {
dprint("File Does Not Exist:returning Zero");
return 0;
}
$fsize = lfilesize($file);
if ($fsize <= 10) {
dprint("File Size is Less Than Zero and Returning Zero:\n");
return "";
}
dprint("File Size is :{$fsize}\n\n\n");
if ($fsize > 20 * 1024) {
fseek($fp, -19 * 1024, SEEK_END);
$line = fgets($fp);
}
$i = 3;
$total = 0;
$count = 0;
while (!feof($fp)) {
$count++;
$line = fgets($fp);
$res[] = webtraffic::apacheLogFullString($line);
}
$c = 0;
foreach ($res as $k => $r) {
$c++;
if ($count - 50 > $c) {
unset($res[$k]);
}
}
$ncount = 0;
foreach ($res as $r) {
if (!$r['Time']) {
continue;
}
$file = strfrom($r['Request'], " ");
$file = strtil($file, "HTTP");
$time = trim($r['Time'], "[]");
$time = strtil($time, " ");
$o['realtime'] = $r['realtime'];
$o['time'] = $time;
$o['nname'] = $ncount;
$o['file'] = $file;
$o['referer'] = $r['Referer'];
$o['remote_host'] = $r['Remote-Host'];
$out[] = $o;
$ncount++;
}
return $out;
}
示例15: dbactionUpdate
function dbactionUpdate($subaction)
{
dprint("here\n");
switch ($subaction) {
case "add_xen_location_a":
$this->check_xen_dirlocation();
break;
}
}