本文整理汇总了PHP中osc_is_web_user_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_is_web_user_logged_in函数的具体用法?PHP osc_is_web_user_logged_in怎么用?PHP osc_is_web_user_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_is_web_user_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fbc_button
function fbc_button()
{
if (!osc_is_web_user_logged_in()) {
echo '<div><a href="' . OSCFacebook::newInstance()->loginUrl() . '">' . __('Login with Facebook', 'facebook') . '</a></div>';
} else {
Header("Refresh:0");
//refresh page
}
}
示例2: __construct
function __construct()
{
parent::__construct();
if (!osc_users_enabled()) {
osc_add_flash_error_message(_m('Users not enabled'));
$this->redirectTo(osc_base_url());
}
if (!osc_user_registration_enabled()) {
osc_add_flash_error_message(_m('User registration is not enabled'));
$this->redirectTo(osc_base_url());
}
if (osc_is_web_user_logged_in()) {
$this->redirectTo(osc_base_url());
}
}
示例3: doModel
function doModel()
{
$user_menu = false;
if(Params::existParam('route')) {
$routes = Rewrite::newInstance()->getRoutes();
$rid = Params::getParam('route');
$file = '../';
if(isset($routes[$rid]) && isset($routes[$rid]['file'])) {
$file = $routes[$rid]['file'];
$user_menu = $routes[$rid]['user_menu'];
}
} else {
// DEPRECATED: Disclosed path in URL is deprecated, use routes instead
// This will be REMOVED in 3.4
$file = Params::getParam('file');
}
// valid file?
if( strpos($file, '../') !== false || strpos($file, '..\\') !==false || stripos($file, '/admin/') !== false ) { //If the file is inside an "admin" folder, it should NOT be opened in frontend
$this->do404();
return;
}
// check if the file exists
if( !file_exists(osc_plugins_path() . $file) ) {
$this->do404();
return;
}
osc_run_hook('custom_controller');
$this->_exportVariableToView('file', $file);
if($user_menu) {
if(osc_is_web_user_logged_in()) {
Params::setParam('in_user_menu', true);
$this->doView('user-custom.php');
} else {
$this->redirectTo(osc_user_login_url());
}
} else {
$this->doView('custom.php');
}
}
示例4: anr_verify_captcha
function anr_verify_captcha()
{
$secre_key = anr_get_option('secret_key');
$response = Params::getParam('g-recaptcha-response');
$remoteip = $_SERVER["REMOTE_ADDR"];
$loggedin_hide = anr_get_option('loggedin_hide');
if ((osc_is_web_user_logged_in() || osc_is_admin_user_logged_in()) && $loggedin_hide) {
return true;
}
if (!$secre_key) {
//if $secre_key is not set
return true;
}
if (!$response || !$remoteip) {
return false;
}
$request = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secre_key . "&response=" . $response . "&remoteip=" . $remoteip);
$result = json_decode($request, true);
if (true == $result['success']) {
return true;
}
return false;
}
示例5: watchlist
function watchlist()
{
if (osc_is_web_user_logged_in()) {
$id = osc_item_id();
$class = '';
$title = '';
if (watchlist_exists($id)) {
$class = 'full';
$title = __('Remove from watchlist', 'watchlist');
} else {
$class = 'empty';
$title = __('Add to watchlist', 'watchlist');
}
echo '<a class="watchlist ' . $class . '" id="' . $id . '"><span title="' . $title . '"></span>';
if ($class == 'empty') {
echo __('Add to watchlist', 'watchlist');
} else {
echo __('Remove from watchlist', 'watchlist');
}
echo '</a>';
} else {
echo '<a class="watchlist empty" onclick="swal(' ' . __('You must login to save favorites', 'pop') . ' ')"><span title="' . $title . '"></span>' . __('Add to watchlist', 'watchlist') . '</a>';
}
}
示例6: switch
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();
}
switch (Params::getParam('page')) {
case 'cron':
// cron system
define('__FROM_CRON__', true);
require_once osc_lib_path() . 'osclass/cron.php';
break;
case 'user':
// user pages (with security)
if (Params::getParam('action') == 'change_email_confirm' || Params::getParam('action') == 'activate_alert' || Params::getParam('action') == 'unsub_alert' && !osc_is_web_user_logged_in() || Params::getParam('action') == 'contact_post' || Params::getParam('action') == 'pub_profile') {
require_once osc_base_path() . 'user-non-secure.php';
$do = new CWebUserNonSecure();
$do->doModel();
} else {
require_once osc_base_path() . 'user.php';
$do = new CWebUser();
$do->doModel();
}
break;
case 'item':
// item pages
require_once osc_base_path() . 'item.php';
$do = new CWebItem();
$do->doModel();
break;
示例7: isLogged
function isLogged()
{
return osc_is_web_user_logged_in();
}
示例8: voting_item_detail_user
/**
* Show form to vote a seller if item belongs to a registered user. (itemDetail)
*
* @param type $item item array or userId
*/
function voting_item_detail_user($item = null)
{
$userId = null;
if ($item == null) {
$userId = osc_item_user_id();
} else {
if (is_numeric($item)) {
$userId = $item;
} else {
if (is_array($item)) {
$userId = $item['fk_i_user_id'];
} else {
exit;
}
}
}
if (osc_get_preference('user_voting', 'voting') == 1 && is_numeric($userId) && isset($userId) && $userId > 0) {
// obtener el avg de las votaciones
$aux_vote = ModelVoting::newInstance()->getUserAvgRating($userId);
$aux_count = ModelVoting::newInstance()->getUserNumberOfVotes($userId);
$vote['vote'] = $aux_vote['vote'];
$vote['total'] = $aux_count['total'];
$vote['userId'] = $userId;
$vote['can_vote'] = false;
if (osc_is_web_user_logged_in() && can_vote_user($userId, osc_logged_user_id())) {
$vote['can_vote'] = true;
}
require 'item_detail_user.php';
}
}
示例9: payment_pro_show_item
function payment_pro_show_item($item)
{
if (osc_get_preference("pay_per_post", 'payment_pro') == "1" && !ModelPaymentPro::newInstance()->publishFeeIsPaid($item['pk_i_id'])) {
if (osc_is_admin_user_logged_in()) {
osc_get_flash_message('pubMessages', true);
osc_add_flash_warning_message(__('The listing hasn\'t been paid', 'payment_pro'));
} else {
if (osc_is_web_user_logged_in() && osc_logged_user_id() == $item['fk_i_user_id']) {
osc_get_flash_message('pubMessages', true);
osc_add_flash_warning_message(sprintf(__('To make this listing available to others, you need to pay a publish fee. <a href="%s">Continue and make the ad public</a>', 'payment_pro'), osc_route_url('payment-pro-user-menu')));
} else {
ob_get_clean();
Rewrite::newInstance()->set_location('error');
header('HTTP/1.1 400 Bad Request');
osc_current_web_theme_path('404.php');
exit;
}
}
}
}
示例10: doModel
function doModel()
{
//calling the view...
$locales = OSCLocale::newInstance()->listAllEnabled();
$this->_exportVariableToView('locales', $locales);
switch ($this->action) {
case 'item_add':
// post
if (osc_reg_user_post() && $this->user == null) {
osc_add_flash_warning_message(_m('Only registered users are allowed to post listings'));
$this->redirectTo(osc_user_login_url());
}
$countries = Country::newInstance()->listAll();
$regions = array();
if (isset($this->user['fk_c_country_code']) && $this->user['fk_c_country_code'] != '') {
$regions = Region::newInstance()->findByCountry($this->user['fk_c_country_code']);
} else {
if (count($countries) > 0) {
$regions = Region::newInstance()->findByCountry($countries[0]['pk_c_code']);
}
}
$cities = array();
if (isset($this->user['fk_i_region_id']) && $this->user['fk_i_region_id'] != '') {
$cities = City::newInstance()->findByRegion($this->user['fk_i_region_id']);
} else {
if (count($regions) > 0) {
$cities = City::newInstance()->findByRegion($regions[0]['pk_i_id']);
}
}
$this->_exportVariableToView('countries', $countries);
$this->_exportVariableToView('regions', $regions);
$this->_exportVariableToView('cities', $cities);
$form = count(Session::newInstance()->_getForm());
$keepForm = count(Session::newInstance()->_getKeepForm());
if ($form == 0 || $form == $keepForm) {
Session::newInstance()->_dropKeepForm();
}
if (Session::newInstance()->_getForm('countryId') != "") {
$countryId = Session::newInstance()->_getForm('countryId');
$regions = Region::newInstance()->findByCountry($countryId);
$this->_exportVariableToView('regions', $regions);
if (Session::newInstance()->_getForm('regionId') != "") {
$regionId = Session::newInstance()->_getForm('regionId');
$cities = City::newInstance()->findByRegion($regionId);
$this->_exportVariableToView('cities', $cities);
}
}
$this->_exportVariableToView('user', $this->user);
osc_run_hook('post_item');
$this->doView('item-post.php');
break;
case 'item_add_post':
//post_item
if (osc_reg_user_post() && $this->user == null) {
osc_add_flash_warning_message(_m('Only registered users are allowed to post listings'));
$this->redirectTo(osc_base_url(true));
}
$mItems = new ItemActions(false);
// prepare data for ADD ITEM
$mItems->prepareData(true);
// set all parameters into session
foreach ($mItems->data as $key => $value) {
Session::newInstance()->_setForm($key, $value);
}
$meta = Params::getParam('meta');
if (is_array($meta)) {
foreach ($meta as $key => $value) {
Session::newInstance()->_setForm('meta_' . $key, $value);
Session::newInstance()->_keepForm('meta_' . $key);
}
}
if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
if (!osc_check_recaptcha()) {
osc_add_flash_error_message(_m('The Recaptcha code is wrong'));
$this->redirectTo(osc_item_post_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
if (!osc_is_web_user_logged_in()) {
$user = User::newInstance()->findByEmail($mItems->data['contactEmail']);
// The user exists but it's not logged
if (isset($user['pk_i_id'])) {
foreach ($mItems->data as $key => $value) {
Session::newInstance()->_keepForm($key);
}
osc_add_flash_error_message(_m('A user with that email address already exists, if it is you, please log in'));
$this->redirectTo(osc_user_login_url());
}
}
// POST ITEM ( ADD ITEM )
$success = $mItems->add();
if ($success != 1 && $success != 2) {
osc_add_flash_error_message($success);
$this->redirectTo(osc_item_post_url());
} else {
Session::newInstance()->_dropkeepForm('meta_' . $key);
if ($success == 1) {
osc_add_flash_ok_message(_m('Check your inbox to validate your listing'));
} else {
//.........这里部分代码省略.........
示例11: prepareData
/**
* Return an array with all data necessary for do the action (ADD OR EDIT)
* @param <type> $is_add
* @return array
*/
public function prepareData($is_add)
{
$aItem = array();
// prepare user
$userId = null;
if ($this->is_admin) {
if (Params::getParam('userId') != '') {
$userId = Params::getParam('userId');
}
} else {
$userId = Session::newInstance()->_get('userId');
if ($userId == '') {
$userId = NULL;
}
}
if ($is_add) {
// ADD
if ($this->is_admin) {
$active = 'ACTIVE';
} else {
if (osc_moderate_items() > 0) {
// HAS TO VALIDATE
if (!osc_is_web_user_logged_in()) {
// NO USER IS LOGGED, VALIDATE
$active = 'INACTIVE';
} else {
// USER IS LOGGED
if (osc_logged_user_item_validation()) {
//USER IS LOGGED, BUT NO NEED TO VALIDATE
$active = 'ACTIVE';
} else {
// USER IS LOGGED, NEED TO VALIDATE, CHECK NUMBER OF PREVIOUS ITEMS
$user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
if ($user['i_items'] < osc_moderate_items()) {
$active = 'INACTIVE';
} else {
$active = 'ACTIVE';
}
}
}
} else {
if (osc_moderate_items() == 0) {
if (osc_is_web_user_logged_in() && osc_logged_user_item_validation()) {
$active = 'ACTIVE';
} else {
$active = 'INACTIVE';
}
} else {
$active = 'ACTIVE';
}
}
}
if ($userId != null) {
$data = User::newInstance()->findByPrimaryKey($userId);
$aItem['contactName'] = $data['s_name'];
$aItem['contactEmail'] = $data['s_email'];
Params::setParam('contactName', $data['s_name']);
Params::setParam('contactEmail', $data['s_email']);
} else {
$aItem['contactName'] = Params::getParam('contactName');
$aItem['contactEmail'] = Params::getParam('contactEmail');
}
$aItem['active'] = $active;
$aItem['userId'] = $userId;
} else {
// EDIT
$aItem['secret'] = Params::getParam('secret');
$aItem['idItem'] = Params::getParam('id');
if ($userId != null) {
$data = User::newInstance()->findByPrimaryKey($userId);
$aItem['contactName'] = $data['s_name'];
$aItem['contactEmail'] = $data['s_email'];
Params::setParam('contactName', $data['s_name']);
Params::setParam('contactEmail', $data['s_email']);
} else {
$aItem['contactName'] = Params::getParam('contactName');
$aItem['contactEmail'] = Params::getParam('contactEmail');
}
$aItem['userId'] = $userId;
}
// get params
$aItem['catId'] = Params::getParam('catId');
$aItem['countryId'] = Params::getParam('countryId');
$aItem['country'] = Params::getParam('country');
$aItem['region'] = Params::getParam('region');
$aItem['regionId'] = Params::getParam('regionId');
$aItem['city'] = Params::getParam('city');
$aItem['cityId'] = Params::getParam('cityId');
$aItem['price'] = Params::getParam('price') != '' ? Params::getParam('price') : null;
$aItem['cityArea'] = Params::getParam('cityArea');
$aItem['address'] = Params::getParam('address');
$aItem['currency'] = Params::getParam('currency');
$aItem['showEmail'] = Params::getParam('showEmail') != '' ? 1 : 0;
$aItem['title'] = Params::getParam('title');
$aItem['description'] = Params::getParam('description');
//.........这里部分代码省略.........
示例12: define
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('ABS_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/');
require_once ABS_PATH . 'oc-load.php';
switch (Params::getParam('page')) {
case 'user':
// user pages (with security)
if (Params::getParam('action') == 'change_email_confirm' || Params::getParam('action') == 'unsub_alert' && !osc_is_web_user_logged_in()) {
require_once osc_base_path() . 'user-non-secure.php';
$do = new CWebUserNonSecure();
$do->doModel();
} else {
require_once osc_base_path() . 'user.php';
$do = new CWebUser();
$do->doModel();
}
break;
case 'item':
// item pages
require_once osc_base_path() . 'item.php';
$do = new CWebItem();
$do->doModel();
break;
示例13: ajaxPayment
public static function ajaxPayment()
{
$status = self::processPayment();
$data = payment_get_custom(Params::getParam('extra'));
$product_type = explode('x', $data['product']);
if ($status == PAYMENT_COMPLETED) {
osc_add_flash_ok_message(sprintf(__('Success! Please write down this transaction ID in case you have any problem: %s', 'payment'), Params::getParam('stripe_transaction_id')));
if ($product_type[0] == 101) {
$item = Item::newInstance()->findByPrimaryKey($product_type[2]);
$category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
View::newInstance()->_exportVariableToView('category', $category);
payment_js_redirect_to(osc_search_category_url());
} else {
if ($product_type[0] == 201) {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-menu'));
} else {
View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
payment_js_redirect_to(osc_item_url());
}
} else {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-pack'));
} else {
// THIS SHOULD NOT HAPPEN
payment_js_redirect_to(osc_base_path());
}
}
}
} else {
if ($status == PAYMENT_ALREADY_PAID) {
osc_add_flash_warning_message(__('Warning! This payment was already paid', 'payment'));
} else {
osc_add_flash_error_message(_e('There were an error processing your payment', 'payment'));
}
if ($product_type[0] == 301) {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-pack'));
} else {
// THIS SHOULD NOT HAPPEN
payment_js_redirect_to(osc_base_path());
}
} else {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-menu'));
} else {
View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
payment_js_redirect_to(osc_item_url());
}
}
}
}
示例14: doModel
//.........这里部分代码省略.........
Session::newInstance()->_setForm("yourEmail", Params::getParam('yourEmail'));
Session::newInstance()->_setForm("yourName", Params::getParam('yourName'));
Session::newInstance()->_setForm("friendName", Params::getParam('friendName'));
Session::newInstance()->_setForm("friendEmail", Params::getParam('friendEmail'));
Session::newInstance()->_setForm("message_body", Params::getParam('message'));
if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
if (!osc_check_recaptcha()) {
osc_add_flash_error_message(_m('The Recaptcha code is wrong'));
$this->redirectTo(osc_item_send_friend_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
$mItem = new ItemActions(false);
$success = $mItem->send_friend();
if ($success) {
Session::newInstance()->_clearVariables();
$this->redirectTo(osc_item_url());
} else {
$this->redirectTo(osc_item_send_friend_url());
}
break;
case 'contact':
$item = $this->itemManager->findByPrimaryKey(Params::getParam('id'));
if (empty($item)) {
osc_add_flash_error_message(_m('This item doesn\'t exist'));
$this->redirectTo(osc_base_url(true));
} else {
$this->_exportVariableToView('item', $item);
if (osc_item_is_expired()) {
osc_add_flash_error_message(_m('We\'re sorry, but the item has expired. You can\'t contact the seller'));
$this->redirectTo(osc_item_url());
}
if (osc_reg_user_can_contact() && osc_is_web_user_logged_in() || !osc_reg_user_can_contact()) {
$this->doView('item-contact.php');
} else {
osc_add_flash_error_message(_m('You can\'t contact the seller, only registered users can'));
$this->redirectTo(osc_item_url());
}
}
break;
case 'contact_post':
$item = $this->itemManager->findByPrimaryKey(Params::getParam('id'));
$this->_exportVariableToView('item', $item);
if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
if (!osc_check_recaptcha()) {
osc_add_flash_error_message(_m('The Recaptcha code is wrong'));
Session::newInstance()->_setForm("yourEmail", Params::getParam('yourEmail'));
Session::newInstance()->_setForm("yourName", Params::getParam('yourName'));
Session::newInstance()->_setForm("phoneNumber", Params::getParam('phoneNumber'));
Session::newInstance()->_setForm("message_body", Params::getParam('message'));
$this->redirectTo(osc_item_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
$category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
if ($category['i_expiration_days'] > 0) {
$item_date = strtotime($item['dt_pub_date']) + $category['i_expiration_days'] * (24 * 3600);
$date = time();
if ($item_date < $date && $item['b_premium'] != 1) {
// The item is expired, we can not contact the seller
osc_add_flash_error_message(_m('We\'re sorry, but the item has expired. You can\'t contact the seller'));
$this->redirectTo(osc_item_url());
}
}
示例15: osc_route_url
echo osc_route_url('seller-items', array('seller' => osc_item_user_id()));
?>
" >See other items from seller</a>
<?php
}
?>
<a href="<?php
echo osc_route_url('watchlist');
?>
" >Check my Watchlist</a>
<?php
if (osc_comments_enabled()) {
?>
<?php
if (osc_reg_user_post_comments() && osc_is_web_user_logged_in() || !osc_reg_user_post_comments()) {
?>
<?php
if (nc_osc_show_fb_comment()) {
?>
<div class="fb-comments"
data-href="<?php
echo getUrl();
?>
"
data-numposts="5" data-colorscheme="light">
</div>
<?php
} else {
?>