コード例 #1
0
ファイル: GWF_LinksFavorite.php プロジェクト: sinfocol/gwf3
 public static function mark(GWF_User $user, GWF_Links $link, $bool)
 {
     $userid = $user->getID();
     $linkid = $link->getID();
     $is_fav = self::table(__CLASS__)->getRow($userid, $linkid) !== false;
     if ($is_fav === $bool) {
         return true;
     }
     $row = new self(array('lf_uid' => $userid, 'lf_lid' => $linkid));
     if ($bool) {
         if (!$row->replace()) {
             return false;
         }
     } else {
         if (!$row->delete()) {
             return false;
         }
     }
     if (false === $link->increase('link_favcount', $bool ? 1 : -1)) {
         return false;
     }
     if (false === $link->onCalcPopularity()) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: Vote.php プロジェクト: sinfocol/gwf3
 private function onUserVote(GWF_User $user)
 {
     if (false !== ($err = $this->votescore->onUserVoteSafe($this->score, $user->getID()))) {
         return $err;
     }
     return $this->onVoted($user);
 }
コード例 #3
0
ファイル: AssignWork.php プロジェクト: sinfocol/gwf3
 public function onAssign(GWF_HelpdeskTicket $ticket, GWF_User $user)
 {
     if (false === $ticket->saveVars(array('hdt_worker' => $user->getID(), 'hdt_status' => 'working'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_assigned', array($ticket->getID(), $user->displayUsername()));
 }
コード例 #4
0
ファイル: Slay_Lyrics.php プロジェクト: sinfocol/gwf3
 public static function isEnabledLyrics(Slay_Song $song, GWF_User $user)
 {
     if (false === ($row = self::getByIDs($song->getID(), $user->getID()))) {
         return true;
     }
     return $row->isOptionEnabled(self::ENABLED);
 }
コード例 #5
0
ファイル: WC_Warchalls.php プロジェクト: sinfocol/gwf3
 public static function markSolved(GWF_User $user, WC_Warchall $chall)
 {
     if (!self::table(__CLASS__)->insertAssoc(array('wc_wcid' => $chall->getID(), 'wc_uid' => $user->getID(), 'wc_solved_at' => GWF_Time::getDate(14)))) {
         return false;
     }
     return true;
 }
コード例 #6
0
ファイル: API_User.php プロジェクト: sinfocol/gwf3
 private function contactData(GWF_User $user)
 {
     require_once GWF_CORE_PATH . 'module/Profile/GWF_Profile.php';
     if (false === ($p = GWF_Profile::getProfile($user->getID()))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if ($p->isGuestHidden() || $p->isHiddenLevel(0)) {
         return '';
     }
     $back = '';
     if ('' !== ($v = $p->getVar('prof_firstname'))) {
         $back .= 'FirstName:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_lastname'))) {
         $back .= 'LastName:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_street'))) {
         $back .= 'Street:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_city'))) {
         $back .= 'City:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_zip'))) {
         $back .= 'ZIPCode:' . $v . PHP_EOL;
     }
     if ($p->isContactHiddenLevel(0)) {
         return $back;
     }
     if ($user->isOptionEnabled(GWF_User::SHOW_EMAIL)) {
         if ('' !== ($v = $user->displayEMail())) {
             $back .= 'EMail:' . $v . PHP_EOL;
         }
     }
     if ('' !== ($v = $p->getVar('prof_tel'))) {
         $back .= 'Tel:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_mobile'))) {
         $back .= 'Mobile:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_icq'))) {
         $back .= 'ICQ:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_msn'))) {
         $back .= 'MSN:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_jabber'))) {
         $back .= 'Jabber:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_skype'))) {
         $back .= 'Skype:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_yahoo'))) {
         $back .= 'Yahoo!:' . $v . PHP_EOL;
     }
     if ('' !== ($v = $p->getVar('prof_aim'))) {
         $back .= 'AIM:' . $v . PHP_EOL;
     }
     return $back;
 }
コード例 #7
0
ファイル: Slay_Tag.php プロジェクト: sinfocol/gwf3
 public static function mayAddTag(GWF_User $user)
 {
     if ($user->isStaff()) {
         return true;
     }
     $uid = $user->getID();
     return self::table(__CLASS__)->selectFirst('1', "st_uid={$uid}") === false;
 }
コード例 #8
0
ファイル: GWF_PMOptions.php プロジェクト: sinfocol/gwf3
 private static function createPMOptions(GWF_User $user)
 {
     $row = new self(array('pmo_uid' => $user->getVar('user_id'), 'pmo_options' => 0, 'pmo_auto_folder' => 0, 'pmo_signature' => '', 'pmo_level' => 0));
     if (false === $row->replace()) {
         return false;
     }
     //		$row->setVar('pmo_uid', $user);
     return $row;
 }
コード例 #9
0
ファイル: CrossLogin.php プロジェクト: sinfocol/gwf3
 private function onCrossLoginB(GWF_User $user)
 {
     if ($user->isDeleted()) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (false === GWF_Session::onLogin($user, false, true)) {
         return $this->module->error('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_cross_login');
 }
コード例 #10
0
ファイル: WC_FirstLink.php プロジェクト: sinfocol/gwf3
 public static function insertFirstLink(GWF_User $user, WC_Site $site, $onsitename, $onsitescore)
 {
     $table = self::table(__CLASS__);
     $siteid = $site->getVar('site_id');
     if (false !== $table->getRow($onsitename, $siteid)) {
         return true;
     }
     $entry = new self(array('fili_onsitename' => $onsitename, 'fili_sid' => $siteid, 'fili_date' => GWF_Time::getDate(GWF_Date::LEN_DAY), 'fili_uid' => $user->getVar('user_id'), 'fili_username' => $user->getVar('user_name'), 'fili_sitename' => $site->getVar('site_name'), 'fili_percent' => $site->getPercent($onsitescore)));
     //		echo GWF_HTML::message('DEBUG', 'Insert First Link...');
     return $entry->insert();
 }
コード例 #11
0
ファイル: GWF_PMInstall.php プロジェクト: sinfocol/gwf3
 private static function installPMBot(Module_PM $module)
 {
     $user = new GWF_User(array('user_name' => '_GWF_PM_BOT_', 'user_password' => 'x', 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT, '127.0.0.1'), 'user_email' => GWF_BOT_EMAIL, 'user_birthdate' => GWF_Time::getDate(GWF_Time::LEN_DAY), 'user_countryid' => 0, 'user_langid' => 0, 'user_options' => GWF_User::BOT, 'user_lastactivity' => time()));
     if (false === $user->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === GWF_ModuleLoader::saveModuleVar($module, 'pm_bot_uid', $user->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return '';
 }
コード例 #12
0
ファイル: UserGroup.php プロジェクト: sinfocol/gwf3
 private function getGroupSelect(GWF_User $user)
 {
     $groups = GDO::table('GWF_Group')->selectAll('group_id, group_name');
     $data = array();
     $data[] = array('0', $this->module->lang('sel_group'));
     foreach ($groups as $group) {
         if (!$user->isInGroupID($group['group_id'])) {
             $data[] = array($group['group_id'], $group['group_name']);
         }
     }
     return GWF_Select::display('groups', $data, intval(Common::getPost('groups')));
 }
コード例 #13
0
ファイル: GWF_AccountDelete.php プロジェクト: sinfocol/gwf3
 public static function insertNote(GWF_User $user, $note)
 {
     # no empty notes
     if ($note === '') {
         return false;
     }
     # insert it
     $entry = new self(array('accrm_uid' => $user->getVar('user_id'), 'accrm_note' => $note));
     if (false === $entry->replace()) {
         return false;
     }
     return $note;
 }
コード例 #14
0
ファイル: WC_PasswordMap.php プロジェクト: sinfocol/gwf3
 public static function convert(GWF_User $user, $password)
 {
     if (false === ($row = self::table(__CLASS__)->getRow($user->getID()))) {
         return true;
     }
     $oldHash = self::oldHash($password);
     if ($oldHash !== $row->getVar('pmap_password')) {
         return GWF_Module::getModule('WeChall')->error('err_password');
     }
     $row->delete();
     $user->saveVar('user_password', GWF_Password::hashPasswordS($password));
     return true;
 }
コード例 #15
0
ファイル: CreateTicket.php プロジェクト: sinfocol/gwf3
 private function onMailTicketB(GWF_HelpdeskTicket $ticket, GWF_HelpdeskMsg $message, GWF_User $user)
 {
     if ('' === ($rec = $user->getValidMail())) {
         return;
     }
     $mail = new GWF_Mail();
     $mail->setSender(GWF_BOT_EMAIL);
     $mail->setReceiver($rec);
     $mail->setSubject($this->module->langUser($user, 'subj_nt', array($ticket->getID())));
     $href_work = Common::getAbsoluteURL($this->module->getMethodURL('AssignWork', '&ticket=' . $ticket->getID() . '&worker=' . $user->getID() . '&token=' . $ticket->getHashcode()), false);
     $mail->setBody($this->module->langUser($user, 'body_nt', array($user->displayUsername(), $ticket->getCreator()->displayUsername(), $ticket->displayTitle($user), $message->displayMessage(), $href_work)));
     return $mail->sendToUser($user);
 }
コード例 #16
0
ファイル: RankingTag.php プロジェクト: sinfocol/gwf3
 private function calcRank(GWF_User $user, $bit)
 {
     $db = gdo_db();
     $bit = (int) $bit;
     $uid = $user->getVar('user_id');
     $score = $this->calcScore($user, $bit);
     $regat = GWF_TABLE_PREFIX . 'wc_regat';
     $query = "SELECT regat_uid, SUM(regat_score) AS sum " . "FROM {$regat} " . "WHERE regat_tagbits&{$bit} AND regat_options&4=0 " . "GROUP BY regat_uid " . "HAVING sum>{$score} OR (sum={$score} AND regat_uid<{$uid})";
     if (false === ($result = $db->queryRead($query, false))) {
         return -1;
     }
     $back = (int) $db->numRows($result);
     $db->free($result);
     return $back + 1;
 }
コード例 #17
0
ファイル: GWF_LangTrans.php プロジェクト: sinfocol/gwf3
 /**
  * Get the translation for a user.
  * A user can have two languages set, and there is browser lang as third fallback;
  * Enter description here ...
  * @param GWF_User $user
  * @param unknown_type $key
  * @param unknown_type $args
  */
 public function langUser(GWF_User $user, $key, $args)
 {
     // Primary
     $iso1 = $user->getVar('user_langid');
     if (false !== $this->loadLanguage($iso1)) {
         return $this->translate($iso1, $key, $args);
     }
     // Secondary
     $iso2 = $user->getVar('user_langid2');
     if (false !== $this->loadLanguage($iso2)) {
         return $this->translate($iso2, $key, $args);
     }
     // Browser
     return $this->translate(self::getBrowserISO(), $key, $args);
 }
コード例 #18
0
ファイル: GWF_Notice.php プロジェクト: sinfocol/gwf3
 /**
  * @todo create countUnread()
  * @param GWF_User $user
  * @param string $pattern
  * @param string $default
  * @return String
  */
 public static function getUnreadPM(GWF_User $user, $pattern = '[%s]', $default = '[0]')
 {
     if (false === self::loadModuleClass('PM', 'GWF_PM.php')) {
         return '';
     }
     if (false === $user->isGuest()) {
         $read = GWF_PM::READ;
         $userid = $user->getID();
         $count = GDO::table('GWF_PM')->countRows("pm_owner={$userid} AND pm_to={$userid} AND pm_options&{$read}=0");
         if ((int) $count > 0) {
             return sprintf($pattern, $count);
         }
     }
     return '';
 }
コード例 #19
0
ファイル: SetupGPGKey.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     if (false === ($user = GWF_User::getByID(Common::getGet('userid')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $tmpfile = GWF_PATH . 'extra/temp/gpg/' . $user->getVar('user_id');
     if (!is_file($tmpfile) || !is_readable($tmpfile)) {
         return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($tmpfile));
     }
     if (false === ($file_content = file_get_contents($tmpfile))) {
         return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($tmpfile));
     }
     if (false === unlink($tmpfile)) {
         return GWF_HTML::err('ERR_WRITE_FILE', array($tmpfile));
     }
     if (false === ($fingerprint = GWF_PublicKey::grabFingerprint($file_content))) {
         return $this->module->error('err_gpg_key');
     }
     if (Common::getGet('token') !== $fingerprint) {
         return $this->module->error('err_gpg_token');
     }
     if (false === GWF_PublicKey::updateKey($user->getID(), $file_content)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $user->saveOption(GWF_User::EMAIL_GPG, true)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_setup_gpg');
 }
コード例 #20
0
ファイル: RankingCountry.php プロジェクト: sinfocol/gwf3
 private function templateSingleU($username)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     return $this->templateSingle($user->getCountryID(), $user);
 }
コード例 #21
0
ファイル: RankingLang.php プロジェクト: sinfocol/gwf3
 private function templateRankingFor(GWF_Language $lang, $username)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     return $this->templateRanking($lang, $user);
 }
コード例 #22
0
ファイル: Songs.php プロジェクト: sinfocol/gwf3
 private function templateSongs()
 {
     //		$user = GWF_Session::getUser();
     //		$uid = $user->getID();
     $table = GDO::table('Slay_Song');
     $joins = NULL;
     $headers = array();
     $headers[] = array($this->module->lang('th_artist'), 'ss_artist');
     $headers[] = array($this->module->lang('th_title'), 'ss_title');
     $headers[] = array($this->module->lang('th_duration'), 'ss_duration');
     $headers[] = array($this->module->lang('th_bpm'), 'ss_bpm');
     $headers[] = array($this->module->lang('th_key'), 'ss_key');
     $headers[] = array($this->module->lang('D'));
     $headers[] = array($this->module->lang('L'));
     $headers[] = array($this->module->lang('T'));
     $headers[] = array($this->module->lang('th_tags'));
     $where = "";
     $nItems = $table->selectVar('COUNT(ss_id)', $where, '', $joins);
     $nPages = GWF_PageMenu::getPagecount(self::IPP, $nItems);
     $page = Common::clamp(Common::getGetInt('page'), 1, $nPages);
     $by = Common::getGetString('by', self::BY);
     $dir = Common::getGetString('dir', self::DIR);
     $orderby = $table->getMultiOrderby($by, $dir, false);
     $songs = $table->selectAll('*', $where, $orderby, $joins, self::IPP, GWF_PageMenu::getFrom($page, self::IPP), GDO::ARRAY_O);
     $tVars = array('is_dj' => GWF_User::isInGroupS('dj'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Slaytags&me=Songs&by=%BY%&dir=%DIR%&page=1', 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('index.php?mo=Slaytags&me=Songs&by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir))), 'songs' => $songs, 'headers' => $headers);
     return $this->module->template('songs.tpl', $tVars);
 }
コード例 #23
0
ファイル: Send.php プロジェクト: sinfocol/gwf3
 private function send()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateSend();
     }
     # Get reply to field
     if (false !== ($otherid = Common::getGetInt('reply', false))) {
     } elseif (false !== ($otherid = Common::getGetInt('quote', false))) {
     }
     $parent1 = $parent2 = 0;
     if ($otherid !== false) {
         if (false !== ($otherpm = GWF_PM::getByID($otherid))) {
             $parent1 = $otherpm->getID();
             if (false !== ($p2 = $otherpm->getOtherPM())) {
                 $parent2 = $p2;
             }
         }
     }
     $result = $this->module->deliver($this->user->getID(), $this->getReceiver()->getID(), $form->getVar('title'), $form->getVar('message'), $parent1, $parent2);
     $mail = '';
     switch ($result) {
         case '1':
             return $this->module->message('msg_mail_sent', array($this->getReceiver()->display('user_name')));
         case '0':
             break;
         case '-4':
             return GWF_HTML::err('ERR_MAIL_SENT');
         default:
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__ . ' - Code: ' . $result));
     }
     return $mail . $this->module->message('msg_sent');
 }
コード例 #24
0
ファイル: ChallsProfile.php プロジェクト: sinfocol/gwf3
 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);
 }
コード例 #25
0
ファイル: Edit.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     if (false === ($page = GWF_Page::getByID(Common::getGetString('pageid')))) {
         return $this->module->error('err_page');
     }
     $user = GWF_User::getStaticOrGuest();
     $this->is_author = $this->module->isAuthor($user);
     $this->is_owner = $this->is_author || $page->isOwner($user);
     if (!$this->is_owner && !$this->is_author) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     $this->page = $page;
     $this->user = $user;
     $this->is_oowner = $this->is_author ? true : $page->getOtherPage()->isOwner($user);
     $back = '';
     if (isset($_POST['edit'])) {
         $back .= $this->onEdit();
     } elseif (isset($_POST['unlock'])) {
         return $this->onUnlock() . $this->templateEdit();
     } elseif (isset($_POST['delete'])) {
         return $this->onDelete() . $this->templateEdit();
     } elseif (isset($_POST['translate'])) {
         GWF_Website::redirect($this->module->getMethodURL('Translate', '&pageid=' . $page->getID()));
         die;
     } elseif (isset($_POST['upload'])) {
         require_once GWF_CORE_PATH . 'module/PageBuilder/PB_Uploader.php';
         $back .= PB_Uploader::onUpload($this->module) . $this->templateEdit();
     }
     return $back . $this->templateEdit();
 }
コード例 #26
0
ファイル: Slay_TagVote.php プロジェクト: sinfocol/gwf3
 public static function addVotes(Slay_Song $song, GWF_User $user, array $tags)
 {
     $uid = $user->getID();
     $sid = $song->getID();
     $date = GWF_Time::getDate(GWF_Date::LEN_SECOND);
     $table = self::table(__CLASS__);
     foreach ($tags as $tag) {
         if (false === ($tid = Slay_Tag::getIDByName($tag))) {
             return false;
         }
         if (false === $table->insertAssoc(array('stv_uid' => $uid, 'stv_sid' => $sid, 'stv_tid' => $tid, 'stv_date' => $date), false)) {
             return false;
         }
     }
     return true;
 }
コード例 #27
0
ファイル: ShowComments.php プロジェクト: sinfocol/gwf3
 public function templateComments(Module_Comments $mod_c, GWF_News $news, GWF_Comments $comments)
 {
     $ipp = 10;
     $cid = $comments->getID();
     $nItems = $comments->getVar('cmts_count');
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('cpage'), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     // Method
     $me = $mod_c->getMethod('Reply');
     $me instanceof Comments_Reply;
     $where = "cmt_cid={$cid}";
     $with_perms = !GWF_User::isInGroupS('moderator');
     if ($with_perms) {
         $visible = GWF_Comment::VISIBLE;
         $deleted = GWF_Comment::DELETED;
         $flags = $visible | $deleted;
         $where .= " cmt_options & {$flags} = {$visible}";
     }
     $c = GDO::table('GWF_Comment')->selectObjects('*', 'cmt_cid=' . $comments->getID(), 'cmt_date ASC', $ipp, $from);
     $href = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-' . $page . '.html';
     $hrefp = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-%PAGE%.html';
     $tVars = array('news' => $news, 'newsitem' => Module_News::displayBoxB(array($news)), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $hrefp), 'comments' => $comments->displayComments($c, $href), 'form' => $me->templateReply($href));
     return $this->module->template('comments.tpl', $tVars);
 }
コード例 #28
0
ファイル: POISAdd.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $lat = $this->module->lat();
     $lon = $this->module->lon();
     $descr = trim(Common::getGetString('pp_descr'));
     $descr = $descr === '' ? null : $descr;
     $id = Common::getGetInt('pp_id', 0);
     $user = GWF_User::getStaticOrGuest();
     $uid = $user->getID();
     if (!GWF_ProfilePOI::changeAllowed($id, $uid)) {
         $this->module->ajaxError('Permission error!');
     }
     $count = $id === 0 ? GWF_ProfilePOI::getPOICount($uid) : 0;
     $max_pois = $this->module->cfgAllowedPOIs();
     if ($count >= $max_pois) {
         $this->module->ajaxErr('err_poi_exceed');
     }
     $poi = new GWF_ProfilePOI(array('pp_id' => $id, 'pp_uid' => $uid, 'pp_lat' => $lat, 'pp_lon' => $lon, 'pp_descr' => $descr));
     $poi->replace();
     $data = $poi->getGDOData();
     $data['user_name'] = $user->getVar('user_name');
     die(json_encode($data));
 }
コード例 #29
0
ファイル: Warsolve.php プロジェクト: sinfocol/gwf3
 private function onSolved(WC_Warflag $flag)
 {
     if ($this->box->isMultisolve()) {
         if (false !== ($err = $this->onMultiSolved($flag))) {
             return $err;
         }
     } else {
         if (false !== ($err = $this->onSingleSolved($flag))) {
             return $err;
         }
     }
     if (!$this->box->recalcPlayersAndScore()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === ($this->flags = WC_Warflag::getForBoxAndUser($this->box, $this->user, 'wf_order ASC'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $this->module->includeClass('WC_RegAt');
     if ($this->site->isUserLinked($this->user->getID())) {
         $result = $this->site->onUpdateUser($this->user);
         return $result->display($this->site->displayName());
     } else {
         return '_YOU_ARE_NOT_LINKED_TO_THE_SITE,_BUT_WELL_DONE!';
     }
 }
コード例 #30
0
ファイル: ShowUsers.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     if (false === ($group = GWF_Group::getByID(Common::getGet('gid')))) {
         return $this->module->error('err_unk_group');
     }
     if ($group->isOptionEnabled(GWF_Group::VISIBLE_MEMBERS)) {
     } else {
         switch ($group->getVisibleMode()) {
             case GWF_Group::VISIBLE:
                 break;
             case GWF_Group::COMUNITY:
                 if (!GWF_Session::isLoggedIn()) {
                     return GWF_HTML::err('ERR_NO_PERMISSION');
                 }
                 break;
             case GWF_Group::HIDDEN:
             case GWF_Group::SCRIPT:
                 if (!GWF_User::isInGroupS($group->getVar('group_name'))) {
                     return $this->module->error('err_not_invited');
                 }
                 break;
             default:
                 return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
         }
     }
     return $this->templateUsers($group);
 }