Beispiel #1
0
 public function execute()
 {
     if (false !== ($term = Common::getRequest('term'))) {
         return $this->templateUsers(trim($term));
     }
     return $this->templateUsers();
 }
Beispiel #2
0
 public function onSearch()
 {
     $form = $this->getForm();
     //		if (false !== ($error = $form->validate($this->module))) {
     //			return $error.$this->templateSearch();
     //		}
     $users = GDO::table('GWF_User');
     $term = Common::getRequest('term');
     if (false !== ($error = $this->validate_term($this->module, $term))) {
         return $error;
     }
     $fields = array('user_name', 'user_email');
     $by = Common::getGet('by', self::DEFAULT_BY);
     $dir = Common::getGet('dir', self::DEFAULT_DIR);
     $orderby = $users->getMultiOrderby($by, $dir);
     if (false === ($conditions = GWF_QuickSearch::getQuickSearchConditions($users, $fields, $term))) {
         $conditions = '0';
     }
     $hits = $users->countRows($conditions);
     $ipp = $this->module->cfgUsersPerPage();
     $nPages = GWF_PageMenu::getPagecount($ipp, $hits);
     $page = Common::clamp((int) Common::getGet('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $tVars = array('searched' => true, 'form' => $form->templateX($this->module->lang('ft_search')), 'hits' => $hits, 'users' => $users->selectObjects('*', $conditions, $orderby, $ipp, $from), 'term' => $term, 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Admin&me=UserSearch&term=' . urlencode($term) . '&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=1'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Admin&me=UserSearch&term=' . urlencode($term) . '&by=%BY%&dir=%DIR%&page=1');
     return $this->module->templatePHP('user_search.php', $tVars);
 }
Beispiel #3
0
 private function templateOverview()
 {
     GWF_Website::setPageTitle($this->module->lang('pt_pm'));
     $fname = $this->folder->urlencodeSEO('pmf_name');
     $hrefPage = GWF_WEB_ROOT . sprintf('pm/folder/%s/%s/by/%s/%s/page-%%PAGE%%', $this->fid, $fname, urlencode(Common::getGet('by')), urlencode(Common::getGet('dir')));
     $hrefSort = GWF_WEB_ROOT . 'pm/folder/' . $this->fid . '/' . $fname . '/by/%BY%/%DIR%/page-1';
     $tVars = array('folder' => $this->folder, 'folders' => $this->folderTable(), 'form_new_folder' => $this->getFormNewFolder()->templateX($this->module->lang('ft_new_folder')), 'pms' => $this->pms, 'pagemenu' => GWF_PageMenu::display($this->page, $this->nPages, $hrefPage), 'sort_url' => $hrefSort, 'new_pm' => $this->getNewPMForm(), 'href_options' => $this->module->getOptionsHREF(), 'href_search' => $this->module->getSearchHREF(), 'folder_select' => GWF_PMFolder::getSelectS($this->module, Common::getRequest('folders', '0')), 'form_action' => isset($_SERVER['REQUEST_URI']) ? GWF_HTML::display($_SERVER['REQUEST_URI']) : GWF_WEB_ROOT . 'pm', 'href_trashcan' => $this->module->getMethodURL('Trashcan&by=pm_date&dir=DESC'));
     return $this->module->templatePHP('overview.php', $tVars);
 }
Beispiel #4
0
 private function templateThread()
 {
     $this->thread->increase('thread_viewcount', 1);
     if (false !== ($user = GWF_Session::getUser())) {
         if (false === $this->thread->markRead($user)) {
             echo GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
         }
     }
     $tVars = array('thread' => $this->thread, 'posts' => $this->thread->getPostPage($this->ppt, $this->page), 'pagemenu' => $this->getPageMenu(), 'actions' => true, 'title' => true, 'reply' => $this->thread->hasReplyPermission(GWF_Session::getUser(), $this->module), 'nav' => true, 'can_vote' => $user === false ? false : $this->module->cfgVotesEnabled(), 'can_thank' => $user === false ? false : $this->module->cfgThanksEnabled(), 'term' => GWF_QuickSearch::getQuickSearchHighlights(Common::getRequest('term', '')), 'page' => $this->page, 'href_add_poll' => $this->thread->hrefAddPoll(), 'href_edit' => $this->thread->getEditHREF());
     return $this->module->templatePHP('show_thread.php', $tVars);
 }
Beispiel #5
0
 private function validate()
 {
     if (false !== ($this->user1 = GWF_User::getByName(Common::getPost('wc_stat_user1')))) {
         #nice
     } elseif (false === Common::getGet('user1')) {
         $this->user1 = false;
         $score1 = 0;
     } elseif (false === ($this->user1 = GWF_User::getByName(Common::getGet('user1', 0)))) {
         if (false === ($this->user1 = GWF_Session::getUser())) {
             GWF_HTML::err('ERR_UNKNOWN_USER', NULL, true, true);
         }
     }
     if (false === ($this->user2 = GWF_User::getByName(Common::getGet('user2', 0)))) {
         if (false === ($this->user2 = GWF_User::getByName(Common::getPost('wc_stat_user2', 0)))) {
             $score2 = 0;
         }
     }
     if ($this->user2 !== false) {
         $score2 = $this->user2->getLevel();
     }
     if ($this->user1 !== false) {
         $score1 = $this->user1->getLevel();
     }
     //		if ($score1 <= 0 && $score2 <= 0) {
     //			return $this->module->error('err_graph_empty');
     //		}
     $sel = Common::getRequest('site', false);
     if (is_array($sel) && count($sel) === 0) {
         $sel = false;
     }
     //		var_dump($sel);
     if ($sel === false) {
         $sel = $this->getSelDefault(false);
     } elseif ($sel === 'all') {
         $sel = $this->getSelDefault(true);
     }
     if (!is_array($sel)) {
         $sel = trim($sel);
         if ($sel !== '') {
             $sel = array(intval($sel) => 'yes');
         } else {
             $sel = array();
         }
     } else {
         $sel2 = array();
         foreach ($sel as $sid => $on) {
             $sel2[intval($sid)] = 'on';
         }
         $sel = $sel2;
     }
     $this->sel = $sel;
     //		var_dump($sel);
     return false;
 }
Beispiel #6
0
 public function execute()
 {
     $syntax = 'syntax: ' . Common::getAbsoluteURL('remoteupdate.php') . '?sitename=FOO&username=BAR';
     $server = htmlspecialchars($_SERVER['SERVER_NAME'], ENT_QUOTES);
     $unknownsite = 'Join us: ' . Common::getAbsoluteURL('join_us');
     # "Join us: http://$server/join.php";
     $unknownuser = '******' . Common::getAbsoluteURL('register') . ' for global ranking. Please note that the username is case sensitive for remoteupdates.';
     // flag for images. 0=normal text, 1=default image, we can assign different image styles to higher numbers
     $img = (int) Common::getGet('img', 0);
     if ($img === 1) {
         header("Content-Type: image/png");
     }
     if (false === ($sitename = Common::getRequest('sitename'))) {
         $this->outDie($syntax);
     }
     if (false === ($onsitename = Common::getRequest('username'))) {
         $this->outDie($syntax);
     }
     if ($sitename === 'FOO' && $onsitename === 'BAR') {
         $this->outDie('Doh! Not literally!');
     }
     if (false === ($site = WC_Site::getByName($sitename)) && false === ($site = WC_Site::getByClassName($sitename))) {
         $this->outExit($unknownsite);
     }
     $this->module->includeClass('WC_RegAt');
     if (false === ($user = WC_RegAt::getUserByOnsiteName($onsitename, $site->getID()))) {
         $this->outExit($unknownuser);
     }
     # Update him
     $result = $site->onUpdateUser($user);
     $site->saveOption(WC_Site::AUTO_UPDATE, true);
     # Output result
     switch ($img) {
         case 0:
             $this->outResult($result);
             break;
         case 1:
             $this->imgDisplayText($result->getMessage());
             break;
     }
 }
Beispiel #7
0
 private function getFormQuick()
 {
     $data = array('mo' => array(GWF_Form::HIDDEN, 'PM'), 'me' => array(GWF_Form::HIDDEN, 'Search'), 'term' => array(GWF_Form::STRING, Common::getRequest('term', ''), $this->module->lang('searchterm')), 'qsearch' => array(GWF_Form::SUBMIT, $this->module->lang('btn_search')));
     return new GWF_Form($this, $data, 'get', 0);
 }
Beispiel #8
0
 /**
  * Get a real basic quicksearch form.
  * @param GWF_Module $module
  * @param callback $caller Validator
  * @param boolean $use_captcha
  */
 public static function getQuickSearchForm(GWF_Module $module, $caller, $use_captcha = false)
 {
     $data = array('term' => array(GWF_Form::STRING, Common::getRequest('term', ''), GWF_HTML::lang('term')), 'qsearch' => array(GWF_Form::SUBMIT, GWF_HTML::lang('search')));
     return new GWF_Form($caller, $data);
 }
Beispiel #9
0
 private function getSearchForm()
 {
     require 'UserSearch.php';
     $data = array('term' => array(GWF_Form::STRING, Common::getRequest('term', ''), GWF_HTML::lang('term')), 'search' => array(GWF_Form::SUBMIT, GWF_HTML::lang('search'), ''));
     return new GWF_Form('Admin_UserSearch', $data);
 }
Beispiel #10
0
 private function validate()
 {
     $this->validateDimension();
     if (false === ($this->user1 = GWF_User::getByName(Common::getRequest('user1', '')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === ($this->user2 = GWF_User::getByName(Common::getRequest('user2', '')))) {
         //			return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     // Check end date
     $this->end = sprintf('%04d%02d%02d', intval(Common::getGet('y', 0), 10), intval(Common::getGet('m', 0), 10), intval(Common::getGet('d', 0), 10));
     if (!GWF_Time::isValidDate($this->end, false, GWF_Date::LEN_DAY)) {
         return $this->module->error('err_end_date');
     }
     // Check start date
     $regdate1 = $this->user1->getVar('user_regdate');
     $regdate2 = $this->user2 === false ? $regdate1 : $this->user2->getVar('user_regdate');
     $this->start = $regdate1 < $regdate2 ? $regdate1 : $regdate2;
     $this->start = substr($this->start, 0, GWF_Date::LEN_DAY);
     if (0 < ($nm = intval(Common::getGet('nm', 0)))) {
         $time = GWF_Time::getTimestamp($this->end);
         $time -= $nm * GWF_Time::ONE_MONTH;
         $time = GWF_Time::getDate(GWF_Date::LEN_DAY, $time);
         if ($time > $this->start) {
             $this->start = $time;
         }
     }
     //		var_dump($this->start);
     // Check sites
     $sites = Common::getGetString('sites');
     if ($sites === 'all') {
         if ($this->user2 === false) {
             $this->sites = WC_Site::getLinkedSites($this->user1->getID());
         } else {
             $this->sites = WC_Site::getLinkedSitesVS2($this->user1->getID(), $this->user2->getID());
         }
         $temp = array();
         foreach ($this->sites as $site) {
             $temp[$site->getID()] = $site;
         }
         $this->sites = $temp;
     } else {
         $this->sites = array();
         $sites = explode(',', $sites);
         foreach ($sites as $siteid) {
             //				var_dump($siteid);
             $siteid = intval(trim($siteid));
             if (false !== ($site = WC_Site::getByID($siteid))) {
                 $this->sites[$siteid] = $site;
             }
         }
     }
     //		if (count($this->sites) === 0) {
     //			return $this->module->error('err_no_sites');
     //		}
     // Options
     $opts = explode(',', Common::getGet('opt', ''));
     foreach ($opts as $opt) {
         $opt = trim($opt);
         if ($opt === 'icons') {
             $this->withIcons = true;
         } elseif ($opt === 'nums') {
             $this->withNumbers = true;
         } elseif ($opt === 'zoom') {
             $this->withZoom = true;
         }
     }
     // All ok
     return false;
 }
Beispiel #11
0
 public function displayMessageTranslated($msg)
 {
     return GWF_Message::display($msg, true, $this->isOptionEnabled(self::SMILEYS), false, GWF_Message::getQuickSearchHighlights(Common::getRequest('term', '')));
 }