本文整理汇总了PHP中Model_Users::edit方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::edit方法的具体用法?PHP Model_Users::edit怎么用?PHP Model_Users::edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Users
的用法示例。
在下文中一共展示了Model_Users::edit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: put
public function put()
{
if (!($id = $this->getRequest()->getId())) {
$this->getResponse()->setBody(array('status' => 'failed', 'message' => 'ID required'));
return;
}
$firstName = $this->getRequest()->getParam('first-name', false);
$lastName = $this->getRequest()->getParam('last-name', false);
$email = $this->getRequest()->getParam('email', false);
$userLevel = (int) $this->getRequest()->getParam('user-level', false);
if (!$firstName || !$lastName || !$email) {
$this->getResponse()->setBody(array('status' => 'failed', 'message' => 'Required parameters: first-name,last-name,email,user-level'));
return;
}
$this->users->edit($id, $firstName, $lastName, $email, $userLevel);
$this->getResponse()->setBody(array('status' => 'success', 'message' => 'User updated'));
}
示例2: resetAction
public function resetAction()
{
$request = $this->getRequest();
if (!JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
}
$done = $request->issetQuery('done');
if ($done) {
$this->forward('password', 'done');
}
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('email'), $this->translate('E-mail'), 'not_empty;min_length[5];max_length[100];email');
if ($validate->_valid_form()) {
$result = Model_Users::forgotPassword($request->getPost('email'));
if ($result) {
if ($result['status']) {
$new_password = Model_Users::generatePassword(8);
$key_forgot = md5($result['user_id'] . md5($new_password));
$add_new_pass = Model_Users::edit($result['user_id'], array('new_password' => $new_password, 'new_password_key' => $key_forgot));
if ($add_new_pass) {
$is_mail_smtp = JO_Registry::forceGet('config_mail_smtp');
$mail = new JO_Mail();
if ($is_mail_smtp) {
$mail->setSMTPParams(JO_Registry::forceGet('config_mail_smtp_host'), JO_Registry::forceGet('config_mail_smtp_port'), JO_Registry::forceGet('config_mail_smtp_user'), JO_Registry::forceGet('config_mail_smtp_password'));
}
$this->view->new_password = $new_password;
$this->view->user_info = $result;
$this->view->forgot_password_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . $result['user_id'] . '&key=' . $key_forgot);
$this->view->header_title = JO_Registry::get('site_name');
$this->view->base_href = WM_Router::create($request->getBaseUrl());
$mail->setFrom(JO_Registry::get('noreply_mail'));
$mail->setReturnPath(JO_Registry::get('noreply_mail'));
$mail->setSubject($this->translate('Request for forgotten password') . ' ' . JO_Registry::get('site_name'));
$mail->setHTML($this->view->render('send_forgot_password_request', 'mail'));
$result_send = (int) $mail->send(array($result['email']), $is_mail_smtp ? 'smtp' : 'mail');
if ($result_send) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset&done='));
} else {
$this->view->error = $this->translate('There was an error. Please try again later!');
}
} else {
$this->view->error = $this->translate('There was a problem with the record. Please try again!');
}
} else {
$this->view->error = $this->translate('This profile is not active.');
}
} else {
$this->view->error = $this->translate('E-mail address was not found!');
}
} else {
$this->view->error = $validate->_get_error_messages();
}
}
$this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset');
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例3: loginAction
public function loginAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]')) {
/* @var $twitteroauth JO_Api_Twitter_OAuth */
$twitteroauth = new JO_Api_Twitter_OAuth(JO_Registry::get('oauth_tw_key'), JO_Registry::get('oauth_tw_secret'), JO_Session::get('twitter[oauth_token]'), JO_Session::get('twitter[oauth_token_secret]'));
$access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
$user_info = $twitteroauth->get('account/verify_credentials');
if ($user_info && $user_info->id) {
Model_Users::edit(JO_Session::get('user[user_id]'), array('twitter_connect' => 1, 'twitter_id' => $user_info->id, 'twitter_username' => $user_info->screen_name));
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=settings'));
}
}
$twitteroauth = new JO_Api_Twitter_OAuth(JO_Registry::get('oauth_tw_key'), JO_Registry::get('oauth_tw_secret'), JO_Session::get('twitter[oauth_token]'), JO_Session::get('twitter[oauth_token_secret]'));
// $data = $twitteroauth->getAccessToken( );
// echo '<pre>';
// var_dump(JO_Session::get('twitter[oauth_token]'), JO_Session::get('twitter[oauth_token_secret]'),$twitteroauth->getAccessToken()); exit;
if (!JO_Session::get('user_info_twitteroauth')) {
$access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
$user_info = $twitteroauth->get('account/verify_credentials');
JO_Session::set('user_info_twitteroauth', $user_info);
JO_Session::set('access_token_twitteroauth', $access_token);
} else {
$user_info = JO_Session::get('user_info_twitteroauth');
}
if ($request->issetQuery('next')) {
JO_Session::set('next', html_entity_decode($request->getQuery('next')));
}
// $access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
// $user_info = $twitteroauth->get('account/verify_credentials');
if (isset($user_info->id) && $user_info->id) {
if (!self::loginInit($user_info->id)) {
$this->setViewChange('no_account');
$page_login_trouble = Model_Pages::getPage(JO_Registry::get('page_login_trouble'));
if ($page_login_trouble) {
$this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
}
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
} else {
$this->setViewChange('error_login');
$page_login_trouble = Model_Pages::getPage(JO_Registry::get('page_login_trouble'));
if ($page_login_trouble) {
$this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
}
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
}
示例4: indexAction
public function indexAction()
{
$request = $this->getRequest();
$rows = array('groups_pin_email', 'comments_email', 'likes_email', 'repins_email', 'follows_email', 'email_interval', 'digest_email', 'news_email');
$user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
if ($request->isPost()) {
$update = array();
foreach ($rows as $row) {
$update[$row] = (int) $request->getRequest($row);
}
// var_dump($update);exit;
Model_Users::edit(JO_Session::get('user[user_id]'), $update);
JO_Session::set('successfu_edite', true);
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=settings'));
}
$this->view->user_data = $user_data;
$this->view->settings_href = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例5: indexAction
public function indexAction()
{
$request = $this->getRequest();
//JO_Session::clear('categoria_id');
//para las APP's
if (isset($_POST['token']) && $_POST['token'] == md5($_POST['userid'])) {
$_SESSION['token'] = $_POST['token'];
JO_Session::set('token', $_POST['token']);
$result = Model_Users::checkLoginAPP($_POST['userid']);
if ($result) {
if ($result['status']) {
@setcookie('csrftoken_', md5($result['user_id'] . $request->getDomain() . $result['date_added']), time() + 86400 * 366 * 5, '/', '.' . $request->getDomain());
JO_Session::set(array('user' => $result));
}
}
}
if ($request->getParam('direct_path') == 'true') {
if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) {
Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
JO_Session::clear('category_id');
$this->view->user_info = JO_Session::get('user');
Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), sprintf($this->translate('Welcome to %s!'), JO_Registry::get('site_name')), $this->view->render('welcome', 'mail'));
}
$this->redirect($request->getBaseUrl());
}
/*$img = JO_Phpthumb::getInstance();
var_dump($img->isValidImplementation('imagick')); exit;
$img = JO_Phpthumb_Factory::create('http://www.desiredanimations.com/wp-content/uploads/2011/08/Cars-2.jpg');
$img->adaptiveResize(250, 250)->createReflection(40, 40, 80, true, '#a4a4a4');
$img->show();
exit;*/
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'));
if (JO_Session::get('user[user_id]')) {
$data['following_users_from_user_id'] = JO_Session::get('user[user_id]');
$data['filter_marker'] = $request->getRequest('marker');
} else {
$data['filter_rand'] = true;
}
$this->view->pins = '';
//error_log("INICIO PINS: ".date("Y-m-d H:i:s"));
$pins = Model_Pins::getPins($data);
//error_log("EMPIEZAN PINES: ".self::udate("Y-m-d H:i:s:u"));
if ($pins) {
$banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'"));
$pp = JO_Registry::get('config_front_limit');
$cuentaPins = 0;
foreach ($pins as $row => $pin) {
$cuentaPins = $cuentaPins + 1;
///banners
$key = $row + ($pp * $page - $pp);
if (isset($banners[$key])) {
$this->view->pins .= Helper_Banners::returnHtml($banners[$key]);
}
//pins
//error_log("EMPIEZA PIN(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u"));
$this->view->pins .= Helper_Pin::returnHtml($pin);
//error_log("FIN PIN(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u"));
}
//error_log("FIN BUCLE (".$cuentaPins." PINS): ".date("Y-m-d H:i:s"));
if (JO_Session::get('user[user_id]')) {
// JO_Registry::set('marker', Model_Pins::getMaxPin($data));
}
}
//error_log("FIN PINES(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u"));
if (!$request->isXmlHttpRequest() && JO_Session::get('user[user_id]')) {
$history = Model_History::getHistory(array('start' => 0, 'limit' => 10, 'sort' => 'DESC', 'order' => 'history_id'));
$model_images = new Helper_Images();
foreach ($history as $key => $data) {
if (!isset($data['user']['store'])) {
continue;
}
$avatar = Helper_Uploadimages::avatar($data['user'], '_A');
$history[$key]['user']['avatar'] = $avatar['image'];
if ($data['history_action'] == Model_History::REPIN) {
$history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $data['pin_id']);
} else {
$history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $data['from_user_id']);
}
}
$this->view->history = $history;
}
if ($request->isXmlHttpRequest()) {
echo $this->view->pins;
// echo $this->renderScript('json');
$this->noViewRenderer(true);
} else {
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
// if((int)JO_Registry::get('config_cache_live')) {
// $http = new JO_Http();
// $http->setTimeout(1);
// $http->execute($request->getBaseUrl() . '?action=generateCache');
// }
//.........这里部分代码省略.........
示例6: header_partAction
public function header_partAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) {
Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
JO_Session::clear('category_id');
$this->view->user_info = JO_Session::get('user');
Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), sprintf($this->translate('Welcome to %s!'), JO_Registry::get('site_name')), $this->view->render('welcome', 'mail'));
}
$this->view->og_namespace = trim(JO_Registry::get('og_namespace'));
$this->view->og_recipe = trim(JO_Registry::get('og_recipe'));
if (!$this->view->og_recipe) {
$this->view->og_namespace = '';
}
$this->view->show_landing = !JO_Registry::get('enable_free_registration');
$to_title = '';
if (JO_Session::get('user[user_id]')) {
$to_title = JO_Session::get('user[fullname]') . ' / ';
}
if ($this->getLayout()->meta_title) {
$this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . JO_Registry::get('meta_title'));
} else {
$this->getLayout()->placeholder('title', $to_title . JO_Registry::get('meta_title'));
}
if ($this->getLayout()->meta_description) {
$this->getLayout()->placeholder('description', $this->getLayout()->meta_description);
} else {
$this->getLayout()->placeholder('description', JO_Registry::get('meta_description'));
}
if ($this->getLayout()->meta_keywords) {
$this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords);
} else {
$this->getLayout()->placeholder('keywords', JO_Registry::get('meta_keywords'));
}
$this->getLayout()->placeholder('site_name', JO_Registry::get('site_name'));
$this->view->site_name = JO_Registry::get('site_name');
$this->view->meta_title = JO_Registry::get('meta_title');
$this->getLayout()->placeholder('google_analytics', html_entity_decode(JO_Registry::get('google_analytics'), ENT_QUOTES, 'utf-8'));
$this->view->baseUrl = $request->getBaseUrl();
$this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png';
if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) {
$this->view->site_logo = $request->getBaseUrl() . 'uploads' . JO_Registry::get('site_logo');
}
if (JO_Registry::get('favicon') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('favicon'))) {
$this->getLayout()->placeholder('favicon', $request->getBaseUrl() . 'uploads' . JO_Registry::get('favicon'));
}
$this->getLayout()->placeholder('site_logo', $this->view->site_logo);
$this->view->show_header_invate = !JO_Session::get('user[user_id]');
if (!JO_Session::get('user[user_id]')) {
switch (true) {
case $request->getAction() == 'login':
$this->view->show_header_invate = true;
case $request->getAction() == 'register':
$this->view->show_header_invate = true;
break;
}
}
$this->view->controller_open = $request->getController();
$this->view->show_header_line = !in_array($request->getController(), array('pin'));
$this->view->show_slider = !in_array($request->getController(), array('users', 'pin', 'settings', 'prefs', 'password'));
if ($request->getController() == 'users') {
$this->view->show_header_line = false;
}
//==== brand =====//
$this->view->show_brand = true;
if (JO_Registry::get('license_powered_check') == 'false' && JO_Registry::get('config_hide_brand')) {
$this->view->show_brand = false;
}
////////// CURRENCY
//autoupdate currency if set
if (JO_Registry::get('config_currency_auto_update')) {
WM_Currency::updateCurrencies();
}
$currencies = WM_Currency::getCurrencies();
$price_left = array();
$price_right = array();
if ($currencies) {
foreach ($currencies as $currency) {
if (trim($currency['symbol_left'])) {
$price_left[] = preg_quote(trim($currency['symbol_left']));
}
if (trim($currency['symbol_right'])) {
$price_right[] = preg_quote(trim($currency['symbol_right']));
}
}
}
$this->view->price_left = implode('|', $price_left);
$this->view->price_right = implode('|', $price_right);
//////////// Categories ////////////
$this->view->categories = array();
$categories1 = array("0" => array("category_id" => "9999", "title" => "TODO", "image" => ""));
$this->view->category_active = false;
$categories2 = Model_Categories::getCategories(array('filter_status' => 1));
$categories = array_merge($categories1, $categories2);
$x = 0;
foreach ($categories as $category) {
if ($x == 0) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=all&category_id=' . $category['category_id']);
if ($request->getRequest('category_id') == 9999) {
//.........这里部分代码省略.........
示例7: indexAction
public function indexAction()
{
$request = $this->getRequest();
//////////// 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;
}
/////////// activate //////////
$_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate');
$_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
$this->view->user_sports = array();
$users_sports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
$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;
$user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
$upload = new JO_Upload_SessionStore();
$upload->setName('upload_avatar');
$info = $upload->getFileInfo();
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
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');
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]');
}
}
$validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), '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('sport_category_1'), $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]');
$data = $request->getPost();
if ($validate->_valid_form()) {
if (Model_Users::isExistEmail($request->getPost('email'), JO_Session::get('user[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'), JO_Session::get('user[username]'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$data['dont_search_index'] = (int) $request->issetPost('dont_search_index');
$data['facebook_timeline'] = (int) $request->issetPost('facebook_timeline');
if ($info) {
if (!@file_exists(BASE_PATH . '/cache/avatar/') || !is_dir(BASE_PATH . '/cache/avatar/')) {
mkdir(BASE_PATH . '/cache/avatar/');
}
$filename = BASE_PATH . '/cache/avatar/' . md5(mt_rand() . time()) . $upload->get_extension($info['name']);
if (file_put_contents($filename, $info['data'])) {
$data['avatar'] = $filename;
}
}
$new_email_key = md5(JO_Session::get('user[email]') . mt_rand() . time());
if (JO_Session::get('user[email]') != $request->getPost('email')) {
$data['new_email_key'] = $new_email_key;
} else {
$data['new_email_key'] = '';
}
$data['new_email'] = $data['email'];
unset($data['email']);
/*
$lat = $data['lat'];
$len = $data['len'];
//.........这里部分代码省略.........
示例8: indexAction
public function indexAction()
{
/*
$request = $this->getRequest();
if($request->isPost()) {
if( !$request->getPost('category_id') || count($request->getPost('category_id')) < 1 ) {
$this->view->error = true;
} else {
JO_Session::set('category_id', $request->getPost('category_id'));
$this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome&action=second') );
}
}
$this->helpas();
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array(
'filter_status' => 1
));
$model_images = new Helper_Images();
foreach($categories AS $category) {
if($category['image']) {
$category['thumb'] = $model_images->resize($category['image'], 113, 113, true);
} else {
$category['thumb'] = $model_images->resize(JO_Registry::get('no_avatar'), 113, 113);
}
$this->view->categories[] = $category;
}
}
function secondAction() {
*/
$request = $this->getRequest();
$this->helpas();
//$categories = JO_Session::get('category_id');
$userSports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
$categories = array();
foreach ($userSports as $userSport) {
$categories[] = $userSport["sport_category"];
}
$users = "";
if (!$categories || count($categories) < 1) {
$this->view->error = true;
Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
} else {
JO_Session::set('category_id', $categories);
$users = Model_Users::getUsers(array('filter_welcome' => $categories, 'start' => 0, 'limit' => 20));
}
/*if(!$users) {
JO_Session::clear('category_id');
$this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome') );
}
*/
$this->view->boards = '';
if ($users) {
$view = JO_View::getInstance();
$view->loged = JO_Session::get('user[user_id]');
$model_images = new Helper_Images();
foreach ($users as $key => $user) {
$user['thumbs'] = array();
for ($i = 0; $i < min(8, count($user['pins_array'])); $i++) {
$image = isset($user['pins_array'][$i]) ? $user['pins_array'][$i]['image'] : false;
if (isset($user['pins_array'][$i])) {
$image = Helper_Uploadimages::pin($user['pins_array'][$i], '_A');
if ($image) {
$user['thumbs'][] = array('thumb' => $image['image'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $user['pins_array'][$i]['pin_id']), 'title' => $user['pins_array'][$i]['title']);
}
}
}
$avatar = Helper_Uploadimages::avatar($user, '_B');
$user['avatar'] = $avatar['image'];
$user['userLikeIgnore'] = true;
if (JO_Session::get('user[user_id]') == $user['user_id']) {
$user['userIsFollow'] = 1;
$user['userFollowIgnore'] = true;
} else {
$user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']);
if (!$user['userIsFollow']) {
$user['userIsFollow'] = Model_Users::FollowUser($user['user_id']);
}
$user['userFollowIgnore'] = false;
}
$user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']);
$user['pins_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user['user_id']);
$user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']);
$view->key = $key % 2 == 0;
$view->user = $user;
$this->view->boards .= $view->render('box', 'users');
}
}
$this->view->pinmarklet_href = WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_pinmarklet'));
//$this->view->direct_path = WM_Router::create( $request->getBaseUrl() . '?direct_path=true' );
if (JO_Registry::get('isMobile')) {
//.........这里部分代码省略.........
示例9: registertwAction
public function registertwAction()
{
$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();
$userId = $request->getPost('userId');
if ($request->getPost('userId')) {
$result = Model_Users::edit($userId, array('twitter_connect' => 1, 'twitter_id' => $request->getPost('twitter_id'), 'twitter_username' => $request->getPost('twitter_username')));
if ($result) {
$return = $return = array('id' => $userId);
} else {
$return = array('error' => 15, 'description' => $this->translate("Error en el registro de twitter"));
}
}
if ($callback) {
$return = $callback . '(' . JO_Json::encode($return) . ')';
} else {
$response->addHeader('Cache-Control: no-cache, must-revalidate');
$response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$response->addHeader('Content-type: application/json; charset=utf-8');
$return = JO_Json::encode($return);
}
$response->appendBody($return);
}
示例10: deleteAction
public function deleteAction()
{
if (JO_Session::get('user[user_id]')) {
Model_Users::edit(JO_Session::get('user[user_id]'), array('delete_account' => '1', 'delete_account_date' => date('Y-m-d H:i:s')));
Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), $this->translate('Delete Account Request'), $this->view->render('delete_account', 'mail'));
}
$this->redirect(WM_Router::create($this->getRequest()->getBaseUrl(), '?controller=settings'));
}