本文整理汇总了PHP中GWF_HTML类的典型用法代码示例。如果您正苦于以下问题:PHP GWF_HTML类的具体用法?PHP GWF_HTML怎么用?PHP GWF_HTML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GWF_HTML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templatePay
private function templatePay(Module_PaymentBank $module, GWF_Order $order)
{
if (false === $order->saveVar('order_status', GWF_Order::ORDERED)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$tVars = array('lang' => $module->loadLangGWF(), 'order_c' => $order);
return $module->templatePHP('pay2.php', $tVars);
//
// $module2 = $order->getOrderModule();
// $module2->onLoadLanguage();
// $gdo = $order->getOrderData();
// $user = $order->getUser();
// $sitename = $module->getSiteName();
//
// $action = GWF_WEB_ROOT.'index.php?mo=PaymentBank&me=Pay2';
// $hidden = GWF_Form::hidden('gwf_token', $order->getOrderToken());
// $buttons = Module_Payment::tinyform('Bank Transfer', 'img/'.GWF_ICON_SET.'buy_bank.png', $action, $hidden);
//
// $lang = $module->loadLangGWF();
//
// $tVars = array(
// 'lang' => $lang,
// 'user' => $user,
// 'order_c' => $order,
// 'order' => Module_Payment::displayOrder3S($module2, $order, $gdo, $user, $sitename, $buttons),
// );
// return $module->templatePHP('pay.php', $tVars);
}
示例2: parseStats
public function parseStats($url)
{
if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
}
$stats = explode(':', $result);
if (count($stats) !== 7) {
// if ($result === '0') {
// return array(0, 0);
// }
return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
}
# username:rank:score:maxscore:challssolved:challcount:usercount
$uname = $stats[0];
$rank = intval($stats[1]);
$onsitescore = intval($stats[2]);
$maxscore = intval($stats[3]);
$challssolved = intval($stats[4]);
$challcount = intval($stats[5]);
$usercount = intval($stats[6]);
if ($maxscore === 0 || $challcount === 0 || $usercount === 0) {
return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
}
return array($onsitescore, $rank, $challssolved, $maxscore, $usercount, $challcount);
}
示例3: onMarkSolved
public function onMarkSolved(GWF_HelpdeskTicket $ticket, GWF_HelpdeskMsg $message)
{
if (false === $ticket->saveVars(array('hdt_status' => 'solved'))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_solve_solved');
}
示例4: write
public static function write($image, $fontfile, $x, $y, $text, $color, $maxwidth, $size = 11, $spacingx = 2, $spacingy = 2, $mx = 1, $my = 1, $angle = 0)
{
if (!Common::isFile($fontfile)) {
echo GWF_HTML::err('ERR_FILE_NOT_FOUND', array(htmlspecialchars($fontfile)));
return false;
}
$dim = GWF_GDText::getFontSize($fontfile, $size, $angle);
$fontwidth = $dim->w;
$fontheight = $dim->h;
if ($maxwidth != NULL) {
// die(''.$maxwidth);
$maxcharsperline = floor($maxwidth / $fontwidth);
$text = wordwrap($text, $maxcharsperline, "\n", 1);
// die($text);
}
// die(var_dump($color));
$lines = explode("\n", $text);
$x += $mx;
$y += $my;
foreach ($lines as $line) {
$y += $fontheight + $spacingy;
imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $line);
}
return true;
}
示例5: templateError
private function templateError()
{
$module = $this->module;
$module instanceof Module_GWF;
$codes = $module->lang('ERR_HTTP');
# Get the error page
$code = Common::getGetString('code', '0');
if (false === isset($codes[$code])) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
@header($_SERVER['SERVER_PROTOCOL'] . ' ' . $code . ' ' . $codes[$code]);
# Generate template
$tVars = array('code' => $code, 'file' => GWF_HTML::error(GWF_SITENAME, $module->getLang()->langA('ERR_HTTP', $code, array(htmlspecialchars($_SERVER['REQUEST_URI']))), false));
$template = $module->template($this->_tpl, $tVars);
# Is the request blacklisted?
foreach (preg_split('/[,;]/', $module->cfgBlacklist()) as $pattern) {
if (false !== strpos($_SERVER['REQUEST_URI'], $pattern)) {
# Do not log and email the request
return $template;
}
}
$message = self::getMessage($code);
# Mail it?
if (1 === preg_match("/(?:^|[,;]){$code}(?:\$|[,;])/", $module->cfgMail())) {
self::errorMail($code, $message);
}
# Log it?
if (1 === preg_match("/(?:^|[,;]){$code}(?:\$|[,;])/", $module->cfgLog())) {
GWF_Log::logHTTP($message);
}
return $template;
}
示例6: onVote
private function onVote(GWF_VoteMulti $poll, $user)
{
$opts = Common::getPostArray('opt', array());
$taken = array();
$max = $poll->getNumChoices();
foreach ($opts as $i => $stub) {
$i = (int) $i;
if ($i < 1 || $i > $max) {
continue;
}
if (!in_array($i, $taken, true)) {
$taken[] = $i;
}
}
$count = count($taken);
// if ($count === 0) {
// return $this->module->error('err_no_options');
// }
if (!$poll->isMultipleChoice() && $count !== 1) {
return $this->module->error('err_no_multi');
}
if (false === $poll->onVote($user, $taken)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_voted', array(htmlspecialchars(GWF_Session::getLastURL())));
}
示例7: parseStats
public function parseStats($url)
{
if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
}
$result = str_replace("", '', $result);
# BOM
$result = trim($result);
$stats = explode(":", $result);
if (count($stats) !== 7) {
return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
}
$i = 0;
$username = $stats[$i++];
$rank = intval($stats[$i++]);
$onsitescore = intval($stats[$i++]);
$onsitescore = Common::clamp($onsitescore, 0);
$maxscore = intval($stats[$i++]);
$challssolved = intval($stats[$i++]);
$challcount = intval($stats[$i++]);
$usercount = intval($stats[$i++]);
if ($maxscore === 0 || $challcount === 0 || $usercount === 0) {
return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
}
return array($onsitescore, $rank, $challssolved, $maxscore, $usercount, $challcount);
}
示例8: onAssign
public function onAssign(GWF_HelpdeskTicket $ticket, GWF_User $user)
{
if (false === $ticket->saveVars(array('hdt_worker' => $user->getID(), 'hdt_status' => 'working'))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_assigned', array($ticket->getID(), $user->displayUsername()));
}
示例9: welcome
private function welcome($first_time)
{
if (false === ($user = GWF_Session::getUser())) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
GWF_Hook::call(GWF_Hook::LOGIN_AFTER, $user, array(GWF_Session::getOrDefault('GWF_LOGIN_BACK', GWF_WEB_ROOT)));
$fails = GWF_Session::getOrDefault('GWF_LOGIN_FAILS', 0);
GWF_Session::remove('GWF_LOGIN_FAILS');
if ($fails > 0) {
$fails = $this->module->lang('err_failures', array($fails));
} else {
$fails = '';
}
$href_hist = $this->module->getMethodURL('History');
$username = $user->display('user_name');
if (false !== ($ll = GWF_LoginHistory::getLastLogin($user->getID()))) {
$last_login = $this->module->lang('msg_last_login', array($ll->displayDate(), $ll->displayIP(), $ll->displayHostname(), $href_hist));
$welcome = $this->module->lang('welcome_back', array($username, $ll->displayDate(), $ll->displayIP()));
} else {
$last_login = '';
$welcome = $this->module->lang('welcome', array($username));
}
$tVars = array('welcome' => $welcome, 'fails' => $fails, 'last_login' => $last_login, 'href_history' => $href_hist);
return $this->module->template('welcome.tpl', $tVars);
}
示例10: imageButton
private function imageButton()
{
$cs = $this->size;
$cx = $cy = round($this->size / 2);
if (false === ($image = imagecreatetruecolor($cs, $cs))) {
# FIXME: {gizmore} define in bootstrap? check if function exists?
return GWF_HTML::err('ERR_GENERAL');
}
imagealphablending($image, true);
$background = imagecolorallocatealpha($image, 0x0, 0x0, 0x0, 0x0);
imagecolortransparent($image, $background);
$color = $this->getColor($image);
$white = imagecolorallocate($image, 0xff, 0xff, 0xff);
imagefilledellipse($image, $cx, $cy, $cs, $cs, $white);
imagefilledellipse($image, $cx, $cy, $cs - 1, $cs - 1, $color);
header('Content-Type: image/' . $this->ext);
switch ($this->ext) {
case 'png':
imagepng($image);
break;
case 'gif':
imagegif($image);
break;
case 'jpg':
imagejpeg($image);
break;
default:
return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
}
imagedestroy($image);
die(0);
}
示例11: execute
public function execute()
{
$this->module->includeClass('WC_Warbox');
$this->module->includeClass('WC_Warflag');
$this->module->includeClass('WC_WarToken');
$this->module->includeClass('sites/warbox/WCSite_WARBOX');
# CHECK TOKEN
if (isset($_GET['CHECK'])) {
$_GET['ajax'] = 1;
if (false === ($username = Common::getGetString('username', false))) {
return GWF_HTML::err('ERR_PARAMETER', array('username'));
}
if (false === ($token = Common::getGetString('token', false))) {
return GWF_HTML::err('ERR_PARAMETER', array('token'));
}
return WC_WarToken::isValidWarToken($username, $token) ? '1' : '0';
}
# GET CONFIG
if (isset($_GET['CONFIG'])) {
return $this->genConfig();
}
if (!GWF_Session::isLoggedIn()) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
# GEN AND SHOW
return $this->templateToken();
}
示例12: onPost
private function onPost($nickname, $target, $message)
{
# Validate the crap!
if (false !== ($error = GWF_ChatValidator::validate_yournick($this->module, $nickname))) {
return $error;
}
if (false !== ($error = GWF_ChatValidator::validate_target($this->module, $target))) {
$error;
}
if (false !== ($error = GWF_ChatValidator::validate_message($this->module, $message))) {
return $error;
}
# Post it!
$oldnick = $this->module->getNickname();
$sender = Common::getPost('yournick', $oldnick);
$target = trim($target);
$message = str_replace("\n", '<br/>', Common::getPost('message'));
if ($oldnick === false) {
$sender = $this->module->getGuestPrefixed($sender);
$this->module->setGuestNick($sender);
} else {
$sender = $oldnick;
}
if (false === GWF_ChatMsg::newMessage($sender, $target, $message)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '1';
}
示例13: err
protected static function err($key, $args = null)
{
$message = GWF_HTML::langISO('en', $key, $args);
GWF_Log::logError($message);
self::reply($message);
return false;
}
示例14: execute
public function execute()
{
if (false === ($group = GWF_Group::getByID(Common::getGet('gid')))) {
return $this->module->error('err_unk_group');
}
if ($group->isOptionEnabled(GWF_Group::VISIBLE_MEMBERS)) {
} else {
switch ($group->getVisibleMode()) {
case GWF_Group::VISIBLE:
break;
case GWF_Group::COMUNITY:
if (!GWF_Session::isLoggedIn()) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
break;
case GWF_Group::HIDDEN:
case GWF_Group::SCRIPT:
if (!GWF_User::isInGroupS($group->getVar('group_name'))) {
return $this->module->error('err_not_invited');
}
break;
default:
return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
}
}
return $this->templateUsers($group);
}
示例15: onAdd
private function onAdd(Dog_User $user, $url)
{
if (false !== ($link = Dog_Link::getByURL($url))) {
return true;
}
if (false === ($description = $this->getDescription($url))) {
Dog_Log::error('Mod_Link::onAdd() failed. URL: ' . $url);
return false;
}
$type = $description[0];
$description = $description[1];
switch ($type) {
case 'image':
if (false === ($link = Dog_Link::insertImage($user->getID(), $url, $description))) {
GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
return;
}
break;
case 'html':
if (false === ($link = Dog_Link::insertLink($user->getID(), $url, $description))) {
GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
return;
}
break;
default:
echo "UNKNOWN TYPE: {$type}\n";
return;
}
Dog_Log::user($user, sprintf('Inserted Link %s (ID:%d)', $url, $link->getID()));
}