本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
}
开发者ID:oanav,项目名称:closetshare,代码行数:9,代码来源:index.php
示例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());
}
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:15,代码来源:register.php
示例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');
}
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:43,代码来源: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;
}
开发者ID:bomvendador,项目名称:soroka_r,代码行数:23,代码来源:index.php
示例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>';
}
}
开发者ID:oanav,项目名称:closetshare,代码行数:24,代码来源:index.php
示例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;
开发者ID:randomecho,项目名称:OSClass,代码行数:31,代码来源:index.php
示例7: isLogged
function isLogged()
{
return osc_is_web_user_logged_in();
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:4,代码来源:WebSecBaseModel.php
示例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';
}
}
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:35,代码来源:index.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;
}
}
}
}
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:20,代码来源:index.php
示例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 {
//.........这里部分代码省略.........
开发者ID:semul,项目名称:Osclass,代码行数:101,代码来源:item.php
示例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');
//.........这里部分代码省略.........
开发者ID:ranjithinnergys,项目名称:OSClass,代码行数:101,代码来源:ItemActions.php
示例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;
开发者ID:hashemgamal,项目名称:OSClass,代码行数:31,代码来源:index.php
示例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());
}
}
}
}
开发者ID:virsoni,项目名称:plugin-payment,代码行数:52,代码来源:StripePayment.php
示例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());
}
}
开发者ID:nsswaga,项目名称:OSClass,代码行数:67,代码来源:item.php
示例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 {
?>
开发者ID:jhalendra,项目名称:classmandu,代码行数:31,代码来源:item3.php
示例16: profile_picture_upload
function profile_picture_upload()
{
// Configuration - Your Options ///////////////////////////////////////////////////////
// Specify display width of picture (height will be automatically calculated proprotionally)
$maxwidth = '120';
$allowed_filetypes = array('.jpg', '.gif', '.bmp', '.png');
// These will be the types of file that will pass the validation.
$max_filesize = 524288;
// Maximum filesize in BYTES (currently 0.5MB).
$upload_path = osc_plugins_path() . 'profile_picture/images/';
$button_text = __('Upload Profile Picture', 'flatter');
////// ***** No modifications below here should be needed ***** /////////////////////
// First, check to see if user has existing profile picture...
$user_id = osc_logged_user_id();
// the user id of the user profile we're at
$conn = getConnection();
$result = $conn->osc_dbFetchResult("SELECT user_id, pic_ext FROM %st_profile_picture WHERE user_id = '%d' ", DB_TABLE_PREFIX, $user_id);
if ($result > 0) {
list($width, $height, $type, $attr) = getimagesize($upload_path . 'profile' . $user_id . $result['pic_ext']);
// Calculate display heigh/width based on max size specified
$ratio = $width / $height;
$height = $maxwidth / $ratio;
echo '<script language="javascript">function ShowDiv(){document.getElementById("HiddenDiv").style.display = \'\';}</script>';
echo '<script language="javascript">function deletePhoto(){document.forms["deleteForm"].submit();}</script>';
$modtime = filemtime($upload_path . 'profile' . $user_id . $result['pic_ext']);
//ensures browser cache is refreshed if newer version of picture exists
echo '<img src="' . osc_base_url() . 'oc-content/plugins/profile_picture/images/profile' . $user_id . $result['pic_ext'] . '?' . $modtime . '" width="' . $maxwidth . '" height="' . $height . '">';
// display picture
} else {
// show default photo since they haven't uploaded one
echo '<img src="' . osc_base_url() . 'oc-content/plugins/profile_picture/no_picture.jpg" width="' . $width . '" height="' . $height . '">';
}
if (osc_is_web_user_logged_in()) {
if ($result > 0) {
echo '<div><a class="upload" href="javascript:ShowDiv();"><i class="fa fa-cog"></i> ' . __('Change picture', 'flatter') . '</a><a class="pdelete" href="javascript:deletePhoto();"><i class="fa fa-times"></i> ' . __('Delete', 'flatter') . '</a></div>';
echo '<div id="HiddenDiv" style="display:none;">';
// hides form if user already has a profile picture and displays a link to form instead
}
$url = !empty($_SERVER['HTTPS']) ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
echo '
<form name="newpic" method="post" enctype="multipart/form-data" action="' . $url . '">
<input type="file" name="userfile" id="file"><br>
<input class="btn btn-primary" name="Submit" type="submit" value="' . $button_text . '">
</form>
<form name="deleteForm" method="POST" action="' . $url . '"><input type="hidden" name="deletePhoto"></form>
';
//echo
if ($result > 0) {
echo '</div>';
}
}
//if logged-in
if (isset($_POST['Submit'])) {
$filename = $_FILES['userfile']['name'];
// Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename, '.'), strlen($filename) - 1);
// Get the extension from the filename.
// Check if the filetype is allowed, if not DIE and inform the user.
if (!in_array($ext, $allowed_filetypes)) {
die('The file you attempted to upload is not allowed.');
}
// Now check the filesize, if it is too large then DIE and inform the user.
if (filesize($_FILES['userfile']['tmp_name']) > $max_filesize) {
die('The file you attempted to upload is too large.');
}
// Check if we can upload to the specified path, if not DIE and inform the user.
if (!is_writable($upload_path)) {
die('You cannot upload to the specified directory, please CHMOD it to 777.');
}
// Upload the file to your specified path.
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_path . 'profile' . $user_id . $ext)) {
if ($result == 0) {
$conn->osc_dbExec("INSERT INTO %st_profile_picture (user_id, pic_ext) VALUES ('%d', '%s')", DB_TABLE_PREFIX, $user_id, $ext);
} else {
$conn->osc_dbExec("UPDATE %st_profile_picture SET pic_ext = '%s' WHERE user_id = '%d' ", DB_TABLE_PREFIX, $ext, $user_id);
}
echo '<script type="text/javascript">window.location = document.URL;</script>';
} else {
echo 'There was an error during the file upload. Please try again.';
// It failed :(.
}
}
if (isset($_POST['deletePhoto'])) {
$conn->osc_dbExec("DELETE FROM %st_profile_picture WHERE user_id = '%d' ", DB_TABLE_PREFIX, $user_id);
echo '<script type="text/javascript">window.location = document.URL;</script>';
}
}
开发者ID:abhi143u11,项目名称:ads,代码行数:87,代码来源:index.php
示例17: osc_item_is_expired
<?php
$is_expired = osc_item_is_expired();
$is_user = osc_logged_user_id() != osc_item_user_id();
$is_can_contact = osc_reg_user_can_contact() && osc_is_web_user_logged_in() || !osc_reg_user_can_contact();
$is_comments_enabled = osc_comments_enabled();
$is_can_comment = osc_reg_user_post_comments() && osc_is_web_user_logged_in() || !osc_reg_user_post_comments();
?>
<!DOCTYPE html>
<html dir="ltr" lang="<?php
echo str_replace('_', '-', osc_current_user_locale());
?>
">
<head>
<?php
osc_current_web_theme_path('head.php');
?>
<script type="text/javascript" src="<?php
echo osc_current_web_theme_js_url('fancybox/jquery.fancybox-1.3.4.js');
?>
"></script>
<script type="text/javascript" src="<?php
echo osc_current_web_theme_js_url('bootstrap-modal.js');
?>
"></script>
<link href="<?php
echo osc_current_web_theme_js_url('fancybox/jquery.fancybox-1.3.4.css');
?>
" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function(){
开发者ID:nsswaga,项目名称:OSClass,代码行数:31,代码来源:item.php
示例18: osclass_pm_supertoolbar
function osclass_pm_supertoolbar()
{
if (!osc_is_web_user_logged_in()) {
return false;
}
/*if( Rewrite::newInstance()->get_location() != 'item' ) {
return false;
}*/
//if( osc_item_user_id() != osc_logged_user_id() ) {
// return false;
//}
$toolbar = SuperToolBar::newInstance();
$newPMs = ModelPM::newInstance()->getRecipientMessages(osc_logged_user_id(), 1, 1, 'pm_id', 'DESC');
$countPMs = count($newPMs);
$pm_url = osc_render_file_url(osc_plugin_folder(__FILE__) . 'user-inbox.php');
$totalNew = '';
if ($countPMs > 0) {
$totalNew = '(' . $countPMs . ')';
}
$toolbar->addOption('<a href="' . $pm_url . '" />' . __('Inbox', 'osclass_pm') . ' ' . $totalNew . '</a>');
}
开发者ID:oanav,项目名称:closetshare,代码行数:21,代码来源:index.php
示例19: 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';
}
}
}
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:11,代码来源:index.php
示例20: doModel
//.........这里部分代码省略.........
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';
} else {
$json['msg'] = _m("The selected photo does not belong to you");
$json['success'] = 'false';
}
} else {
$json['msg'] = _m("The selected photo couldn't be deleted");
$json['success'] = 'false';
}
echo json_encode($json);
return true;
break;
case 'alerts':
// Allow to register to an alert given (not sure it's used on admin)
$encoded_alert = Params::getParam("alert");
$alert = osc_decrypt_alert(base64_decode($encoded_alert));
// check alert integrity / signature
$stringToSign = osc_get_alert_public_key() . $encoded_alert;
$signature = hex2b64(hmacsha1(osc_get_alert_private_key(), $stringToSign));
$server_signature = Session::newInstance()->_get('alert_signature');
if ($server_signature != $signature) {
|
请发表评论