• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP osc_user_dashboard_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中osc_user_dashboard_url函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_user_dashboard_url函数的具体用法?PHP osc_user_dashboard_url怎么用?PHP osc_user_dashboard_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了osc_user_dashboard_url函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'login_post':
             //post execution for the login
             if (!osc_users_enabled()) {
                 osc_add_flash_error_message(_m('Users are not enabled'));
                 $this->redirectTo(osc_base_url());
             }
             osc_csrf_check();
             osc_run_hook('before_validating_login');
             // e-mail or/and password is/are empty or incorrect
             $wrongCredentials = false;
             $email = Params::getParam('email');
             $password = Params::getParam('password', false, false);
             if ($email == '') {
                 osc_add_flash_error_message(_m('Please provide an email address'));
                 $wrongCredentials = true;
             }
             if ($password == '') {
                 osc_add_flash_error_message(_m('Empty passwords are not allowed. Please provide a password'));
                 $wrongCredentials = true;
             }
             if ($wrongCredentials) {
                 $this->redirectTo(osc_user_login_url());
             }
             if (osc_validate_email($email)) {
                 $user = User::newInstance()->findByEmail($email);
             }
             if (empty($user)) {
                 $user = User::newInstance()->findByUsername($email);
             }
             if (empty($user)) {
                 osc_add_flash_error_message(_m("The user doesn't exist"));
                 $this->redirectTo(osc_user_login_url());
             }
             if (!osc_verify_password($password, isset($user['s_password']) ? $user['s_password'] : '')) {
                 osc_add_flash_error_message(_m('The password is incorrect'));
                 $this->redirectTo(osc_user_login_url());
                 // @TODO if valid user, send email parameter back to the login form
             } else {
                 if (@$user['s_password'] != '') {
                     if (preg_match('|\\$2y\\$([0-9]{2})\\$|', $user['s_password'], $cost)) {
                         if ($cost[1] != BCRYPT_COST) {
                             User::newInstance()->update(array('s_password' => osc_hash_password($password)), array('pk_i_id' => $user['pk_i_id']));
                         }
                     } else {
                         User::newInstance()->update(array('s_password' => osc_hash_password($password)), array('pk_i_id' => $user['pk_i_id']));
                     }
                 }
             }
             // e-mail or/and IP is/are banned
             $banned = osc_is_banned($email);
             // int 0: not banned or unknown, 1: email is banned, 2: IP is banned, 3: both email & IP are banned
             if ($banned & 1) {
                 osc_add_flash_error_message(_m('Your current email is not allowed'));
             }
             if ($banned & 2) {
                 osc_add_flash_error_message(_m('Your current IP is not allowed'));
             }
             if ($banned !== 0) {
                 $this->redirectTo(osc_user_login_url());
             }
             osc_run_hook('before_login');
             $url_redirect = osc_get_http_referer();
             $page_redirect = '';
             if (osc_rewrite_enabled()) {
                 if ($url_redirect != '') {
                     $request_uri = urldecode(preg_replace('@^' . osc_base_url() . '@', "", $url_redirect));
                     $tmp_ar = explode("?", $request_uri);
                     $request_uri = $tmp_ar[0];
                     $rules = Rewrite::newInstance()->listRules();
                     foreach ($rules as $match => $uri) {
                         if (preg_match('#' . $match . '#', $request_uri, $m)) {
                             $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                             if (preg_match('|([&?]{1})page=([^&]*)|', '&' . $request_uri . '&', $match)) {
                                 $page_redirect = $match[2];
                                 if ($page_redirect == '' || $page_redirect == 'login') {
                                     $url_redirect = osc_user_dashboard_url();
                                 }
                             }
                             break;
                         }
                     }
                 }
             }
             require_once LIB_PATH . 'osclass/UserActions.php';
             $uActions = new UserActions(false);
             $logged = $uActions->bootstrap_login($user['pk_i_id']);
             if ($logged == 0) {
                 osc_add_flash_error_message(_m("The user doesn't exist"));
             } else {
                 if ($logged == 1) {
                     if (time() - strtotime($user['dt_access_date']) > 1200) {
                         // EACH 20 MINUTES
                         osc_add_flash_error_message(sprintf(_m('The user has not been validated yet. Would you like to re-send your <a href="%s">activation?</a>'), osc_user_resend_activation_link($user['pk_i_id'], $user['s_email'])));
                     } else {
                         osc_add_flash_error_message(_m('The user has not been validated yet'));
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:login.php


示例2: breadcrumbs


//.........这里部分代码省略.........
                $aCategories = Category::newInstance()->toRootTree($category);
                if (count($aCategories) > 0) {
                    $deep = 1;
                    foreach ($aCategories as $single) {
                        $list[] = '<a href="' . breadcrumbs_category_url($single['pk_i_id']) . '"><span class="bc_level_' . $deep . '">' . $single['s_name'] . '</span></a>';
                        $deep++;
                    }
                    // remove last link
                    if (!$b_pattern && !$b_location) {
                        $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]);
                    }
                    $result .= implode($separator, $list) . $separator;
                }
            }
            if ($b_location) {
                $list = array();
                $params = array();
                if ($b_category) {
                    $params['sCategory'] = $category;
                }
                if ($b_city) {
                    $aCity = City::newInstance()->findByName($city);
                    if (count($aCity) == 0) {
                        $params['sCity'] = $city;
                        $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_city">' . $city . '</span></a>';
                    } else {
                        $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']);
                        $params['sRegion'] = $aRegion['s_name'];
                        $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_region">' . $aRegion['s_name'] . '</span></a>';
                        $params['sCity'] = $aCity['s_name'];
                        $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_city">' . $aCity['s_name'] . '</span></a>';
                    }
                    if (!$b_pattern) {
                        $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]);
                    }
                    $result .= implode($separator, $list) . $separator;
                } else {
                    if ($b_region) {
                        $params['sRegion'] = $region;
                        $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_region">' . $region . '</span></a>';
                        if (!$b_pattern) {
                            $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]);
                        }
                        $result .= implode($separator, $list) . $separator;
                    }
                }
            }
            if ($b_pattern) {
                $result .= '<span class="bc_last">' . __('Search Results', 'breadcrumbs') . ': ' . $pattern . '</span>' . $separator;
            }
            // remove last separator
            $result = preg_replace('|' . trim($separator) . '\\s*$|', '', $result);
            $text = $result;
            break;
        case 'login':
            switch ($section) {
                case 'recover':
                    $text = $page_title . $separator . '<span class="bc_last">' . __('Recover your password', 'breadcrumbs') . '</span>';
                default:
                    $text = $page_title . $separator . '<span class="bc_last">' . __('Login', 'breadcrumbs') . '</span>';
            }
            break;
        case 'register':
            $text = $page_title . $separator . '<span class="bc_last">' . __('Create a new account', 'breadcrumbs') . '</span>';
            break;
        case 'user':
            $user_dashboard = '<a href="' . osc_user_dashboard_url() . '"><span class="bc_user">' . __('My account', 'breadcrumbs') . '</span></a>';
            switch ($section) {
                case 'dashboard':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Dashboard', 'breadcrumbs') . '</span>';
                    break;
                case 'items':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Manage my items', 'breadcrumbs') . '</span>';
                    break;
                case 'alerts':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Manage my alerts', 'breadcrumbs') . '</span>';
                    break;
                case 'profile':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Update my profile', 'breadcrumbs') . '</span>';
                    break;
                case 'change_email':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Change my email', 'breadcrumbs') . '</span>';
                    break;
                case 'change_password':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Change my password', 'breadcrumbs') . '</span>';
                    break;
                case 'forgot':
                    $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Recover my password', 'breadcrumbs') . '</span>';
                    break;
            }
            break;
        case 'contact':
            $text = $page_title . $separator . '<span class="bc_last">' . __('Contact', 'breadcrumbs') . '</span>';
            break;
        default:
            break;
    }
    echo $text;
    return true;
}
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:index.php


示例3: make_userlogin

function make_userlogin()
{
    if (isset($_GET['page'])) {
        return;
    }
    $facebookData = FacebookClassified::newInstance()->selectFacebookData();
    $api_id = osc_get_preference('facebook_api_id', 'classified');
    $api_secret = osc_get_preference('facebook_api_secret', 'classified');
    if (isset($_GET['code']) and !empty($_GET['code'])) {
        $code = $_GET['code'];
        if (!empty($code)) {
            $get_access_data = facebookall_get_fb_contents("https://graph.facebook.com/v2.3/oauth/access_token?" . 'client_id=' . $api_id . '&redirect_uri=' . urlencode(osc_base_url()) . '&client_secret=' . $api_secret . '&code=' . urlencode($code));
            $access_data = json_decode($get_access_data, true);
        }
        if (empty($access_data['access_token'])) {
            $get_access_data = facebookall_get_fb_contents("https://graph.facebook.com/v2.3/oauth/access_token?" . 'client_id=' . $api_id . '&redirect_uri=' . urlencode(osc_base_url()) . '&client_secret=' . $api_secret . '&code=' . urlencode($code));
            $access_data = json_decode($get_access_data, true);
        }
        if (!empty($access_data['access_token'])) {
            $access_token = $access_data['access_token'];
        } else {
            echo 'Error : Could not get access token please check your app settings for more about this error<br> Or Follow our doc setion <a href="http://sourceaddons.com/documentation">Documentation Section</a>.';
            exit;
        }
        ?>
    <script>
      window.opener.FbAll.parentRedirect({'action' : 'fball', 'fball_access_token' : '<?php 
        echo $access_token;
        ?>
'});
      window.close();
    </script>
    <?php 
    }
    if (!empty($_REQUEST['fball_access_token']) and isset($_REQUEST['fball_redirect'])) {
        $user_info = json_decode(facebookall_get_fb_contents("https://graph.facebook.com/v2.3/me?access_token=" . $_REQUEST['fball_access_token']));
        Session::newInstance()->_set('fb-token', $_REQUEST['fball_access_token']);
        $user_data = get_userprofile_data($user_info);
        if (!empty($user_data['email']) and !empty($user_data['id'])) {
            // Filter username form data.
            if (!empty($user_data['name'])) {
                $username = $user_data['name'];
            } else {
                if (!empty($user_data['first_name']) && !empty($user_data['last_name'])) {
                    $username = $user_data['first_name'] . $user_data['last_name'];
                } else {
                    $user_emailname = explode('@', $user_data['email']);
                    $username = $user_emailname[0];
                }
            }
            $user_login = $username;
            $new_user = false;
            $user_id = get_userid($user_data['id']);
            if (empty($user_id)) {
                //Not Registered As Facebook User
                $u_data = User::newInstance()->findByEmail($user_data['email']);
                if (!empty($u_data)) {
                    //Registered As OSClass but not as Facebook User
                    $user = User::newInstance()->findByEmail($user_data['email']);
                    insert_facebook_user_data($user['pk_i_id'], $user_data['id']);
                } else {
                    //New User Not Registered as Facebook User And OSClass User
                    $new_user = true;
                    register_user($user_data);
                }
            }
            $manager = User::newInstance();
            $oscUser = $manager->findByEmail($user_data['email']);
            $email = $oscUser['pk_i_id'];
            require_once osc_lib_path() . 'osclass/UserActions.php';
            $uActions = new UserActions(false);
            $logged = $uActions->bootstrap_login($oscUser['pk_i_id']);
            // Redirect user.
            osc_redirect_to(osc_user_dashboard_url());
            /*
              if (!empty ($_GET['redirect_to'])) {
                $redirect_to = $_GET['redirect_to'];
                wp_safe_redirect ($redirect_to);
              }
              else {
                $redirect_to = facebookall_redirect_loggedin_user();
                wp_redirect ($redirect_to);
              }
              exit();
            }
            */
        }
    }
}
开发者ID:Ashishr2,项目名称:Kathmandu,代码行数:89,代码来源:facebook-function.php


示例4: sprintf

                    <div class="content-section">
                        <div class="row">
                            <div class="col-md-3">
                                <!-- <h4 class="my-account">My Public Profile</h4> -->
                            </div>
                            <div class="com-md-9 text-right">
                                <div class="my-account1">
                                    <?php 
if (osc_is_web_user_logged_in()) {
    ?>
                                    <?php 
    echo sprintf(__('Hi %s', 'classified'), osc_logged_user_name() . '!  ');
    ?>
&nbsp;&nbsp;&nbsp;
                                    <a class="my_account" href="<?php 
    echo osc_user_dashboard_url();
    ?>
"><?php 
    _e('My account', 'classified');
    ?>
</a>
                                    <?php 
    if (nc_osc_get_post_ads_settings()) {
        echo "<a class='post_an_ad' href=" . osc_item_post_url() . ">Post an Ad</a>";
    }
    ?>
                                    <a class="log_out" href="<?php 
    echo osc_user_logout_url();
    ?>
"><?php 
    _e('Logout', 'classified');
开发者ID:Ashishr2,项目名称:Kathmandu,代码行数:31,代码来源:user-public-profile.php


示例5: twitter_user_menu

 function twitter_user_menu()
 {
     $options = array();
     $options[] = array('name' => __('Dashboard', 'twitter'), 'url' => osc_user_dashboard_url(), 'class' => osc_is_user_dashboard() ? 'active opt_dashboard' : 'opt_dashboard');
     $options[] = array('name' => __('Manage your items', 'twitter'), 'url' => osc_user_list_items_url(), 'class' => osc_is_user_manage_items() ? 'active opt_items' : 'opt_items');
     $options[] = array('name' => __('Manage your alerts', 'twitter'), 'url' => osc_user_alerts_url(), 'class' => osc_is_user_manage_alerts() ? 'active opt_alerts' : 'opt_alerts');
     $options[] = array('name' => __('My account', 'twitter'), 'url' => osc_user_profile_url(), 'class' => osc_is_user_profile() ? 'active opt_dashboard' : 'opt_account');
     echo '<ul class="tabs">';
     $var_l = count($options);
     for ($var_o = 0; $var_o < $var_l; $var_o++) {
         echo '<li class="' . $options[$var_o]['class'] . '" ><a href="' . $options[$var_o]['url'] . '" >' . $options[$var_o]['name'] . '</a></li>';
     }
     osc_run_hook('user_menu');
     echo '</ul>';
 }
开发者ID:ricktaylord,项目名称:osclass-themes,代码行数:15,代码来源:functions.php


示例6: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'login_post':
             //post execution for the login
             if (!osc_users_enabled()) {
                 osc_add_flash_error_message(_m('Users are not enabled'));
                 $this->redirectTo(osc_base_url());
             }
             require_once LIB_PATH . 'osclass/UserActions.php';
             $user = User::newInstance()->findByEmail(Params::getParam('email'));
             $url_redirect = osc_user_dashboard_url();
             $page_redirect = '';
             if (osc_rewrite_enabled()) {
                 if (isset($_SERVER['HTTP_REFERER'])) {
                     $request_uri = urldecode(preg_replace('@^' . osc_base_url() . '@', "", $_SERVER['HTTP_REFERER']));
                     $tmp_ar = explode("?", $request_uri);
                     $request_uri = $tmp_ar[0];
                     $rules = Rewrite::newInstance()->listRules();
                     foreach ($rules as $match => $uri) {
                         if (preg_match('#' . $match . '#', $request_uri, $m)) {
                             $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                             if (preg_match('|([&?]{1})page=([^&]*)|', '&' . $request_uri . '&', $match)) {
                                 $page_redirect = $match[2];
                             }
                             break;
                         }
                     }
                 }
             } else {
                 if (preg_match('|[\\?&]page=([^&]+)|', $_SERVER['HTTP_REFERER'] . '&', $match)) {
                     $page_redirect = $match[1];
                 }
             }
             if (Params::getParam('http_referer') != '') {
                 Session::newInstance()->_setReferer(Params::getParam('http_referer'));
                 $url_redirect = Params::getParam('http_referer');
             } else {
                 if (Session::newInstance()->_getReferer() != '') {
                     Session::newInstance()->_setReferer(Session::newInstance()->_getReferer());
                     $url_redirect = Session::newInstance()->_getReferer();
                 } else {
                     if ($page_redirect != '' && $page_redirect != 'login') {
                         Session::newInstance()->_setReferer($_SERVER['HTTP_REFERER']);
                         $url_redirect = $_SERVER['HTTP_REFERER'];
                     }
                 }
             }
             if (!$user) {
                 osc_add_flash_error_message(_m('The username doesn\'t exist'));
                 $this->redirectTo(osc_user_login_url());
             }
             if ($user["s_password"] != sha1(Params::getParam('password'))) {
                 osc_add_flash_error_message(_m('The password is incorrect'));
                 $this->redirectTo(osc_user_login_url());
             }
             $uActions = new UserActions(false);
             $logged = $uActions->bootstrap_login($user['pk_i_id']);
             if ($logged == 0) {
                 osc_add_flash_error_message(_m('The username doesn\'t exist'));
             } else {
                 if ($logged == 1) {
                     osc_add_flash_error_message(_m('The user has not been validated yet'));
                 } else {
                     if ($logged == 2) {
                         osc_add_flash_error_message(_m('The user has been suspended'));
                     } else {
                         if ($logged == 3) {
                             if (Params::getParam('remember') == 1) {
                                 //this include contains de osc_genRandomPassword function
                                 require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
                                 $secret = osc_genRandomPassword();
                                 User::newInstance()->update(array('s_secret' => $secret), array('pk_i_id' => $user['pk_i_id']));
                                 Cookie::newInstance()->set_expires(osc_time_cookie());
                                 Cookie::newInstance()->push('oc_userId', $user['pk_i_id']);
                                 Cookie::newInstance()->push('oc_userSecret', $secret);
                                 Cookie::newInstance()->set();
                             }
                             $this->redirectTo($url_redirect);
                         } else {
                             osc_add_flash_error_message(_m('This should never happens'));
                         }
                     }
                 }
             }
             if (!$user['b_enabled']) {
                 $this->redirectTo(osc_user_login_url());
             }
             $this->redirectTo(osc_user_login_url());
             break;
         case 'recover':
             //form to recover the password (in this case we have the form in /gui/)
             $this->doView('user-recover.php');
             break;
         case 'recover_post':
             //post execution to recover the password
             require_once LIB_PATH . 'osclass/UserActions.php';
             // e-mail is incorrect
             if (!preg_match('|^[a-z0-9\\.\\_\\+\\-]+@[a-z0-9\\.\\-]+\\.[a-z]{2,3}$|i', Params::getParam('s_email'))) {
                 osc_add_flash_error_message(_m('Invalid email address'));
//.........这里部分代码省略.........
开发者ID:acharei,项目名称:OSClass,代码行数:101,代码来源:login.php


示例7: osc_private_user_menu

/**
 * Prints the user's account menu
 *
 * @param array $options array with options of the form array('name' => 'display name', 'url' => 'url of link')
 * @return void
 */
function osc_private_user_menu($options = null)
{
    if ($options == null) {
        $options = array();
        $options[] = array('name' => __('Public Profile'), 'url' => osc_user_public_profile_url(), 'class' => 'opt_publicprofile');
        $options[] = array('name' => __('Dashboard'), 'url' => osc_user_dashboard_url(), 'class' => 'opt_dashboard');
        $options[] = array('name' => __('Manage your listings'), 'url' => osc_user_list_items_url(), 'class' => 'opt_items');
        $options[] = array('name' => __('Manage your alerts'), 'url' => osc_user_alerts_url(), 'class' => 'opt_alerts');
        $options[] = array('name' => __('My profile'), 'url' => osc_user_profile_url(), 'class' => 'opt_account');
        $options[] = array('name' => __('Logout'), 'url' => osc_user_logout_url(), 'class' => 'opt_logout');
    }
    $options = osc_apply_filter('user_menu_filter', $options);
    echo '<script type="text/javascript">';
    echo '$(".user_menu > :first-child").addClass("first");';
    echo '$(".user_menu > :last-child").addClass("last");';
    echo '</script>';
    echo '<ul class="user_menu">';
    $var_l = count($options);
    for ($var_o = 0; $var_o < $var_l - 1; $var_o++) {
        echo '<li class="' . $options[$var_o]['class'] . '" ><a href="' . $options[$var_o]['url'] . '" >' . $options[$var_o]['name'] . '</a></li>';
    }
    osc_run_hook('user_menu');
    echo '<li class="' . $options[$var_l - 1]['class'] . '" ><a href="' . $options[$var_l - 1]['url'] . '" >' . $options[$var_l - 1]['name'] . '</a></li>';
    echo '</ul>';
}
开发者ID:naneri,项目名称:Osclass,代码行数:31,代码来源:hUtils.php


示例8: userlogin

function userlogin()
{
    osc_redirect_to(osc_user_dashboard_url());
}
开发者ID:jhalendra,项目名称:classmandu,代码行数:4,代码来源:functions.php


示例9: osc_add_flash_error_message

<?php

$item = Item::newInstance()->findByPrimaryKey(Params::getParam('itemId'));
if ($item['b_premium'] == 1) {
    osc_add_flash_error_message(_m('Seems like this item is premium already'));
    osc_redirect_to(osc_user_dashboard_url());
}
?>
<div class="container">
  <div style="float:left; width: 50%;">
      <label style="font-weight: bold;"><?php 
_e("Item's title", 'classified');
?>
:</label> <?php 
echo $item['s_title'];
?>
<br/>
      <label style="font-weight: bold;"><?php 
_e("Premium enhancement price", 'classified');
?>
:</label> <?php 
echo osc_get_preference('premium_cost', 'classified');
?>
<br/>
  </div>
  
        <input type="hidden" name="itemId" value="<?php 
echo Params::getParam('itemId');
?>
"/>
        <div>
开发者ID:Ashishr2,项目名称:Kathmandu,代码行数:31,代码来源:payment.php


示例10: moreedit_item_edit

function moreedit_item_edit()
{
    if (Params::getParam('page') == 'item' && Params::getParam('action') == 'item_edit') {
        if (osc_get_preference('disable_edit', 'moreedit') == '1') {
            osc_add_flash_error_message(__('Sorry, editing is not allowed', 'moreedit'));
            if (osc_is_web_user_logged_in()) {
                header("location: " . osc_user_dashboard_url());
            } else {
                header("location: " . osc_base_url());
            }
            exit;
        }
        if (osc_get_preference('moderate_edit', 'moreedit') == '1') {
            osc_add_flash_info_message(__('Your ad will be needed to be moderated by an admin after you edit it. Until it gets approved it will not be visible to the rest of the users', 'moreedit'));
        }
    }
}
开发者ID:syedfiraat4,项目名称:bikade.com,代码行数:17,代码来源:index.php


示例11: doModel


//.........这里部分代码省略.........
         case 'change_password_post':
             //change password post
             osc_csrf_check();
             $user = User::newInstance()->findByPrimaryKey(Session::newInstance()->_get('userId'));
             if (Params::getParam('password', false, false) == '' || Params::getParam('new_password', false, false) == '' || Params::getParam('new_password2', false, false) == '') {
                 osc_add_flash_warning_message(_m('Password cannot be blank'));
                 $this->redirectTo(osc_change_user_password_url());
             }
             if (!osc_verify_password(Params::getParam('password', false, false), $user['s_password'])) {
                 osc_add_flash_error_message(_m("Current password doesn't match"));
                 $this->redirectTo(osc_change_user_password_url());
             }
             if (!Params::getParam('new_password', false, false)) {
                 osc_add_flash_error_message(_m("Passwords can't be empty"));
                 $this->redirectTo(osc_change_user_password_url());
             }
             if (Params::getParam('new_password', false, false) != Params::getParam('new_password2', false, false)) {
                 osc_add_flash_error_message(_m("Passwords don't match"));
                 $this->redirectTo(osc_change_user_password_url());
             }
             User::newInstance()->update(array('s_password' => osc_hash_password(Params::getParam('new_password', false, false))), array('pk_i_id' => Session::newInstance()->_get('userId')));
             osc_add_flash_ok_message(_m('Password has been changed'));
             $this->redirectTo(osc_user_profile_url());
             break;
         case 'items':
             // view items user
             $itemsPerPage = Params::getParam('itemsPerPage') != '' ? Params::getParam('itemsPerPage') : 10;
             $page = Params::getParam('iPage') > 0 ? Params::getParam('iPage') - 1 : 0;
             $itemType = Params::getParam('itemType');
             $total_items = Item::newInstance()->countItemTypesByUserID(osc_logged_user_id(), $itemType);
             $total_pages = ceil($total_items / $itemsPerPage);
             $items = Item::newInstance()->findItemTypesByUserID(osc_logged_user_id(), $page * $itemsPerPage, $itemsPerPage, $itemType);
             $this->_exportVariableToView('items', $items);
             $this->_exportVariableToView('search_total_pages', $total_pages);
             $this->_exportVariableToView('search_total_items', $total_items);
             $this->_exportVariableToView('items_per_page', $itemsPerPage);
             $this->_exportVariableToView('items_type', $itemType);
             $this->_exportVariableToView('search_page', $page);
             $this->doView('user-items.php');
             break;
         case 'activate_alert':
             $email = Params::getParam('email');
             $secret = Params::getParam('secret');
             $result = 0;
             if ($email != '' && $secret != '') {
                 $result = Alerts::newInstance()->activate($email, $secret);
             }
             if ($result == 1) {
                 osc_add_flash_ok_message(_m('Alert activated'));
             } else {
                 osc_add_flash_error_message(_m('Oops! There was a problem trying to activate your alert. Please contact an administrator'));
             }
             $this->redirectTo(osc_base_url());
             break;
         case 'unsub_alert':
             $email = Params::getParam('email');
             $secret = Params::getParam('secret');
             $id = Params::getParam('id');
             $alert = Alerts::newInstance()->findByPrimaryKey($id);
             $result = 0;
             if (!empty($alert)) {
                 if ($email == $alert['s_email'] && $secret == $alert['s_secret']) {
                     $result = Alerts::newInstance()->unsub($id);
                 }
             }
             if ($result == 1) {
                 osc_add_flash_ok_message(_m('Unsubscribed correctly'));
             } else {
                 osc_add_flash_error_message(_m('Oops! There was a problem trying to unsubscribe you. Please contact an administrator'));
             }
             $this->redirectTo(osc_user_alerts_url());
             break;
         case 'delete':
             $id = Params::getParam('id');
             $secret = Params::getParam('secret');
             if (osc_is_web_user_logged_in()) {
                 $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
                 View::newInstance()->_exportVariableToView('user', $user);
                 if (!empty($user) && osc_logged_user_id() == $id && $secret == $user['s_secret']) {
                     User::newInstance()->deleteUser(osc_logged_user_id());
                     Session::newInstance()->_drop('userId');
                     Session::newInstance()->_drop('userName');
                     Session::newInstance()->_drop('userEmail');
                     Session::newInstance()->_drop('userPhone');
                     Cookie::newInstance()->pop('oc_userId');
                     Cookie::newInstance()->pop('oc_userSecret');
                     Cookie::newInstance()->set();
                     osc_add_flash_ok_message(_m("Your account have been deleted"));
                     $this->redirectTo(osc_base_url());
                 } else {
                     osc_add_flash_error_message(_m("Oops! you can not do that"));
                     $this->redirectTo(osc_user_dashboard_url());
                 }
             } else {
                 osc_add_flash_error_message(_m("Oops! you can not do that"));
                 $this->redirectTo(osc_base_url());
             }
             break;
     }
 }
开发者ID:naneri,项目名称:Osclass,代码行数:101,代码来源:user.php


示例12: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'login_post':
             //post execution for the login
             $user = User::newInstance()->findByEmail(Params::getParam('email'));
             if (!$user) {
                 osc_add_flash_message(_m('The username doesn\'t exist'));
                 $this->redirectTo(osc_user_login_url());
             }
             if (!$user['b_enabled']) {
                 osc_add_flash_message(_m('The user has not been validated yet'));
                 $this->redirectTo(osc_user_login_url());
             }
             if ($user["s_password"] == sha1(Params::getParam('password'))) {
                 if (Params::getParam('remember') == 1) {
                     //this include contains de osc_genRandomPassword function
                     require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
                     $secret = osc_genRandomPassword();
                     User::newInstance()->update(array('s_secret' => $secret), array('pk_i_id' => $user['pk_i_id']));
                     Cookie::newInstance()->set_expires(osc_time_cookie());
                     Cookie::newInstance()->push('oc_userId', $user['pk_i_id']);
                     Cookie::newInstance()->push('oc_userSecret', $secret);
                     Cookie::newInstance()->set();
                 }
                 //we are logged in... let's go!
                 Session::newInstance()->_set('userId', $user['pk_i_id']);
                 Session::newInstance()->_set('userName', $user['s_name']);
                 Session::newInstance()->_set('userEmail', $user['s_email']);
                 $phone = $user['s_phone_mobile'] ? $user['s_phone_mobile'] : $user['s_phone_land'];
                 Session::newInstance()->_set('userPhone', $phone);
             } else {
                 osc_add_flash_message(_m('The password is incorrect'));
             }
             //returning logged in to the main page...
             $this->redirectTo(osc_user_dashboard_url());
             break;
         case 'recover':
             //form to recover the password (in this case we have the form in /gui/)
             $this->doView('user-recover.php');
             break;
         case 'recover_post':
             //post execution to recover the password
             require_once LIB_PATH . 'osclass/UserActions.php';
             $userActions = new UserActions(false);
             $recaptcha_ok = $userActions->recover_password();
             if ($recaptcha_ok) {
                 // We ALWAYS show the same message, so we don't give clues about which emails are in our database and which don't!
                 osc_add_flash_message(_m('We have sent you an email with the instructions to reset your password'));
                 $this->redirectTo(osc_base_url());
             } else {
                 osc_add_flash_message(_m('The recaptcha code is wrong'));
                 $this->redirectTo(osc_recover_user_password_url());
             }
             break;
         case 'forgot':
             //form to recover the password (in this case we have the form in /gui/)
             $user = User::newInstance()->findByIdPasswordSecret(Params::getParam('userId'), Params::getParam('code'));
             if ($user) {
                 $this->doView('user-forgot_password.php');
             } else {
                 osc_add_flash_message(_m('Sorry, the link is not valid'));
                 $this->redirectTo(osc_base_url());
             }
             break;
         case 'forgot_post':
             $user = User::newInstance()->findByIdPasswordSecret(Params::getParam('userId'), Params::getParam('code'));
             if ($user) {
                 if (Params::getParam('new_password') == Params::getParam('new_password2')) {
                     User::newInstance()->update(array('s_pass_code' => osc_genRandomPassword(50), 's_pass_date' => date('Y-m-d H:i:s', 0), 's_pass_ip' => $_SERVER['REMOTE_ADDR'], 's_password' => sha1(Params::getParam('new_password'))), array('pk_i_id' => $user['pk_i_id']));
                     osc_add_flash_message(_m('The password has been changed'));
                     $this->redirectTo(osc_user_login_url());
                 } else {
                     osc_add_flash_message(_m('Error, the password don\'t match'));
                     $this->redirectTo(osc_forgot_user_password_confirm_url(Params::getParam('userId'), Params::getParam('code')));
                 }
             } else {
                 osc_add_flash_message(_m('Sorry, the link is not valid'));
             }
             $this->redirectTo(osc_base_url());
             break;
         default:
             //login
             if (osc_logged_user_id() != '') {
                 $this->redirectTo(osc_user_dashboard_url());
             }
             $this->doView('user-login.php');
     }
 }
开发者ID:hashemgamal,项目名称:OSClass,代码行数:89,代码来源:login.php


示例13: doModel


//.........这里部分代码省略.........
         case 'item_delete':
             $secret = Params::getParam('secret');
             $id = Params::getParam('id');
             $item = $this->itemManager->listWhere("i.pk_i_id = '%s' AND ((i.s_secret = '%s' AND i.fk_i_user_id IS NULL) OR (i.fk_i_user_id = '%d'))", $id, $secret, $this->userId);
             if (count($item) == 1) {
                 $mItems = new ItemActions(false);
                 $success = $mItems->delete($item[0]['s_secret'], $item[0]['pk_i_id']);
                 if ($success) {
                     osc_add_flash_message(_m('Your item has been deleted'));
                 } else {
                     osc_add_flash_message(_m('The item you are trying to delete couldn\'t be deleted'));
                 }
                 if ($this->user != null) {
                     $this->redirectTo(osc_user_list_items_url());
                 } else {
                     $this->redirectTo(osc_base_url());
                 }
             } else {
                 osc_add_flash_message(_m('The item you are trying to delete couldn\'t be deleted'));
                 $this->redirectTo(osc_base_url());
             }
             break;
         case 'deleteResource':
             $id = Params::getParam('id');
             $item = Params::getParam('item');
             $code = Params::getParam('code');
             $secret = Params::getParam('secret');
             // Check for required fields
             if (!(is_numeric($id) && is_numeric($item) && preg_match('/^([a-z0-9]+)$/i', $code))) {
                 osc_add_flash_message(_m("The selected photo couldn't be deleted, the url doesn't exist"));
                 if ($this->userId == null) {
                     $this->redirectTo(osc_base_url());
                 } else {
                     $this->redirectTo(osc_user_dashboard_url());
                 }
             }
             $aItem = $this->itemManager->findByPrimaryKey($item);
             // Check if the item exists
             if (count($aItem) == 0) {
                 osc_add_flash_message(_m('The item doesn\'t exist'));
                 $this->redirectTo(osc_base_url());
             }
             // Check if the item belong to the user
             if ($this->userId != null && $this->userId != $aItem['fk_i_user_id']) {
                 osc_add_flash_message(_m('The item doesn\'t belong to you'));
                 $this->redirectTo(osc_item_url_ns($item));
             }
             // Check if the secret passphrase match with the item
             if ($this->userId == null && $secret != $aItem['s_secret']) {
                 osc_add_flash_message(_m('The item doesn\'t belong to you'));
                 $this->redirectTo(osc_item_url_ns($item));
             }
             // Does id & code combination exist?
             $result = ItemResource::newInstance()->getResourceSecure($id, $code);
             if ($result > 0) {
                 // Delete: file, db table entry
                 osc_deleteResource($id);
                 ItemResource::newInstance()->delete(array('pk_i_id' => $id, 'fk_i_item_id' => $item, 's_name' => $code));
                 osc_add_flash_message(_m('The selected photo has been successfully deleted'));
             } else {
                 osc_add_flash_message(_m("The selected photo couldn't be deleted"));
             }
             // Redirect to item_edit. If unregistered user, include $secret.
             $this->redirectTo(osc_item_edit_url($secret, $item));
             break;
         case 'mark':
开发者ID:hashemgamal,项目名称:OSClass,代码行数:67,代码来源:item.php


示例14: payment_get_custom

<?php

$data = payment_get_custom(Params::getParam('extra'));
$url = osc_base_url();
if (isset($data['product']) && isset($data['itemid'])) {
    $product = explode('x', $data['product']);
    if ($product[0] == '301') {
        // PACK PAYMENT FROM USER'S DASHBOARD
        $url = osc_user_dashboard_url();
    } else {
        $item = Item::newInstance()->findByPrimaryKey($data['itemid']);
        $category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
        View::newInstance()->_exportVariableToView('category', $category);
        $url = osc_search_category_url();
    }
} else {
}
osc_add_flash_error_message(__('You cancel the payment process or there was an error. If the error continue, please contact the administrator', 'payment'));
_e('You cancel the payment process or there was an error. If the error continue, please contact the administrator', 'payment');
payment_js_redirect_to($url);
开发者ID:virsoni,项目名称:plugin-payment,代码行数:20,代码来源:cancel.php


示例15: get_menu_options

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP osc_user_list_items_url函数代码示例发布时间:2022-05-15
下一篇:
PHP osc_user函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap