示例#1
0
 public function templateChalls(GWF_User $user)
 {
     $whitelist = array('chall_score', 'chall_title', 'chall_creator_name', 'chall_solvecount', 'chall_date', 'chall_dif', 'chall_edu', 'chall_fun', 'csolve_date', 'csolve_time_taken');
     require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
     $challs = GDO::table('WC_Challenge');
     $db = gdo_db();
     $uid = $user->getVar('user_id');
     $challs = GWF_TABLE_PREFIX . 'wc_chall';
     $solved = GWF_TABLE_PREFIX . 'wc_chall_solved';
     $by = GDO::getWhitelistedByS(Common::getGet('pcby'), $whitelist, self::DEFAULT_BY);
     $dir = GDO::getWhitelistedDirS(Common::getGet('pcdir'), self::DEFAULT_DIR);
     $orderby = "ORDER BY {$by} {$dir}";
     $query = "SELECT c.*, s.* FROM {$challs} c LEFT JOIN {$solved} s ON c.chall_id=s.csolve_cid AND s.csolve_uid={$uid} {$orderby}";
     $tVars = array('data' => $db->queryAll($query), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Profile&me=Profile&username='******'user_name') . '&pcby=%BY%&pcdir=%DIR%#wc_profile_challenges', 'table_title' => $this->module->lang('tt_challs_for', array('', $user->display('user_name'))));
     return $this->module->templatePHP('challs_profile.php', $tVars);
 }
示例#2
0
文件: Send.php 项目: sinfocol/gwf3
 private function create()
 {
     if (false === ($this->rec = GWF_User::getByName(Common::getPost('username'))) && false === ($this->rec = GWF_User::getByName(Common::getPost('username_sel')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER') . $this->module->requestMethodB('Overview');
     }
     GWF_Website::redirect(GWF_WEB_ROOT . 'pm/send/to/' . $this->rec->urlencode('user_name'));
     die;
 }
示例#3
0
function wcProfileGraph(GWF_User $user, $type)
{
    if (false === ($tu = GWF_Session::getUser()) || ($tu->getLevel() === 0 || $tu->getID() === $user->getID())) {
        $href = GWF_WEB_ROOT . 'graph/wc_' . $type . '.' . $user->urlencode('user_name') . '.png';
        $alt = WC_HTML::lang('alt_graph_' . $type, array($user->displayUsername()));
        return sprintf('<img src="%s" alt="%s" title="%s" />', $href, $alt, $alt);
    } else {
        $href = GWF_WEB_ROOT . 'graph/wc_' . $type . '.' . $user->urlencode('user_name') . '.vs.' . $tu->urlencode('user_name') . '.png';
        $alt = WC_HTML::lang('alt_graph_' . $type . '_vs', array($user->displayUsername(), $tu->displayUsername()));
        return sprintf('<img src="%s" alt="%s" title="%s" />', $href, $alt, $alt);
    }
}