Пример #1
0
 private function getAllISO()
 {
     if (isset($_POST['all_targets'])) {
         return 'all';
     }
     return $this->target->getISO();
 }
Пример #2
0
 private function getItems(GWF_Language $lang)
 {
     $back = array();
     $items = GWF_News::getNews($this->module->cfgFeedItemcount(), 0, 1, "news_date DESC", false);
     $langid = $lang->getID();
     foreach ($items as $item) {
         $item instanceof GWF_News;
         $t = $item->getTranslationB($langid);
         $back[] = array('title' => $t['newst_title'], 'descr' => GWF_Message::display($t['newst_message'], true, false, false), 'guid' => Common::getAbsoluteURL($item->hrefShow($lang), false), 'link' => Common::getAbsoluteURL($item->hrefShow($lang), false), 'date' => $item->displayDate(), 'pub_date' => $item->rssDate());
     }
     return $back;
 }
Пример #3
0
 private static function createLangBoard(Module_Forum $module, GWF_Language $lang, $parent)
 {
     $iso = $lang->getISO();
     $title = $module->langISO($iso, 'lang_board_title', array($lang->getVar('name')));
     if (false !== ($board = GWF_ForumBoard::getByTitle($title))) {
         return '';
     }
     $descr = $module->langISO($iso, 'lang_board_descr', array($lang->getVar('lang_nativename')));
     $options = GWF_ForumBoard::GUEST_VIEW | GWF_ForumBoard::ALLOW_THREADS;
     if (false === ($board = GWF_ForumBoard::createBoard($title, $descr, $parent, $options, 0))) {
         return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
     }
     return '';
 }
Пример #4
0
 public function export()
 {
     header("Content-Type: application/xml; charset=UTF-8");
     $rss_date = self::displayDate($this->guessRSSDate());
     $tVars = array('items' => $this->items, 'title_link' => $this->feedURL, 'feed_title' => $this->title, 'feed_description' => $this->descr, 'language' => GWF_Language::getCurrentISO(), 'image_url' => Common::getAbsoluteURL('/favicon.ico', false), 'image_link' => $this->webURL, 'image_width' => '32', 'image_height' => '32', 'pub_date' => $rss_date, 'build_date' => $rss_date);
     return GWF_Template::templatePHPMain('rss2.php', $tVars);
 }
Пример #5
0
 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];
     }
 }
Пример #6
0
 private function templatePurchase()
 {
     $designs = GWF_Design::getDesigns();
     $langs = GWF_Language::getSupportedLanguages();
     $tVars = array('modules' => $this->modules, 'designs' => $designs, 'langs' => $langs, 'client' => GWF_Client::getByID(GWF_Session::getUserID()));
     return $this->module->templatePHP('purchase.php', $tVars);
 }
Пример #7
0
 public function __construct($basepath = NULL, array $config = array())
 {
     self::init($basepath);
     self::onDefineWebRoot();
     GWF_Language::initEnglish();
     GWF_Website::init(false);
 }
Пример #8
0
 public function displayPaysiteButton(GWF_Module $module, GWF_Order $order, GWF_Orderable $gdo, GWF_User $user)
 {
     $lang_iso = GWF_Language::getCurrentISO();
     $action = self::RECEIVE_MONEY_URL;
     $hidden = GWF_Form::hidden('ap_purchasetype', 'item') . GWF_Form::hidden('ap_merchant', $this->cfgSeller()) . GWF_Form::hidden('ap_itemname', $gdo->getOrderItemName($module, $lang_iso)) . GWF_Form::hidden('ap_currency', $order->getOrderCurrency()) . GWF_Form::hidden('ap_returnurl', Common::getAbsoluteURL($gdo->getOrderSuccessURL($user), false)) . GWF_Form::hidden('ap_itemcode', $order->getOrderToken()) . GWF_Form::hidden('ap_quantity', $order->getOrderAmount()) . GWF_Form::hidden('ap_description', $gdo->getOrderDescr($module, $lang_iso)) . GWF_Form::hidden('ap_amount', $order->getOrderPriceTotal()) . GWF_Form::hidden('ap_cancelurl', Common::getAbsoluteURL($gdo->getOrderCancelURL($user), false));
     //		echo GWF_HTML::display($hidden);
     return Module_Payment::tinyform('pay_ap', 'img/' . GWF_ICON_SET . 'buy_ap.png', $action, $hidden);
 }
Пример #9
0
 public function displayLang()
 {
     # FIXME: page_lang not assigned
     //if (false === ($lang = GWF_Language::getByID($this->getVar('page_lang')))) {
     if (false === ($lang = GWF_Language::getByID(1))) {
         return GWF_Module::getModule('PageBuilder')->lang('lang_all');
     }
     return $lang->displayName();
 }
Пример #10
0
 public function getForm()
 {
     $langid = Common::getPostString('langid', GWF_Language::getEnglish()->getID());
     require_once GWF_CORE_PATH . 'module/Category/GWF_CategorySelect.php';
     //key => array(TYPE, default, text, classname)
     //		GWF_Language::setShowSupported(true);
     $data = array('langid' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_Language::SUPPORTED, 'langid', $langid), $this->module->lang('th_langid')), 'catid' => array(GWF_Form::SELECT, GWF_CategorySelect::single('catid', Common::getPostString('catid', '1'), 0), $this->module->lang('th_category')), 'title' => array(GWF_Form::STRING, '', $this->module->lang('th_title')), 'message' => array(GWF_Form::MESSAGE, '', $this->module->lang('th_message')), 'div1' => array(GWF_Form::DIVIDER), 'div2' => array(GWF_Form::DIVIDER), 'preview' => array(GWF_Form::SUBMIT, $this->module->lang('btn_preview'), ''), 'add' => array(GWF_Form::SUBMIT, $this->module->lang('btn_add'), ''));
     return new GWF_Form($this, $data);
 }
Пример #11
0
 /**
  * Get a langid from possible get parameters. default is browser.
  * @return string
  */
 private function getSelectedLangID()
 {
     if ('' !== ($iso = Common::getGetString('to_iso'))) {
         if (false !== ($id = GWF_Language::getIDByISO($iso))) {
             return $id;
         }
     }
     return Common::getGetString('to_lang_id', true);
 }
Пример #12
0
 public function execute()
 {
     if (false === ($order = GWF_Order::getByToken(Common::getPostString('gwf_token')))) {
         return $this->module->error('err_order');
     }
     if (!$order->isCreated()) {
         return $this->module->error('err_order');
     }
     $gdo = $order->getOrderData();
     $user = $order->getOrderUser();
     # GWF_User::getStaticOrGuest();
     /* The servername and serverport tells PayPal where the buyer
        should be directed back to after authorizing payment.
        In this case, its the local webserver that is running this script
        Using the servername and serverport, the return URL is the first
        portion of the URL that buyers will return to after authorizing payment
        */
     /* The returnURL is the location where buyers return when a
     			payment has been succesfully authorized.
     			The cancelURL is the location buyers are sent to when they hit the
     			cancel button during authorization of payment during the PayPal flow
     		*/
     $successURL = urlencode($this->get2ndStepURL($order, $gdo));
     $cancelURL = urlencode(Common::getAbsoluteURL($gdo->getOrderCancelURL($user), false));
     $shipping = $gdo->needsShipping($user) ? '0' : '1';
     /* Construct the parameter string that describes the PayPal payment
     			the varialbes were set in the web form, and the resulting string
     			is stored in $nvpstr
     			*/
     $paymentAmount = $order->getOrderPriceTotal(2);
     $paymentType = "Sale";
     $currencyCodeType = $order->getOrderCurrency();
     $nvpstr = "&Amt={$paymentAmount}" . "&PAYMENTACTION={$paymentType}" . "&ReturnUrl={$successURL}" . "&CANCELURL={$cancelURL}" . "&CURRENCYCODE={$currencyCodeType}" . "&no_shipping={$shipping}" . "&LOCALECODE=" . strtoupper(GWF_Language::getCurrentISO());
     //		var_dump($nvpstr);
     /* Make the call to PayPal to set the Express Checkout token
     			If the API call succeded, then redirect the buyer to PayPal
     			to begin to authorize payment.  If an error occured, show the
     			resulting errors
     			*/
     $resArray = Paypal_Util::hash_call('SetExpressCheckout', $nvpstr);
     //		var_dump($resArray);
     $ack = strtoupper($resArray["ACK"]);
     if ($ack == "SUCCESS") {
         // Redirect to paypal.com here
         $token = urldecode($resArray["TOKEN"]);
         if (false === $order->saveVar('order_xtoken', $token)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         $payPalURL = PAYPAL_URL . $token;
         header("Location: " . $payPalURL);
         echo 'The browser should redirect you to: ' . $payPalURL . PHP_EOL;
         die;
     } else {
         return Paypal_Util::paypalError($resArray);
     }
 }
Пример #13
0
 private static function initB()
 {
     if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         return false;
     }
     $iso = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
     if (false === ($lang = self::getByISO($iso))) {
         return false;
     }
     return GWF_Language::setCurrentLanguage($lang);
 }
Пример #14
0
 public static function select($name = 'lang_switch')
 {
     $current = GWF_Language::getCurrentLanguage();
     $langs = GWF_Language::getSupported();
     $data = array();
     foreach ($langs as $lang) {
         $lang instanceof GWF_Language;
         $data[] = array($lang->getISO(), $lang->getVar('lang_name'));
     }
     return GWF_Select::display($name, $data, $current->getISO(), self::getOnChange());
 }
Пример #15
0
 private function onCheck()
 {
     $form = $this->getForm();
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors . $this->templateChecker();
     }
     if (false === ($this->lang = GWF_Language::getByID(Common::getPost('langs')))) {
         return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE') . $this->templateChecker();
     }
     $this->show_warns = isset($_POST['warns']);
     return $this->templateChecker() . $this->onCheckB();
 }
Пример #16
0
 private static function getLangRewrites()
 {
     $back = '#################' . PHP_EOL;
     $back .= '### languages ###' . PHP_EOL;
     $back .= '#################' . PHP_EOL;
     foreach (GWF_Language::getAvailable() as $iso) {
         if (false !== GWF_Language::getByISO($iso)) {
             $back .= sprintf('RewriteRule ^%s/(.*) /$1', $iso) . PHP_EOL;
         }
     }
     return $back;
 }
Пример #17
0
function module_PageBuilder_monthly()
{
    require_once GWF_CORE_PATH . 'module/PageBuilder/GWF_Page.php';
    $enabled = GWF_Page::ENABLED;
    $langid = GWF_Language::getCurrentID();
    $db = gdo_db();
    $t = GWF_TABLE_PREFIX . 'page';
    $query = "SELECT IFNULL(p2.page_otherid,p1.page_otherid), IFNULL(p2.page_title,p1.page_title), IFNULL(p2.page_url,p1.page_url), IFNULL(p2.page_date,p1.page_date) FROM {$t} p1 LEFT JOIN {$t} p2 ON p1.page_otherid=p2.page_otherid AND p2.page_lang={$langid} WHERE p1.page_lang=0 ORDER BY 4 DESC";
    if (false === ($result = $db->queryRead($query))) {
        return '';
    }
    $first = NULL;
    $tree = array();
    while (false !== ($page = $db->fetchRow($result))) {
        if ($first === NULL) {
            $first = $page;
        }
        monthlyAddTree($tree, $page);
    }
    $db->free($result);
    if (count($tree) === 0) {
        return '';
    }
    //	$first = $pages[key($pages)];
    $currdate = $first[3];
    list($y, $m, $d) = monthlySplit($currdate);
    $cy = $y;
    $cm = $m;
    $cd = $d;
    //	$tree = monthlyGetTree($pages);
    $back = '<div class="gwf_pb_monthly fr">' . PHP_EOL;
    foreach ($tree as $year => $y2) {
        $c = count($y2);
        $back .= "<ol id=\"_pby{$year}\"><li>{$year}({$c})</li>\n";
        foreach ($y2 as $m1 => $m2) {
            $c = count($m2);
            $month = GWF_HTML::lang('M' . ($m1 + 0));
            $back .= "<li>{$year} {$month} ({$c})<ol>\n";
            foreach ($m2 as $page) {
                $url = htmlspecialchars(GWF_WEB_ROOT . $page[2]);
                $title = htmlspecialchars($page[1]);
                $back .= "<li><a href=\"{$url}\" title=\"{$title}\">{$title}</a></li>\n";
            }
            $back .= "</ol></li>\n";
        }
        $back .= "</ol>\n";
    }
    $back .= '</div>' . PHP_EOL;
    return $back;
    echo $back;
    return;
}
Пример #18
0
 public static function getSwitchLangSelectDomain()
 {
     $langs = GWF_Language::getSupportedLanguages();
     $data = array();
     foreach ($langs as $lang) {
         $data[] = array($lang->displayName(), $lang->getISO());
     }
     $current_iso = GWF_Language::getCurrentISO();
     $domain = GWF_DOMAIN;
     $url = htmlspecialchars($_SERVER['REQUEST_URI']);
     $onchange = "window.location='http://'+this.value+'.{$domain}{$url}';";
     return GWF_Select::display('switch_lang', $data, $current_iso, $onchange);
 }
Пример #19
0
 private function templateRanking(GWF_Language $lang, $user)
 {
     $db = gdo_db();
     $ipp = 50;
     $iso = $lang->getISO();
     $langid = $lang->getID();
     $users = GWF_TABLE_PREFIX . 'user';
     $regat = GWF_TABLE_PREFIX . 'wc_regat';
     # Count number of users playing this language.
     $query = "SELECT COUNT(DISTINCT regat_uid) AS c FROM {$regat} WHERE regat_langid={$langid} AND regat_options&4=0";
     if (false === ($result = $db->queryFirst($query))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     # Page Menu
     $nItems = intval($result['c']);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     list($page, $hl_rank) = $this->getPageRank($langid, $ipp, $user);
     GWF_Website::setPageTitle($this->module->lang('pt_langrank', array($lang->displayName(), $page, $nPages)));
     GWF_Website::setMetaTags($this->module->lang('mt_ranking_lang', array($lang->displayName())));
     GWF_Website::setMetaDescr($this->module->lang('md_ranking_lang', array($lang->displayName(), $page, $nPages)));
     //		echo 'PAGE:';
     //		var_dump($page);
     //
     //		echo 'RANK:';
     //		var_dump($hl_rank);
     //
     $page = Common::clamp($page, 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     # Query Data
     $query = "SELECT r1.regat_uid AS user_id, user_name, user_level, user_countryid, r1.regat_sid, r1.regat_solved AS solved, r2.sum AS sum " . "FROM {$regat} AS r1 " . "JOIN (SELECT regat_uid,SUM(regat_score) AS sum FROM {$regat} WHERE regat_langid={$langid}  GROUP BY regat_uid ORDER BY SUM(regat_score) DESC LIMIT {$from},{$ipp}) AS r2 ON r1.regat_uid=r2.regat_uid " . "JOIN {$users} AS u ON u.user_id=r1.regat_uid " . "WHERE regat_options&4=0 " . "ORDER BY sum DESC ";
     if (false === ($result = $db->queryRead($query))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     //		var_dump($query);
     $data = array();
     while (false !== ($row = $db->fetchAssoc($result))) {
         $uid = intval($row['user_id']);
         if (!isset($data[$uid])) {
             $data[$uid] = new GWF_User($row);
         }
         $sid = $row['regat_sid'];
         $data[$uid]->setVar('ss_' . $sid, (double) $row['solved']);
     }
     $db->free($result);
     # Show template
     $tVars = array('rank' => $from + 1, 'hlrank' => $hl_rank, 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'lang_ranking/' . $iso . '/page-%PAGE%'), 'langname' => $lang->displayName(), 'users' => $data, 'sites' => WC_Site::getSitesLang($langid), 'form_action' => $this->getMethodHref(), 'iso' => $lang->getISO());
     return $this->module->templatePHP('ranking_lang.php', $tVars);
 }
Пример #20
0
 private function getForm($row)
 {
     $user = GWF_User::getStaticOrGuest();
     if ($row === false) {
         $email = $user->getValidMail();
         $type = 0;
         $langid = GWF_Language::getCurrentID();
     } else {
         $email = $row->getEMail();
         $type = $row->getType();
         $langid = $row->getLangID();
     }
     $data = array('email' => array(GWF_Form::STRING, $email, $this->module->lang('th_email')), 'type' => array(GWF_Form::SELECT, GWF_Newsletter::getTypeSelectB($this->module, 'type', $type), $this->module->lang('th_type')), 'langid' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_Language::SUPPORTED, 'langid', $langid), $this->module->lang('th_langid')), 'sign' => array(GWF_Form::SUBMIT, $this->module->lang('btn_sign'), ''));
     return new GWF_Form(GDO::table('GWF_Newsletter'), $data);
 }
Пример #21
0
 public static function isValidLanguage($langid, $allow_zero = false, $bitmask = self::TYPE_ALL)
 {
     $min = $allow_zero === true ? -1 : 0;
     if ($min >= ($langid = (int) $langid)) {
         return false;
     }
     if ($langid === 0) {
         return true;
         # Zero allowed
     }
     if (false === ($lang = GWF_Language::getByID($langid))) {
         return false;
     }
     return $lang->isOptionEnabled($bitmask);
 }
Пример #22
0
 private function buildFAQ()
 {
     $back = array();
     $faq = GDO::table('GWF_HelpdeskFAQ');
     $lid = GWF_Language::getCurrentID();
     $where = "(hdf_langid=0 OR hdf_langid={$lid})";
     if (false === ($result = $faq->select('*', $where, '', NULL))) {
         return $back;
     }
     while (false !== ($row = $faq->fetch($result, GDO::ARRAY_A))) {
         $back[] = $this->buildFAQRow($row);
     }
     $faq->free($result);
     return $back;
 }
Пример #23
0
 private static function displayMenuLang(Module_PoolTool $module)
 {
     switch (GWF_Language::getCurrentISO()) {
         case 'de':
             $country = GWF_Country::getByTLD('gb');
             $to = 'en';
             break;
         case 'en':
         default:
             $country = GWF_Country::getByTLD('de');
             $to = 'de';
             break;
     }
     $href = sprintf('http://%s.%s%s', $to, GWF_DOMAIN, htmlspecialchars($_SERVER['REQUEST_URI']));
     return sprintf('<a href="%s">%s</a>', $href, $country->displayFlag());
 }
Пример #24
0
 public static function single($name, $selected, $parent_id = 0)
 {
     if (false === ($mod_cat = GWF_Module::loadModuleDB('Category', true, true))) {
         return GWF_HTML::err('ERR_MODULE_MISSING', array('Category'));
     }
     $langid = GWF_Language::getCurrentID();
     $data = array();
     $data[] = array('0', $mod_cat->lang('th_sel'));
     if (false !== ($cats = GWF_Category::getAllCategoriesCached())) {
         foreach ($cats as $cat) {
             $cat instanceof GWF_Category;
             $cat->loadTranslations();
             $trans = $cat->getTranslation($langid);
             $data[] = array($cat->getID(), false !== $trans ? $trans : $cat->getVar('cat_tree_key'));
         }
     }
     return GWF_Select::display($name, $data, $selected);
 }
Пример #25
0
 private function gTranslate()
 {
     if (false === ($post = $this->module->getCurrentPost())) {
         return $this->module->error('err_post');
     }
     if (false === ($thread = $post->getThread())) {
         return $this->module->error('err_post');
     }
     if (false === $thread->hasPermission(GWF_Session::getUser())) {
         return $this->module->error('err_post_perm');
     }
     $text = $post->displayTitle() . PHP_EOL . PHP_EOL . $post->displayMessage();
     $text = preg_replace('/<[^>]+>/', '', $text);
     $text = str_replace('|', '-', $text);
     $text = urlencode($text);
     $browser_lang = GWF_Language::getCurrentISO();
     $url = 'http://translate.google.com/translate_t#auto|' . $browser_lang . '|' . $text;
     header('Location: ' . $url);
 }
Пример #26
0
 private static function installGoogleHasIt(Module_Language $module, $dropTables)
 {
     $data = array('af', 'sq', 'ar', 'hy', 'az', 'eu', 'be', 'bg', 'ca', 'zh-CN', 'hr', 'cs', 'da', 'nl', 'en', 'et', 'tl', 'fi', 'fr', 'gl', 'ka', 'de', 'el', 'ht', 'iw', 'hi', 'hu', 'is', 'id', 'ga', 'it', 'ja', 'ko', 'lv', 'lt', 'mk', 'ms', 'mt', 'no', 'fa', 'pl', 'pt', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'sw', 'sv', 'th', 'tr', 'uk', 'ur', 'vi', 'cy', 'yi');
     $s = GWF_Language::GOOGLE_HAS_IT;
     if (false === GDO::table('GWF_Language')->update("lang_options=lang_options-{$s}", "lang_options&{$s}")) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     foreach ($data as $iso) {
         if (false === ($lang = GWF_Language::getByISO($iso))) {
             //				var_dump($iso);
             GWF_HTML::err('ERR_UNKNOWN_LANGUAGE', array($iso), true, true);
             continue;
         }
         if (false === $lang->saveOption($s, true)) {
             GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__), true, true);
         }
     }
     return '';
 }
Пример #27
0
 private static function sendMail(Module_Account $module, GWF_User $user, array $data)
 {
     $token = GWF_AccountChange::createToken($user->getID(), 'demo', serialize($data));
     $mail = new GWF_Mail();
     $mail->setSender($module->cfgMailSender());
     $mail->setReceiver($user->getVar('user_email'));
     $mail->setSubject($module->lang('chdemo_subj'));
     $username = $user->display('user_name');
     $timeout = GWF_Time::humanDuration($module->cfgChangeTime());
     $gender = GWF_HTML::display($user->getVar('user_gender'));
     $country = GWF_Country::getByIDOrUnknown($data['user_countryid'])->display('country_name');
     $lang1 = GWF_Language::getByIDOrUnknown($data['user_langid'])->display('lang_nativename');
     $lang2 = GWF_Language::getByIDOrUnknown($data['user_langid2'])->display('lang_nativename');
     $gender = GWF_HTML::lang('gender_' . $data['user_gender']);
     $birthdate = $data['user_birthdate'] > 0 ? GWF_Time::displayDate($data['user_birthdate'], true, 1) : GWF_HTML::lang('unknown');
     $link = self::getChangeLink($user->getID(), $token);
     $mail->setBody($module->lang('chdemo_body', array($username, $timeout, $gender, $country, $lang1, $lang2, $birthdate, $link)));
     return $mail->sendToUser($user) ? $module->message('msg_mail_sent') : GWF_HTML::err('ERR_MAIL_SENT');
 }
Пример #28
0
 private function getPageTranslationsString(GWF_Page $page, array $translations)
 {
     $back = '';
     foreach ($translations as $data) {
         list($title, $url, $id) = $data;
         $back .= sprintf('<a href="%s%s">%s</a>', GWF_WEB_ROOT, htmlspecialchars($url), GWF_Language::displayFlagByID($id));
     }
     return $back;
 }
Пример #29
0
function wordpat_getLangSelect()
{
    $data = array();
    $langs = array('en', 'fr', 'de');
    foreach ($langs as $iso) {
        if (false === ($lang = GWF_Language::getByISO($iso))) {
            continue;
        }
        $data[] = array($lang->displayName(), $iso);
    }
    return GWF_Select::display('iso', $data, Common::getPost('iso', 'en'));
}
Пример #30
0
 private function onLoggedIn(GWF_User $user, $isAjax)
 {
     $last_url = GWF_Session::getLastURL();
     if (false === GWF_Session::onLogin($user, isset($_POST['bind_ip']))) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
     GWF_LoginHistory::insertEvent($user->getID());
     # save last login time
     $user->saveVar('user_lastlogin', time());
     if ($this->module->cfgCleanupAlways()) {
         GWF_LoginFailure::cleanupUser($user->getID());
     }
     if ($isAjax) {
         return sprintf('1:%s', GWF_Session::getSessID());
     } else {
         GWF_Session::set('GWF_LOGIN_BACK', $last_url);
         if (false !== ($lang = $user->getLanguage())) {
             GWF_Language::setCurrentLanguage($lang);
         }
         if (0 < ($fails = GWF_LoginFailure::getFailCount($user, $this->module->cfgTryExceed()))) {
             GWF_Session::set('GWF_LOGIN_FAILS', $fails);
         }
         GWF_Website::redirect(GWF_WEB_ROOT . 'welcome');
     }
 }