예제 #1
0
파일: SendMail.php 프로젝트: sinfocol/gwf3
 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()));
 }
예제 #2
0
파일: Freeze.php 프로젝트: sinfocol/gwf3
 public function validate_username(Module_WeChall $m, $arg)
 {
     if (false === ($this->user = GWF_User::getByName($arg))) {
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     return false;
 }
예제 #3
0
파일: Admin.php 프로젝트: sinfocol/gwf3
 public function validate_username(Module_Ban $m, $arg)
 {
     if (false === ($this->user = GWF_User::getByName($arg))) {
         $_POST['username'] = '';
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     return false;
 }
예제 #4
0
파일: GWF_Guest.php 프로젝트: sinfocol/gwf3
 /**
  * Get a fake Guest User.
  * @return GWF_User
  */
 public static function getGuest()
 {
     static $GUEST;
     if (!isset($GUEST)) {
         $GUEST = new GWF_User(array('user_id' => '0', 'user_options' => 0, 'user_name' => GWF_HTML::lang('guest'), 'user_password' => '', 'user_regdate' => '', 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT), 'user_email' => '', 'user_gender' => GWF_User::NO_GENDER, 'user_lastlogin' => '0', 'user_lastactivity' => time(), 'user_birthdate' => '', 'user_avatar_v' => '0', 'user_countryid' => '0', 'user_langid' => '0', 'user_langid2' => '0', 'user_level' => '0', 'user_title' => '', 'user_settings' => '', 'user_data' => '', 'user_credits' => '0.00'));
     }
     return $GUEST;
 }
예제 #5
0
파일: SiteDescr.php 프로젝트: sinfocol/gwf3
 private function getFormEdit($langid, $desc)
 {
     $buttons = array('edit[' . $langid . ']' => $this->module->lang('btn_edit'), 'default[' . $langid . ']' => $this->module->lang('btn_set_default'), 'delete[' . $langid . ']' => $this->module->lang('btn_delete'));
     $default = $this->site->getVar('site_descr_lid');
     $is_def = $default == $langid ? GWF_HTML::lang('yes') : GWF_HTML::lang('no');
     $langname = GWF_Language::getByID($langid)->displayName();
     $data = array('default' => array(GWF_Form::HEADLINE, $is_def, $this->module->lang('th_is_default')), 'langid' => array(GWF_Form::HEADLINE, $langname, $this->module->lang('th_site_language')), 'descr' => array(GWF_Form::MESSAGE, $desc, $this->module->lang('th_site_description')), 'btns' => array(GWF_Form::SUBMITS, $buttons));
     return new GWF_Form($this, $data);
 }
예제 #6
0
파일: GWF_Ban.php 프로젝트: sinfocol/gwf3
 public function displayEndDate()
 {
     if ($this->isWarning()) {
         return '';
     } elseif ('' === ($ends = $this->getVar('ban_ends'))) {
         return GWF_HTML::lang('never');
     } else {
         return GWF_Time::displayDate($ends);
     }
 }
예제 #7
0
 public function validate_user_name(Module_Profile $m, $arg)
 {
     if (!($this->user_to_add = GWF_User::getByName($arg))) {
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     if ($this->user_to_add->getID() == GWF_Session::getUserID()) {
         return $m->lang('err_self_whitelist');
     }
     return false;
 }
예제 #8
0
파일: Bundle.php 프로젝트: sinfocol/gwf3
 public function validate_target(Module_Language $m, $arg)
 {
     if (isset($_POST['all_targets'])) {
         return false;
     }
     if (false === ($this->target = GWF_Language::getByID($arg))) {
         return GWF_HTML::lang('ERR_UNKNOWN_LANGUAGE');
     }
     return false;
 }
예제 #9
0
파일: LoginAs.php 프로젝트: sinfocol/gwf3
 public function onLoginAs()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateLoginAs();
     }
     if (false === ($user = GWF_User::getByName($form->getVar('username')))) {
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     GWF_Session::onLogin($user);
     return $this->module->message('msg_login_as', array($user->displayUsername()));
 }
예제 #10
0
파일: monthly.php 프로젝트: sinfocol/gwf3
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;
}
예제 #11
0
 /**
  * Return a public key in hex format or false.
  * @param string $key
  */
 public static function grabFingerprint($file_content)
 {
     $gpg = gnupg_init();
     if (false === ($result = gnupg_import($gpg, $file_content))) {
         GWF_Log::logCritical('gnupg_import() failed');
         GWF_Log::logCritical(GWF_HTML::lang('ERR_GENERAL', __FILE__, __LINE__));
         return false;
     }
     if ($result['imported'] + $result['unchanged'] === 0) {
         return false;
     }
     return $result['fingerprint'];
 }
예제 #12
0
function Upgrade_WeChall_5_03(Module_WeChall $module)
{
    GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Sites can have multiple warboxes now. (thx awe)"));
    $module->includeClass('WC_Site');
    $sites = GDO::table('WC_Site');
    $columns = array('site_warport', 'site_warhost', 'site_war_rs', 'site_war_ip');
    $back = '';
    foreach ($columns as $column) {
        if (!$sites->dropColumn($column)) {
            $back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
        }
    }
    return $back;
}
예제 #13
0
파일: API_Site.php 프로젝트: sinfocol/gwf3
 private function showAllSites()
 {
     if (false === ($sites = WC_Site::getSites('site_name ASC'))) {
         return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $back = '';
     foreach ($sites as $site) {
         $site instanceof WC_Site;
         if ($site->getURL() !== '') {
             $back .= $this->showSite($site);
         }
     }
     return $back;
 }
예제 #14
0
 public static function validate_langidMulti($langids, $allow_zero = false, $bitmask = self::TYPE_ALL)
 {
     # Zero and nothing
     if (!is_array($langids)) {
         return $allow_zero ? false : GWF_HTML::lang('ERR_UNKNOWN_LANGUAGE');
     }
     # Validate them all
     foreach ($langids as $langid) {
         if (!self::isValidLanguage($langid, false, $bitmask)) {
             return GWF_HTML::lang('ERR_UNKNOWN_LANGUAGE');
         }
     }
     return false;
 }
예제 #15
0
파일: GWF_Array.php 프로젝트: sinfocol/gwf3
 /**
  * Implode an array like humans would do:
  * Example: 1, 2, 3 and last
  * @todo Make it recursive?
  * @param array $array
  * @return string
  */
 public static function implodeHuman(array $array)
 {
     static $and = NULL;
     $cnt = count($array);
     if ($cnt <= 0) {
         return '';
     } elseif ($cnt === 1) {
         return array_pop($array);
     }
     if ($and === NULL) {
         $and = GWF_HTML::lang('and');
     }
     $last = array_pop($array);
     return implode(', ', $array) . " {$and} {$last}";
 }
예제 #16
0
파일: AddPoll.php 프로젝트: sinfocol/gwf3
 private function getPollSelect()
 {
     if (false === ($mv = GWF_Module::getModule('Votes'))) {
         return GWF_HTML::lang('ERR_MODULE_MISSING', array('Votes'));
     }
     $uid = GWF_Session::getUserID();
     if (false === ($polltable = GDO::table('GWF_VoteMulti'))) {
         return GWF_HTML::lang('ERR_MODULE_MISSING', array('Votes'));
     }
     $polls = $polltable->selectAll('vm_id, vm_title', "vm_uid={$uid}", 'vm_title ASC', NULL, -1, -1, GDO::ARRAY_N);
     $data = array(array('0', $this->module->lang('sel_poll')));
     foreach ($polls as $poll) {
         $data[] = $poll;
         //			$data[] = $poll;array($poll[0], $poll->getVar('vm_title'), );
     }
     return GWF_Select::display('pollid', $data, Common::getPostString('pollid', '0'));
 }
예제 #17
0
파일: Show.php 프로젝트: sinfocol/gwf3
 private function sanitize()
 {
     if (false === ($this->cat = GWF_Category::getByID(Common::getGet('catid', 0)))) {
         $this->catid = 0;
         $this->catTitle = GWF_HTML::lang('no_category');
     } else {
         $this->catid = $this->cat->getID();
         $this->catTitle = $this->cat->getTranslatedText();
     }
     $news = GDO::table('GWF_News');
     $catQuery = $this->catid === 0 ? '1' : "news_catid={$this->catid}";
     $hiddenQuery = "news_options&1=0";
     $condition = "({$catQuery}) AND ({$hiddenQuery})";
     $this->numNews = $news->countRows($condition);
     $npp = $this->module->getNewsPerPage();
     $this->nPages = GWF_PageMenu::getPagecount($npp, $this->numNews);
     $this->page = intval(Common::clamp(Common::getGet('page', '1'), 1, $this->nPages));
 }
예제 #18
0
function Upgrade_WeChall_5_04(Module_WeChall $module)
{
    GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Warboxes can have flags now. (thx Steven)"));
    $back = '';
    # Kill Old Warbox mode bit
    $killbit = WC_Site::NO_V1_SCRIPTS;
    $module->includeClass('WC_Site');
    $sites = GDO::table('WC_Site');
    if (!$sites->update("site_options=site_options&{$killbit}")) {
        $back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    $module->includeClass('WC_Warbox');
    $boxes = GDO::table('WC_Warbox');
    if (!$boxes->createColumn('wb_options')) {
        $back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    return $back;
}
예제 #19
0
 public static function installCurrencies(Module_Payment $module, $dropTable)
 {
     $path = GWF_CORE_PATH . '/module/Payment/install/_currencies.txt';
     if (false === ($fh = @fopen($path, 'r'))) {
         return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($path));
     }
     $n = 0;
     $errors = array();
     while (false !== ($line = fgets($fh))) {
         $n++;
         if ($line[0] === '#') {
             continue;
         }
         $cols = explode("\t", $line);
         $cols = array_map('trim', $cols);
         if (count($cols) < 6) {
             $errors[] = sprintf('Error in currency file %s line %d.', $path, $n);
             continue;
         }
         list($countryname, $currency, $char, $iso, $fracname, $multi) = $cols;
         if (false === ($c = GWF_Country::getByName($countryname))) {
             $errors[] = sprintf('Unknown Country %s in currency file %s line %d.', $countryname, $path, $n);
         } elseif ($currency == '') {
             $errors[] = sprintf('Unknown Currency for %s in currency file %s line %d.', $countryname, $path, $n);
         } elseif ($char == '') {
             $errors[] = sprintf('No Symbol for %s in currency file %s line %d.', $currency, $path, $n);
         } elseif (strlen($iso) !== 3) {
             continue;
             $errors[] = sprintf('No ISO for %s in currency file %s line %d.', $currency, $path, $n);
         } elseif ($fracname == '') {
             $errors[] = sprintf('No Fraction Name for %s in currency file %s line %d.', $currency, $path, $n);
         } elseif ($multi !== '1,000' && $multi !== '100' && $multi !== '10') {
             $errors[] = sprintf('Invalid Multiplier for %s in currency file %s line %d.', $currency, $path, $n);
         } else {
             $row = new GWF_Currency(array('curr_iso' => $iso === 'None' ? sprintf('%03d', $n) : strtoupper($iso), 'curr_cid' => $c->getID(), 'curr_char' => $char, 'curr_digits' => $multi === '100' ? 2 : ($multi === '1,000' ? 3 : ($multi === '10' ? 2 : 0))));
             if (false === $row->replace()) {
                 $errors[] = GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
                 break;
             }
         }
     }
     fclose($fh);
     return GWF_HTML::error('Install Currencies', $errors);
 }
예제 #20
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');
 }
예제 #21
0
function Upgrade_WeChall_5_02(Module_WeChall $module)
{
    GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Sites have hostname, port, reducescore and IP now. (thx epoch)"));
    $module->includeClass('WC_Site');
    $sites = GDO::table('WC_Site');
    if (!$sites->createColumn('site_warhost')) {
        return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    if (!$sites->createColumn('site_warport')) {
        return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    if (!$sites->createColumn('site_war_rs')) {
        return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    if (!$sites->createColumn('site_war_ip')) {
        return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    return '';
}
예제 #22
0
 public function after_pull($repo_id, array $data)
 {
     // 		printf("DOGMOD_CVS::afterPull($repo_id): %s\n", print_r($data, true));
     $code = $data[0];
     $pullResult = $data[1];
     $this->pulling = false;
     if (!($repo = Dog_Repo::getByID($repo_id))) {
         Dog_Log::critical(GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__)));
         return;
     }
     if (!$repo->isNew($pullResult)) {
         return;
     }
     if (!$repo->storePullResult($pullResult)) {
         Dog_Log::critical(GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__)));
         return;
     }
     $this->announce_commit($repo);
 }
예제 #23
0
 public static function validate_countryidMulti($arg, $allow_zero = false)
 {
     if (!is_array($arg)) {
         return $allow_zero === true ? false : GWF_HTML::lang('ERR_UNKNOWN_COUNTRY');
     }
     $success = true;
     foreach ($arg as $cid) {
         if ($cid === '0') {
             if ($allow_zero === false) {
                 $success = false;
                 break;
             }
         } elseif (false === self::getByID($cid)) {
             $success = false;
             break;
         }
     }
     return $success === true ? false : GWF_HTML::lang('ERR_UNKNOWN_COUNTRY');
 }
예제 #24
0
파일: API_User.php 프로젝트: sinfocol/gwf3
 private function showUser(GWF_User $user, $api_key)
 {
     if (false !== ($error = $this->module->isExcludedFromAPI($user, $api_key))) {
         return $error;
     }
     $private_mode = $this->module->isAPIKeyCorrect($user, $api_key);
     require_once GWF_CORE_PATH . 'module/WeChall/WC_RegAt.php';
     if (false === ($regats = WC_RegAt::getRegats($user->getID(), 'regat_solved ASC'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     require_once GWF_CORE_PATH . 'module/Forum/GWF_ForumOptions.php';
     if (false === ($fopts = GWF_ForumOptions::getUserOptions($user, false))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $unknown = GWF_HTML::lang('unknown');
     if ('0' === ($countryid = $user->getVar('user_countryid'))) {
         $country = false;
         $cname = $unknown;
         $crank = $unknown;
     } else {
         $country = GWF_Country::getByID($countryid);
         $cname = $country->displayName();
         $crank = WC_RegAt::calcExactCountryRank($user);
     }
     $back = '';
     $back .= 'Username:'******'user_name') . PHP_EOL;
     $back .= 'Country:' . $cname . PHP_EOL;
     $back .= 'Totalscore:' . $user->getVar('user_level') . PHP_EOL;
     $back .= 'GlobalRank:' . WC_RegAt::calcExactRank($user) . PHP_EOL;
     $back .= 'CountryRank:' . $crank . PHP_EOL;
     $back .= $this->contactData($user);
     $back .= 'ForumPosts:' . $fopts->getVar('fopt_posts') . PHP_EOL;
     $back .= 'ForumThanks:' . $fopts->getVar('fopt_thanks') . PHP_EOL;
     $back .= 'ForumVoteUp:' . $fopts->getVar('fopt_upvotes') . PHP_EOL;
     $back .= 'ForumVoteDown:' . $fopts->getVar('fopt_downvotes') . PHP_EOL;
     $back .= $this->regatData($user, $regats);
     if ($private_mode === true) {
         $back .= $this->privateData($user);
     }
     return $back;
 }
예제 #25
0
파일: Sign.php 프로젝트: sinfocol/gwf3
 private function getSignInfo()
 {
     if (false === ($user = GWF_Session::getUser())) {
         return $this->module->lang('sign_info_login');
     }
     $type = GWF_Newsletter::getEmailTypeForUser($user);
     switch ($type) {
         case 0:
             $key = 'sign_info_none';
             break;
         case GWF_Newsletter::WANT_HTML:
             $key = 'sign_info_html';
             break;
         case GWF_Newsletter::WANT_TEXT:
             $key = 'sign_info_text';
             break;
         default:
             return GWF_HTML::lang('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     return $this->module->lang($key);
 }
예제 #26
0
 public static function multi($name, $selected = true, $allow_empty = true, $own_groups_only = true)
 {
     $user = GWF_User::getStaticOrGuest();
     if (false === ($groups = GDO::table('GWF_Group')->select('group_id, group_name'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if ($selected === true) {
         $selected = Common::getPostArray($name, array());
     }
     $data = array();
     if ($allow_empty) {
         $data[] = array('0', GWF_HTML::lang('sel_group'));
     }
     while (false !== ($group = GDO::table('GWF_Group')->fetch($groups, GDO::ARRAY_N))) {
         if ($own_groups_only && !$user->isInGroupName($group[1])) {
             continue;
         }
         $data[] = $group;
     }
     return GWF_Select::multi($name, $data, $selected);
 }
예제 #27
0
파일: crackcha.php 프로젝트: sinfocol/gwf3
function crackcha_next(WC_Challenge $chall)
{
    if (crackcha_round_over()) {
        header('Content-Type: text/plain');
        if (false === crackcha_insert_high($chall)) {
            echo GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
            return;
        } else {
            echo $chall->lang('msg_insert_high') . PHP_EOL;
            echo crackcha_reset($chall);
            return;
        }
    }
    require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
    $chars = GWF_Random::randomKey(5, GWF_Random::ALPHAUP);
    crackcha_increase_count();
    GWF_Session::set('WCC_CRACKCHA_CHARS', $chars);
    $aFonts = array(GWF_PATH . 'extra/font/teen.ttf');
    $rgbcolor = GWF_CAPTCHA_COLOR_BG;
    $oVisualCaptcha = new PhpCaptcha($aFonts, 210, 42, $rgbcolor);
    $oVisualCaptcha->Create('', $chars);
}
예제 #28
0
function wcProfileLastActivity(GWF_User $user, $ipp, $priv = false)
{
    $uid = $user->getID();
    $uh = GDO::table('WC_HistoryUser2');
    $entries = $uh->selectObjects('*', "userhist_uid={$uid}", 'userhist_date DESC', $ipp);
    //	$entries = array_reverse($entries);
    $back = '';
    $back .= '<table class="cl">';
    $href_txt_history = GWF_WEB_ROOT . 'history/for/' . $user->urlencode2('user_name');
    $anchor = GWF_HTML::anchor($href_txt_history, WC_HTML::lang('th_last_activites', array($user->displayUsername())));
    $back .= sprintf('<thead><tr><th colspan="2">%s</th></tr></thead>', $anchor);
    $unknown = GWF_HTML::lang('unknown');
    foreach ($entries as $entry) {
        $entry instanceof WC_HistoryUser2;
        $back .= GWF_Table::rowStart();
        $back .= sprintf('<td class="gwf_date">%s</td>', $priv ? $unknown : $entry->displayDate());
        $back .= sprintf('<td>%s</td>', $entry->displayComment());
        $back .= GWF_Table::rowEnd();
    }
    $back .= '</table>';
    return $back;
}
예제 #29
0
파일: IRC.php 프로젝트: sinfocol/gwf3
 public function execute()
 {
     GWF_Website::plaintext();
     if (false === ($datestamp = Common::getGet('datestamp'))) {
         return 'TRY ?datestamp=YYYYMMDDHHIISS&limit=5';
     }
     if (strlen($datestamp) !== 14) {
         return 'TRY ?datestamp=YYYYMMDDHHIISS&limit=5';
     }
     if (0 === ($limit = Common::getGetInt('limit', 0))) {
         return 'TRY ?datestamp=YYYYMMDDHHIISS&limit=5';
     }
     $date = GDO::escape($datestamp);
     $limit = Common::clamp($limit, 1, 25);
     if (false === ($result = GDO::table('GWF_ForumThread')->selectObjects('*', "thread_lastdate>='{$date}' AND thread_options&4=0", 'thread_lastdate DESC', $limit))) {
         return GWF_HTML::lang('ERR_DATABASE', __FILE__, __LINE__);
     }
     $back = '';
     $unknown = GWF_HTML::lang('unknown');
     foreach (array_reverse($result) as $thread) {
         #timestamp::lock::postid::threadid::posturl::userurl::username::title
         $thread instanceof GWF_ForumThread;
         $locked = $thread->getVar('thread_gid') === '0' ? '0' : '1';
         $back .= $thread->getVar('thread_tid');
         $back .= '::';
         $back .= $thread->getVar('thread_lastdate');
         $back .= '::';
         $back .= $thread->getVar('thread_gid');
         $back .= '::';
         $back .= 'https://' . GWF_DOMAIN . $thread->getLastPageHREF($locked === '1');
         $back .= '::';
         $back .= $locked === '1' ? $unknown : $this->getLastPosterName($thread);
         $back .= '::';
         $back .= $locked === '1' ? $unknown : $thread->getVar('thread_title');
         $back .= PHP_EOL;
     }
     return $back;
 }
예제 #30
0
<?php

Module_WeChall::includeForums();
$chall = $tVars['chall'];
$chall instanceof WC_Challenge;
$headers = array(array($tLang->lang('th_length'), 'wmc_length'), array($tLang->lang('th_csolve_date'), 'wmc_date'), array($tLang->lang('th_user_name'), 'user_name'), array($tLang->lang('th_solution'), 'wmc_solution'));
$chall->showHeader(true);
echo GWF_Box::box($tVars['table_title']);
echo $tVars['page_menu'];
echo GWF_Table::start();
//echo GWF_Table::displayHeaders1($headers, $tVars['sort_url'], 'wmc_date', 'ASC', 'by', 'dir', $tVars['table_title']);
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
$guest = GWF_Guest::getGuest();
$userr = new GWF_User(false);
foreach ($tVars['data'] as $row) {
    if ($row['user_name'] === NULL) {
        $username = GWF_HTML::lang('guest');
    } else {
        $userr->setGDOData($row);
        $username = $userr->displayProfileLink();
    }
    echo GWF_Table::rowStart();
    echo GWF_Table::column($row['wmc_length'], 'gwf_num');
    echo GWF_Table::column(GWF_Time::displayDate($row['wmc_date']), 'gwf_date');
    echo GWF_Table::column($username);
    echo GWF_Table::column($row['wmc_solution']);
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo $tVars['page_menu'];