示例#1
0
文件: Ajax.php 项目: sinfocol/gwf3
 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';
 }
示例#2
0
文件: History.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== ($array = Common::getPost('delete'))) {
         return $this->onDelete($array);
     }
     return $this->templatePage();
 }
示例#3
0
文件: Form.php 项目: sinfocol/gwf3
 private function onRequest()
 {
     $form = $this->getForm();
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors . $this->form();
     }
     $email = Common::getPost('email', '');
     $user1 = GWF_User::getByName(Common::getPost('username'));
     $user2 = GWF_Validator::isValidEmail($email) ? GWF_User::getByEmail($email) : false;
     # nothing found
     if ($user1 === false && $user2 === false) {
         return $this->module->error('err_not_found') . $this->form();
     }
     # Two different users
     if ($user1 !== false && $user2 !== false && $user1->getID() !== $user2->getID()) {
         return $this->module->error('err_not_same_user') . $this->form();
     }
     # pick the user and send him mail
     if ($user1 !== false && $user2 !== false) {
         $user = $user1;
     } elseif ($user1 !== false) {
         $user = $user1;
     } elseif ($user2 !== false) {
         $user = $user2;
     }
     return $this->sendMail($user);
 }
示例#4
0
文件: BaseCFG.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== Common::getPost('gpg_create')) {
         return $this->onGPGSig() . $this->templateBase();
     }
     return $this->templateBase();
 }
示例#5
0
 public function execute()
 {
     # Permissions
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gbid')))) {
         return $this->module->error('err_gb');
     }
     if (false === $gb->canModerate(GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     # Toggle Moderation Flag
     if (false !== ($state = Common::getGet('set_moderation'))) {
         return $this->onSetModeration($gb, Common::getGet('gbmid', 0), $state > 0);
     }
     # Toggle Public Flag
     if (false !== ($state = Common::getGet('set_public'))) {
         return $this->onSetPublic($gb, Common::getGet('gbmid', 0), $state > 0);
     }
     # Edit Guestbook
     if (false !== Common::getPost('edit')) {
         return $this->onEdit($gb) . $this->templateEditGB($gb);
     }
     # Edit Single Entry
     if (false !== Common::getPost('edit_entry')) {
         return $this->onEditEntry($gb, Common::getGet('gbmid', 0), false);
     }
     if (false !== Common::getPost('del_entry')) {
         return $this->onEditEntry($gb, Common::getGet('gbmid', 0), true);
     }
     if (false !== Common::getGet('edit_entry')) {
         return $this->templateEditEntry($gb, Common::getGet('gbmid', 0));
     }
     return $this->templateEditGB($gb);
 }
示例#6
0
文件: Zipper.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== Common::getPost('zipper')) {
         return $this->onZipB();
     }
     return $this->templateZipper();
 }
示例#7
0
 public function execute()
 {
     require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php';
     if (false === ($site = WC_Site::getByID(Common::getGet('siteid')))) {
         return $this->module->error('err_site');
     }
     $this->site = $site;
     if (false === ($is_admin = GWF_User::isInGroupS(GWF_Group::STAFF))) {
         if (false === $site->isSiteAdmin(GWF_Session::getUser())) {
             return GWF_HTML::err('ERR_NO_PERMISSION');
         }
     }
     if (false !== Common::getPost('add_sitemin')) {
         return $this->onAddSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin);
     }
     if (false !== Common::getPost('rem_sitemin')) {
         return $this->onRemSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin);
     }
     if (false !== Common::getPost('rem_logo')) {
         return $this->onRemLogo($site, $is_admin) . $this->templateEdit($site, $is_admin);
     }
     if (false !== Common::getPost('set_logo')) {
         return $this->onSetLogo($site, $is_admin) . $this->templateEdit($site, $is_admin);
     }
     if (false !== Common::getPost('edit')) {
         return $this->onEdit($site, $is_admin) . $this->templateEdit($site, $is_admin);
     }
     return $this->templateEdit($site, $is_admin);
 }
示例#8
0
文件: Add.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== Common::getPost('add')) {
         return $this->onAdd();
     }
     return $this->templateAdd();
 }
示例#9
0
 private function onEditBoard()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     if (!$this->board->isRoot()) {
         $bid = $this->board->getID();
         if ($bid !== ($newpid = (int) $form->getVar('moveboard'))) {
             if ($this->board->getParentID() !== $newpid) {
                 if (false !== ($newparent = GWF_ForumBoard::getBoard($newpid))) {
                     if (false === $this->board->move($newparent)) {
                         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
                     }
                 }
             }
         }
     }
     $this->board->saveVars(array('board_gid' => $form->getVar('groupid'), 'board_title' => $form->getVar('title'), 'board_descr' => $form->getVar('descr')));
     # Options
     $this->board->saveOption(GWF_ForumBoard::ALLOW_THREADS, Common::getPost('allow_threads') !== false);
     $this->board->saveOption(GWF_ForumBoard::LOCKED, Common::getPost('is_locked') !== false);
     $this->board->saveOption(GWF_ForumBoard::GUEST_POSTS, Common::getPost('guests') !== false);
     $this->board->saveOption(GWF_ForumBoard::GUEST_VIEW, Common::getPost('guest_view') !== false);
     if (!$this->board->isRoot()) {
         $this->board->saveOption(GWF_ForumBoard::INVISIBLE, Common::getPost('invisible') !== false);
     }
     return $this->module->message('msg_edited_board', array($this->board->getShowBoardHREF()));
 }
示例#10
0
文件: Form.php 项目: sinfocol/gwf3
 private function onRegister()
 {
     $form = $this->getForm();
     $errorsA = $errorsB = '';
     if (false !== ($errorsA = $form->validate($this->module)) || false !== ($errorsB = $this->onRegisterB())) {
         return $errorsA . $errorsB . $this->templateForm();
     }
     $username = Common::getPost('username');
     $password = Common::getPost('password');
     $email = Common::getPost('email');
     $birthdate = sprintf('%04d%02d%02d', Common::getPost('birthdatey'), Common::getPost('birthdatem'), Common::getPost('birthdated'));
     $default_country = $this->module->cfgDetectCountry() ? GWF_IP2Country::detectCountryID() : 0;
     $countryid = $form->getVar('countryid', $default_country);
     require_once GWF_CORE_PATH . 'module/Register/GWF_UserActivation.php';
     $token = GWF_UserActivation::generateToken();
     $ua = new GWF_UserActivation(array('username' => $username, 'email' => $email, 'token' => $token, 'birthdate' => $birthdate, 'countryid' => $countryid, 'password' => GWF_Password::hashPasswordS($password), 'timestamp' => time(), 'ip' => GWF_IP6::getIP(GWF_IP_EXACT)));
     if (false === $ua->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateForm();
     }
     if ($this->module->wantEmailActivation()) {
         return $this->sendEmail($username, $email, $token, $password);
     } else {
         GWF_Website::redirect(GWF_WEB_ROOT . 'quick_activate/' . $token);
     }
     return $this->module->message('msg_registered');
 }
示例#11
0
文件: Shout.php 项目: sinfocol/gwf3
 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));
 }
示例#12
0
 public function execute()
 {
     if (false !== Common::getPost('purge')) {
         return $this->onPurge();
     }
     return $this->templatePurge();
 }
示例#13
0
文件: Options.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== Common::getPost('change')) {
         return $this->onChange() . $this->templateOptions();
     }
     return $this->templateOptions();
 }
示例#14
0
文件: Module.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== ($error = $this->sanitize())) {
         return $error;
     }
     $nav = $this->module->templateNav();
     $back = '';
     # Enable
     if (false !== Common::getPost('enable')) {
         $back .= $this->onEnable('enabled');
     } elseif (false !== Common::getPost('disable')) {
         $back .= $this->onEnable('disabled');
     } elseif (false !== Common::getPost('defaults')) {
         $back .= $this->onDefaults();
     } elseif (false !== Common::getPost('update')) {
         $back .= $this->onUpdate();
     } elseif (false !== Common::getPost('admin_sect')) {
         if ($this->mod->hasAdminSection()) {
             GWF_Website::redirect($this->mod->getAdminSectionURL());
             return '';
         } else {
             $back .= $this->module->error('err_no_admin_sect');
         }
     }
     # Form
     return $nav . $back . $this->templateModule();
 }
示例#15
0
 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()));
 }
示例#16
0
 public function execute()
 {
     require_once GWF_CORE_PATH . 'module/Helpdesk/GWF_HelpdeskTitle.php';
     if (false !== Common::getPost('create')) {
         return $this->onCreate();
     }
     return $this->templateCT();
 }
示例#17
0
 public function execute()
 {
     $nav = $this->module->templateNav();
     if (false !== Common::getPost('search') || false !== Common::getGet('term')) {
         return $nav . $this->onSearch();
     }
     return $nav . $this->templateSearch();
 }
示例#18
0
 public function execute()
 {
     $back = '';
     if (false !== Common::getPost('delete_folder')) {
         $back .= $this->onDeleteFolders();
     }
     return $back . $this->module->requestMethodB('Overview');
 }
示例#19
0
文件: LoginAs.php 项目: sinfocol/gwf3
 public function execute()
 {
     $nav = $this->module->templateNav();
     if (false !== Common::getPost('login')) {
         return $nav . $this->onLoginAs();
     }
     return $nav . $this->templateLoginAs();
 }
示例#20
0
文件: SetPass.php 项目: sinfocol/gwf3
 public function execute()
 {
     $nav = $this->module->templateNav();
     if (Common::getPost('setup') !== false) {
         return $nav . $this->onSetup();
     }
     return $nav . $this->templateSetup();
 }
示例#21
0
文件: MatchIP.php 项目: sinfocol/gwf3
 private function getHourSelect($name)
 {
     $selected = (int) Common::getPost($name, 0);
     $data = array();
     for ($i = 0; $i < 24; $i++) {
         $data[] = array($i, $i);
     }
     return GWF_Select::display($name, $data, $selected);
 }
示例#22
0
文件: Form.php 项目: sinfocol/gwf3
 public function execute()
 {
     GWF_Website::setPageTitle($this->module->lang('page_title'));
     GWF_Website::setMetaTags($this->module->lang('page_meta'));
     if (false !== Common::getPost('contact')) {
         return $this->onSend();
     }
     return $this->templateForm();
 }
示例#23
0
文件: History.php 项目: sinfocol/gwf3
 public function execute()
 {
     require_once GWF_CORE_PATH . 'module/Login/GWF_LoginCleared.php';
     require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
     if (false !== Common::getPost('clear')) {
         return $this->onClear() . $this->templateHistory();
     }
     return $this->templateHistory();
 }
示例#24
0
文件: Form.php 项目: sinfocol/gwf3
 public function execute()
 {
     if (false !== Common::getPost('edit')) {
         return $this->onEditSettings() . $this->templateSettings();
     }
     GWF_Website::setPageTitle($this->module->lang('pt_settings'));
     GWF_Website::setMetaTags($this->module->lang('mt_settings'));
     GWF_Website::setMetaTags($this->module->lang('md_settings'));
     return $this->templateSettings();
 }
示例#25
0
 public function execute()
 {
     if (false !== ($filename = Common::getGetString('filename', false))) {
         return $this->templateFile($filename);
     }
     if (false !== Common::getPost('save_file')) {
         return $this->onSaveFile();
     }
     return $this->templateFiles();
 }
示例#26
0
文件: Pay2.php 项目: sinfocol/gwf3
 public function execute(GWF_Module $module)
 {
     if (false === ($order = GWF_Order::getByToken(Common::getPost('gwf_token')))) {
         return $module->error('err_order');
     }
     if (!$order->isCreated()) {
         return $module->error('err_order');
     }
     return $this->onPay($module, $order);
 }
示例#27
0
文件: Change.php 项目: sinfocol/gwf3
 public function validate_password(Module_PasswordForgot $module, $password)
 {
     if (!GWF_Validator::isValidPassword($password)) {
         return $this->module->lang('err_weak_pass', array(8));
     } elseif (Common::getPost('password2', '') !== $password) {
         return $this->module->lang('err_pass_retype');
     } else {
         return false;
     }
 }
示例#28
0
 private function onQuickjump()
 {
     require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteCats.php';
     if (false === ($cat = WC_SiteCats::getCatForBit(Common::getPost('category')))) {
         $location = GWF_WEB_ROOT . 'category_ranking';
     } else {
         $location = GWF_WEB_ROOT . 'category_ranking/' . urlencode($cat);
     }
     header('Location: ' . $location);
     return '';
 }
示例#29
0
文件: Form.php 项目: sinfocol/gwf3
 public function execute()
 {
     GWF_Website::setPageTitle($this->module->lang('pt_login'));
     if (false !== GWF_Session::getUser()) {
         return $this->module->error('err_already_logged_in');
     }
     if (false !== Common::getPost('login')) {
         return $this->onLogin();
     }
     return $this->form();
 }
示例#30
-6
 public function execute()
 {
     $mp = Module_Payment::instance();
     if (false === ($gwf_token = Common::getPost('gwf_token'))) {
         return $mp->error('err_token');
     }
     if (false === ($order = GWF_Order::getByToken($gwf_token))) {
         return $mp->error('err_order');
     }
     if ($order->isProcessed()) {
         return $mp->message('err_already_done');
     }
     if (!$order->isCreated()) {
         return $mp->error('err_order');
     }
     /* Gather the information to make the final call to
     		finalize the PayPal payment.  The variable nvpstr
     		holds the name value pairs
     		*/
     if (false === ($resArray = @unserialize($order->getOrderXToken()))) {
         return $mp->error('err_xtoken', $this->module->getSiteName());
     }
     $token = $resArray["TOKEN"];
     $paymentAmount = $order->getOrderPriceTotal();
     $paymentType = "Sale";
     $currCodeType = $order->getOrderCurrency();
     $payerID = urlencode($resArray["PAYERID"]);
     $serverName = urlencode($_SERVER['SERVER_NAME']);
     $order->saveVar('order_email', $resArray["EMAIL"]);
     $nvpstr = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTACTION=' . $paymentType . '&AMT=' . $paymentAmount . '&CURRENCYCODE=' . $currCodeType . '&IPADDRESS=' . $serverName;
     $nvpstr .= "&ITEMAMT=" . $paymentAmount . "&L_QTY0=1" . "&L_NAME0=" . urlencode($order->getOrderDescrAdmin()) . "&L_AMT0=" . $paymentAmount;
     /* Make the call to PayPal to finalize payment
        	If an error occured, show the resulting errors
        */
     $resArray = Paypal_Util::hash_call('DoExpressCheckoutPayment', $nvpstr);
     /* Display the API response back to the browser.
        If the response from PayPal was a success, display the response parameters'
        If the response was an error, display the errors received using APIError.php.
        */
     $ack = strtoupper($resArray["ACK"]);
     if ($ack != "SUCCESS") {
         return Paypal_Util::paypalError($resArray);
     }
     // Get Payment module;
     $mp = Module_Payment::instance();
     $module2 = $order->getOrderModule();
     $module2->onLoadLanguage();
     Paypal_Util::logResArray($resArray);
     $status = strtoupper($resArray['PAYMENTSTATUS']);
     if ($status === 'COMPLETED') {
         return $mp->onExecuteOrder($module2, $order);
     } else {
         return $mp->onPendingOrder($module2, $order);
     }
 }