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(); }
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; }
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); }
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'; }
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); }
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); }
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())); }
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; }
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'); }
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'); }
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())); }
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'); }
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())); }
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()); } }
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'); }
private function send(GWF_User $user) { $form = $this->form($user); if (false !== ($errors = $form->validate($this->module))) { return $errors . $this->template($user); } $u = GWF_User::getStaticOrGuest(); $sendermail = $u->getValidMail(); if ($sendermail === '') { $sendermail = Common::getPost('email'); } if ($sendermail === '') { $sendermail = GWF_HTML::lang('unknown'); } $sendermail = GWF_HTML::display($sendermail); $mail = new GWF_Mail(); $mail->setSender(GWF_BOT_EMAIL); $mail->setReceiver($user->getValidMail()); $mail->setReply($sendermail); $mail->setSubject($this->module->langUser($user, 'mail_subj_mail', $sendermail)); $mail->setBody($this->module->langUser($user, 'mail_subj_body', array($user->displayUsername(), $sendermail, GWF_Message::display($_POST['message'])))); if (false === $mail->sendToUser($user)) { return GWF_HTML::err('ERR_MAIL_SENT'); } return $this->module->message('msg_mailed', array($user->displayUsername())); }
public static function display(GWF_Module $module, GDO $gdo, $user, $sortURL, $conditions = '', $ipp = 25, $pageURL = false, $joins = NULL) { $fields = $gdo->getSortableFields($user); $headers = self::getGDOHeaders2($module, $gdo, $user, $sortURL); $nItems = $gdo->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $orderby = self::getMultiOrderBy($gdo, $user); $from = GWF_PageMenu::getFrom($page, $ipp); $i = 0; $data = array(); if (false === ($result = $gdo->select('*', $conditions, $orderby, $joins, $ipp, $from))) { echo GWF_HTML::err(ERR_DATABASE, __FILE__, __LINE__); return false; } while (false !== ($row = $gdo->fetch($result, GDO::ARRAY_O))) { $row instanceof GWF_Sortable; $data[$i] = array(); foreach ($fields as $field) { $data[$i][] = $row->displayColumn($module, $user, $field); } $i++; } $gdo->free($result); if ($pageURL === false) { $pageURL = ''; } elseif ($pageURL === true) { $pageURL = str_replace(array('%BY%', '%DIR%'), array(urlencode(Common::getGet('by')), urlencode(Common::getGet('dir'))), $sortURL); $pageURL .= '&page=%PAGE%'; } $pagemenu = $pageURL === '' ? '' : GWF_PageMenu::display($page, $nPages, $pageURL); return $pagemenu . self::display2($headers, $data) . $pagemenu; }
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); }
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()))); }
public function execute() { if (false === ($user = GWF_User::getByID(Common::getGet('userid')))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } $tmpfile = GWF_PATH . 'extra/temp/gpg/' . $user->getVar('user_id'); if (!is_file($tmpfile) || !is_readable($tmpfile)) { return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($tmpfile)); } if (false === ($file_content = file_get_contents($tmpfile))) { return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($tmpfile)); } if (false === unlink($tmpfile)) { return GWF_HTML::err('ERR_WRITE_FILE', array($tmpfile)); } if (false === ($fingerprint = GWF_PublicKey::grabFingerprint($file_content))) { return $this->module->error('err_gpg_key'); } if (Common::getGet('token') !== $fingerprint) { return $this->module->error('err_gpg_token'); } if (false === GWF_PublicKey::updateKey($user->getID(), $file_content)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $user->saveOption(GWF_User::EMAIL_GPG, true)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_setup_gpg'); }
public static function getDescription($siteid) { $siteid = (int) $siteid; $browser_lid = GWF_Language::getCurrentID(); if (false === ($result = GDO::table('WC_Site')->selectAll('site_desc_lid, site_desc_txt', "site_desc_sid={$siteid} AND (site_desc_lid= {$browser_lid} OR site_desc_lid=site_descr_lid)", '', array('description'), 2, 0, GDO::ARRAY_N))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } // $sites = GWF_TABLE_PREFIX.'wc_site'; // $descr = GWF_TABLE_PREFIX.'wc_site_descr'; // $db = gdo_db(); // // $query = "SELECT site_desc_lid, site_desc_txt FROM $sites JOIN $descr ON site_desc_sid=site_id WHERE site_desc_sid=$siteid AND (site_desc_lid=$browser_lid OR site_desc_lid=site_descr_lid)"; // // if (false === ($result = $db->queryAll($query, false))) { // return ''; // } // if (count($result) === 2) { if ($result[0][0] === $browser_lid) { return $result[0][1]; } else { return $result[1][1]; } } else { return $result[0][1]; } }
private function templateRankingU($username) { if (false === ($user = GWF_User::getByName($username))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } return $this->templateRanking($user); }
public function onDeleteFolder($folderid) { # Permission $folderid = (int) $folderid; $user = GWF_Session::getUser(); if (false === ($folder = GWF_PMFolder::getByID($folderid)) || $folder->getVar('pmf_uid') !== $user->getID()) { return $this->module->error('err_folder_perm'); } # Delete PMs$result $count = 0; $pms = GDO::table('GWF_PM'); $uid = $user->getVar('user_id'); $fid = "{$folderid}"; $del = GWF_PM::OWNER_DELETED; if (false === ($result = $pms->update("pm_options=pm_options|{$del}", "pm_owner={$uid} AND pm_folder={$fid}"))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $count += $pms->affectedRows($result); // $del = GWF_PM::FROM_DELETED; // if (false === $pms->update("pm_options=pm_options|$del", "pm_from=$uid AND pm_from_folder=$fid")) { // return GWF_HTML::err('ERR_DATABASE', array( __FILE__, __LINE__)); // } // $count += $pms->affectedRows(); if ($folderid > 2) { # Delete Folder if (false === $folder->delete()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } } # Done return $this->module->message('msg_folder_deleted', array($folder->display('pmf_name'), $count)); }
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; }
public function execute() { if (false === ($user = GWF_User::getByName(Common::getGet('username')))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } return $this->templateHistory($user); }
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; }
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)))); } }
private function contactData(GWF_User $user) { require_once GWF_CORE_PATH . 'module/Profile/GWF_Profile.php'; if (false === ($p = GWF_Profile::getProfile($user->getID()))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if ($p->isGuestHidden() || $p->isHiddenLevel(0)) { return ''; } $back = ''; if ('' !== ($v = $p->getVar('prof_firstname'))) { $back .= 'FirstName:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_lastname'))) { $back .= 'LastName:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_street'))) { $back .= 'Street:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_city'))) { $back .= 'City:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_zip'))) { $back .= 'ZIPCode:' . $v . PHP_EOL; } if ($p->isContactHiddenLevel(0)) { return $back; } if ($user->isOptionEnabled(GWF_User::SHOW_EMAIL)) { if ('' !== ($v = $user->displayEMail())) { $back .= 'EMail:' . $v . PHP_EOL; } } if ('' !== ($v = $p->getVar('prof_tel'))) { $back .= 'Tel:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_mobile'))) { $back .= 'Mobile:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_icq'))) { $back .= 'ICQ:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_msn'))) { $back .= 'MSN:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_jabber'))) { $back .= 'Jabber:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_skype'))) { $back .= 'Skype:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_yahoo'))) { $back .= 'Yahoo!:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_aim'))) { $back .= 'AIM:' . $v . PHP_EOL; } return $back; }
private function onDownload(GWF_Download $dl) { if (false === ($method = $this->module->getMethod('Download'))) { return GWF_HTML::err('ERR_METHOD_MISSING', array('Download', 'Download')); } $method instanceof Download_Download; $method->sendTheFile($dl); }
private function toggleModeration(GWF_Guestbook $gb, GWF_GuestbookMSG $gbm, $state) { $state = $state > 0; if (false === $gbm->saveOption(GWF_GuestbookMSG::IN_MODERATION, $state)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_gbm_mod_' . ($state ? '1' : '0')); }