本文整理汇总了PHP中GWF_HTML::error方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_HTML::error方法的具体用法?PHP GWF_HTML::error怎么用?PHP GWF_HTML::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_HTML
的用法示例。
在下文中一共展示了GWF_HTML::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wccgpg_doit
function wccgpg_doit(WC_Challenge $chall, $user)
{
if ($user === false) {
echo GWF_HTML::error('GPG', $chall->lang('err_login'), false);
return;
}
if (!$user->hasValidMail()) {
echo GWF_HTML::error('GPG', $chall->lang('err_no_mail'));
return;
}
$receiver = $user->getValidMail();
if (!function_exists('gnupg_init')) {
echo GWF_HTML::error('GPG', $chall->lang('err_server'));
return;
}
if (false === ($fingerprint = GWF_PublicKey::getFingerprintForUser($user))) {
$url = GWF_WEB_ROOT . 'account';
echo GWF_HTML::error('GPG', $chall->lang('err_no_gpg', $url), false);
return;
}
$solution = WC_CryptoChall::generateSolution('OHOYOUGOTGPG!', true, false);
$mail = new GWF_Mail();
$mail->setSubject($chall->lang('mail_s'));
$mail->setSender(GWF_BOT_EMAIL);
$mail->setReceiver($receiver);
$mail->setBody($chall->lang('mail_b', array($user->displayUsername(), $solution)));
if (false === $mail->sendToUser($user)) {
echo GWF_HTML::err('ERR_MAIL_SENT');
} else {
echo GWF_HTML::message('GPG', $chall->lang('msg_mail_sent', array(htmlspecialchars($receiver))));
}
}
示例2: execute
public function execute()
{
if (false === ($user = GWF_Session::getUser()) && !$this->module->cfgGuestShouts()) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
if ($user !== false && $user->isWebspider()) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
if (false !== ($error = $this->isFlooding())) {
return $error;
}
$message = Common::getPost('message', '');
if (false !== ($error = $this->validate_message($message))) {
return GWF_HTML::error('Shoutbox', $error);
}
$entry = new GWF_Shoutbox(array('shout_id' => '0', 'shout_uid' => GWF_Session::getUserID(), 'shout_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'shout_uname' => GWF_Shoutbox::generateUsername(), 'shout_message' => $message));
if (false === $entry->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if ($this->module->cfgEMailModeration()) {
$this->onEMailModeration($user, $entry);
}
$url = htmlspecialchars(GWF_Session::getLastURL());
return $this->module->message('msg_shouted', array($url, $url));
}
示例3: onPurchase
private function onPurchase()
{
if (false !== ($error = GWF_Form::validateCSRF_WeakS())) {
return GWF_HTML::error('Purchase GWF Modules', $error) . $this->templatePurchase();
}
if (!isset($_POST['mod']) || !is_array($_POST['mod'])) {
return $this->module->error('err_select_modules') . $this->templatePurchase();
// return GWF_HTML::err('ERR_GENERAL', array( __FILE__, __LINE__)).$this->templatePurchase();
}
$purchased_modules = array();
foreach ($_POST['mod'] as $mname => $yes) {
if (isset($this->modules[$mname])) {
$purchased_modules[] = $mname;
}
}
if (count($purchased_modules) === 0) {
return $this->module->error('err_select_modules') . $this->templatePurchase();
}
$designs = GWF_Design::getDesigns();
$purchased_designs = array();
foreach ($_POST['design'] as $dname => $yes) {
if (array_key_exists($dname, $designs)) {
$purchased_designs[] = $dname;
}
}
$user = GWF_User::getStaticOrGuest();
$userid = GWF_Session::getUserID();
if (false === ($client = GWF_Client::getClient($userid))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templatePurchase();
}
$order = new GWF_ClientOrder(array('vsco_uid' => $userid, 'vsco_modules' => implode(',', $purchased_modules), 'vsco_designs' => implode(',', $purchased_designs)));
Module_Payment::saveTempOrder($order);
$tVars = array('order' => Module_Payment::displayOrderS($this->module, $order, $user));
return $this->module->template('order.tpl', $tVars);
}
示例4: 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;
}
示例5: onTag
private function onTag(Slay_Song $song)
{
$form = $this->formTag($song);
if (false !== ($error = $form->validateCSRF_WeakS())) {
return $error;
}
$tags = array();
$errors = array();
foreach ($_POST as $k => $v) {
if (Common::startsWith($k, 'tag_')) {
$k = substr($k, 4);
if (Slay_Tag::getByName($k) === false) {
$errors[] = $this->module->lang('err_tag_uk');
} else {
$tags[] = $k;
}
}
}
if (count($errors) > 0) {
return GWF_HTML::error('Slaytags', $errors);
}
$user = GWF_Session::getUser();
if (false === Slay_TagVote::clearVotes($song, $user)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === Slay_TagVote::addVotes($song, $user, $tags)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $song->computeTags()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_tagged');
}
示例6: display
public function display($title = 'Error')
{
if ($this->isError()) {
return GWF_HTML::error($title, (array) $this->msg);
} else {
return GWF_HTML::message($title, (array) $this->msg);
}
}
示例7: sanitize
private function sanitize()
{
$this->user = GWF_Session::getUser();
if (false !== ($error = GWF_LinksValidator::mayAddLink($this->module, $this->user))) {
return GWF_HTML::error('Links', $error);
}
return false;
}
示例8: display
public function display($title = 'Error')
{
if ($this->is_error) {
return GWF_HTML::error($title, $this->message);
} else {
return GWF_HTML::message($title, $this->message);
}
}
示例9: getHTAccess
public static function getHTAccess()
{
if (false === Common::isFile(GWF_WWW_PATH . '.htaccess')) {
GWF_HTML::error('ERR_FILE_NOT_FOUND', array(GWF_WWW_PATH . '.htaccess'));
# TODO
return false;
}
return file_get_contents(GWF_WWW_PATH . '.htaccess');
}
示例10: onJoin
private function onJoin($array)
{
if (false !== ($error = GWF_Form::validateCSRF_WeakS())) {
return GWF_HTML::error('Join Group', $error);
}
if (false === ($group = GWF_Group::getByID(key($array)))) {
return $this->module->error('err_unk_group');
}
return $this->module->getMethod('Join')->onQuickJoin($group, GWF_User::getStaticOrGuest());
}
示例11: the_preg_match
/**
* We don't like the text "evilfunction" and "badmethod".
*/
function the_preg_match(WC_Challenge $chall, $text)
{
if (1 === preg_match('#^.*((?:badmethod)|(?:evilfunction)).*$#s', $text, $matches)) {
echo GWF_HTML::error($chall->lang('title'), $chall->lang('evil', array($matches[1])));
return false;
} else {
echo GWF_HTML::message($chall->lang('title'), $chall->lang('lovely'));
return true;
}
}
示例12: www_basic_go
function www_basic_go(WC_Challenge $chall, $url, $content)
{
if (false === ($response = GWF_HTTP::getFromURL($url))) {
echo GWF_HTML::error('WWW Basics', $chall->lang('err_file_not_found'));
} elseif ($response !== $content) {
echo GWF_HTML::error('WWW Basics', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($content), strlen($response), strlen($content))));
} else {
$chall->onChallengeSolved(GWF_Session::getUserID());
}
}
示例13: bacon_check_messages
function bacon_check_messages(WC_Challenge $chall, $hidden)
{
$chars = bacon_count_chars($hidden);
$bits = $chars * 5;
$avail = bacon_count_chars($chall->lang('message'));
if ($bits > $avail) {
echo GWF_HTML::error('Bacon', "The carrier message is too short: Need {$bits} bits and have only {$avail} available.", false);
return false;
}
return true;
}
示例14: onDeleteFolders
private function onDeleteFolders()
{
if (false !== ($error = GWF_Form::validateCSRF_WeakS())) {
return GWF_HTML::error('PM', $error, false);
}
$back = '';
foreach (Common::getPostArray('folder', array()) as $folderid => $stub) {
$back .= $this->onDeleteFolder($folderid);
}
return $back;
}
示例15: __call
public function __call($name, $args)
{
if (false === ($mo = Common::substrUntil($name, '_'))) {
return GWF_HTML::error('ERR_GENERAL', array(__FILE__, __LINE__));
}
$me = Common::substrFrom($name, '_');
if (false === ($module = GWF_Module::loadModuleDB($mo))) {
return GWF_HTML::error('ERR_MODULE_MISSING', array(__FILE__, __LINE__));
}
return $module->execute($me);
}