本文整理匯總了PHP中Model_Users::checkSharedContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Users::checkSharedContent方法的具體用法?PHP Model_Users::checkSharedContent怎麽用?PHP Model_Users::checkSharedContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model_Users
的用法示例。
在下文中一共展示了Model_Users::checkSharedContent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: registerfbAction
public function registerfbAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
$response = $this->getResponse();
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$callback = $request->getRequest('callback');
if (!preg_match('/^([a-z0-9_.]{1,})$/', $callback)) {
$callback = false;
}
$return = array();
$shared_content = Model_Users::checkSharedContent($request->getParam('key'), $request->getParam('user_id'));
//self::loginInit($fbData['id'], $session);
$ph = new WM_Facebook_Photo();
$image = $ph->getRealUrl('http://graph.facebook.com/' . $request->getPost('facebook_id') . '/picture?type=large');
if (!@getimagesize($image)) {
$image = '';
}
$this->view->error = false;
if ($request->isPost()) {
$session = $request->getPost('facebook_id');
//error_log("facebook id " . $session . " " . $request->getPost('username') . " " . $request->getPost('firstname')." ". $request->getPost('lastname'));
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
// $validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
// $validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
// $validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
if ($validate->_valid_form()) {
if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
$validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
$validate->_set_valid_form(false);
//error_log("ERROR PASSS ". $request->getPost('password') . " " . $request->getPost('password2') );
}
if (Model_Users::isExistEmail($request->getPost('email'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
//error_log("ERROR MAIL ". $request->getPost('email'));
}
if (Model_Users::isExistUsername($request->getPost('username'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
//error_log("ERROR USER ". $request->getPost('username'));
}
}
if ($validate->_valid_form()) {
$reg_key = sha1($request->getPost('email') . $request->getPost('username'));
$result = Model_Users::create(array('facebook_id' => $request->getPost('facebook_id'), 'gender' => $request->getPost('gender'), 'avatar' => $image ? $image : '', 'location' => $request->getPost('location'), 'website' => $request->getPost('website'), 'username' => $request->getPost('username'), 'firstname' => $request->getPost('firstname'), 'lastname' => $request->getPost('lastname'), 'email' => $request->getPost('email'), 'password' => $request->getPost('password'), 'delete_email' => $request->getPost('email'), 'facebook_session' => $session, 'delete_code' => isset($shared_content['if_id']) ? $shared_content['if_id'] : '', 'following_user' => isset($shared_content['user_id']) ? $shared_content['user_id'] : '', 'facebook_connect' => 1, 'confirmed' => '0', 'regkey' => $reg_key));
if ($result) {
if (self::sendMail($result)) {
//self::loginInit($result);
}
$return = array('id' => $result);
//['user_id']);
//error_log("SIN ERROR ". $result);
} else {
$return = array('error' => 3, 'description' => $this->translate('There was a problem with the record. Please try again!'));
//error_log("ERROR 3 ");
}
} else {
$return = array('error' => 4, 'description' => str_replace("<br />", ". ", $validate->_get_error_messages()));
//error_log("ERROR 4 " . str_replace("<br />", ". ", $validate->_get_error_messages()));
}
}
$this->view->user_id_fb = $request->getPost('facebook_id');
$this->view->baseUrl = $request->getBaseUrl();
if ($request->issetPost('email')) {
$this->view->email = $request->getPost('email');
} else {
$this->view->email = '';
}
if ($request->issetPost('firstname')) {
$this->view->firstname = $request->getPost('firstname');
} else {
$this->view->firstname = '';
}
//
// if($request->issetPost('lastname')) {
// $this->view->lastname = $request->getPost('lastname');
// } else {
// if(isset($fbData['last_name'])) {
// $this->view->lastname = $fbData['last_name'];
// } else {
// $this->view->lastname = '';
// }
// }
if ($request->issetPost('username')) {
$this->view->username = $request->getPost('username');
} else {
$this->view->username = '';
}
$this->view->password = $request->getPost('password');
// $this->view->password2 = $request->getPost('password2');
if ($callback) {
$return = $callback . '(' . JO_Json::encode($return) . ')';
} else {
//.........這裏部分代碼省略.........
示例2: registerAction
public function registerAction()
{
$request = $this->getRequest();
$_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
$this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array('filter_status' => 1));
foreach ($categories as $category) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$this->view->categories[] = $category;
}
//////////// User Type ////////////
$this->view->user_types = array();
$user_types = Model_Users::getUserType(array('filter_status' => 1));
foreach ($user_types as $user_type) {
$user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
$this->view->user_types[] = $user_type;
}
$this->view->user_sports = array();
$users_sports = Model_Users::getUserSports(0);
$i = 0;
foreach ($users_sports as $user_sports) {
if ($user_sports['sport_category'] != 1) {
if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
$this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
$i++;
}
}
}
//$this->view->sportcounter = $i;
if (JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')));
}
$shared_content = Model_Users::checkSharedContent($request->getParam('key'), $request->getParam('user_id'));
if (!JO_Registry::get('enable_free_registration')) {
if (!$shared_content) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
}
} else {
$this->view->fb_register = null;
$fb_ses = JO_Registry::get('facebookapi');
$session = $fb_ses->getUser();
if (JO_Registry::get('oauth_fb_key') && JO_Registry::get('oauth_fb_secret')) {
$this->view->fb_register = $this->facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=facebook&action=login'), 'req_perms' => 'email,user_birthday,status_update,user_videos,user_status,user_photos,offline_access,read_friendlists'));
}
}
if (JO_Registry::get('oauth_in_key')) {
$this->view->instagram_register = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=instagram&action=register&next=' . urlencode(WM_Router::create($request->getBaseUrl() . '?controller=instagram&action=register')));
}
$this->view->error = false;
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
$validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
if (!isset($_SESSION['token'])) {
if ($request->issetPost('type_user')) {
if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
$validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
}
}
//is_nan() sino
/* if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
$validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
} */
$validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
}
if ($validate->_valid_form()) {
if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
$validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistEmail($request->getPost('email'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$reg_key = sha1($request->getPost('email') . $request->getPost('username'));
$lat = $request->getPost('lat');
$len = $request->getPost('len');
/*
while (Model_Users::getUsersLatLen($lat, $len))
{
$posLat = strpos($lat, ".");
$longLat = strlen(substr((string) $lat, $posLat));
$cantLat = 0;
//.........這裏部分代碼省略.........