public static function updateUserData() { $userDataArray = UserDataDB::getUserDataBy('userDataId', $_SESSION['arguments']); if (empty($userDataArray)) { HomeView::show(); header('Location: /' . $_SESSION['base']); } elseif ($_SERVER["REQUEST_METHOD"] == "GET") { $_SESSION['userData'] = $userDataArray[0]; UserDataView::showUpdate(); } else { $userData = $userDataArray[0]; $parms = $userData->getParameters(); $parms['userId'] = array_key_exists('userId', $_POST) ? $_POST['userId'] : $userData->getUserId(); $parms['user_name'] = array_key_exists('user_name', $_POST) ? $_POST['user_name'] : ""; $parms['skill_level'] = array_key_exists('skill_level', $_POST) ? $_POST['skill_level'] : ""; $parms['skill_areas'] = array_key_exists('skill_areas', $_POST) ? $_POST['skill_areas'] : array(); $parms['profile_pic'] = array_key_exists('profile_pic', $_POST) ? $_POST['profile_pic'] : ""; $parms['started_hobby'] = array_key_exists('started_hobby', $_POST) ? $_POST['started_hobby'] : ""; $parms['fav_color'] = array_key_exists('fav_color', $_POST) ? $_POST['fav_color'] : ""; $parms['url'] = array_key_exists('url', $_POST) ? $_POST['url'] : ""; $parms['phone'] = array_key_exists('phone', $_POST) ? $_POST['phone'] : ""; $newUserData = new UserData($parms); $newUserData->setUserDataId($userData->getUserDataId()); $userDataEntry = UserDataDB::updateUserData($newUserData); if ($userDataEntry->getErrorCount() != 0) { $_SESSION['userData'] = array($newUserData); //return; UserDataView::showUpdate(); } else { HomeView::show(); header('Location: /' . $_SESSION['base']); } } }
public function testGetCallsFileGetContentsWithUserId() { $fileGetContents = \idfly\Moka::spy('"USER"'); $userData = new UserData($fileGetContents); $userData->get(1000); $this->assertEquals(['/data/1000.json'], $fileGetContents->report()[0]); }
public function isCaptchaNeeded($isHaveFailedLogin) { if ($isHaveFailedLogin) { if ($this->userData->getIpCountry() !== $this->loginData->getIpCountry()) { $this->logger->logAttempt($this->loginData->getLoginIp(), self::FAILED_IP_LIMIT); return true; } $loggerData = $this->logger->getAttempts(); $regexp = '/\\.([0-9]{1,3}$)/'; $ipRange = preg_replace($regexp, 'X', $this->loginData->getLoginIp()); if (@$loggerData[$this->loginData->getLoginIp()] >= self::FAILED_IP_LIMIT) { $this->logger->logAttempt($this->loginData->getLoginIp()); } else { $this->logger->logAttempt($this->loginData->getLoginIp()); $this->logger->logAttempt($this->loginData->getIpCountry()); $this->logger->logAttempt($this->loginData->getLoginName()); $this->logger->logAttempt($ipRange); } $loggerData = $this->logger->getAttempts(); $a = @$loggerData[$this->loginData->getLoginIp()] >= self::FAILED_IP_LIMIT || @$loggerData[$this->loginData->getLoginName()] >= self::FAILED_USER_LIMIT || @$loggerData[$this->loginData->getIpCountry()] >= self::FAILED_IP_COUNTRY_LIMIT || @$loggerData[$ipRange] >= self::FAILED_IP_RANGE_LIMIT; echo 'ezlett' . json_encode($loggerData); return $a; } return false; }
public function fetchInfo() { global $srkEnv; $code = $_GET['code']; $data = (object) array('client_id' => $srkEnv->thirdPartyLogin['github']->clientId, 'client_secret' => $srkEnv->thirdPartyLogin['github']->clientSecret, 'code' => $code, 'accept' => 'json'); $postRes = decipherGetStr(webPostData('https://github.com/login/oauth/access_token', $data)); if (isset($postRes['access_token'])) { $accessToken = $postRes['access_token']; $dataStr = webGetData('https://api.github.com/user?access_token=' . $accessToken); $userInfo = json_decode($dataStr); if (!$userInfo) { return 'Data fetching error'; } $userData = (object) array('userId' => 'github_' . $userInfo->login, 'email' => $userInfo->email, 'nickname' => $userInfo->name, 'accessToken' => $accessToken, 'avatarURL' => $userInfo->avatar_url, 'source' => 'github'); $user = new UserData(); $user->registerThirdParty($userData); $writeRes = $user->writeUser(); if (!$writeRes) { $_SESSION['userId'] = $userData->userId; } return $writeRes; } else { return 'Access code error'; } }
function amp_badge_related_form($data) { $data = array_merge($data, $_GET); foreach ($data as $key => $value) { if (is_array($value) && count($value) == 1) { $quick_val = array_values($value); $data[$key] = $quick_val[0]; } } $modin = isset($data['modin']) && $data['modin'] ? $data['modin'] : false; $related_index = isset($data['related_index']) && $data['related_index'] ? $data['related_index'] : false; if (!$modin) { return false; } if (!AMP_authenticate('admin')) { $live_forms = AMP_lookup('formsPublic'); if (!isset($live_forms[$modin])) { return 'Please publish the related form'; } } require_once 'AMP/UserData.php'; $udm = new UserData(AMP_Registry::getDbcon(), $modin); $udm->registerPlugin('Output', 'Text'); $udm->setData($data); $renderer = AMP_get_renderer(); # $delete_button = $renderer->form( $delete_button = $renderer->link('#', $renderer->image(AMP_SYSTEM_ICON_DELETE, array('class' => 'icon', 'style' => 'border: 0;')), array('alt' => AMP_TEXT_DELETE_ITEM, 'title' => AMP_TEXT_DELETE_ITEM, 'onClick' => "\$('form_related_item_{$related_index}').remove( ); \$('form_{$modin}_related_custom_fields_{$related_index}').remove(); return false;")); $content = $delete_button . $renderer->tag('pre', $udm->doPlugin('Output', 'Text')); $result = $renderer->div($content, array('class' => 'form_related_item', 'id' => 'form_related_item_' . $related_index)); return $result; }
/** * ユーザーデータ取得 * @param int (user_id) * @return array (user data) */ public function getUserData() { $user_id = $this->input->get_post('id', TRUE); $user_data = new UserData(); $data = $user_data->getUser($user_id); $this->output->set_output(json_encode($data)); $this->output->_display(); exit; }
/** * userデータの取得 * @param user_id */ function user() { $user_id = $_REQUEST['user_id']; $user_id = 1; $userData = new UserData(); $data = $userData->get_user($user_id); $this->output->set_output(json_encode($data)); $this->output->_display(); exit; }
/** * 出発させる * @params * @return */ public function questGo() { $data = array(); $user_id = $this->input->get_post('user_id', TRUE); $quest_data = $this->input->get_post('quest_select', TRUE); $userData = new UserData(); $userData->userQuestGo($user_id, $quest_data); // 更新したデータを返す $data = $userData->getUser($user_id); $this->output->set_output(json_encode($data)); $this->output->_display(); exit; }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $userdata = new UserData($_POST); if ($userdata->getErrorCount() == 0) { ProfileView::show($userdata); } else { SignupView::show($userdata); } } else { // Initial link SignupView::show(null); } }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $user = new User($_POST); $userData = new UserData($_POST); if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) { HomeView::show(); } else { SignupView::show($user, $userData); } } else { SignupView::show(null, null); } }
/** * 重新获取当前登录用户信息 */ protected function refreshCurrentUser() { $currUser = $this->getCurrentUser(); $currUser = UserData::getById($currUser['id']); $_SESSION['user'] = array('id' => $currUser['id'], 'mobile' => $currUser['mobile'], 'email' => $currUser['email'], 'passwd' => $currUser['passwd'], 'name' => $currUser['name']); return $currUser; }
/** * This class implements the Singleton pattern. There is only ever * one instance of the this class and it is accessed only via the * ClassName::instance() method. * * @return object * @access public * @since 5/26/05 * @static */ public static function instance() { if (!isset(self::$instance)) { self::$instance = new UserData(); } return self::$instance; }
public function tryConnect(SSH2DAO $ssh2dao) { UserData::$SSH2Data = $ssh2dao; $host = trim($ssh2dao->host); $port = $ssh2dao->port; $timeout = $ssh2dao->timeout; UserData::$SSH2Conn = new Net_SSH2($host, $port, $timeout); }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { //simpleEcho.php; $user = new User($_POST); $userData = new UserData($_POST); //print_r($_FILES); echo '<br>'; if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) { ProfileView::show($userData); } else { SignupView::show($user, $userData); } } else { // Initial link SignupView::show(null, null); } }
private function getUnreadCount() { $unreadCount = UserData::model()->getUnreadCount(Ibos::app()->user->uid); $sidebarUnreadMap["mention"] = $unreadCount["unread_atme"]; $sidebarUnreadMap["comment"] = $unreadCount["unread_comment"]; $sidebarUnreadMap["notify"] = $unreadCount["unread_notify"]; $sidebarUnreadMap["pm"] = $unreadCount["unread_message"]; return $sidebarUnreadMap; }
public static function run() { $user = null; $userData = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { $user = new User($_POST); //$dbUser = UsersDB::addUser($user); $userData = new UserData($_POST); //$_POST["userId"] = $user->getUserId(); if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) { $dbUserData = UsersDB::addUser($user, $userData); ProfileView::show($user, $userData); } else { SignupView::show($user, $userData); } } else { SignupView::show(null, null); } }
public function loginValidate() { // post data $user_name = $this->input->get_post('user_name', TRUE); $password = $this->input->get_post('password', TRUE); $userData = new UserData(); $isLogin = $userData->userLoginValidate($user_name, $password); $user = array(); if ($isLogin) { $user = $userData->getUserByName($user_name); log_message('debug', 'ログイン成功'); } else { $user['id'] = 0; log_message('debug', 'ログイン失敗'); redirect('Login/login'); } $data['data'] = $user['id']; $this->load->view('Mains/index', $data); }
/** * @return mixed|string */ public function getUserData() { try { return UserData::makeApiCall($this->username); } catch (InvalidUrlException $e) { return $e->getErrorMessage(); } catch (InvalidUsernameException $e) { return $e->getErrorMessage(); } }
public function getHeader($lang = array()) { $onlineStatus = UserUtil::getOnlineStatus($this->getUid()); $styleMap = array(-1 => "o-pm-offline", 1 => "o-pm-online"); $data = array("user" => $this->getUser(), "assetUrl" => $this->getAssetUrl("user"), "swfConfig" => AttachUtil::getUploadConfig(), "onlineIcon" => $styleMap[$onlineStatus], "lang" => $lang); if ($this->getIsWeiboEnabled()) { $data["userData"] = UserData::model()->getUserData($this->getUid()); !$this->getIsMe() && ($data["states"] = Follow::model()->getFollowState(Ibos::app()->user->uid, $this->getUid())); } return $this->renderPartial("application.modules.user.views.header", $data, true); }
/** * ログインバリデート */ public function login() { $data = array(); $user_name = $this->input->get_post('user_name', TRUE); $passwd = $this->input->get_post('passwd', TRUE); $userData = new UserData(); $isLogin = $userData->userLoginValidate($user_name, $passwd); $user = array(); if ($isLogin) { $user = $userData->getUserByName($user_name); log_message('debug', 'ログインに成功しているようです。'); } else { $user['id'] = 0; log_message('debug', 'ログインに失敗しているようです。'); } $data = $user; $this->output->set_output(json_encode($data)); $this->output->_display(); exit; }
protected function setDefaltInput() { parent::setDefaltInput(); $yourUser = new UserData(); $authorization = $yourUser->checkAuthorization(); if ($authorization) { $userData = $yourUser->getUserData(); } $this->insertValue['ip'] = parent::getOriginalPostValue('ip'); // $this->insertValue['fio'] = parent::getOriginalPostValue('fio'); $this->insertValue['fio'] = $userData['login']; $this->insertValue['date'] = date("Y-m-d h:i:s"); $this->insertValue['phone'] = parent::getOriginalPostValue('phone'); $this->insertValue['email'] = parent::getOriginalPostValue('email'); $this->insertValue['title'] = parent::getOriginalPostValue('title'); $this->insertValue['text'] = parent::getOriginalPostValue('text'); $this->insertValue['like'] = parent::getOriginalPostValue('like'); $this->insertValue['dislike'] = parent::getOriginalPostValue('dislike'); $this->insertValue['parentFeedback'] = parent::getOriginalPostValue('parentFeedback'); $this->originalInsertValue = $this->insertValue; }
public static function start() { if (URI::getUri(true) == '?logout') { UserData::$status = false; } $template = new Main(); $template->renderHead(); $template->renderMainContent(); $template->renderFooter(); echo URI::getID(); // Objects::select(); }
/** * Answer the head JS * * @return string * @access public * @since 1/13/09 * @static */ public static function getHeadJs() { ob_start(); print "\n\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "/javascript/UserData.js'></script>"; print "\n\t\t<script type='text/javascript'>\n\t\t// <![CDATA[\n\t\t\n\t\t\tvar userData = UserData.instance();\n"; $userData = UserData::instance(); foreach ($userData->getPreferenceKeys() as $key) { print "\n\t\t\tuserData.prefs['{$key}'] = '" . addslashes($userData->getPreference($key)) . "';"; } print "\n\t\t// ]]>\n\t\t</script>\n"; return ob_get_clean(); }
public function actionIndex() { $uid = Ibos::app()->user->uid; $unreadAtMe = UserData::model()->countUnreadAtMeByUid($uid); $pageCount = Atme::model()->countByAttributes(array("uid" => $uid)); $pages = PageUtil::create($pageCount); $atList = Atme::model()->fetchAllAtmeListByUid($uid, $pages->getLimit(), $pages->getOffset()); $feedIds = ConvertUtil::getSubByKey($atList, "feedid"); $diggArr = FeedDigg::model()->checkIsDigg($feedIds, $uid); $data = array("unreadAtmeCount" => $unreadAtMe, "list" => $atList, "pages" => $pages, "digg" => $diggArr); $this->setPageTitle(Ibos::lang("Mention me")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Mention me")))); $this->render("index", $data); }
/** * Execute * * @return void * @access public * @since 09/23/08 */ public function execute() { try { $this->start(); $userData = UserData::instance(); $userData->setPreference(RequestContext::value('key'), RequestContext::value('val')); print "\n\t<preference key=\"" . RequestContext::value('key') . '">'; print $userData->getPreference(RequestContext::value('key')); print '</preference>'; $this->end(); } catch (Exception $e) { HarmoniErrorHandler::logException($e); $this->error($e->getMessage(), get_class($e)); } }
/** * getAllLabels Helper * * @param array $data * @param function $callback * @return mixed */ static function getAllLabels(array $data, $callback = false) { // validate data parameters if (!isset($data['website'])) { throw new \InvalidArgumentException('website is required.'); } // setup the labels api $labels = new UserData($data); // run the show call $rsp = $labels->show(array('website' => $data['website'])); // add all the data to the labels array $labels = array(); foreach ($rsp as $label) { foreach ($label as $l) { $labels[$l->uid] = $l->meta->name; } } // run callback or return the label data if (is_callable($callback)) { $callback($labels); } else { return $labels; } }
public function addComment($data, $forApi = false, $notCount = false, $lessUids = null) { $add = $this->escapeData($data); if ($add["content"] === "") { $this->addError("comment", Ibos::lang("Required comment content", "message.default")); return false; } $add["isdel"] = 0; $res = $this->add($add, true); if ($res) { isset($data["touid"]) && !empty($data["touid"]) && ($lessUids[] = intval($data["touid"])); $scream = explode("//", $data["content"]); Atme::model()->addAtme("message", "comment", trim($scream[0]), $res, null, $lessUids); $table = ucfirst($add["table"]); $pk = $table::model()->getTableSchema()->primaryKey; $table::model()->updateCounters(array("commentcount" => 1), "`{$pk}` = {$add["rowid"]}"); if (Ibos::app()->user->uid != $add["moduleuid"] && $add["moduleuid"] != "") { !$notCount && UserData::model()->updateKey("unread_comment", 1, true, $add["moduleuid"]); } if (!empty($add["touid"]) && $add["touid"] != Ibos::app()->user->uid && $add["touid"] != $add["moduleuid"]) { !$notCount && UserData::model()->updateKey("unread_comment", 1, true, $add["touid"]); } if ($add["table"] == "feed") { if (Ibos::app()->user->uid != $add["uid"]) { UserUtil::updateCreditByAction("addcomment", Ibos::app()->user->uid); UserUtil::updateCreditByAction("getcomment", $data["moduleuid"]); } Feed::model()->cleanCache($add["rowid"]); } if ($add["touid"] != Ibos::app()->user->uid || $add["moduleuid"] != Ibos::app()->user->uid && $add["moduleuid"] != "") { $author = User::model()->fetchByUid(Ibos::app()->user->uid); $config["{name}"] = $author["realname"]; $sourceInfo = Source::getCommentSource($add, $forApi); $config["{url}"] = $sourceInfo["source_url"]; $config["{sourceContent}"] = StringUtil::parseHtml($sourceInfo["source_content"]); if (!empty($add["touid"])) { $config["{commentType}"] = "回复了我的评论:"; Notify::model()->sendNotify($add["touid"], "comment", $config); } else { $config["{commentType}"] = "评论了我的微博:"; if (!empty($add["moduleuid"])) { Notify::model()->sendNotify($add["moduleuid"], "comment", $config); } } } } return $res; }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); ob_start(); $userPrefs = UserData::instance(); // $userPrefs->setPreference('test_pref2', 'goodbye world'); print "\n<input type='button' value='" . _("Clear Session-Values") . "'/>"; // print "\n<input type='button' value='"._("Delete All Values")."'/>"; print "\n<table border='1'>"; print "\n\t<thead>"; print "\n\t\t<tr>"; print "\n\t\t\t<th>" . "</th>"; print "\n\t\t\t<th>" . _('Key') . "</th>"; print "\n\t\t\t<th>" . _('Value') . "</th>"; print "\n\t\t\t<th>" . "</th>"; print "\n\t\t\t<th>" . _('Session-Value') . "</th>"; print "\n\t\t\t<th>" . _('Stored-Value') . "</th>"; print "\n\t\t</tr>"; print "\n\t</thead>"; print "\n\t<tbody>"; foreach ($userPrefs->getPreferenceKeys() as $key) { print "\n\t\t<tr>"; print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('delete') . "' value='" . _("Delete") . "'/></td>"; print "\n\t\t\t<td class='user_pref_key'>" . $key . "</td>"; print "\n\t\t\t<td class='user_pref_val'><input type='text' name='" . RequestContext::name('pref_val') . "' value=\"" . $userPrefs->getPreference($key) . "\"/></td>"; print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('save') . "' value='" . _("Save Changes") . "'/></td>"; print "\n\t\t\t<td class='user_pref_sess_val'>" . $userPrefs->getPreferenceSessionValue($key) . "</td>"; print "\n\t\t\t<td class='user_pref_stored_val'>" . $userPrefs->getPreferencePersistantValue($key) . "</td>"; print "\n\t\t</tr>"; } print "\n\t\t<tr>"; print "\n\t\t\t<td></td>"; print "\n\t\t\t<td><input type='text' name='" . RequestContext::name('pref_key') . "'/></td>"; print "\n\t\t\t<td><input type='text' name='" . RequestContext::name('pref_val') . "'/></td>"; print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('new') . "' value='" . _("Create New Preference") . "'/></td>"; print "\n\t\t\t<td></td>"; print "\n\t\t\t<td></td>"; print "\n\t\t</tr>"; print "\n\t</tbody>"; print "\n</table>"; $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); textdomain($defaultTextDomain); }
public function actionIndex() { $data = array(); $data["userData"] = UserData::model()->getUserData($this->uid); $data["activeUser"] = UserData::model()->fetchActiveUsers(); $data["movements"] = Ibos::app()->setting->get("setting/wbmovement"); $data["enableMovementModule"] = WbCommonUtil::getMovementModules(); $data["uploadConfig"] = AttachUtil::getUploadConfig(); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Enterprise weibo")), array("name" => Ibos::lang("Index"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("List")))); $var["type"] = isset($_GET["type"]) ? StringUtil::filterCleanHtml($_GET["type"]) : "all"; $var["feedtype"] = isset($_GET["feedtype"]) ? StringUtil::filterCleanHtml($_GET["feedtype"]) : "all"; $var["feedkey"] = isset($_GET["feedkey"]) ? StringUtil::filterCleanHtml(urldecode($_GET["feedkey"])) : ""; $var["loadNew"] = isset($_GET["page"]) ? 0 : 1; $var["loadMore"] = isset($_GET["page"]) ? 0 : 1; $var["loadId"] = 0; $var["nums"] = isset($_GET["page"]) ? WbConst::DEF_LIST_FEED_NUMS : 10; $this->render("index", array_merge($data, $var, $this->getData($var))); }
public function login1($email, $password) { $password = md5($password); $query = "SELECT * FROM `" . Config::PREFIX . "user` WHERE `email` = '{$email}' AND `password` = '{$password}'"; $query = self::$db->query($query); $query = $query->fetch_assoc(); if ($query) { self::$first_name = $query['first_name']; self::$last_name = $query['last_name']; self::$email = $query['email']; self::$password = $query['password']; self::$group = $query['group']; if (self::$email != false) { self::$status = true; } } else { self::$status = false; } }