本文整理汇总了PHP中GWF_HTML::err方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_HTML::err方法的具体用法?PHP GWF_HTML::err怎么用?PHP GWF_HTML::err使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_HTML
的用法示例。
在下文中一共展示了GWF_HTML::err方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: isFlooding
public function isFlooding()
{
$uid = GWF_Session::getUserID();
$uname = GWF_Shoutbox::generateUsername();
$euname = GDO::escape($uname);
$table = GDO::table('GWF_Shoutbox');
$max = $uid === 0 ? $this->module->cfgMaxPerDayGuest() : $this->module->cfgMaxPerDayUser();
// $cut = GWF_Time::getDate(GWF_Time::LEN_SECOND, time()-$this->module->cfgTimeout());
// $cnt = $table->countRows("shout_uname='$euname' AND shout_date>'$cut'");
# Check captcha
if ($this->module->cfgCaptcha()) {
require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
if (!PhpCaptcha::Validate(Common::getPostString('captcha'), true)) {
return GWF_HTML::err('ERR_WRONG_CAPTCHA');
}
}
# Check date
$timeout = $this->module->cfgTimeout();
$last_date = $table->selectVar('MAX(shout_date)', "shout_uid={$uid} AND shout_uname='{$euname}'");
$last_time = $last_date === NULL ? 0 : GWF_Time::getTimestamp($last_date);
$next_time = $last_time + $timeout;
if ($last_time + $timeout > time()) {
return $this->module->error('err_flood_time', array(GWF_Time::humanDuration($next_time - time())));
}
# Check amount
$today = GWF_Time::getDate(GWF_Date::LEN_SECOND, time() - $timeout);
$count = $table->countRows("shout_uid={$uid} AND shout_date>='{$today}'");
if ($count >= $max) {
return $this->module->error('err_flood_limit', array($max));
}
# All fine
return false;
}
示例3: 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);
}
示例4: 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';
}
示例5: 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);
}
示例6: 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);
}
示例7: 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()));
}
示例8: execute
public function execute()
{
# Page exists?
if (false === ($page = GWF_Page::getByID(Common::getGetString('pageid')))) {
header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found");
return $this->module->error('err_404');
}
# Have permission to see?
if (!$this->checkPermission($page)) {
header($_SERVER['SERVER_PROTOCOL'] . " 403 Forbidden");
return GWF_HTML::err('ERR_NO_PERMISSION');
}
# Load comments?
if ($page->isOptionEnabled(GWF_Page::COMMENTS)) {
$this->mod_c = GWF_Module::loadModuleDB('Comments', true, true);
if (false === ($this->comments = $page->getComments())) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$_REQUEST['cmts_id'] = $this->comments->getID();
}
# Exec ...
$back = '';
if (isset($_POST['reply'])) {
$back = $this->onReply($page);
}
return $this->showPage($page) . $back;
}
示例9: move
private function move($dir = -1, $bid)
{
if (false === ($board = GWF_ForumBoard::getBoard($bid))) {
return $this->module->error('err_board');
}
if ($board->isRoot()) {
return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'board_is_root'));
}
$myPos = $board->getVar('board_pos');
$pid = $board->getVar('board_pid');
$cmp = $dir === 1 ? '>' : '<';
$orderby = $dir === 1 ? 'board_pos ASC' : 'board_pos DESC';
if (false === ($swap = $board->selectFirstObject('*', "board_pid={$pid} AND board_pos{$cmp}{$myPos}", $orderby))) {
return $this->module->requestMethodB('Forum');
}
$swapPos = $swap->getVar('board_pos');
if (false === $board->saveVar('board_pos', $swapPos)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
if (false === $swap->saveVar('board_pos', $myPos)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
$this->cleanupPositions();
$this->module->setCurrentBoard(GWF_ForumBoard::getBoard($pid));
GWF_ForumBoard::init(true, true);
return $this->module->requestMethodB('Forum');
}
示例10: 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');
}
示例11: 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()));
}
示例12: onAddSite
public function onAddSite()
{
$form = $this->getForm();
if (false !== ($error = $form->validate($this->module))) {
return $error . $this->templateSiteAdd();
}
$site = new WC_Site(array('site_status' => 'wanted', 'site_name' => $form->getVar('site_name'), 'site_classname' => $form->getVar('site_classname'), 'site_country' => 0, 'site_language' => 0, 'site_joindate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'site_launchdate' => '', 'site_authkey' => GWF_Random::randomKey(32), 'site_xauthkey' => GWF_Random::randomKey(32), 'site_irc' => '', 'site_url' => '', 'site_url_mail' => '', 'site_url_score' => '', 'site_url_profile' => '', 'site_score' => 0, 'site_basescore' => 0, 'site_avg' => 0, 'site_vote_dif' => 0, 'site_vote_fun' => 0, 'site_challcount' => 0, 'site_usercount' => 0, 'site_visit_in' => 0, 'site_visit_out' => 0, 'site_options' => 0, 'site_boardid' => 0, 'site_threadid' => 0, 'site_tags' => ''));
if (false === $site->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
Module_WeChall::includeVotes();
if (false === $site->onCreateVotes()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
Module_WeChall::includeForums();
if (false === $site->onCreateBoard()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $site->onCreateThread($this->module)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteDescr.php';
if (false === WC_SiteDescr::insertDescr($site->getID(), 1, 'Please edit me :)')) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_site_added');
}
示例13: onAdd
private function onAdd()
{
$form = $this->formAdd();
if (false !== ($error = $form->validate($this->module))) {
return $error . $this->templateAdd();
}
$file = $form->getVar('file');
$tmp = $file['tmp_name'];
$postid = $this->post->getID();
$userid = GWF_Session::getUserID();
$options = 0;
$options |= isset($_POST['guest_view']) ? GWF_ForumAttachment::GUEST_VISIBLE : 0;
$options |= isset($_POST['guest_down']) ? GWF_ForumAttachment::GUEST_DOWNLOAD : 0;
# Put in db
$attach = new GWF_ForumAttachment(array('fatt_aid' => 0, 'fatt_uid' => $userid, 'fatt_pid' => $postid, 'fatt_mime' => GWF_Upload::getMimeType($tmp), 'fatt_size' => filesize($tmp), 'fatt_downloads' => 0, 'fatt_filename' => $file['name'], 'fatt_options' => $options, 'fatt_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND)));
if (false === $attach->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$aid = $attach->getID();
# Copy file
$path = $attach->dbimgPath();
if (false === GWF_Upload::moveTo($file, $path)) {
@unlink($tmp);
return GWF_HTML::err('ERR_WRITE_FILE', $path);
}
@unlink($tmp);
$this->post->increase('post_attachments', 1);
return $this->module->message('msg_attach_added', array($this->post->getShowHREF()));
}
示例14: onThanks
private function onThanks()
{
if (false === ($post = $this->module->getCurrentPost())) {
return $this->module->error('err_post');
}
if (false === $this->module->cfgThanksEnabled()) {
return $this->module->error('err_thanks_off');
}
if (false === ($user = GWF_Session::getUser())) {
return GWF_HTML::err('ERR_GENERAL', __FILE__, __LINE__);
}
if ($post->hasThanked($user)) {
return $this->module->error('err_thank_twice');
}
if ($post->getUserID() === $user->getID()) {
return $this->module->error('err_thank_self');
}
if (false === $post->onThanks($this->module, $user)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
if ($this->module->isAjax()) {
return '1:' . $post->getThanksCount();
} else {
return $this->module->message('msg_thanked', $post->getShowHREF());
}
}
示例15: onApprove
private function onApprove($lid, $approve)
{
if (false === ($link = GWF_Links::getByID($lid))) {
return $this->module->error('err_link');
}
if (!$link->isInModeration()) {
return $this->module->error('err_approved');
}
if ($link->getToken() !== Common::getGet('token')) {
return $this->module->error('err_token');
}
if ($approve) {
if (false !== ($error = $link->insertTags($this->module))) {
return $error;
}
if (false === $link->saveOption(GWF_Links::IN_MODERATION, false)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $link->setVotesEnabled(true)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
} else {
if (false !== ($error = $link->deleteLink($this->module))) {
return $error;
}
}
return $this->module->message($approve ? 'msg_approved' : 'msg_deleted');
}