本文整理汇总了PHP中warn函数的典型用法代码示例。如果您正苦于以下问题:PHP warn函数的具体用法?PHP warn怎么用?PHP warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ReadData
/**
* @param string $targetString The string from the config file
* @param the $map A reference to the map object (redundant)
* @param the $mapItem A reference to the object this target is attached to
* @return array invalue, outvalue, unix timestamp that the data was valid
*/
function ReadData($targetString, &$map, &$mapItem)
{
$data[IN] = null;
$data[OUT] = null;
$data_time = 0;
$matches = 0;
if (preg_match("/^time:(.*)\$/", $targetString, $matches)) {
$timezone = $matches[1];
$offset = "now";
if (preg_match("/^([^:]+):(.*)\$/", $timezone, $matches2)) {
$timezone = $matches2[1];
$offset = $matches2[2];
// test that the offset is valid
$timestamp = strtotime($offset);
if ($timestamp === false || $timestamp === -1) {
warn("Time ReadData: Offset String ({$offset}) is bogus - ignoring [WMTIME03]\n");
$offset = "now";
}
}
$timezone_l = strtolower($timezone);
if (array_key_exists($timezone_l, $this->timezones)) {
$tz = $this->timezones[$timezone_l];
wm_debug("Time ReadData: Timezone exists: {$tz}\n");
$dateTime = new DateTime($offset, new DateTimeZone($tz));
$mapItem->add_note("time_time12", $dateTime->format("h:i"));
$mapItem->add_note("time_time12ap", $dateTime->format("h:i A"));
$mapItem->add_note("time_time24", $dateTime->format("H:i"));
$mapItem->add_note("time_timet", $dateTime->format("U"));
$mapItem->add_note("time_timezone", $tz);
$data[IN] = $dateTime->format("H");
$data[OUT] = $dateTime->format("i");
$data_time = time();
$matches++;
}
if ($matches == 0) {
wm_warn("Time ReadData: Couldn't recognize {$timezone} as a valid timezone name [WMTIME02]\n");
}
} else {
// some error code to go in here
wm_warn("Time ReadData: Couldn't recognize {$targetString} \n");
}
wm_debug("Time ReadData: Returning (" . WMUtility::valueOrNull($data[IN]) . "," . WMUtility::valueOrNull($data[OUT]) . ",{$data_time})\n");
return array($data[IN], $data[OUT], $data_time);
}
开发者ID:hdecreis,项目名称:network-weathermap,代码行数:50,代码来源:WeatherMapDataSource_time.php
示例2: ReadData
function ReadData($targetstring, &$map, &$item)
{
$data[IN] = NULL;
$data[OUT] = NULL;
$data_time = 0;
$itemname = $item->name;
$matches = 0;
if (preg_match("/^time:(.*)\$/", $targetstring, $matches)) {
$timezone = $matches[1];
$timezone_l = strtolower($timezone);
$timezone_identifiers = DateTimeZone::listIdentifiers();
foreach ($timezone_identifiers as $tz) {
if (strtolower($tz) == $timezone_l) {
debug("Time ReadData: Timezone exists: {$tz}\n");
$dateTime = new DateTime("now", new DateTimeZone($tz));
$item->add_note("time_time12", $dateTime->format("h:i"));
$item->add_note("time_time12ap", $dateTime->format("h:i A"));
$item->add_note("time_time24", $dateTime->format("H:i"));
$item->add_note("time_timezone", $tz);
$data[IN] = $dateTime->format("H");
$data_time = time();
$data[OUT] = $dateTime->format("i");
$matches++;
}
}
if ($matches == 0) {
warn("Time ReadData: Couldn't recognize {$timezone} as a valid timezone name [WMTIME02]\n");
}
} else {
// some error code to go in here
warn("Time ReadData: Couldn't recognize {$targetstring} \n");
}
debug("Time ReadData: Returning (" . ($data[IN] === NULL ? 'NULL' : $data[IN]) . "," . ($data[OUT] === NULL ? 'NULL' : $data[OUT]) . ",{$data_time})\n");
return array($data[IN], $data[OUT], $data_time);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:35,代码来源:WeatherMapDataSource_time.php
示例3: preTestPost
function preTestPost(ISblamPost $p)
{
$text = preg_replace('/\\[:..:\\]\\s+/', ' ', $p->getRawContent());
if (strlen($text) < 40) {
$text .= $p->getAuthorURI();
}
if (strlen($text) < 40) {
$text .= $p->getAuthorEmail();
}
if (strlen($text) < 40) {
$text .= $p->getAuthorName();
}
if (strlen($text) < 20) {
$text .= $p->getAuthorIP();
}
if (strlen($text) < 10) {
$this->checksum = NULL;
return;
}
$text = preg_replace(array('/[.,\\s!:;()-]+/', '/([a-f0-9]{1,3}[a-f]{1,6}[0-9]{1,6})+/', '/\\d\\d{1,8}/'), array(' ', 'H', 'D'), strtolower($text));
d($text, 'normalized text');
$this->length = strlen($text);
$this->checksum = md5($text);
if (!$this->db->exec(sprintf("/*maxtime5*/INSERT INTO dupes (checksum,count,expires,ip) VALUES(UNHEX('%s'),1,%d,%u)\n\t\t\tON DUPLICATE KEY UPDATE count = 1 + IF(expires < %d,CEIL(count/10),count), expires = GREATEST(expires + 3600*6, %d)", $this->checksum, time() + 3600 * 18, ip2long($p->getAuthorIP()), time(), time() + 3600 * 18))) {
warn($this->db->errorInfo());
}
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:27,代码来源:dedupe.php
示例4: convertToArray
private function convertToArray($dat)
{
if (!function_exists('mb_convert_encoding') || !($conv = mb_convert_encoding($dat, "UTF-8", "UTF-8,ISO-8859-2,Windows-1252"))) {
$conv = @iconv("UTF-8", "UTF-8", $dat);
if ($conv === false || strlen($conv) < strlen($dat) * 0.9) {
$conv = @iconv("ISO-8859-2", "UTF-8//IGNORE", $dat);
if ($conv === false || strlen($conv) < strlen($dat)) {
warn($conv, "A total failure, not even ISO!");
$conv = utf8_encode($dat);
} else {
d($conv, "got iso converted");
}
} else {
d($conv, "got UTF-8 converted");
}
}
$dat = strtr($conv, array('ą' => 'ą', 'ę' => 'ę', 'ó' => 'ó', 'ż' => 'ż', 'ś' => 'ś', 'ć' => 'ć', 'ź' => 'ź', 'ń' => 'ń', 'Ą' => 'Ą', 'Ę' => 'Ę', 'Ó' => 'Ó', 'Ż' => 'Ż', 'Ś' => 'Ś', 'Ć' => 'Ć', 'Ź' => 'Ź', 'Ń' => 'Ń'));
$dat = explode("", $dat);
$cnt = count($dat);
$fields = array();
for ($i = 1; $i < $cnt; $i += 2) {
$fields[$dat[$i - 1]] = $dat[$i];
}
return $fields;
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:25,代码来源:server.php
示例5: ReadData
function ReadData($targetstring, &$map, &$item)
{
$data[IN] = NULL;
$data[OUT] = NULL;
$data_time = 0;
if (preg_match("/^!(.*)\$/", $targetstring, $matches)) {
$command = $matches[1];
debug("ExternalScript ReadData: Running {$command}\n");
// run the command here
if (($pipe = popen($command, "r")) === false) {
warn("ExternalScript ReadData: Failed to run external script. [WMEXT01]\n");
} else {
$i = 0;
while ($i < 5 && !feof($pipe)) {
$lines[$i++] = fgets($pipe, 1024);
}
pclose($pipe);
if ($i == 5) {
$data[IN] = floatval($lines[0]);
$data[OUT] = floatval($lines[1]);
$item->add_hint("external_line1", $lines[0]);
$item->add_hint("external_line2", $lines[1]);
$item->add_hint("external_line3", $lines[2]);
$item->add_hint("external_line4", $lines[3]);
$data_time = time();
} else {
warn("ExternalScript ReadData: Not enough lines read from external script ({$i} read, 4 expected) [WMEXT02]\n");
}
}
}
debug("ExternalScript ReadData: Returning (" . ($data[IN] === NULL ? 'NULL' : $data[IN]) . "," . ($data[OUT] === NULL ? 'NULL' : $data[OUT]) . ",{$data_time})\n");
return array($data[IN], $data[OUT], $data_time);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:33,代码来源:WeatherMapDataSource_external.php
示例6: ReadData
/**
* @param string $targetString The string from the config file
* @param the $map A reference to the map object (redundant)
* @param the $mapItem A reference to the object this target is attached to
* @return array invalue, outvalue, unix timestamp that the data was valid
*/
function ReadData($targetString, &$map, &$mapItem)
{
$data[IN] = null;
$data[OUT] = null;
$data_time = 0;
if (preg_match("/^time:(.*)\$/", $targetString, $matches)) {
$timezone = $matches[1];
$offset = "now";
if (preg_match("/^([^:]+):(.*)\$/", $timezone, $matches2)) {
$timezone = $matches2[1];
$offset = $matches2[2];
// test that the offset is valid
$timestamp = strtotime($offset);
if ($timestamp === false || $timestamp === -1) {
warn("Time ReadData: Offset String ({$offset}) is bogus - ignoring [WMTIME03]\n");
$offset = "now";
}
}
list($required_time, $timezone_name) = $this->getTimeForTimeZone($timezone, $offset);
$data = $this->populateTimeData($mapItem, $required_time, $timezone_name);
$data_time = time();
} else {
// some error code to go in here
wm_warn("Time ReadData: Couldn't recognize {$targetString} \n");
}
wm_debug("Time ReadData: Returning (" . WMUtility::valueOrNull($data[IN]) . "," . WMUtility::valueOrNull($data[OUT]) . ",{$data_time})\n");
return array($data[IN], $data[OUT], $data_time);
}
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:34,代码来源:WeatherMapDataSource_time.php
示例7: ReadData
function ReadData($targetstring, &$map, &$item)
{
$data[IN] = NULL;
$data[OUT] = NULL;
$data_time = 0;
if (preg_match("/^dbplug:([^:]+)\$/", $targetstring, $matches)) {
$database_user = $map->get_hint('dbplug_dbuser');
$database_pass = $map->get_hint('dbplug_dbpass');
$database_name = $map->get_hint('dbplug_dbname');
$database_host = $map->get_hint('dbplug_dbhost');
$key = mysql_real_escape_string($matches[1]);
$SQL = "select in,out from table where host={$key} LIMIT 1";
if (mysql_connect($database_host, $database_user, $database_pass)) {
if (mysql_select_db($database_name)) {
$result = mysql_query($SQL);
if (!$result) {
warn("dbsample ReadData: Invalid query: " . mysql_error() . "\n");
} else {
$row = mysql_fetch_assoc($result);
$data[IN] = $row['in'];
$data[OUT] = $row['out'];
}
} else {
warn("dbsample ReadData: failed to select database: " . mysql_error() . "\n");
}
} else {
warn("dbsample ReadData: failed to connect to database server: " . mysql_error() . "\n");
}
$data_time = now();
}
debug("RRD ReadData: Returning (" . ($data[IN] === NULL ? 'NULL' : $data[IN]) . "," . ($data[OUT] === NULL ? 'NULL' : $data[IN]) . ",{$data_time})\n");
return array($data[IN], $data[OUT], $data_time);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:33,代码来源:WeatherMapDataSource_dbsample.php
示例8: collectArtDirectories
private function collectArtDirectories($path)
{
global $config;
$this->directories[] = $path . '/';
if (count($this->directories) % 3 == 0) {
echo '.';
}
$dir = @opendir($path);
if (!$dir) {
if ($config['art.error.when.missing']) {
error("Unable to locate art directory: {$path}");
}
echo "\n";
warn("Unable to locate art directory: {$path}");
return;
}
$dirs = array();
while (false !== ($file = readdir($dir))) {
if ($file == '.' || $file == '..') {
continue;
}
if (!is_dir($path . '/' . $file)) {
continue;
}
$dirs[] = $path . '/' . $file;
}
closedir($dir);
foreach ($dirs as $path) {
$this->collectArtDirectories($path);
}
}
开发者ID:kyuumeitai,项目名称:cardgen,代码行数:31,代码来源:ArtDB.php
示例9: authenticate
function authenticate($params)
{
assert(isset($params['user']) && isset($params['pass']));
$contactId = $params['user'];
$token = $params['pass'];
$contact = DatabaseHelper::getInstance()->getContactByIdentifier($contactId, $identifier);
if ($contact) {
info(__METHOD__ . ': Contact ' . $contact['Id'] . ' succesfully authenticated');
return array('Id' => $contact['Id'], 'Role' => $contact['Role']);
} else {
warn(__METHOD__ . ': Authentication failed for contact "' . $contactId . '" and token "' . $identifier . '"');
return false;
}
}
开发者ID:atrakroo,项目名称:carpool-1,代码行数:14,代码来源:AuthenticationHelperToken.php
示例10: readConfig
protected function readConfig(array $ini)
{
if (!empty($ini['tlds'])) {
SblamURI::init($ini['tlds'], $this->services->getDB());
} else {
warn('tlds not given!');
}
if (!empty($ini['dns'])) {
AsyncDNS::init(preg_split('![\\s,]+!', $ini['dns'], NULL, PREG_SPLIT_NO_EMPTY));
} else {
warn('dns not given!');
}
foreach ($ini as $name => $settings) {
if (!is_array($settings) || $name == 'db') {
continue;
}
if (!empty($settings['disabled']) || isset($settings['enabled']) && !$settings['enabled']) {
/*d($name,'disabled');*/
continue;
}
try {
include_once "tests/" . strtolower($name) . ".php";
$classname = "SblamTest" . ucfirst($name);
if (!class_exists($classname)) {
warn($name, "Problem loading test plugin");
}
$info = call_user_func(array($classname, 'info'));
if (!empty($info['remote']) && isset($ini['remote']) && !$ini['remote']) {
d($info, 'Its a remote service, remote disabled, skipping');
continue;
}
if (!empty($info['unsupported'])) {
d($info, 'unsupported in this configuration');
continue;
}
$test = new $classname($settings, $this->services);
if (!$test instanceof ISblamTest) {
warn($test, 'Not a test');
continue;
}
//d($classname,"instantiated");
$this->addTest($test, isset($settings['phase']) ? $settings['phase'] : 10);
} catch (Exception $e) {
warn($e, "Failed to initialize plugin {$name}");
}
}
return true;
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:48,代码来源:sblam.php
示例11: initInternal
public function initInternal()
{
$this->_regions = DatabaseHelper::getInstance()->getRegions();
if (isset($_GET['regionSelector']) && array_key_exists($_GET['regionSelector'], $this->_regions)) {
$this->_currentRegion = $this->_regions[$_GET['regionSelector']];
// Set the cookie for 14 days
if (!setcookie('region', $_GET['regionSelector'], time() + TWO_WEEKS, getConfiguration('public.path') . '/')) {
warn(__METHOD__ . ': Could not set cookie for user! Output already exists.');
}
unset($_GET['region']);
} else {
if (isset($_COOKIE['region']) && array_key_exists($_COOKIE['region'], $this->_regions)) {
$this->_currentRegion = $this->_regions[$_COOKIE['region']];
// Update cookie expiry time
setcookie('region', $_COOKIE['region'], time() + TWO_WEEKS, getConfiguration('public.path') . '/');
} else {
$this->_currentRegion = $this->_regions[self::getDefaultRegion()];
}
}
info(__METHOD__ . ' region selected: ' . $this->_currentRegion['Id'] . ' (' . $this->_currentRegion['Name'] . ')');
}
开发者ID:atrakroo,项目名称:carpool-1,代码行数:21,代码来源:RegionManager.php
示例12: severity
private function severity($ip)
{
$rev = SblamURI::gethostbyaddr($ip);
if (is_array($rev)) {
warn($rev, "gethostbyaddr returned array!?");
$rev = reset($rev);
}
if (!$rev) {
return 3;
}
if (preg_match('/(^|[.-])(vp[sn]|srv)[.\\d-]|(^|\\.)(colo|dedi?)[-.]|dedic|resell|serv(er|[.\\d-])|^ns\\d*\\.|^mail\\d*\\.|multicast|invalid|unknown/', $rev)) {
return 2;
}
if (preg_match('/internetdsl\\.|static/', $rev) || preg_match('/^[^\\d]+$/', $rev) || strlen($rev) < 10) {
return 1.5;
}
if (preg_match('/^nat[\\d.-]|cache|proxy|gprs[^a-z]|dynamic|\\.dhcp\\.|\\.sta\\.|ppp[\\d.-]|\\.dyn\\.|(^|[.-])adsl[.0-9-]/', $rev)) {
return 0.8;
}
return 1;
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:21,代码来源:plonker.php
示例13: authenticate
function authenticate($params)
{
assert('isset($params["email"]) && isset($params["password"])');
// TODO: A primitive brute-force defense?
// We must call buildEmail as we may have explicitely added the
// domain suffix during registration
$email = Utils::buildEmail($params['email']);
$pass = $params['password'];
// Created a hashed hexadecimal string, use the salt if possible
$hashed = Utils::hashPassword($pass);
$contact = DatabaseHelper::getInstance()->getContactByEmail($email);
if ($contact !== false) {
if ($contact['Identifier'] === $hashed) {
info(__METHOD__ . ': Contact ' . $contact['Id'] . ' succesfully authenticated');
return array('Id' => $contact['Id'], 'Role' => $contact['Role']);
} else {
warn(__METHOD__ . ': Contact ' . $contact['Id'] . ' failed to authorize: wrong password');
}
}
return false;
}
开发者ID:atrakroo,项目名称:carpool-1,代码行数:21,代码来源:AuthenticationHelperPassword.php
示例14: addDecklist
public function addDecklist (Decklist $decklist) {
global $config;
if (!$this->decklistOnlyOutput) $this->addCards($decklist->cards);
if ($this->decklistOnlyOutput || $config['render.decklist']) {
$count = count($decklist->cards);
if ($count <= 75) {
// 75 or less and we assume this is a standard 60 card deck with upto a 15
// card sideboard.
$decklistRenderer = new DecklistRenderer();
$decklistRenderer->cards = $decklist->cards;
$decklistRenderer->writer = $this;
$decklistRenderer->outputDir = $config['output.directory'];
$decklistRenderer->outputName = 'Decklist - ' . $decklist->name;
$this->renderers[] = $decklistRenderer;
} else {
// Enough cards for a multi page list.
$cardsPerDeckpage = isset($config['output.decklist.cardsperpage']) ? $config['output.decklist.cardsperpage'] : 50;
echo "\n";
warn('Large/Highlander deck detected, going to ' . $cardsPerDeckpage . ' card per page lists.');
$cardsRendered = 0 ;
while ($cardsRendered < $count) {
// slice out each card block.
$cardPage = array_slice($decklist->cards, $cardsRendered, $cardsPerDeckpage);
$decklistRenderer = new DecklistRenderer();
$decklistRenderer->cards = $cardPage;
$decklistRenderer->wholeDeck = $decklist->cards;
$decklistRenderer->writer = $this;
$decklistRenderer->outputDir = $config['output.directory'];
$decklistRenderer->outputName = 'Decklist - ' . $decklist->name . ' page ' . (floor($cardsRendered / $cardsPerDeckpage) + 1);
$this->renderers[] = $decklistRenderer;
$cardsRendered += $cardsPerDeckpage;
}
}
}
}
开发者ID:GarikRC,项目名称:arcane,代码行数:39,代码来源:ImageWriter.php
示例15: index
function index()
{
$pdo = $this->services->getDB();
$sblam = $this->getSblam();
// inits urls
$table = 'plonker';
// FIXME: read config!
$accumulate = array();
$max = 10;
while ($max--) {
foreach ($pdo->query("SELECT ip,added from {$table} where flags=0 order by rand() limit 2000") as $r) {
try {
$ip = long2ip($r['ip']);
$rev = preg_replace('!(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)!', '\\4.\\3.\\2.\\1.dul.dnsbl.sorbs.net', $ip);
$r['rev1'] = $rev;
SblamURI::gethostbynameasync($rev);
$rev = preg_replace('!(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)!', '\\4.\\3.\\2.\\1.korea.services.net', $ip);
$r['rev2'] = $rev;
SblamURI::gethostbynameasync($rev);
$accumulate[] = $r;
usleep(50000);
if (count($accumulate) >= 20) {
foreach ($accumulate as $r) {
$res = SblamURI::gethostbyname($r['rev1']) ? 'dul' : 'nodul';
$res .= ',' . (SblamURI::gethostbyname($r['rev2']) ? 'wild' : 'nowild');
$q = "update {$table} set flags = '{$res}', added = added where ip = {$r['ip']}";
d($q);
if (!$pdo->query($q)) {
warn($pdo->errorInfo());
}
}
$accumulate = array();
}
} catch (Exception $e) {
}
}
}
return array('redirect' => '/admin/plonker');
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:39,代码来源:classifyips.php
示例16: initInternal
private function initInternal()
{
$this->locales = DatabaseHelper::getInstance()->getLocales();
if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $this->locales)) {
$this->locale = $this->locales[$_GET['lang']];
// Set the cookie for 14 days
if (!setcookie('lang', $_GET['lang'], time() + TWO_WEEKS, getConfiguration('public.path') . '/')) {
warn(__METHOD__ . ': Could not set cookie for user! Output already exists.');
}
unset($_GET['lang']);
} else {
if (isset($_COOKIE['lang']) && array_key_exists($_COOKIE['lang'], $this->locales)) {
$this->locale = $this->locales[$_COOKIE['lang']];
// Update cookie expiry time
setcookie('lang', $_COOKIE['lang'], time() + TWO_WEEKS, getConfiguration('public.path') . '/');
} else {
$this->locale = $this->locales[self::getDefaultLocale()];
}
}
info(__METHOD__ . ' locale selected: ' . $this->locale['Name'] . ' (' . $this->locale['Locale'] . ')');
setlocale(LC_ALL, $this->locale['Locale']);
putenv('LC_ALL=' . $this->locale['Locale']);
}
开发者ID:atrakroo,项目名称:carpool-1,代码行数:23,代码来源:LocaleManager.php
示例17: testPost
function testPost(ISblamPost $p)
{
// whitelist only direct connection (because other can be forged) and only when there aren't any objectionable hosts there
$out = array();
$firstIP = true;
$whitelisted = false;
foreach ($p->getAuthorIPs() as $ip) {
$rev = SblamURI::gethostbyaddr($ip);
if (!$rev) {
continue;
}
if (is_array($rev)) {
warn($rev, 'gethostbyaddr returned array');
$rev = reset($rev);
}
// WTF?
if (preg_match('!(?:\\.|^)(?:' . $this->isps . ')$!', $rev)) {
$out[] = array(0.5, self::CERTAINITY_LOW, "Sent from blacklisted ISP ({$rev})");
} else {
if ($firstIP && preg_match('!\\.(?:' . $this->whitelist . ')$!', $rev)) {
$whitelisted = true;
} else {
if (preg_match('!\\.(?:' . $this->blacklist . ')$!', $rev)) {
$out[] = array(0.35, self::CERTAINITY_LOW, "Sent from blacklisted TLD ({$rev})");
}
}
}
$firstIP = false;
}
if (!count($out) && $whitelisted) {
return array(-0.25, self::CERTAINITY_LOW, "Sent from whitelisted TLD ({$rev})");
}
if (count($out)) {
return $out;
}
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:36,代码来源:networks.php
示例18: user_with_color
}
if ($rowuser["reputation"] >= 1) {
$rep = "<a href=index.php?page=reputationpage > Reputace <img src='images/rep/reputation_pos.gif' border='0' alt='" . $setrep["good_level"] . "' title='" . $setrep["good_level"] . "' /></a>";
}
if ($rowuser["reputation"] <= -1) {
$rep = "<a href=index.php?page=reputationpage > Reputace <img src='images/rep/reputation_neg.gif'border='0' alt='" . $setrep["bad_level"] . "' title='" . $setrep["bad_level"] . "' /></a>";
}
if ($rowuser["reputation"] >= 101) {
$rep = "<a href=index.php?page=reputationpage > Reputace <img src='images/rep/reputation_highpos.gif' border='0' alt='" . $setrep["best_level"] . "' title='" . $setrep["best_level"] . "' /></a>";
}
if ($rowuser["reputation"] <= -101) {
$rep = "<a href=index.php?page=reputationpage > Reputace <img src='images/rep/reputation_highneg.gif'border='0' alt='" . $setrep["worse_level"] . "' title='" . $setrep["worse_level"] . "' /></a>";
}
}
// DT end reputation system
print "<td class=\"blocklist\" align=\"center\" style=\"text-align:left;\">" . $language["WELCOME_BACK"] . "<a href='index.php?page=userdetails&id=" . $CURUSER["uid"] . "'> " . user_with_color($CURUSER["username"], $CURUSER["prefixcolor"], $CURUSER["suffixcolor"]) . get_user_icons($CURUSER) . warn($CURUSER) . $rra . $upr . $udo . $udob . $ubir . $umal . $ufem . $uban . $uwar . $upar . $ubot . $utrmu . $utrmo . $uvimu . $uvimo . $ufrie . $ujunk . $ustaf . $usys . " </a> \n";
if ($CURUSER["announce"] == "yes") {
print "<td class=\"blocklist\" align=\"left\" style=\"text-align:left;\"><a href=\"index.php?page=announcement&uid=" . $CURUSER["uid"] . "\"><img src=\"images/ann.png\"></a></td>\n";
}
print "<td class=\"blocklist\" align=\"left\" style=\"text-align:left;\">" . $rep . " \n";
print "<td class=\"blocklist\" align=\"left\" style=\"text-align:left;\">" . $col . "<font color='{$freec}'>{$till}" . ucfirst($post) . "</font> {$pic}</td>\n";
print "<td class=\"blocklist\" align=\"left\" style=\"text-align:center;\"><a class=\"mainmenu\" href=\"logout.php\"><img src=\"images/logout.png \" /></a></td>\n";
?>
</tr>
</table>
<?php
if (!$CURUSER || $CURUSER["view_torrents"] == "no") {
// do nothing
} else {
if ($XBTT_USE) {
$res = get_result("select count(*) as tot, sum(f.seeds)+sum(ifnull(x.seeders,0)) as seeds, sum(f.leechers)+sum(ifnull(x.leechers,0)) as leechs FROM {$TABLE_PREFIX}files f LEFT JOIN xbt_files x ON f.bin_hash=x.info_hash", true, $btit_settings['cache_duration']);
开发者ID:Karpec,项目名称:gizd,代码行数:31,代码来源:maintrackertoolbar_block.php
示例19: addURIs
function addURIs(array $links, $isspam, $howmuch = 1)
{
$parsed = array();
foreach ($links as $l) {
try {
$this->addURI($parsed, new SblamURI($l));
} catch (Exception $e) {
warn($e);
}
}
if (count($parsed)) {
return $this->db->add(array_keys($parsed), $isspam, $howmuch);
}
return false;
}
开发者ID:bitemyapp,项目名称:Sblam,代码行数:15,代码来源:spamvertises.php
示例20: render
//.........这里部分代码省略.........
}
}
switch ($format) {
case "Vintage (T1)":
$format = "t1";
break;
case "Legacy (T1.5)":
$format = "t15";
break;
case "Extended (T1.x)":
$format = "t1x";
break;
case "Standard (T2)":
$format = "t2";
break;
}
$legalityImage = @imagecreatefrompng("images/decklist/{$imageName} {$format}.png");
if (!$legalityImage) {
error("Legality image not found: {$imageName} {$format}.png");
}
imagecopy($canvas, $legalityImage, $x, $y, 0, 0, 25, 25);
imagedestroy($legalityImage);
$x += 35;
}
// Compute card qty in main deck and sideboard.
$maindeckCards = array();
$n = count($this->cards);
if ($n >= 75) {
$n -= 15;
}
for ($i = 0; $i < $n; $i++) {
$card = $this->cards[$i];
$title = strtolower($card->title);
if (!@$maindeckCards[$title]) {
$maindeckCards[$title] = 0;
}
$maindeckCards[$title]++;
}
$sideboardCards = array();
for ($n = count($this->cards); $i < $n; $i++) {
$card = $this->cards[$i];
$title = strtolower($card->title);
if (!@$sideboardCards[$title]) {
$sideboardCards[$title] = 0;
}
$sideboardCards[$title]++;
}
echo '.';
// Draw main deck cards.
$baselineStart = $settings['cards.top'] + $this->font('cards')->getHeight();
$left = $settings['cards.column.1.left'];
$right = $settings['cards.column.1.right'];
$baseline = $baselineStart;
foreach ($maindeckCards as $title => $qty) {
if ($baseline > $settings['cards.bottom']) {
if ($left == $settings['cards.column.2.left']) {
break;
}
$left = $settings['cards.column.2.left'];
$right = $settings['cards.column.2.right'];
$baseline = $baselineStart;
}
$baseline = $this->drawTitle($canvas, $left, $baseline, $right, $qty, $title, $this->font('cards'));
}
// Sideboard goes on the second column, or after a blank line if already on the second column.
if ($left == $settings['cards.column.1.left']) {
$left = $settings['cards.column.2.left'];
$right = $settings['cards.column.2.right'];
$baseline = $baselineStart;
} else {
$baseline += $this->font('cards')->getLineHeight();
}
// Draw sideboard cards.
foreach ($sideboardCards as $title => $qty) {
if ($baseline > $settings['cards.bottom']) {
if ($left == $settings['cards.column.2.left']) {
break;
}
$left = $settings['cards.column.2.left'];
$right = $settings['cards.column.2.right'];
$baseline = $baselineStart;
}
$color = in_array($title, $illegalSideboardCards) ? 'color:130,130,130' : null;
$baseline = $this->drawTitle($canvas, $left, $baseline, $right, $qty, $title, $this->font('cards', $color));
}
if ($baseline > $settings['cards.bottom'] && $left == $settings['cards.column.2.left']) {
echo "\n";
warn('Not all cards fit on the decklist card.');
}
// Draw card count.
$count = count($this->cards);
if ($count >= 75) {
$count = $count - 15 . "/15";
}
$count = "({$count})";
$width = $this->getTextWidth($count, $this->font('count'));
$this->drawText($canvas, $settings['count.right'] - $width, $settings['count.y'], null, $count, $this->font('count'));
echo "\n";
return $canvas;
}
开发者ID:kyuumeitai,项目名称:cardgen,代码行数:101,代码来源:DecklistRenderer.php
注:本文中的warn函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论