本文整理汇总了PHP中osc_is_admin_user_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_is_admin_user_logged_in函数的具体用法?PHP osc_is_admin_user_logged_in怎么用?PHP osc_is_admin_user_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_is_admin_user_logged_in函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: isLogged
function isLogged()
{
return osc_is_admin_user_logged_in();
}
示例3: dirname
<?php
/**
* cut file
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
if (!osc_is_admin_user_logged_in()) {
exit('Direct access is not allowed.');
}
$error = "";
$info = '';
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_CUT) {
$error = SYS_DISABLED;
} elseif (!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1) {
$error = ERR_NOT_DOC_SELECTED_FOR_CUT;
} elseif (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else {
require_once CLASS_SESSION_ACTION;
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);
$sessionAction->setFolder($_POST['currentFolderPath']);
$sessionAction->set($_POST['selectedDoc']);
$info = ',num:' . sizeof($_POST['selectedDoc']);
}
echo "{error:'" . $error . "'\n" . $info . "}";
示例4: doModel
//.........这里部分代码省略.........
$item = Item::newInstance()->findByPrimaryKey($itemId);
if (count($item) == 0) {
osc_add_flash_error_message(_m("This listing doesn't exist"));
$this->redirectTo(osc_base_url(true));
}
View::newInstance()->_exportVariableToView('item', $item);
if ($this->userId == null) {
osc_add_flash_error_message(_m('You must be logged in to delete a comment'));
$this->redirectTo(osc_item_url());
}
$commentManager = ItemComment::newInstance();
$aComment = $commentManager->findByPrimaryKey($commentId);
if (count($aComment) == 0) {
osc_add_flash_error_message(_m("The comment doesn't exist"));
$this->redirectTo(osc_item_url());
}
if ($aComment['b_active'] != 1) {
osc_add_flash_error_message(_m('The comment is not active, you cannot delete it'));
$this->redirectTo(osc_item_url());
}
if ($aComment['fk_i_user_id'] != $this->userId) {
osc_add_flash_error_message(_m('The comment was not added by you, you cannot delete it'));
$this->redirectTo(osc_item_url());
}
$commentManager->deleteByPrimaryKey($commentId);
osc_add_flash_ok_message(_m('The comment has been deleted'));
$this->redirectTo(osc_item_url());
break;
default:
// if there isn't ID, show an error 404
if (Params::getParam('id') == '') {
$this->do404();
return;
}
if (Params::getParam('lang') != '') {
Session::newInstance()->_set('userLocale', Params::getParam('lang'));
}
$item = $this->itemManager->findByPrimaryKey(Params::getParam('id'));
// if item doesn't exist show an error 404
if (count($item) == 0) {
$this->do404();
return;
}
if ($item['b_active'] != 1) {
if ($this->userId == $item['fk_i_user_id']) {
osc_add_flash_warning_message(_m("The listing hasn't been validated. Please validate it in order to make it public"));
} else {
osc_add_flash_warning_message(_m("This listing hasn't been validated"));
$this->redirectTo(osc_base_url(true));
}
} else {
if ($item['b_enabled'] == 0) {
osc_add_flash_warning_message(_m('The listing has been suspended'));
$this->redirectTo(osc_base_url(true));
}
}
if (!osc_is_admin_user_logged_in()) {
require_once osc_lib_path() . 'osclass/user-agents.php';
foreach ($user_agents as $ua) {
if (preg_match('|' . $ua . '|', @$_SERVER['HTTP_USER_AGENT'])) {
$mStats = new ItemStats();
$mStats->increase('i_num_views', $item['pk_i_id']);
break;
}
}
}
foreach ($item['locale'] as $k => $v) {
$item['locale'][$k]['s_title'] = osc_apply_filter('item_title', $v['s_title']);
$item['locale'][$k]['s_description'] = nl2br(osc_apply_filter('item_description', $v['s_description']));
}
if ($item['fk_i_user_id'] != '') {
$user = User::newInstance()->findByPrimaryKey($item['fk_i_user_id']);
$this->_exportVariableToView('user', $user);
}
$this->_exportVariableToView('item', $item);
osc_run_hook('show_item', $item);
// redirect to the correct url just in case it has changed
$itemURI = str_replace(osc_base_url(), '', osc_item_url());
$URI = preg_replace('|^' . REL_WEB_URL . '|', '', $_SERVER['REQUEST_URI']);
// do not clean QUERY_STRING if permalink is not enabled
if (osc_rewrite_enabled()) {
$URI = str_replace('?' . $_SERVER['QUERY_STRING'], '', $URI);
} else {
$params_keep = array('page', 'id');
$params = array();
foreach (Params::getParamsAsArray('get') as $k => $v) {
if (in_array($k, $params_keep)) {
$params[] = "{$k}={$v}";
}
}
$URI = 'index.php?' . implode('&', $params);
}
// redirect to the correct url
if ($itemURI != $URI) {
$this->redirectTo(osc_base_url() . $itemURI);
}
$this->doView('item.php');
break;
}
}
示例5: define
<?php
define('ABS_PATH', dirname(dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))))) . '/');
define('OC_ADMIN', true);
require_once ABS_PATH . 'oc-load.php';
if (osc_is_admin_user_logged_in() == FALSE) {
die;
}
$model = new GzNewsModel();
$dao = GzNewsDao::newInstance();
$redirect_url = $_SERVER['HTTP_REFERER'];
$gn_id = (int) Params::getParam('gn_id');
$from_form = (bool) Params::getParam('from_form');
if ($from_form) {
$redirect_url = GzNewsUtils::getAdminIndexUrl();
}
$success = $dao->deleteByPrimaryKey($gn_id);
if ($success) {
$model->removeFiles($gn_id);
osc_add_flash_ok_message(__('The item was deleted successfully', 'gz_news'), 'admin');
} else {
osc_add_flash_error_message('There were a problem while deleting the item', 'admin');
}
$model->redirectTo($redirect_url);
示例6: seo_item_edit
function seo_item_edit($catId = null, $item_id = null)
{
$allow_custom_meta = osc_get_preference('allSeo_allow_custom_meta', 'plugin-all_in_one');
if ($allow_custom_meta == 1 or osc_is_admin_user_logged_in()) {
include_once 'item_edit.php';
} else {
if ($allow_custom_meta == 2 and osc_is_web_user_logged_in() or osc_is_admin_user_logged_in()) {
include_once 'item_edit.php';
}
}
}
示例7: doModel
function doModel()
{
//specific things for this class
switch ($this->action) {
case 'bulk_actions':
break;
case 'regions':
//Return regions given a countryId
$regions = Region::newInstance()->findByCountry(Params::getParam("countryId"));
echo json_encode($regions);
break;
case 'cities':
//Returns cities given a regionId
$cities = City::newInstance()->findByRegion(Params::getParam("regionId"));
echo json_encode($cities);
break;
case 'location':
// This is the autocomplete AJAX
$cities = City::newInstance()->ajax(Params::getParam("term"));
foreach ($cities as $k => $city) {
$cities[$k]['label'] = $city['label'] . " (" . $city['region'] . ")";
}
echo json_encode($cities);
break;
case 'location_countries':
// This is the autocomplete AJAX
$countries = Country::newInstance()->ajax(Params::getParam("term"));
echo json_encode($countries);
break;
case 'location_regions':
// This is the autocomplete AJAX
$regions = Region::newInstance()->ajax(Params::getParam("term"), Params::getParam("country"));
echo json_encode($regions);
break;
case 'location_cities':
// This is the autocomplete AJAX
$cities = City::newInstance()->ajax(Params::getParam("term"), Params::getParam("region"));
echo json_encode($cities);
break;
case 'delete_image':
// Delete images via AJAX
$ajax_photo = Params::getParam('ajax_photo');
$id = Params::getParam('id');
$item = Params::getParam('item');
$code = Params::getParam('code');
$secret = Params::getParam('secret');
$json = array();
if ($ajax_photo != '') {
$files = Session::newInstance()->_get('ajax_files');
$success = false;
foreach ($files as $uuid => $file) {
if ($file == $ajax_photo) {
$filename = $files[$uuid];
unset($files[$uuid]);
Session::newInstance()->_set('ajax_files', $files);
$success = @unlink(osc_content_path() . 'uploads/temp/' . $filename);
break;
}
}
echo json_encode(array('success' => $success, 'msg' => $success ? _m('The selected photo has been successfully deleted') : _m("The selected photo couldn't be deleted")));
return false;
}
if (Session::newInstance()->_get('userId') != '') {
$userId = Session::newInstance()->_get('userId');
$user = User::newInstance()->findByPrimaryKey($userId);
} else {
$userId = null;
$user = null;
}
// Check for required fields
if (!(is_numeric($id) && is_numeric($item) && preg_match('/^([a-z0-9]+)$/i', $code))) {
$json['success'] = false;
$json['msg'] = _m("The selected photo couldn't be deleted, the url doesn't exist");
echo json_encode($json);
return false;
}
$aItem = Item::newInstance()->findByPrimaryKey($item);
// Check if the item exists
if (count($aItem) == 0) {
$json['success'] = false;
$json['msg'] = _m("The listing doesn't exist");
echo json_encode($json);
return false;
}
if (!osc_is_admin_user_logged_in()) {
// Check if the item belong to the user
if ($userId != null && $userId != $aItem['fk_i_user_id']) {
$json['success'] = false;
$json['msg'] = _m("The listing doesn't belong to you");
echo json_encode($json);
return false;
}
// Check if the secret passphrase match with the item
if ($userId == null && $aItem['fk_i_user_id'] == null && $secret != $aItem['s_secret']) {
$json['success'] = false;
$json['msg'] = _m("The listing doesn't belong to you");
echo json_encode($json);
return false;
}
}
//.........这里部分代码省略.........
示例8: doModel
function doModel()
{
//specific things for this class
switch ($this->action) {
case 'bulk_actions':
break;
case 'regions':
//Return regions given a countryId
$regions = Region::newInstance()->findByCountry(Params::getParam("countryId"));
echo json_encode($regions);
break;
case 'cities':
//Returns cities given a regionId
$cities = City::newInstance()->findByRegion(Params::getParam("regionId"));
echo json_encode($cities);
break;
case 'location':
// This is the autocomplete AJAX
$cities = City::newInstance()->ajax(Params::getParam("term"));
foreach ($cities as $k => $city) {
$cities[$k]['label'] = $city['label'] . " (" . $city['region'] . ")";
}
echo json_encode($cities);
break;
case 'location_countries':
// This is the autocomplete AJAX
$countries = Country::newInstance()->ajax(Params::getParam("term"));
echo json_encode($countries);
break;
case 'location_regions':
// This is the autocomplete AJAX
$regions = Region::newInstance()->ajax(Params::getParam("term"), Params::getParam("country"));
echo json_encode($regions);
break;
case 'location_cities':
// This is the autocomplete AJAX
$cities = City::newInstance()->ajax(Params::getParam("term"), Params::getParam("region"));
echo json_encode($cities);
break;
case 'delete_image':
// Delete images via AJAX
$id = Params::getParam('id');
$item = Params::getParam('item');
$code = Params::getParam('code');
$secret = Params::getParam('secret');
$json = array();
if (Session::newInstance()->_get('userId') != '') {
$userId = Session::newInstance()->_get('userId');
$user = User::newInstance()->findByPrimaryKey($userId);
} else {
$userId = null;
$user = null;
}
// Check for required fields
if (!(is_numeric($id) && is_numeric($item) && preg_match('/^([a-z0-9]+)$/i', $code))) {
$json['success'] = false;
$json['msg'] = _m("The selected photo couldn't be deleted, the url doesn't exist");
echo json_encode($json);
return false;
}
$aItem = Item::newInstance()->findByPrimaryKey($item);
// Check if the item exists
if (count($aItem) == 0) {
$json['success'] = false;
$json['msg'] = _m("The listing doesn't exist");
echo json_encode($json);
return false;
}
if (!osc_is_admin_user_logged_in()) {
// Check if the item belong to the user
if ($userId != null && $userId != $aItem['fk_i_user_id']) {
$json['success'] = false;
$json['msg'] = _m("The listing doesn't belong to you");
echo json_encode($json);
return false;
}
// Check if the secret passphrase match with the item
if ($userId == null && $aItem['fk_i_user_id'] == null && $secret != $aItem['s_secret']) {
$json['success'] = false;
$json['msg'] = _m("The listing doesn't belong to you");
echo json_encode($json);
return false;
}
}
// Does id & code combination exist?
$result = ItemResource::newInstance()->existResource($id, $code);
if ($result > 0) {
$resource = ItemResource::newInstance()->findByPrimaryKey($id);
if ($resource['fk_i_item_id'] == $item) {
// Delete: file, db table entry
if (defined(OC_ADMIN)) {
osc_deleteResource($id, true);
Log::newInstance()->insertLog('ajax', 'deleteimage', $id, $id, 'admin', osc_logged_admin_id());
} else {
osc_deleteResource($id, false);
Log::newInstance()->insertLog('ajax', 'deleteimage', $id, $id, 'user', osc_logged_user_id());
}
ItemResource::newInstance()->delete(array('pk_i_id' => $id, 'fk_i_item_id' => $item, 's_name' => $code));
$json['msg'] = _m('The selected photo has been successfully deleted');
$json['success'] = 'true';
//.........这里部分代码省略.........
示例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: array
<?
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
if(!osc_is_admin_user_logged_in()) { exit('Direct access is not allowed.'); };
$error = '';
$fileMoved = array();
$unmovedDocDueToSamePath = array();
if(CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY))
{
$error = SYS_DISABLED;
}
elseif(empty($_GET['current_folder_path']))
{
$error = ERR_NOT_DEST_FOLDER_SPECIFIED;
}elseif(!file_exists($_GET['current_folder_path']) || !is_dir($_GET['current_folder_path']))
{
$error = ERR_DEST_FOLDER_NOT_FOUND;
}elseif(!isUnderRoot($_GET['current_folder_path']))
{
$error = ERR_DEST_FOLDER_NOT_ALLOWED;
}else
{
include_once(CLASS_MANAGER);
include_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
include_once(DIR_AJAX_INC . "class.manager.php");
$manager = new manager();
$manager->setSessionAction($sessionAction);
$selectedDocuments = $sessionAction->get();
$destFolderPath = addTrailingSlash(backslashToSlash($_GET['current_folder_path']));