Index: core/kernel/application.php
===================================================================
--- core/kernel/application.php (revision 12650)
+++ core/kernel/application.php (working copy)
@@ -198,6 +198,22 @@
var $Memcached = null;
/**
+ * Tells, that administrator has authentificated in administrative console
+ * Should be used to manipulate data change OR data restrictioning!
+ *
+ * @var bool
+ */
+ var $isAdminUser = false;
+
+ /**
+ * Tells, that admin version of "index.php" was used, nothing more!
+ * Should be used to manipulate data display!
+ *
+ * @var bool
+ */
+ var $isAdmin = false;
+
+ /**
* Returns kApplication instance anywhere in the script.
*
* This method should be used to get single kApplication object instance anywhere in the
@@ -277,8 +293,12 @@
*/
function Init()
{
- if($this->InitDone) return false;
+ if($this->InitDone) {
+ return false;
+ }
+ $this->isAdmin = constOn('ADMIN');
+
$this->InitMemcached();
if (!constOn('SKIP_OUT_COMPRESSION')) {
@@ -326,7 +346,7 @@
$rewrite_on = $this->ConfigValue('UseModRewrite');
// admin=1 - when front is browsed using admin session
- $admin_on = getArrayValue($_REQUEST, 'admin') || $this->IsAdmin();
+ $admin_on = getArrayValue($_REQUEST, 'admin') || $this->isAdmin;
define('MOD_REWRITE', $rewrite_on && !$admin_on ? 1 : 0);
$this->HttpQuery =& $this->recallObject('HTTPQuery');
@@ -465,18 +485,26 @@
function VerifyLanguageId()
{
$language_id = $this->GetVar('m_lang');
+
if (!$language_id) {
$language_id = 'default';
}
+
$this->SetVar('lang.current_id', $language_id );
$this->SetVar('m_lang', $language_id );
$lang_mode = $this->GetVar('lang_mode');
$this->SetVar('lang_mode', '');
+
$lang =& $this->recallObject('lang.current');
- if ( !$lang->IsLoaded() || (!$this->Application->IsAdmin() && !$lang->GetDBField('Enabled')) ) {
- if (!defined('IS_INSTALL')) $this->ApplicationDie('Unknown or disabled language');
+ /* @var $lang kDBItem */
+
+ if (!$lang->isLoaded() || (!$this->isAdmin && !$lang->GetDBField('Enabled'))) {
+ if (!defined('IS_INSTALL')) {
+ $this->ApplicationDie('Unknown or disabled language');
+ }
}
+
$this->SetVar('lang_mode',$lang_mode);
}
@@ -486,7 +514,7 @@
*/
function VerifyThemeId()
{
- if ($this->Application->IsAdmin()) {
+ if ($this->isAdmin) {
safeDefine('THEMES_PATH', '/core/admin_templates');
return;
}
@@ -567,7 +595,7 @@
if (constOn('DBG_FORCE_THEME')) {
$theme_id = DBG_FORCE_THEME;
}
- elseif (!$force_front && $this->IsAdmin()) {
+ elseif (!$force_front && $this->isAdmin) {
$theme_id = 999;
}
else {
@@ -804,7 +832,7 @@
$this->Debugger->appendMemoryUsage('Application before Run:');
}
- if ($this->IsAdmin()) {
+ if ($this->isAdminUser) {
// for permission checking in events & templates
$this->LinkVar('module'); // for common configuration templates
$this->LinkVar('module_key'); // for common search templates
@@ -813,8 +841,6 @@
if ($this->GetVar('m_opener') == 'p') {
$this->LinkVar('main_prefix'); // window prefix, that opened selector
$this->LinkVar('dst_field'); // field to set value choosed in selector
-// $this->LinkVar('return_template'); // template to go, when something was coosen from popup (from finalizePopup)
-// $this->LinkVar('return_m'); // main env part to restore after popup will be closed (from finalizePopup)
}
if ($this->GetVar('ajax') == 'yes' && !$this->GetVar('debug_ajax')) {
@@ -844,7 +870,7 @@
$this->InitParser();
$t = $this->GetVar('t');
- if (!$this->TemplatesCache->TemplateExists($t) && !$this->IsAdmin()) {
+ if (!$this->TemplatesCache->TemplateExists($t) && !$this->isAdmin) {
$cms_handler =& $this->recallObject('st_EventHandler');
/* @var $cms_handler CategoriesEventHandler */
@@ -927,7 +953,7 @@
$this->Session->SaveData();
}
- if (defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !$this->IsAdmin()) {
+ if (defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !$this->isAdmin) {
$this->_storeStatistics();
}
}
@@ -1310,26 +1336,19 @@
*/
function HREF($t, $prefix='', $params=null, $index_file=null)
{
- if(!$t) $t = $this->GetVar('t'); // moved from kMainTagProcessor->T()
+ if (!$t) {
+ $t = $this->GetVar('t'); // moved from kMainTagProcessor->T()
+ }
$t = preg_replace('/^Content\//i', '', $t);
-
- /*if ($this->GetVar('skip_last_template')) {
- $params['opener'] = 'p';
- $this->SetVar('m_opener', 'p');
+ if (substr($t, -4) == '.tpl') {
+ $t = substr($t, 0, strlen($t) - 4);
}
- if ($t == 'incs/close_popup') {
- // because this template closes the popup and we don't need popup mark here anymore
- $params['m_opener'] = 's';
- }*/
+ if ($this->isAdmin && $prefix == '') $prefix = ADMIN_DIRECTORY;
+ if ($this->isAdmin && $prefix == '_FRONT_END_') $prefix = '';
- if( substr($t, -4) == '.tpl' ) $t = substr($t, 0, strlen($t) - 4 );
-
- if ( $this->IsAdmin() && $prefix == '') $prefix = ADMIN_DIRECTORY;
- if ( $this->IsAdmin() && $prefix == '_FRONT_END_') $prefix = '';
-
$index_file = $this->getIndexFile($prefix, $index_file, $params);
if (isset($params['_auto_prefix_'])) {
@@ -1952,16 +1971,23 @@
{
$session =& $this->recallObject('Session');
$user_id = $session->GetField('PortalUserId');
- if (!$user_id && $user_id != -1) $user_id = -2;
+
+ if (!$user_id && $user_id != -1) {
+ $user_id = -2;
+
+ }
+
$this->SetVar('u.current_id', $user_id);
- if (!$this->IsAdmin()) {
+ if (!$this->isAdmin) {
// needed for "profile edit", "registration" forms ON FRONT ONLY
$this->SetVar('u_id', $user_id);
}
$this->StoreVar('user_id', $user_id, $user_id == -2); // storing Guest user_id (-2) is optional
+ $this->isAdminUser = $this->isAdmin && $this->LoggedIn();
+
if ($this->GetVar('expired') == 1) {
// this parameter is set only from admin
$user =& $this->recallObject('u.current');
@@ -1989,7 +2015,7 @@
}
function LoadCache() {
- $cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->IsAdmin();
+ $cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->isAdmin;
$query = sprintf("SELECT PhraseList, ConfigVariables FROM %s WHERE Template = %s",
TABLE_PREFIX.'PhraseCache',
$this->Conn->qstr(md5($cache_key)));
@@ -2017,7 +2043,7 @@
$update = $update || $this->Phrases->NeedsCacheUpdate();
$update = $update || (count($this->ConfigCacheIds) && $this->ConfigCacheIds != $this->Caches['ConfigVariables']);
if ($update) {
- $cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->IsAdmin();
+ $cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->isAdmin;
$query = sprintf("REPLACE %s (PhraseList, CacheDate, Template, ConfigVariables)
VALUES (%s, %s, %s, %s)",
TABLE_PREFIX.'PhraseCache',
@@ -2263,17 +2289,6 @@
}
/**
- * Checks if it is admin
- *
- * @return bool
- * @author Alex
- */
- function IsAdmin()
- {
- return constOn('ADMIN');
- }
-
- /**
* Apply url rewriting used by mod_rewrite or not
*
* @param bool $ssl Force ssl link to be build
@@ -2628,7 +2643,7 @@
*/
function setVisitField($field, $value)
{
- if ($this->IsAdmin() || !$this->ConfigValue('UseVisitorTracking')) {
+ if ($this->isAdmin || !$this->ConfigValue('UseVisitorTracking')) {
// admin logins are not registred in visits list
return ;
}
Index: core/kernel/constants.php
===================================================================
--- core/kernel/constants.php (revision 12650)
+++ core/kernel/constants.php (working copy)
@@ -61,7 +61,7 @@
$spacer_url = $application->BaseURL().'core/admin_templates/img/spacer.gif';
define('SPACER_URL', $spacer_url);
- if (!$application->IsAdmin()) {
+ if (!$application->isAdmin) {
// don't show debugger buttons on front (if not overrided in "debug.php")
safeDefine('DBG_TOOLBAR_BUTTONS', 0);
}
Index: core/kernel/db/cat_dbitem.php
===================================================================
--- core/kernel/db/cat_dbitem.php (revision 12650)
+++ core/kernel/db/cat_dbitem.php (working copy)
@@ -67,7 +67,7 @@
$this->SetDBField('Modified_date', adodb_mktime() );
$this->SetDBField('Modified_time', adodb_mktime() );
- $is_admin = $this->Application->IsAdmin();
+ $is_admin = $this->Application->isAdminUser;
$owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField');
if (!$owner_field) {
Index: core/kernel/db/cat_event_handler.php
===================================================================
--- core/kernel/db/cat_event_handler.php (revision 12650)
+++ core/kernel/db/cat_event_handler.php (working copy)
@@ -68,7 +68,7 @@
*/
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
if ($event->Name == 'OnSetSortingDirect') {
// allow sorting on front event without view permission
return true;
@@ -675,7 +675,7 @@
}
}
- /*if ( !$this->Application->IsAdmin() ) {
+ /*if (!$this->Application->isAdminUser) {
$object->addFilter('expire_filter', '%1$s.Expire IS NULL OR %1$s.Expire > UNIX_TIMESTAMP()');
}*/
@@ -724,7 +724,7 @@
// Link1 (before modifications) [Status = 1, OrgId = NULL], Link2 (after modifications) [Status = -2, OrgId = Link1_ID]
$pending_editing = $this->Application->getUnitOption($object->Prefix, 'UsePendingEditing');
- if ( !$this->Application->IsAdmin() ) {
+ if (!$this->Application->isAdminUser) {
$types = explode(',', $types);
if (in_array('my_items', $types)) {
$allow_statuses = Array (STATUS_ACTIVE, STATUS_PENDING, STATUS_PENDING_EDITING);
@@ -874,7 +874,7 @@
$object =& $event->getObject();
/* @var $object kCatDBItem */
- if( $this->Application->IsAdmin() && ($this->Application->GetVar($click_field.'_original') !== false) &&
+ if( $this->Application->isAdminUser && ($this->Application->GetVar($click_field.'_original') !== false) &&
floor($this->Application->GetVar($click_field.'_original')) != $object->GetDBField($click_field) )
{
$sql = 'SELECT MAX('.$click_field.') FROM '.$this->Application->getUnitOption($event->Prefix, 'TableName').'
@@ -955,7 +955,7 @@
$this->setCustomExportColumns($event);
}
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$object =& $event->getObject();
/* @var $object kDBItem */
@@ -989,7 +989,7 @@
$this->setCustomExportColumns($event);
}
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$object =& $event->getObject();
/* @var $object kDBItem */
@@ -2199,7 +2199,8 @@
*/
function OnBeforeItemCreate(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
+ // don't set permission-based status, when creating categories in admin
return true;
}
@@ -2294,7 +2295,7 @@
function OnUpdate(&$event)
{
$use_pending = $this->Application->getUnitOption($event->Prefix, 'UsePendingEditing');
- if ($this->Application->IsAdmin() || !$use_pending) {
+ if ($this->Application->isAdminUser || !$use_pending) {
parent::OnUpdate($event);
$this->SetFrontRedirectTemplate($event, 'modify');
return ;
@@ -2386,7 +2387,7 @@
*/
function SetFrontRedirectTemplate(&$event, $template_key)
{
- if ($this->Application->IsAdmin() || $event->status != erSUCCESS) {
+ if ($this->Application->isAdminUser || $event->status != erSUCCESS) {
return ;
}
@@ -2470,7 +2471,7 @@
{
parent::OnDelete($event);
- if ($event->status == erSUCCESS && !$this->Application->IsAdmin()) {
+ if ($event->status == erSUCCESS && !$this->Application->isAdmin) {
$event->SetRedirectParam('pass', 'm');
$event->SetRedirectParam('m_cat_id', 0);
}
@@ -2512,7 +2513,7 @@
*/
function SetSorting(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$event->setEventParam('same_special', true);
}
@@ -2527,7 +2528,7 @@
*/
function getPerPage(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$event->setEventParam('same_special', true);
}
Index: core/kernel/db/cat_tag_processor.php
===================================================================
--- core/kernel/db/cat_tag_processor.php (revision 12650)
+++ core/kernel/db/cat_tag_processor.php (working copy)
@@ -116,7 +116,7 @@
function CategoryPath($params)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
// path for module root category in admin
if (!isset($params['cat_id'])) {
$params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
Index: core/kernel/db/db_event_handler.php
===================================================================
--- core/kernel/db/db_event_handler.php (revision 12650)
+++ core/kernel/db/db_event_handler.php (working copy)
@@ -71,7 +71,7 @@
*/
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$allow_events = Array('OnSearch', 'OnSearchReset', 'OnNew');
if (in_array($event->Name, $allow_events)) {
// allow search on front
@@ -98,7 +98,7 @@
}
if ($event->Name == 'OnSaveWidths') {
- return $this->Application->IsAdmin() && $this->Application->LoggedIn();
+ return $this->Application->isAdminUser;
}
return parent::CheckPermission($event);
@@ -517,7 +517,7 @@
$status_checked = true;
$editing_mode = defined('EDITING_MODE') ? EDITING_MODE : false;
- if ($user_id != -1 && !$this->Application->IsAdmin() && !($editing_mode || $this->checkItemStatus($event))) {
+ if ($user_id != -1 && !$this->Application->isAdmin && !($editing_mode || $this->checkItemStatus($event))) {
// non-root user AND on front-end AND (not editing mode || incorrect status)
$perm_status = false;
}
@@ -532,7 +532,7 @@
$this->Application->Debugger->appendTrace();
}
trigger_error('ItemLoad Permission Failed for prefix ['.$event->getPrefixSpecial().'] in <strong>'.($status_checked ? 'checkItemStatus' : 'CheckPermission').'</strong>', E_USER_WARNING);
- $next_template = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
+ $next_template = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
$this->Application->Redirect($next_template, Array('next_template' => $this->Application->GetVar('t')));
}
}
@@ -2460,7 +2460,7 @@
*/
function OnSuggestValues(&$event)
{
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
+ if (!$this->Application->isAdminUser) {
// very careful here, because this event allows to
// view every object field -> limit only to logged-in admins
return ;
Index: core/kernel/db/db_tag_processor.php
===================================================================
--- core/kernel/db/db_tag_processor.php (revision 12650)
+++ core/kernel/db/db_tag_processor.php (working copy)
@@ -731,7 +731,9 @@
{
$field = $this->SelectParam($params, 'name,field');
- if( !$this->Application->IsAdmin() ) $params['no_special'] = 'no_special';
+ if (!$this->Application->isAdmin) {
+ $params['no_special'] = 'no_special';
+ }
$object =& $this->getObject($params);
Index: core/kernel/db/dbitem.php
===================================================================
--- core/kernel/db/dbitem.php (revision 12650)
+++ core/kernel/db/dbitem.php (working copy)
@@ -1081,7 +1081,7 @@
function setModifiedFlag($mode = null)
{
$main_prefix = $this->Application->GetTopmostPrefix($this->Prefix);
- $this->Application->StoreVar($main_prefix.'_modified', '1', !$this->Application->IsAdmin());
+ $this->Application->StoreVar($main_prefix.'_modified', '1', !$this->Application->isAdmin);
if ($this->ShouldLogChanges()) {
$this->LogChanges($main_prefix, $mode);
Index: core/kernel/event_manager.php
===================================================================
--- core/kernel/event_manager.php (revision 12650)
+++ core/kernel/event_manager.php (working copy)
@@ -374,7 +374,7 @@
continue;
}
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
array_push($all_passed, $prefix_special);
}
else {
@@ -421,7 +421,7 @@
if ($event->status == erPERM_FAIL) {
// should do redirect but to no_permissions template
- $event->redirect = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
+ $event->redirect = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
$event->redirect_params['pass'] = 'm';
$themes_helper =& $this->Application->recallObject('ThemesHelper');
Index: core/kernel/kbase.php
===================================================================
--- core/kernel/kbase.php (revision 12650)
+++ core/kernel/kbase.php (working copy)
@@ -458,7 +458,7 @@
{
$allowed_modifiers = Array('required', 'multiple');
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
// can change upload dir on the fly (admin only!)
$allowed_modifiers[] = 'upload_dir';
}
Index: core/kernel/languages/phrases_cache.php
===================================================================
--- core/kernel/languages/phrases_cache.php (revision 12650)
+++ core/kernel/languages/phrases_cache.php (working copy)
@@ -79,7 +79,7 @@
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
- if (defined('DEBUG_MODE') && DEBUG_MODE && $this->Application->IsAdmin()) {
+ if (defined('DEBUG_MODE') && DEBUG_MODE && $this->Application->isAdmin) {
// only has effect in admin, because on front-end phrases are translated in "Content Mode"
$this->_editMissing = defined('DBG_PHRASES') && DBG_PHRASES;
}
@@ -94,7 +94,7 @@
*/
function setPhraseEditing()
{
- if (!$this->Application->IsAdmin() && (EDITING_MODE == EDITING_MODE_CONTENT)) {
+ if (!$this->Application->isAdmin && (EDITING_MODE == EDITING_MODE_CONTENT)) {
$this->_editExisting = true;
$this->_editMissing = true;
$this->_simpleEditingMode = true;
@@ -108,7 +108,7 @@
$this->LanguageId = 1;
}
else {
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
$id_field = $this->Application->getUnitOption('lang', 'IDField');
$table_name = $this->Application->getUnitOption('lang', 'TableName');
$sql = 'SELECT '.$id_field.'
Index: core/kernel/nparser/template_cache.php
===================================================================
--- core/kernel/nparser/template_cache.php (revision 12650)
+++ core/kernel/nparser/template_cache.php (working copy)
@@ -48,11 +48,11 @@
var $_compressOutput = false;
/**
- * Tells, that we are in administrative console (for performance)
+ * Template locations of each module
*
- * @var bool
+ * @var Array
*/
- var $_isAdmin = false;
+ var $_modulePaths = Array ();
function TemplatesCache()
{
@@ -62,7 +62,17 @@
$this->_compileToDatabase = defined('SAFE_MODE') && SAFE_MODE;
$this->_compressOutput = $this->Application->ConfigValue('UseTemplateCompression');
- $this->_isAdmin = $this->Application->IsAdmin();
+
+ if ($this->Application->isAdmin) {
+ // prepare module template paths for quick access
+ $module_paths = Array ();
+
+ foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
+ $module_paths[$module_name] = rtrim($module_info['Path'], '/');
+ }
+
+ $this->_modulePaths = $module_paths;
+ }
}
/**
@@ -73,7 +83,7 @@
*/
function GetTemplatePaths($filename)
{
- if ($this->_isAdmin && array_key_exists($filename, $this->Application->ReplacementTemplates)) {
+ if ($this->Application->isAdmin && array_key_exists($filename, $this->Application->ReplacementTemplates)) {
$filename = $this->Application->ReplacementTemplates[$filename];
}
@@ -95,7 +105,7 @@
}
// !preg_match for backward compatability with full-path plugins
- if ($this->_isAdmin && ($first_dir == 'plugins') && !preg_match('/admin_templates/', $module_filename)) {
+ if ($this->Application->isAdmin && ($first_dir == 'plugins') && !preg_match('/admin_templates/', $module_filename)) {
if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $module_filename, $regs)) {;
$path = MODULES_PATH.'/'.mb_strtolower($first_dir).'/'.$regs[1].'/admin_templates';
$module_filename = $regs[2];
@@ -105,7 +115,8 @@
$module_filename = $filename;
}
}
- elseif ($this->_isAdmin && $this->Application->findModule('Name', $first_dir)) {
+ elseif ($this->Application->isAdmin && in_array($first_dir, $this->_modulePaths)) {
+ // $this->Application->findModule('Name', $first_dir)
/*if ($first_dir == 'in-portal') {
$first_dir = 'kernel';
}*/
Index: core/kernel/processors/main_processor.php
===================================================================
--- core/kernel/processors/main_processor.php (revision 12650)
+++ core/kernel/processors/main_processor.php (working copy)
@@ -42,7 +42,7 @@
$force_admin = array_key_exists('force_admin', $params) && $params['force_admin'];
$module = array_key_exists('module', $params) ? $params['module'] : 'core';
- if ($this->Application->IsAdmin() || $force_admin) {
+ if ($this->Application->isAdmin || $force_admin) {
if ($module == 'in-portal') {
$module = 'kernel';
}
@@ -590,7 +590,7 @@
$module_key = mb_strtolower($module_name);
if ($module_name == 'In-Portal') {
- if (!$cms_mode && $this->Application->IsAdmin()) {
+ if (!$cms_mode && $this->Application->isAdmin) {
// don't process In-Portal templates in admin
continue;
}
@@ -599,7 +599,7 @@
$module_prefix = $module_data['TemplatePath'];
}
else {
- $module_prefix = $this->Application->IsAdmin() ? $module_key.'/' : rtrim($module_data['TemplatePath'], '/').'/';
+ $module_prefix = $this->Application->isAdmin ? $module_key.'/' : rtrim($module_data['TemplatePath'], '/').'/';
}
$block_params['t'] = $module_prefix.$this->SelectParam($params, $module_key.'_template,'.$module_key.'_t,template,t');
@@ -799,7 +799,7 @@
*/
function CheckSSL($params)
{
- $ssl = $this->Application->IsAdmin() ? $this->Application->ConfigValue('AdminSSL_URL') : false;
+ $ssl = $this->Application->isAdmin ? $this->Application->ConfigValue('AdminSSL_URL') : false;
if (!$ssl) {
// not in admin or admin ssl url is empty
Index: core/kernel/session/inp_session.php
===================================================================
--- core/kernel/session/inp_session.php (revision 12650)
+++ core/kernel/session/inp_session.php (working copy)
@@ -28,7 +28,7 @@
$cookie_name = 'sid';
}
- $admin_session = ($this->Application->IsAdmin() && $special !== 'front') || ($special == 'admin');
+ $admin_session = ($this->Application->isAdmin && $special !== 'front') || ($special == 'admin');
if ($admin_session) {
$cookie_name = 'adm_' . $cookie_name;
@@ -56,7 +56,7 @@
parent::Init($prefix, $special);
- if (!$this->Application->IsAdmin() && $this->GetField('PortalUserId') <= 0) {
+ if (!$this->Application->isAdmin && $this->GetField('PortalUserId') <= 0) {
$group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup');
$this->SetField('GroupId', $this->Application->ConfigValue('User_GuestGroup'));
$this->SetField('GroupList', $group_list);
@@ -114,7 +114,7 @@
function StoreSession(&$session, $additional_fields = Array())
{
$fields_hash = Array (
- 'PortalUserId' => $this->Application->IsAdmin() ? 0 : -2, // Guest
+ 'PortalUserId' => $this->Application->isAdmin ? 0 : -2, // Guest
'Language' => $this->Application->GetDefaultLanguageId(),
'Theme' => $this->Application->GetDefaultThemeId(),
'IpAddress' => $_SERVER['REMOTE_ADDR'], // getenv('REMOTE_ADDR') won't work on IIS, so use $_SERVER instead
Index: core/kernel/session/session.php
===================================================================
--- core/kernel/session/session.php (revision 12650)
+++ core/kernel/session/session.php (working copy)
@@ -564,7 +564,7 @@
$check = $this->Check();
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// 1. Front-End session may not be created (SID is present, but no data in database).
// Check expiration LATER from kApplication::Init, because template, used in session
// expiration redirect should be retrieved from mod-rewrite url first.
@@ -851,7 +851,7 @@
return true;
}
- if (!$force && !($this->Application->IsAdmin() || $this->Application->GetVar('admin')) && !$this->NeedSession()) {
+ if (!$force && !($this->Application->isAdmin || $this->Application->GetVar('admin')) && !$this->NeedSession()) {
// don't create session (in db) on Front-End, when sid is present (GPC), but data in db isn't
if ($this->_fromGet) {
// set sid, that was given in GET
@@ -887,7 +887,7 @@
$this->Storage->StoreSession($this);
- if ($this->Application->IsAdmin() || $this->Special == 'admin') {
+ if ($this->Application->isAdmin || $this->Special == 'admin') {
$this->StoreVar('admin', 1);
}
@@ -1092,7 +1092,7 @@
// save last_template in persistant session
if (!$wid) {
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// only for main window, not popups, not login template, not temp mode (used in adm:MainFrameLink tag)
$temp_mode = false;
$passed = explode(',', $this->Application->GetVar('passed'));
Index: core/kernel/utility/formatters/formatter.php
===================================================================
--- core/kernel/utility/formatters/formatter.php (revision 12650)
+++ core/kernel/utility/formatters/formatter.php (working copy)
@@ -66,7 +66,7 @@
}
$type_ok = preg_match('#int|integer|double|float|real|numeric|string#', $field_type);
if ($field_type == 'string') {
- if (!$this->Application->IsAdmin() && isset($options['allow_html']) && $options['allow_html']) {
+ if (!$this->Application->isAdmin && isset($options['allow_html']) && $options['allow_html']) {
// this allows to revert htmlspecialchars call for each field submitted on front-end
$value = unhtmlentities($value);
}
Index: core/kernel/utility/http_query.php
===================================================================
--- core/kernel/utility/http_query.php (revision 12650)
+++ core/kernel/utility/http_query.php (working copy)
@@ -15,6 +15,7 @@
defined('FULL_PATH') or die('restricted access!');
class kHTTPQuery extends Params {
+
/**
* $_POST vars
*
@@ -30,6 +31,7 @@
* @access private
*/
var $Get;
+
/**
* $_COOKIE vars
*
@@ -73,8 +75,6 @@
var $specialsToRemove = Array();
- var $Admin = false;
-
/**
* Description
*
@@ -101,10 +101,9 @@
function kHTTPQuery($order = 'CGPF')
{
parent::Params();
+
$this->Conn =& $this->Application->GetADODBConnection();
-
$this->Order = $order;
- $this->Admin = $this->Application->IsAdmin(); // better cache this value, not to calculate it each time in foreach
if (array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
// when AJAX request is made from jQuery, then create ajax variable,
@@ -546,23 +545,29 @@
function StripSlashes($array)
{
- //if( !get_magic_quotes_gpc() ) return $array;
- foreach($array as $key=>$value)
- {
- if( is_array($value) )
- {
+ static $magic_quotes = null;
+
+ if (!isset($magic_quotes)) {
+ $magic_quotes = get_magic_quotes_gpc();
+ }
+
+ foreach ($array as $key => $value) {
+ if (is_array($value)) {
$array[$key] = $this->StripSlashes($value);
}
- else
- {
-// $value = iconv('UTF-8', 'windows-1257', $value);
+ else {
+ if ($magic_quotes) {
+ $value = stripslashes($value);
+ }
- if( get_magic_quotes_gpc() ) $value = stripslashes($value);
- if(!$this->Admin) $value = htmlspecialchars($value);
+ if (!$this->Application->isAdmin) {
+ $value = htmlspecialchars($value);
+ }
+
$array[$key] = $value;
}
- //$array[$key]=is_array($value)?$this->StripSlashes($value):stripslashes($value);
}
+
return $array;
}
@@ -591,7 +596,7 @@
if ($access_error) {
$vars = $this->_removePassThroughVariables($vars);
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// place 1 of 2 (also in UsersEventHandler::OnSessionExpire)
$vars['m_cat_id'] = 0; // category means nothing on admin login screen
$vars['m_wid'] = ''; // remove wid, otherwise parent window may add wid to its name breaking all the frameset (for <a> targets)
@@ -651,7 +656,7 @@
if ($fp) {
$session =& $this->Application->recallObject('Session');
$user_id = $session->GetField('PortalUserId');
- $admin_mark = $this->Application->IsAdmin() ? 'ADMIN' : 'FRONT';
+ $admin_mark = $this->Application->isAdmin ? 'ADMIN' : 'FRONT';
$data = '['.date('D M d H:i:s Y').'] '.$admin_mark.'; ip: '.$_SERVER['REMOTE_ADDR'].'; user_id: '.$user_id.'; sid: '.$this->Application->GetSID().'; request: '."\n";
if ($this->Get) {
Index: core/units/admin/admin_events_handler.php
===================================================================
--- core/units/admin/admin_events_handler.php (revision 12650)
+++ core/units/admin/admin_events_handler.php (working copy)
@@ -71,7 +71,7 @@
}
if ($event->Name == 'OnSaveMenuFrameWidth') {
- $perm_value = $this->Application->IsAdmin() && $this->Application->LoggedIn();
+ $perm_value = $this->Application->isAdminUser;
}
if (isset($perm_value)) {
Index: core/units/categories/categories_event_handler.php
===================================================================
--- core/units/categories/categories_event_handler.php (revision 12650)
+++ core/units/categories/categories_event_handler.php (working copy)
@@ -62,7 +62,7 @@
*/
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
if ($event->Name == 'OnSetSortingDirect') {
// allow sorting on front event without view permission
return true;
@@ -306,7 +306,7 @@
$object->addFilter('perm_filter2', $view_filter);
}
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
// apply status filter only on front
$object->addFilter('status_filter', $object->TableName.'.Status = 1');
}
@@ -501,7 +501,7 @@
return $this->_getPassedStructureID($event);
}
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
return parent::getPassedID($event);
}
@@ -556,7 +556,7 @@
$created = $this->_prepareAutoPage($object, $template, null, SMS_MODE_AUTO, false); // create virtual (not system!) page
if ($created) {
- if ($this->Application->ConfigValue('QuickCategoryPermissionRebuild') || !$this->Application->IsAdmin()) {
+ if ($this->Application->ConfigValue('QuickCategoryPermissionRebuild') || !$this->Application->isAdmin) {
$updater =& $this->Application->recallObject('kPermCacheUpdater');
/* @var $updater kPermCacheUpdater */
@@ -577,7 +577,7 @@
}
}
- if (!$page_id && !$this->Application->IsAdmin()) {
+ if (!$page_id && !$this->Application->isAdmin) {
$page_id = $this->Application->GetVar('m_cat_id');
}
@@ -1183,7 +1183,7 @@
{
$this->_beforeItemChange($event);
- if ($this->Application->IsAdmin() || $event->Prefix == 'st') {
+ if ($this->Application->isAdminUser || $event->Prefix == 'st') {
// don't check category permissions when auto-creating structure pages
return ;
}
@@ -1210,7 +1210,7 @@
$min_priority = $this->_getNextPriority($object->GetDBField('ParentId'), $object->TableName);
$object->SetDBField('Priority', $min_priority);
- /*if (!$this->Application->IsAdmin()) {
+ /*if (!$this->Application->isAdminUser) {
$object->SetDBField('IsMenu', 0); // add all suggested categories as non-menu
}*/
}
@@ -1261,7 +1261,8 @@
{
parent::OnCreate($event);
- if ($this->Application->IsAdmin() || $event->status != erSUCCESS) {
+ if ($this->Application->isAdminUser || $event->status != erSUCCESS) {
+ // don't sent email or rebuild cache directly after category is created by admin
return ;
}
@@ -1293,7 +1294,7 @@
*/
function getPerPage(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$event->setEventParam('same_special', true);
}
@@ -1312,7 +1313,7 @@
{
parent::SetPagination($event);
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$page_var = $event->getEventParam('page_var');
if ($page_var !== false) {
$page = $this->Application->GetVar($page_var);
@@ -1496,7 +1497,7 @@
$object->SetError('Template', 'no_inherit');
}
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
+ if (!$this->Application->isAdminUser) {
// only administrator can set/change "cust_RssSource" field
if ($object->GetDBField('cust_RssSource') != $object->GetOriginalField('cust_RssSource')) {
@@ -1787,7 +1788,7 @@
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields);
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// don't sort by Front-End sorting fields
$config_mapping = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping');
$remove_keys = Array ('DefaultSorting1Field', 'DefaultSorting2Field', 'DefaultSorting1Dir', 'DefaultSorting2Dir');
@@ -1823,7 +1824,8 @@
{
parent::OnAfterItemLoad($event);
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
+ // calculate priorities dropdown only for admin
return ;
}
Index: core/units/categories/categories_item.php
===================================================================
--- core/units/categories/categories_item.php (revision 12650)
+++ core/units/categories/categories_item.php (working copy)
@@ -27,7 +27,7 @@
}
// TODO: move to CategoryEventHandler::OnBeforeItemCreate
- $is_admin = $this->Application->IsAdmin();
+ $is_admin = $this->Application->isAdminUser;
if ((!$this->IsTempTable() && !$is_admin) || ($is_admin && !$this->GetDBField('CreatedById'))) {
$this->SetDBField('CreatedById', $this->Application->RecallVar('user_id'));
Index: core/units/categories/categories_tag_processor.php
===================================================================
--- core/units/categories/categories_tag_processor.php (revision 12650)
+++ core/units/categories/categories_tag_processor.php (working copy)
@@ -393,7 +393,7 @@
$list_unique_key = $this->getUniqueListKey($params);
// check for "admin" variable, because we are parsing front-end template from admin when using template editor feature
- if ($this->Application->GetVar('admin') || !$this->Application->IsAdmin()) {
+ if ($this->Application->GetVar('admin') || !$this->Application->isAdmin) {
// add parent category to special, when on Front-End,
// because there can be many category lists on same page
$list_unique_key .= $parent_cat_id;
@@ -1547,7 +1547,7 @@
{
$template = $this->Application->GetVar('t');
- if (!$this->Application->TemplatesCache->TemplateExists($template) && !$this->Application->IsAdmin()) {
+ if (!$this->Application->TemplatesCache->TemplateExists($template) && !$this->Application->isAdmin) {
$cms_handler =& $this->Application->recallObject($this->Prefix . '_EventHandler');
/* @var $cms_handler CategoriesEventHandler */
Index: core/units/custom_fields/custom_fields_event_handler.php
===================================================================
--- core/units/custom_fields/custom_fields_event_handler.php (revision 12650)
+++ core/units/custom_fields/custom_fields_event_handler.php (working copy)
@@ -65,7 +65,7 @@
$object->addFilter('itemtype_filter', '%1$s.Type = '.$item_type);
}
- if (!($this->Application->isDebugMode() && $this->Application->IsAdmin())) {
+ if (!($this->Application->isDebugMode() && $this->Application->isAdminUser)) {
$object->addFilter('user_filter', '%1$s.IsSystem = 0');
}
}
Index: core/units/email_events/email_events_event_handler.php
===================================================================
--- core/units/email_events/email_events_event_handler.php (revision 12650)
+++ core/units/email_events/email_events_event_handler.php (working copy)
@@ -165,7 +165,7 @@
return false;
}
- if ($email_event->GetDBField('FrontEndOnly') && $this->Application->IsAdmin()) {
+ if ($email_event->GetDBField('FrontEndOnly') && $this->Application->isAdmin) {
return false;
}
Index: core/units/fck/fck_eh.php
===================================================================
--- core/units/fck/fck_eh.php (revision 12650)
+++ core/units/fck/fck_eh.php (working copy)
@@ -23,7 +23,7 @@
*/
function CheckPermission(&$event)
{
- if ($this->Application->LoggedIn() && $this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
// this limits all event execution only to logged-in users in admin
return true;
}
Index: core/units/files/file_eh.php
===================================================================
--- core/units/files/file_eh.php (revision 12650)
+++ core/units/files/file_eh.php (working copy)
@@ -76,7 +76,7 @@
$object =& $event->getObject();
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('active_filter', '%1$s.Status = '.STATUS_ACTIVE);
}
}
Index: core/units/form_submissions/form_submissions_eh.php
===================================================================
--- core/units/form_submissions/form_submissions_eh.php (revision 12650)
+++ core/units/form_submissions/form_submissions_eh.php (working copy)
@@ -18,7 +18,7 @@
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
if ($event->Name == 'OnCreate') {
// anybody can submit forms on front
return true;
@@ -118,9 +118,11 @@
function getPassedID(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
+ // no way to see other user's form submission by giving it's ID directly in url
return 0;
}
+
return parent::getPassedID($event);
}
Index: core/units/helpers/captcha_helper.php
===================================================================
--- core/units/helpers/captcha_helper.php (revision 12650)
+++ core/units/helpers/captcha_helper.php (working copy)
@@ -130,7 +130,7 @@
*/
function prepareCode($variable_name)
{
- if ($this->Application->IsAdmin() || $this->Application->RecallVar($variable_name)) {
+ if ($this->Application->isAdmin || $this->Application->RecallVar($variable_name)) {
// when code found don't generate it 2nd time
return $this->Application->RecallVar($variable_name);
}
@@ -150,7 +150,7 @@
*/
function validateCode(&$event, $check_request = true)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// no captcha codes in admin
return true;
}
Index: core/units/helpers/category_helper.php
===================================================================
--- core/units/helpers/category_helper.php (revision 12650)
+++ core/units/helpers/category_helper.php (working copy)
@@ -500,10 +500,10 @@
$url_params = Array ('m_cat_id' => $page_id, 'pass' => 'm');
$page_url = $this->Application->HREF(strtolower($templates[$page_id]), '', $url_params);
- /*if ($this->Application->IsAdmin()) {
+ /*if ($this->Application->isAdmin) {
$page_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $page_url);
}*/
- $text = preg_replace('/@@' . $page_id . '@@/', $page_url, $text);
+ $text = preg_replace('/@@' . $page_id . '@@/', $page_url, $text);
}
return $text;
Index: core/units/helpers/modules_helper.php
===================================================================
--- core/units/helpers/modules_helper.php (revision 12650)
+++ core/units/helpers/modules_helper.php (working copy)
@@ -20,7 +20,8 @@
{
$where_clause = Array('Loaded = 1');
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
+ // no license checks on front-end
return implode(' AND ', $where_clause);
}
@@ -141,7 +142,7 @@
*/
function _CheckDomain($user_domain, $license_domain)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
$user_domain = $this->_StripDomainHost($user_domain);
return preg_match('/(.*)'.preg_quote($user_domain, '/').'$/', $license_domain);
}
Index: core/units/helpers/permissions_helper.php
===================================================================
--- core/units/helpers/permissions_helper.php (revision 12650)
+++ core/units/helpers/permissions_helper.php (working copy)
@@ -192,7 +192,7 @@
if (!$id) {
// item being created -> check by current (before editing started, saved in OnPreCreate event) category permissions
// note: category in session is placed on catalog data import start
- $category_id = $this->Application->IsAdmin() ? $this->Application->RecallVar('m_cat_id') : $this->Application->GetVar('m_cat_id');
+ $category_id = $this->Application->isAdmin ? $this->Application->RecallVar('m_cat_id') : $this->Application->GetVar('m_cat_id');
}
elseif ($top_prefix == 'c' || $top_prefix == 'st') {
$category_id = $id;
@@ -212,7 +212,7 @@
$new_item = false;
}
else {
- $new_item = $this->Application->IsAdmin() && $event_handler->isNewItemCreate($event) ? true : false;
+ $new_item = $this->Application->isAdminUser && $event_handler->isNewItemCreate($event) ? true : false;
$check_status = $this->checkCombinedPermissions($event, $owner_id, (int)$category_id, $new_item);
}
@@ -329,7 +329,7 @@
*/
function CheckEventCategoryPermission(&$event, $event_perm_mapping)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
// check front-end permission by old scheme
return $this->_frontCheckEventCategoryPermission($event, $event_perm_mapping);
}
@@ -348,7 +348,7 @@
}
// 1. most of events does require admin login only
- $perm_status = $this->Application->LoggedIn() && $this->Application->IsAdmin();
+ $perm_status = $this->Application->isAdminUser;
// 2. in case, when event require more, then "view" right, then restrict it to temporary tables only
if (!in_array('view', $check_perms)) {
@@ -450,7 +450,7 @@
if (!$this->Application->LoggedIn()) {
$redirect_template = array_key_exists('login_template', $params) ? $params['login_template'] : '';
- if (!$redirect_template && $this->Application->IsAdmin()) {
+ if (!$redirect_template && $this->Application->isAdmin) {
$redirect_template = 'login';
}
$redirect_params['next_template'] = $t;
@@ -460,7 +460,7 @@
$redirect_template = $params['no_permissions_template'];
}
else {
- $redirect_template = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
+ $redirect_template = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
}
if ($this->Application->isDebugMode()) {
Index: core/units/helpers/themes_helper.php
===================================================================
--- core/units/helpers/themes_helper.php (revision 12650)
+++ core/units/helpers/themes_helper.php (working copy)
@@ -343,7 +343,7 @@
return $theme_id;
}
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// get theme, that user selected in catalog
$theme_id = $this->Application->RecallVar('theme_id');
Index: core/units/images/image_event_handler.php
===================================================================
--- core/units/images/image_event_handler.php (revision 12650)
+++ core/units/images/image_event_handler.php (working copy)
@@ -51,7 +51,7 @@
*/
function getMainSpecial(&$event)
{
- if ($event->Special == 'list' && !$this->Application->IsAdmin()) {
+ if ($event->Special == 'list' && !$this->Application->isAdmin) {
// ListImages aggregated tag uses this special
return '';
}
@@ -301,8 +301,7 @@
$object =& $event->getObject();
$type_clauses = Array();
- if( !$this->Application->IsAdmin() )
- {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('active', '%1$s.Enabled = 1');
}
Index: core/units/images/image_tag_processor.php
===================================================================
--- core/units/images/image_tag_processor.php (revision 12650)
+++ core/units/images/image_tag_processor.php (working copy)
@@ -304,7 +304,7 @@
// show default image, use different base urls for admin and front-end
$base_url = rtrim($this->Application->BaseURL(), '/');
- $sub_folder = $this->Application->IsAdmin() ? rtrim(IMAGES_PATH, '/') : THEMES_PATH;
+ $sub_folder = $this->Application->isAdmin ? rtrim(IMAGES_PATH, '/') : THEMES_PATH;
if ($max_width > 0 || $max_height > 0) {
$image_helper =& $this->Application->recallObject('ImageHelper');
Index: core/units/languages/languages_event_handler.php
===================================================================
--- core/units/languages/languages_event_handler.php (revision 12650)
+++ core/units/languages/languages_event_handler.php (working copy)
@@ -241,7 +241,7 @@
{
$this->Application->SetVar('m_lang', $this->Application->GetVar('language'));
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
// without this language change in admin will cause erase of last remembered tree section
$this->Application->SetVar('skip_last_template', 1);
}
Index: core/units/languages/languages_item.php
===================================================================
--- core/units/languages/languages_item.php (revision 12650)
+++ core/units/languages/languages_item.php (working copy)
@@ -69,7 +69,7 @@
if ($default) {
if (!$res) {
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
$res = parent::Load(1);
}
else {
Index: core/units/phrases/phrases_event_handler.php
===================================================================
--- core/units/phrases/phrases_event_handler.php (revision 12650)
+++ core/units/phrases/phrases_event_handler.php (working copy)
@@ -48,7 +48,7 @@
*/
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin() && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
+ if (!$this->Application->isAdmin && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
$allow_events = Array ('OnCreate', 'OnUpdate');
if (in_array($event->Name, $allow_events)) {
Index: core/units/reviews/reviews_event_handler.php
===================================================================
--- core/units/reviews/reviews_event_handler.php (revision 12650)
+++ core/units/reviews/reviews_event_handler.php (working copy)
@@ -24,7 +24,7 @@
*/
function getMainSpecial(&$event)
{
- if ($event->Special == 'product' && !$this->Application->IsAdmin()) {
+ if ($event->Special == 'product' && !$this->Application->isAdmin) {
// rev.product should auto-link
return '';
}
@@ -172,7 +172,7 @@
$object =& $event->getObject();
/* @var $object kDBList */
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('active', '%1$s.Status = '.STATUS_ACTIVE);
}
@@ -264,7 +264,8 @@
$object->SetDBField('ItemType', $item_type);
$object->SetDBField('Module', $this->Application->findModule('Var', $parent_info['ParentPrefix'], 'Name'));
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
+ // don't perform spam control on admin
return ;
}
@@ -315,7 +316,7 @@
{
$this->updateSubitemCounters($event);
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
@@ -352,7 +353,7 @@
$object =& $event->getObject();
/* @var $object kDBItem */
- if ($this->Application->IsAdmin() && !$object->IsTempTable()) {
+ if ($this->Application->isAdminUser && !$object->IsTempTable()) {
// send email on review status change from reviews grid in admin
$review_status = $object->GetDBField('Status');
$process_status = Array (STATUS_ACTIVE, STATUS_DISABLED);
@@ -481,7 +482,7 @@
{
parent::OnCreate($event);
- if ($event->status != erSUCCESS || $this->Application->IsAdmin()) {
+ if ($event->status != erSUCCESS || $this->Application->isAdmin) {
return ;
}
Index: core/units/theme_files/theme_file_eh.php
===================================================================
--- core/units/theme_files/theme_file_eh.php (revision 12650)
+++ core/units/theme_files/theme_file_eh.php (working copy)
@@ -41,7 +41,7 @@
function CheckPermission(&$event)
{
if ($event->Name == 'OnLoadBlock' || $event->Name == 'OnSaveBlock') {
- return $this->Application->LoggedIn() && $this->Application->IsAdmin();
+ return $this->Application->isAdminUser;
}
return parent::CheckPermission($event);
Index: core/units/themes/theme_item.php
===================================================================
--- core/units/themes/theme_item.php (revision 12650)
+++ core/units/themes/theme_item.php (working copy)
@@ -29,7 +29,7 @@
if ($default) {
if (!$res) {
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
$res = parent::Load(1);
}
}
Index: core/units/themes/themes_eh.php
===================================================================
--- core/units/themes/themes_eh.php (revision 12650)
+++ core/units/themes/themes_eh.php (working copy)
@@ -123,7 +123,7 @@
*/
function OnChangeTheme(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
// for structure theme dropdown
$this->Application->StoreVar('theme_id', $this->Application->GetVar('theme'));
$this->Application->StoreVar('RefreshStructureTree', 1);
@@ -152,7 +152,7 @@
{
parent::SetCustomQuery($event);
- if ($event->Special == 'enabled' || !$this->Application->IsAdmin()) {
+ if ($event->Special == 'enabled' || !$this->Application->isAdminUser) {
// "enabled" special or Front-End
$object =& $event->getObject();
Index: core/units/thesaurus/thesaurus_eh.php
===================================================================
--- core/units/thesaurus/thesaurus_eh.php (revision 12650)
+++ core/units/thesaurus/thesaurus_eh.php (working copy)
@@ -28,7 +28,7 @@
$object =& $event->getObject();
/* @var $object kDBList */
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$keywords = unhtmlentities( trim($this->Application->GetVar('keywords')) );
$object->addFilter('search_filter', '%1$s.SearchTerm LIKE ' . $this->Conn->qstr($keywords).' OR %1$s.SearchTerm LIKE ' . $this->Conn->qstr($keywords . '_'));
}
Index: core/units/users/users_event_handler.php
===================================================================
--- core/units/users/users_event_handler.php (revision 12650)
+++ core/units/users/users_event_handler.php (working copy)
@@ -67,7 +67,7 @@
$object->addFilter('primary_filter', 'ug.GroupId <> 11');
}
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('status_filter', '%1$s.Status = '.STATUS_ACTIVE);
}
@@ -104,7 +104,7 @@
return true;
}
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$user_id = $this->Application->RecallVar('user_id');
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
@@ -164,8 +164,7 @@
'no_pass_through' => 1, // this way kApplication::HREF won't add them again
);
- if ($this->Application->IsAdmin()) {
-
+ if ($this->Application->isAdmin) {
$this->Application->Redirect('index', $admin_url_params, '', 'index.php');
}
@@ -199,11 +198,11 @@
function OnLogin(&$event)
{
// persistent session data after login is not refreshed, because redirect will follow in any case
- $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme
+ $prefix_special = $this->Application->isAdmin ? 'u.current' : 'u'; // "u" used on front not to change theme
$object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true));
$password = $this->Application->GetVar('password');
- $invalid_pseudo = $this->Application->IsAdmin() ? 'la_invalid_password' : 'lu_invalid_password';
+ $invalid_pseudo = $this->Application->isAdmin ? 'la_invalid_password' : 'lu_invalid_password';
$remember_login_cookie = $this->Application->GetVar('remember_login');
if (!$password && !$remember_login_cookie) {
@@ -213,18 +212,18 @@
}
$email_as_login = $this->Application->ConfigValue('Email_As_Login');
- list ($login_field, $submit_field) = $email_as_login && !$this->Application->IsAdmin() ? Array('Email', 'email') : Array('Login', 'login');
+ list ($login_field, $submit_field) = $email_as_login && !$this->Application->isAdmin ? Array('Email', 'email') : Array('Login', 'login');
$login_value = $this->Application->GetVar($submit_field);
// process "Save Username" checkbox
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
$save_username = $this->Application->GetVar('cb_save_username') ? $login_value : '';
$this->Application->Session->SetCookie('save_username', $save_username, adodb_mktime() + 31104000); // 1 year expiration
$this->Application->SetVar('save_username', $save_username); // cookie will be set on next refresh, but refresh won't occur if login error present, so duplicate cookie in HTTPQuery
}
$super_admin = ($login_value == 'super-root') && $this->verifySuperAdmin();
- if ($this->Application->IsAdmin() && ($login_value == 'root') || ($super_admin && $login_value == 'super-root')) {
+ if ($this->Application->isAdmin && ($login_value == 'root') || ($super_admin && $login_value == 'super-root')) {
// logging in "root" (admin only)
$login_value = 'root';
@@ -350,7 +349,7 @@
{
$remember_login_cookie = $this->Application->GetVar('remember_login');
- if (!$remember_login_cookie || $this->Application->IsAdmin() || $this->Application->LoggedIn()) {
+ if (!$remember_login_cookie || $this->Application->isAdmin || $this->Application->LoggedIn()) {
return ;
}
@@ -377,8 +376,9 @@
function checkLoginPermission($user_name)
{
$ret = true;
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdmin) {
$modules_helper =& $this->Application->recallObject('ModulesHelper');
+
if ($user_name != 'root') {
// root is virtual user, so allow him to login to admin in any case
$ret = $this->Application->CheckPermission('ADMIN', 1);
@@ -387,6 +387,7 @@
else {
$ret = $this->Application->CheckPermission('LOGIN', 1);
}
+
return $ret;
}
@@ -397,7 +398,7 @@
*/
function processLoginRedirect(&$event, $password)
{
- $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme
+ $prefix_special = $this->Application->isAdmin ? 'u.current' : 'u'; // "u" used on front not to change theme
$object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true));
$next_template = $this->Application->GetVar('next_template');
@@ -533,7 +534,7 @@
$this->Conn->Query($sql);
// set primary group to user
- if ($this->Application->IsAdmin() && $this->Application->GetVar('user_group')) {
+ if ($this->Application->isAdminUser && $this->Application->GetVar('user_group')) {
// while in admin you can set any group for new users
$group_id = $this->Application->GetVar('user_group');
}
@@ -640,7 +641,9 @@
{
$this->OnAfterItemCreate($event);
$object->SendEmailEvents();
- if( !$this->Application->IsAdmin() && ($event->status == erSUCCESS) && $event->redirect) $this->autoLoginUser($event);
+ if (!$this->Application->isAdmin && ($event->status == erSUCCESS) && $event->redirect) {
+ $this->autoLoginUser($event);
+ }
}
}
return $is_subscriber;
@@ -653,10 +656,11 @@
*/
function OnCreate(&$event)
{
- if( !$this->Application->IsAdmin() ) $this->setUserStatus($event);
+ if (!$this->Application->isAdminUser) {
+ $this->setUserStatus($event);
+ }
- if( !$this->isSubscriberOnly($event) )
- {
+ if (!$this->isSubscriberOnly($event)) {
$cs_helper =& $this->Application->recallObject('CountryStatesHelper');
$cs_helper->CheckStateField($event, 'State', 'Country');
@@ -674,8 +678,7 @@
$this->setNextTemplate($event);
- if( !$this->Application->IsAdmin() && ($event->status == erSUCCESS) && $event->redirect)
- {
+ if (!$this->Application->isAdmin && ($event->status == erSUCCESS) && $event->redirect) {
$object->SendEmailEvents();
$this->autoLoginUser($event);
}
@@ -1144,14 +1147,18 @@
*/
function setNextTemplate(&$event)
{
- if( !$this->Application->IsAdmin() )
- {
- $event->redirect_params['opener'] = 's';
- $object =& $event->getObject();
- if($object->GetDBField('Status') == STATUS_ACTIVE)
- {
- $next_template = $this->Application->GetVar('next_template');
- if($next_template) $event->redirect = $next_template;
+ if ($this->Application->isAdmin) {
+ return ;
+ }
+
+ $event->redirect_params['opener'] = 's';
+ $object =& $event->getObject();
+
+ if ($object->GetDBField('Status') == STATUS_ACTIVE) {
+ $next_template = $this->Application->GetVar('next_template');
+
+ if ($next_template) {
+ $event->redirect = $next_template;
}
}
}
@@ -1437,7 +1444,7 @@
$object =& $event->getObject();
/* @var $object UsersItem */
- if (!$this->Application->IsAdmin() || $object->IsTempTable()) {
+ if (!$this->Application->isAdmin || $object->IsTempTable()) {
return ;
}
@@ -1549,7 +1556,7 @@
$file_helper->createItemFiles($event->Prefix, true); // create image fields
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
// 4. when in administrative console, then create all users with Active status
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
// $fields['Password']['required'] = 1; // set password required (will broke approve/decline buttons)
@@ -1728,7 +1735,7 @@
*/
function saveUserImages(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
Index: core/units/visits/visits_event_handler.php
===================================================================
--- core/units/visits/visits_event_handler.php (revision 12650)
+++ core/units/visits/visits_event_handler.php (working copy)
@@ -37,7 +37,7 @@
*/
function OnRegisterVisit(&$event)
{
- if ($this->Application->IsAdmin() || !$this->Application->ConfigValue('UseVisitorTracking')) {
+ if ($this->Application->isAdmin || !$this->Application->ConfigValue('UseVisitorTracking')) {
// admin logins are not registred in visits list
return true;
}
Index: custom/units/sections/e_link_eh.php
===================================================================
--- custom/units/sections/e_link_eh.php (revision 12650)
+++ custom/units/sections/e_link_eh.php (working copy)
@@ -78,12 +78,12 @@
/* @var $object kDBList */
# identifying event based on special and setting filter
- if ( $event->Special == 'custom-special' ) {
+ if ($event->Special == 'custom-special') {
// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
}
# identifying event based not admin condition and setting filter
- if ( !$this->Application->IsAdmin() ) {
+ if (!$this->Application->isAdminUser) {
// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
}
}
Index: custom/units/sections/e_product_eh.php
===================================================================
--- custom/units/sections/e_product_eh.php (revision 12650)
+++ custom/units/sections/e_product_eh.php (working copy)
@@ -84,7 +84,7 @@
}
# identifying event based not admin condition and setting filter
- if ( !$this->Application->IsAdmin() ) {
+ if (!$this->Application->isAdminUser) {
// $object->addFilter('status_filter', '%1$s.Status = '.STATUS_ACTIVE);
}
}
Index: custom/units/sections/e_user_eh.php
===================================================================
--- custom/units/sections/e_user_eh.php (revision 12650)
+++ custom/units/sections/e_user_eh.php (working copy)
@@ -83,7 +83,7 @@
}
# identifying event based not admin condition and setting filter
- if ( !$this->Application->IsAdmin() ) {
+ if (!$this->Application->isAdminUser) {
// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
}
}
Index: in-auction/units/error_log/error_log_eh.php
===================================================================
--- in-auction/units/error_log/error_log_eh.php (revision 12651)
+++ in-auction/units/error_log/error_log_eh.php (working copy)
@@ -57,7 +57,7 @@
*/
function OnDeleteAll(&$event)
{
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
+ if (!$this->Application->isAdminUser) {
return;
}
Index: in-auction/units/listing/listing_eh.php
===================================================================
--- in-auction/units/listing/listing_eh.php (revision 12651)
+++ in-auction/units/listing/listing_eh.php (working copy)
@@ -43,9 +43,9 @@
*/
function OnNewListingWindow(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
$copy_event = new kEvent($this->Application->GetVar('active_prefix').':OnCopy');
$this->Application->HandleEvent($copy_event);
@@ -154,9 +154,9 @@
*/
function OnDeleteAll(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
@@ -223,9 +223,9 @@
*/
function OnProcessAddListing(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
$listing_items =& $this->Application->recallObject('l-ebay.add','l-ebay_List',Array('skip_counting'=>true,'per_page'=>-1) );
/* @var $listing_items kDBList */
@@ -409,8 +409,8 @@
function OnListItems(&$event)
{
// get queued items data
- if (!$this->Application->IsAdmin()) {
- return;
+ if (!$this->Application->isAdmin) {
+ return;
}
$sql = 'SELECT * FROM '.TABLE_PREFIX.'eBayListings
@@ -489,7 +489,7 @@
';
$description = $this->Conn->GetOne($sql);
-
+
$this->Application->InitParser();
$parser_params = $this->Application->Parser->Params; // backup parser params
$description = $this->Application->Parser->Parse($description, 'auction_template', 0);
@@ -1095,9 +1095,9 @@
function OnArchive(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
@@ -1126,9 +1126,9 @@
function OnEndItem(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
@@ -1167,9 +1167,9 @@
function OnArchiveAll(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
@@ -1238,9 +1238,9 @@
*/
function OnChangeStatistics(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
$a_items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if (!is_array($a_items_info))
{
@@ -1325,9 +1325,9 @@
function OnPrintChart(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
$ChartHelper =& $this->Application->RecallObject('ChartHelper');
header("Content-type: image/png");
@@ -1450,11 +1450,5 @@
'<commas><tab><commas>'.number_format($a_record['ProductCost'], 2).
'<commas><tab><commas>'.number_format($a_record['GMV'] - $a_record['ProductCost'] - $a_record['Fees'], 2).'<commas><cr>';
}
-
- function _checkAdminLogin()
- {
- return ($this->Application->IsAdmin() && $this->Application->LoggedIn());
- }
-
}
?>
\ No newline at end of file
Index: in-auction/units/product_listing/product_listing_eh.php
===================================================================
--- in-auction/units/product_listing/product_listing_eh.php (revision 12651)
+++ in-auction/units/product_listing/product_listing_eh.php (working copy)
@@ -348,18 +348,18 @@
*/
function OnGenerateTemplate(&$event)
{
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
$listing_info = $this->Application->GetVar('p-ebay');
foreach ($listing_info AS $productListingID => $a_listing_data) {
break;
}
-
+
$template_id = $listing_info[$productListingID]['DetailTemplateId'];
$product_id = $listing_info[$productListingID]['ProductId'];
-
+
$Product =& $this->Application->recallObject('p', null, Array('skip_autoload' => true));
$Product->Load($product_id);
// Parse description (with product 'p' tags possible)
@@ -372,9 +372,9 @@
$description = $this->Conn->GetOne($sql);
$this->Application->InitParser();
$parser_params = $this->Application->Parser->Params; // backup parser params
-
+
$description = $this->Application->Parser->Parse($description, 'auction_template', 0);
-
+
$this->Application->Parser->SetParams($parser_params); // restore parser params
if (trim($description) == '') {
Index: in-auction/units/schedule/schedule_eh.php
===================================================================
--- in-auction/units/schedule/schedule_eh.php (revision 12651)
+++ in-auction/units/schedule/schedule_eh.php (working copy)
@@ -60,9 +60,9 @@
*/
function SetMassStatus(&$event, $status)
{
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
$object =& $event->getObject( Array('skip_autoload' => true) );
$this->StoreSelectedIDs($event);
$ids=$this->getSelectedIDs($event);
Index: in-auction/units/sections/ebay_eh.php
===================================================================
--- in-auction/units/sections/ebay_eh.php (revision 12651)
+++ in-auction/units/sections/ebay_eh.php (working copy)
@@ -451,7 +451,7 @@
*/
function OnRefreshStore(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
}
@@ -1028,7 +1028,7 @@
function OnRefreshCategories(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
}
@@ -1882,7 +1882,7 @@
$params['ebay-sections_event'] = 'OnOrderLogin';
$autologin_url = $this->Application->HREF(
'in-auction/autologin',
- $this->Application->IsAdmin() ? '_FRONT_END_' : '',
+ $this->Application->isAdmin ? '_FRONT_END_' : '',
Array(
'ebay-sections_event' => 'OnOrderLogin',
'key' => $autologin_key,
@@ -2255,7 +2255,7 @@
*/
function OnBeforeRecalculateItems(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return;
}
@@ -3402,7 +3402,7 @@
*/
function OnNewTokenReject(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
}
}
@@ -3412,7 +3412,7 @@
*/
function OnNewTokenAccept(&$event)
{
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
}
@@ -3456,8 +3456,7 @@
*/
function OnAuthorizeForToken(&$event)
{
-
- if (!$this->_checkAdminLogin()) {
+ if (!$this->Application->isAdminUser) {
return;
}
@@ -3909,16 +3908,13 @@
*/
function OnDeleteToken(&$event)
{
- if (!DEBUG_MODE) {
+ if (!DEBUG_MODE || !$this->Application->isAdminUser) {
return;
}
- if (!$this->_checkAdminLogin()) {
- return;
- }
-
$eBayHelper =& $this->Application->recallObject('eBayHelper');
/* @var $eBayHelper eBayHelper*/
+
$eBayHelper->RemoveToken();
}
@@ -3928,12 +3924,10 @@
*/
function OnSetAPIKeys(&$event)
{
- if (!DEBUG_MODE) {
+ if (!DEBUG_MODE || !$this->Application->isAdminUser) {
return;
}
- if (!$this->_checkAdminLogin()) {
- return;
- }
+
$this->AcceptKeys('Production');
$this->AcceptKeys('Sandbox');
header("location: ".$this->Application->BaseURL().'/in-auction/generate_keys.php?keys_accepted=1');
@@ -3957,9 +3951,4 @@
$this->Conn->Query($sql);
}
-
- function _checkAdminLogin()
- {
- return ($this->Application->IsAdmin() && $this->Application->LoggedIn());
- }
}
\ No newline at end of file
Index: in-auction/units/shipping/shipping_eh.php
===================================================================
--- in-auction/units/shipping/shipping_eh.php (revision 12651)
+++ in-auction/units/shipping/shipping_eh.php (working copy)
@@ -49,14 +49,17 @@
}
+ /**
+ * Save changes in ebay shipping options, made on config template
+ *
+ * @param kEvent $event
+ */
function OnConfigUpdate(&$event)
{
- // save changes in ebay shipping options, made on config template
+ if (!$this->Application->isAdminUser) {
+ return;
+ }
- // $object =& $event->getObject();
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
- return;
- }
$this->UpdateShippings('s-ebay', 'domestic');
$this->UpdateShippings('s-ebay', 'international');
@@ -132,7 +135,7 @@
}
}
-
+
/**
* Enter description here...
*
@@ -140,9 +143,10 @@
*/
function OnParentPreSave(&$event)
{
- if (!$this->Application->IsAdmin() || !$this->Application->LoggedIn()) {
+ if (!$this->Application->isAdminUser) {
return;
- }
+ }
+
$prefix = $event->Prefix;
$this->UpdateShippings($prefix, 'domestic');
$this->UpdateShippings($prefix, 'international');
Index: in-bulletin/units/poll_comments/poll_comment_eh.php
===================================================================
--- in-bulletin/units/poll_comments/poll_comment_eh.php (revision 12650)
+++ in-bulletin/units/poll_comments/poll_comment_eh.php (working copy)
@@ -48,7 +48,7 @@
*/
function SetCustomQuery(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return ;
}
@@ -65,7 +65,7 @@
*/
function OnBeforeItemCreate(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return ;
}
@@ -115,7 +115,7 @@
{
parent::OnCreate($event);
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return;
}
@@ -133,9 +133,7 @@
*/
function OnAfterItemCreate(&$event)
{
-// return;
-
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
Index: in-bulletin/units/polls/poll_eh.php
===================================================================
--- in-bulletin/units/polls/poll_eh.php (revision 12650)
+++ in-bulletin/units/polls/poll_eh.php (working copy)
@@ -38,7 +38,7 @@
*/
function SetCustomQuery(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return ;
}
Index: in-bulletin/units/posts/post_eh.php
===================================================================
--- in-bulletin/units/posts/post_eh.php (revision 12650)
+++ in-bulletin/units/posts/post_eh.php (working copy)
@@ -206,7 +206,7 @@
$category_id = $this->Application->GetVar('m_cat_id');
$post_helper->PropagateCategoryField($category_id, 'Modified', $object->GetDBField('CreatedOn'));
- if (!$this->Application->IsAdmin() && $main_object->GetDBField('Posts')) {
+ if (!$this->Application->isAdmin && $main_object->GetDBField('Posts')) {
// don't send any email events when in admin OR new topic just added (0 posts)
$user_notified = false; // don't send POST.ADD event twice to same user (in case if owner adds new post)
@@ -271,7 +271,7 @@
{
parent::OnCreate($event);
- if ($event->status == erSUCCESS && !$this->Application->IsAdmin()) {
+ if ($event->status == erSUCCESS && !$this->Application->isAdmin) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('next_template');
}
@@ -286,7 +286,7 @@
{
parent::OnUpdate($event);
- if ($event->status == erSUCCESS && !$this->Application->IsAdmin()) {
+ if ($event->status == erSUCCESS && !$this->Application->isAdmin) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('next_template');
$event->SetRedirectParam('pass', 'm,bb');
@@ -367,7 +367,7 @@
{
parent::OnDelete($event);
- if ($event->status == erSUCCESS && !$this->Application->IsAdmin()) {
+ if ($event->status == erSUCCESS && !$this->Application->isAdmin) {
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$event->SetRedirectParam('pass', 'm,'.$parent_prefix);
}
Index: in-bulletin/units/private_messages/private_message_eh.php
===================================================================
--- in-bulletin/units/private_messages/private_message_eh.php (revision 12650)
+++ in-bulletin/units/private_messages/private_message_eh.php (working copy)
@@ -146,7 +146,7 @@
{
parent::OnCreate($event);
- if ($event->status == erSUCCESS && !$this->Application->IsAdmin()) {
+ if ($event->status == erSUCCESS && !$this->Application->isAdmin) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('next_template');
}
Index: in-bulletin/units/topics/topics_event_handler.php
===================================================================
--- in-bulletin/units/topics/topics_event_handler.php (revision 12650)
+++ in-bulletin/units/topics/topics_event_handler.php (working copy)
@@ -136,7 +136,7 @@
*/
function OnAfterItemUpdate(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
return ;
}
@@ -168,7 +168,7 @@
$object =& $event->getObject();
/* @var $object kCatDBItem */
- if ($object->GetDBField('Posts') > 0 || !$this->Application->IsAdmin()) {
+ if ($object->GetDBField('Posts') > 0 || !$this->Application->isAdminUser) {
$object->setRequired('PostingText', false);
}
}
Index: in-commerce/units/addresses/addresses_event_handler.php
===================================================================
--- in-commerce/units/addresses/addresses_event_handler.php (revision 12650)
+++ in-commerce/units/addresses/addresses_event_handler.php (working copy)
@@ -46,7 +46,7 @@
*/
function SetCustomQuery(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return ;
}
@@ -128,7 +128,7 @@
*/
function setNextTemplate(&$event)
{
- if($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return ;
}
@@ -268,7 +268,7 @@
*/
function checkItemStatus(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return true;
}
Index: in-commerce/units/affiliates/affiliates_event_handler.php
===================================================================
--- in-commerce/units/affiliates/affiliates_event_handler.php (revision 12650)
+++ in-commerce/units/affiliates/affiliates_event_handler.php (working copy)
@@ -520,7 +520,7 @@
*/
function checkItemStatus(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return true;
}
Index: in-commerce/units/currencies/currencies_event_handler.php
===================================================================
--- in-commerce/units/currencies/currencies_event_handler.php (revision 12650)
+++ in-commerce/units/currencies/currencies_event_handler.php (working copy)
@@ -94,7 +94,7 @@
$object->addFilter('status_filter', '%1$s.Status = 1');
}
- if ( !$this->Application->IsAdmin() ) {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('status_filter', $object->TableName.'.Status = 1');
}
}
Index: in-commerce/units/gateways/gw_classes/authorizenet.php
===================================================================
--- in-commerce/units/gateways/gw_classes/authorizenet.php (revision 12650)
+++ in-commerce/units/gateways/gw_classes/authorizenet.php (working copy)
@@ -80,7 +80,7 @@
{
$gw_responce = unserialize( $item_data['GWResult1'] );
- if( ($item_data['PortalUserId'] != $gw_responce['customer_id']) && ($gw_repsponce['customer_id'] != -2 && !$this->Application->IsAdmin())) return false;
+ if( ($item_data['PortalUserId'] != $gw_responce['customer_id']) && ($gw_repsponce['customer_id'] != -2 && !$this->Application->isAdmin)) return false;
if( ( strtolower($gw_responce['transaction_type']) == 'auth_only') )
{
Index: in-commerce/units/gateways/gw_event_handler.php
===================================================================
--- in-commerce/units/gateways/gw_event_handler.php (revision 12650)
+++ in-commerce/units/gateways/gw_event_handler.php (working copy)
@@ -58,8 +58,12 @@
function OnCheckGateways(&$event)
{
- if (!$this->Application->IsAdmin()) return ;
- $fh=opendir(GW_CLASS_PATH);
+ if (!$this->Application->isAdminUser) {
+ return ;
+ }
+
+ $fh = opendir(GW_CLASS_PATH);
+
while( $entry=readdir($fh) )
{
if ( !is_file(GW_CLASS_PATH.'/'.$entry) ) continue;
Index: in-commerce/units/manufacturers/manufacturers_event_handler.php
===================================================================
--- in-commerce/units/manufacturers/manufacturers_event_handler.php (revision 12650)
+++ in-commerce/units/manufacturers/manufacturers_event_handler.php (working copy)
@@ -36,8 +36,8 @@
*/
function SetCustomQuery(&$event)
{
- if ($this->Application->IsAdmin()) {
- return true;
+ if ($this->Application->isAdminUser) {
+ return ;
}
$category_id = $this->Application->GetVar('m_cat_id');
Index: in-commerce/units/orders/orders_event_handler.php
===================================================================
--- in-commerce/units/orders/orders_event_handler.php (revision 12650)
+++ in-commerce/units/orders/orders_event_handler.php (working copy)
@@ -23,7 +23,7 @@
*/
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
if ($event->Name == 'OnCreate') {
// user can't initiate custom order creation directly
return false;
@@ -160,7 +160,9 @@
*/
function OnSelectAddress(&$event)
{
- if ($this->Application->IsAdmin()) return true;
+ if ($this->Application->isAdminUser) {
+ return ;
+ }
$object =& $event->getObject();
@@ -397,8 +399,7 @@
$this->SplitOrder($event, $order);
}
- if( !$this->Application->IsAdmin() )
- {
+ if (!$this->Application->isAdminUser) {
// for tracking code
$this->Application->StoreVar('last_order_amount', $order->GetDBField('TotalAmount'));
$this->Application->StoreVar('last_order_number', $order->GetDBField('OrderNumber'));
@@ -603,7 +604,7 @@
parent::OnUpdate($event);
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return true;
}
else {
@@ -784,7 +785,7 @@
$event->setEventParam('ItemData', serialize($item_data));
// 1 for PacakgeNum when in admin - temporary solution to overcome splitting into separate sub-orders
// of orders with items added through admin when approving them
- $this->AddItemToOrder($event, $item_id, $qty, $this->Application->IsAdmin() ? 1 : null);
+ $this->AddItemToOrder($event, $item_id, $qty, $this->Application->isAdminUser ? 1 : null);
}
if ($event->status == erSUCCESS && !$event->redirect) {
$event->redirect_params['pass'] = 'm';
@@ -792,7 +793,7 @@
$event->redirect = true;
}
else {
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
$event->redirect_params['opener'] = 'u';
}
}
@@ -878,7 +879,7 @@
if ($result) {
$event->status = erSUCCESS;
- $event->redirect = $this->Application->IsAdmin() ? true : $this->Application->GetVar('shop_cart_template');
+ $event->redirect = $this->Application->isAdminUser ? true : $this->Application->GetVar('shop_cart_template');
}
else {
$event->status = erFAIL;
@@ -918,7 +919,7 @@
$ord_item->SetDBField('OptionsSalt', $this->OptionsSalt($options));
$ord_item->Update();
$event->CallSubEvent('OnRecalculateItems');
- if ($event->status == erSUCCESS && $this->Application->IsAdmin()) {
+ if ($event->status == erSUCCESS && $this->Application->isAdminUser) {
$event->redirect_params['opener'] = 'u';
}
}
@@ -1049,7 +1050,8 @@
{
$event->setEventParam('raise_warnings', 0);
$passed = parent::getPassedID($event);
- if ( $this->Application->IsAdmin() ) {
+
+ if ($this->Application->isAdminUser) {
// work as usual in admin
return $passed;
}
@@ -1215,14 +1217,14 @@
$check_cc = $this->Application->GetVar('check_credit_card');
$ord_event = $this->Application->GetVar($event->getPrefixSpecial().'_event');
- if (($ord_event !== 'OnProceedToPreview') && !$this->Application->IsAdmin()) {
+ if (($ord_event !== 'OnProceedToPreview') && !$this->Application->isAdmin) {
// don't check credit card when going from "billing info" to "order preview" step
$check_cc = 0;
}
if ($check_cc && ($field_values['PaymentType'] == $order->GetDBField('PaymentType'))) {
// cc check required AND payment type was not changed during SUBMIT
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
$req_fields = array('PaymentCardType', 'PaymentAccount', 'PaymentNameOnCard', 'PaymentCCExpDate');
}
else {
@@ -1242,7 +1244,10 @@
*/
function CheckUser(&$event)
{
- if ( $this->Application->IsAdmin() ) return;
+ if ($this->Application->isAdminUser) {
+ return;
+ }
+
$order =& $event->GetObject();
$ses_user = $this->Application->RecallVar('user_id');
@@ -2084,18 +2089,18 @@
function CheckQuantites(&$event)
{
if ($this->OnRecalculateItems($event)) { // if something has changed in the order
- if ( $this->Application->IsAdmin() )
- {
+ if ($this->Application->isAdminUser) {
if ($this->UseTempTables($event)) {
$event->redirect = 'in-commerce/orders/orders_edit_items';
}
}
- else
- {
+ else {
$event->redirect = $this->Application->GetVar('viewcart_template');
}
+
return false;
}
+
return true;
}
@@ -2635,7 +2640,7 @@
$order =& $this->Application->recallObject('ord');
/* @var $order kDBItem */
- if (!$order->isLoaded() && !$this->Application->IsAdmin()) {
+ if (!$order->isLoaded() && !$this->Application->isAdmin) {
// no order was created before -> create one now
if ($this->_createNewCart($event)) {
$this->LoadItem($event);
@@ -2753,7 +2758,7 @@
}
$this->Application->HandleEvent($ord_event, 'ord:OnRecalculateItems');
- /*if ($ord_event->getEventParam('RecalculateChangedCart') && !$this->Application->IsAdmin() ) {
+ /*if ($ord_event->getEventParam('RecalculateChangedCart') && !$this->Application->isAdmin) {
$event->SetRedirectParam('checkout_error', $ord_event->redirect_params['checkout_error']);
}*/
}
@@ -3814,7 +3819,7 @@
$fields['Number']['format'] = str_replace('%06d', '%0'.$order_number.'d', $fields['Number']['format']);
$fields['SubNumber']['format'] = str_replace('%03d', '%0'.$order_sub_number.'d', $fields['SubNumber']['format']);
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$user_groups = explode(',', $this->Application->RecallVar('UserGroups'));
$default_group = $this->Application->ConfigValue('User_LoggedInGroup');
if (!in_array($default_group, $user_groups)){
@@ -3915,7 +3920,7 @@
*/
function checkItemStatus(&$event)
{
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
return true;
}
@@ -3985,7 +3990,7 @@
$UserName = explode(" ", $object->GetDBField('ShippingTo'));
$item_table = TABLE_PREFIX.'OrderItems';
- if ( $this->Application->IsAdmin() ) {
+ if ($this->Application->isAdminUser) {
// this strange contraption actually uses temp table from object (when in temp mode)
$order_table = $object->TableName;
$item_table = str_replace('Orders', 'OrderItems', $order_table);
Index: in-commerce/units/orders/orders_item.php
===================================================================
--- in-commerce/units/orders/orders_item.php (revision 12650)
+++ in-commerce/units/orders/orders_item.php (working copy)
@@ -313,7 +313,7 @@
if ($this->Application->ConfigValue('Comm_MaskProcessedCreditCards')) {
$mask_found = strpos($value, str_repeat('X', 4)) !== false;
- if ($this->Application->IsAdmin() && $mask_found) {
+ if ($this->Application->isAdminUser && $mask_found) {
// masked card numbers always appear valid in admin
return true;
}
@@ -420,24 +420,24 @@
$formatter = getArrayValue($params, 'formatter');
if( ($formatter != 'kCCDateFormatter') || !$this->requireCreditCard() ) return true;
- if( !$this->Application->IsAdmin() )
- {
+ if(!$this->Application->isAdminUser) {
// validate expiration date only for front
- if( preg_match('/([\d]{2})\/([\d]{2})/', $this->GetDBField($field), $rets) )
- {
+ if (preg_match('/([\d]{2})\/([\d]{2})/', $this->GetDBField($field), $rets)) {
$month = $rets[1];
$year = $rets[2];
$now_date = adodb_mktime(0, 0, 0, adodb_date('m'), adodb_date('d'), adodb_date('Y') );
$day_count = adodb_date('t', adodb_mktime(0, 0, 0, $month, 1, $year) );
$cc_date = adodb_mktime(23, 59, 59, $month, $day_count, $year);
- if($cc_date < $now_date)
- {
+
+ if ($cc_date < $now_date) {
$error_field = isset($params['error_field']) ? $params['error_field'] : $field;
$this->FieldErrors[$error_field]['pseudo'] = 'credit_card_expired';
+
return false;
}
}
}
+
return true;
}
Index: in-commerce/units/pricing/pricing_event_handler.php
===================================================================
--- in-commerce/units/pricing/pricing_event_handler.php (revision 12650)
+++ in-commerce/units/pricing/pricing_event_handler.php (working copy)
@@ -408,53 +408,58 @@
*
* @param kEvent $event
*/
- function SetCustomQuery(&$event){
+ function SetCustomQuery(&$event)
+ {
$object =& $event->getObject();
- if (!$this->Application->IsAdmin()){
- $user_groups = $this->Application->RecallVar('UserGroups');
+ if ($this->Application->isAdminUser) {
+ return ;
+ }
- $pricing_method = $this->Application->ConfigValue('Comm_PriceBracketCalculation');
- if ($pricing_method == 1){
- $primary_group = $this->Conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId='.$this->Application->GetVar('u_id').' AND PrimaryGroup=1');
- $pricing_group = $primary_group;
- if ($pricing_group) {
- $pricing_for_group_exists = $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'ProductsPricing WHERE ProductId='.$this->Application->GetVar('p_id').' AND GroupId='.$primary_group.' AND Price IS NOT NULL');
- }
- if ($pricing_group && $pricing_for_group_exists > 0){
- $pricing_group = $primary_group;
- }
- else {
- $pricing_group = $this->Application->ConfigValue('User_LoggedInGroup');
- }
+ $user_groups = $this->Application->RecallVar('UserGroups');
-
+ $pricing_method = $this->Application->ConfigValue('Comm_PriceBracketCalculation');
+ if ($pricing_method == 1) {
+ $primary_group = $this->Conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId='.$this->Application->GetVar('u_id').' AND PrimaryGroup=1');
+ $pricing_group = $primary_group;
+ if ($pricing_group) {
+ $pricing_for_group_exists = $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'ProductsPricing WHERE ProductId='.$this->Application->GetVar('p_id').' AND GroupId='.$primary_group.' AND Price IS NOT NULL');
}
+ if ($pricing_group && $pricing_for_group_exists > 0) {
+ $pricing_group = $primary_group;
+ }
else {
- //$cheapest_group = $this->Conn->GetOne('SELECT GroupId FROM '.$object->TableName.' WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') AND MinQty = 1 GROUP BY GroupId ORDER BY Price ASC');
- $effective_brackets = $this->Conn->Query('SELECT PriceId, Price, GroupId FROM '.$object->TableName.'
- WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') ORDER BY GroupId ASC, MinQty ASC', 'PriceId');
- $group_prices = array();
- $min_price = -1;
- $cheapest_group = 0;
+ $pricing_group = $this->Application->ConfigValue('User_LoggedInGroup');
+ }
- foreach ($effective_brackets as $bracket) {
- if (!isset($group_prices[$bracket['GroupId']])) {
- $group_prices[$bracket['GroupId']] = $bracket['Price'];
- if ($bracket['Price'] < $min_price || $min_price == -1) {
- $min_price = $bracket['Price'];
- $cheapest_group = $bracket['GroupId'];
- }
+
+ }
+ else {
+ //$cheapest_group = $this->Conn->GetOne('SELECT GroupId FROM '.$object->TableName.' WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') AND MinQty = 1 GROUP BY GroupId ORDER BY Price ASC');
+ $effective_brackets = $this->Conn->Query('SELECT PriceId, Price, GroupId FROM '.$object->TableName.'
+ WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') ORDER BY GroupId ASC, MinQty ASC', 'PriceId');
+ $group_prices = array();
+ $min_price = -1;
+ $cheapest_group = 0;
+
+ foreach ($effective_brackets as $bracket) {
+ if (!isset($group_prices[$bracket['GroupId']])) {
+ $group_prices[$bracket['GroupId']] = $bracket['Price'];
+ if ($bracket['Price'] < $min_price || $min_price == -1) {
+ $min_price = $bracket['Price'];
+ $cheapest_group = $bracket['GroupId'];
}
}
+ }
- if (!$cheapest_group) $cheapest_group = $this->Application->ConfigValue('User_LoggedInGroup');
-
- $pricing_group = $cheapest_group;
+ if (!$cheapest_group) {
+ $cheapest_group = $this->Application->ConfigValue('User_LoggedInGroup');
}
- $object->addFilter('price_user_group', $object->TableName.'.GroupId='.$pricing_group);
+ $pricing_group = $cheapest_group;
}
+
+ $object->addFilter('price_user_group', $object->TableName.'.GroupId='.$pricing_group);
}
}
\ No newline at end of file
Index: in-commerce/units/products/products_event_handler.php
===================================================================
--- in-commerce/units/products/products_event_handler.php (revision 12650)
+++ in-commerce/units/products/products_event_handler.php (working copy)
@@ -532,7 +532,7 @@
$object->addFilter('not_virtual', '%1$s.Virtual = 0');
- if ( !$this->Application->IsAdmin() ) {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('expire_filter', '%1$s.Expire IS NULL OR %1$s.Expire > UNIX_TIMESTAMP()');
}
@@ -1226,9 +1226,10 @@
return $passed;
}
- if ($this->Application->IsAdmin()) {
+ if ($this->Application->isAdminUser) {
// we may get product id out of OrderItem, if it exists
$ord_item =& $this->Application->recallObject('orditems', null, Array ('raise_warnings' => 0));
+
if ($ord_item->GetDBField('ProductId')) {
$passed = $ord_item->GetDBField('ProductId');
}
Index: in-commerce/units/products/products_item.php
===================================================================
--- in-commerce/units/products/products_item.php (revision 12650)
+++ in-commerce/units/products/products_item.php (working copy)
@@ -34,21 +34,25 @@
*/
function getPrimaryPricing()
{
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$user_id = $this->Application->RecallVar('user_id');
$primary_group = $user_id != -2 ? $this->Conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PrimaryGroup = 1 AND PortalUserId = '.$user_id) : false;
+
if ($primary_group) {
$sql = 'SELECT Price, Cost
FROM '.TABLE_PREFIX.'ProductsPricing
WHERE (ProductId = '.$this->GetID().') AND (GroupId = '.$primary_group.')
ORDER BY MinQty';
$a_values = $this->Conn->GetRow($sql);
+
if ($a_values !== false) {
return $a_values;
}
}
}
+
$pr_table = $this->Application->getUnitOption('pr', 'TableName');
+
if ($this->mode == 't') {
$pr_table = $this->Application->GetTempName($pr_table, 'prefix:'.$this->Prefix);
}
@@ -56,6 +60,7 @@
$sql = 'SELECT Price, Cost
FROM '.$pr_table.'
WHERE ('.$this->IDField.' = '.$this->GetID().') AND (IsPrimary = 1)';
+
return $this->Conn->GetRow($sql);
}
Index: in-commerce/units/shipping/shipping_tag_processor.php
===================================================================
--- in-commerce/units/shipping/shipping_tag_processor.php (revision 12650)
+++ in-commerce/units/shipping/shipping_tag_processor.php (working copy)
@@ -221,18 +221,18 @@
$original_shipping = unserialize($original_shipping);
$shipping_type_keys = array_keys($shipping_types);
if( getArrayValue($original_shipping, $package_id, 'ShippingId') &&
- ( $this->Application->IsAdmin() || in_array( $original_shipping[$package_id]['ShippingId'], $shipping_type_keys ) ) )
+ ( $this->Application->isAdminUser || in_array( $original_shipping[$package_id]['ShippingId'], $shipping_type_keys ) ) )
{
$original_shipping = $original_shipping[$package_id];
$key = $original_shipping['ShippingId'];
- $shipping_types[$key]['TotalCost'] = $this->Application->IsAdmin() ? $original_shipping['TotalCost'] : $shipping_types[$key]['TotalCost'];
- $shipping_types[$key]['ShippingName'] = $this->Application->IsAdmin() ? 'Original: '.$original_shipping['ShippingName'] : $shipping_types[$key]['ShippingName'];
+ $shipping_types[$key]['TotalCost'] = $this->Application->isAdminUser ? $original_shipping['TotalCost'] : $shipping_types[$key]['TotalCost'];
+ $shipping_types[$key]['ShippingName'] = $this->Application->isAdminUser ? 'Original: '.$original_shipping['ShippingName'] : $shipping_types[$key]['ShippingName'];
$shipping_types[$key]['ShippingId'] = $key;
$selected_id = $key;
}
$last_shippings[$package_id] = $shipping_types;
- if( $this->Application->IsAdmin() && $key)
+ if( $this->Application->isAdminUser && $key)
{
$orig_name = ltrim($last_shippings[$package_id][$key]['ShippingName'], 'Original: ');
$last_shippings[$package_id][$key]['ShippingName'] = $orig_name;
Index: in-commerce/units/shipping_quote_engines/custom_shipping_quote_engine.php
===================================================================
--- in-commerce/units/shipping_quote_engines/custom_shipping_quote_engine.php (revision 12650)
+++ in-commerce/units/shipping_quote_engines/custom_shipping_quote_engine.php (working copy)
@@ -23,7 +23,7 @@
$query = $this->QueryShippingCost($params['dest_country'], $params['dest_state'], $params['dest_postal'], $default_pack['weight'], $params['items'], $params['amount'], $params['shipping_type'], $params['promo_params']);
$shipping_types = $db->Query($query, 'ShippingId');
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$user_groups = explode(',', $this->Application->RecallVar('UserGroups'));
$filteres_shipping_types = array();
foreach ($shipping_types as $key=>$shipping_type) {
Index: in-link/units/links/link_tag_processor.php
===================================================================
--- in-link/units/links/link_tag_processor.php (revision 12650)
+++ in-link/units/links/link_tag_processor.php (working copy)
@@ -213,7 +213,7 @@
$object->RegisterHit();
// save user and time
- if (!$this->Application->IsAdmin() && $this->Application->LoggedIn()) {
+ if (!$this->Application->isAdmin && $this->Application->LoggedIn()) {
$resource_id = $object->GetDBField('ResourceId');
$user_id = $this->Application->RecallVar('user_id');
Index: in-link/units/links/links_event_handler.php
===================================================================
--- in-link/units/links/links_event_handler.php (revision 12650)
+++ in-link/units/links/links_event_handler.php (working copy)
@@ -44,7 +44,7 @@
$object =& $event->getObject();
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$object->addFilter('expire_filter', '(Expire > '.adodb_mktime().' OR Expire IS NULL)');
}
@@ -239,7 +239,7 @@
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields);
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
// for now only on Front-End
$this->Application->setUnitOption($event->Prefix, 'PopulateMlFields', true);
}
Index: in-link/units/listings/listings_event_handler.php
===================================================================
--- in-link/units/listings/listings_event_handler.php (revision 12650)
+++ in-link/units/listings/listings_event_handler.php (working copy)
@@ -587,7 +587,7 @@
{
parent::OnCancel($event);
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdmin) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('cancel_template');
}
Index: in-news/units/articles/articles_event_handler.php
===================================================================
--- in-news/units/articles/articles_event_handler.php (revision 12650)
+++ in-news/units/articles/articles_event_handler.php (working copy)
@@ -27,7 +27,7 @@
$object =& $event->getObject();
- if (!$this->Application->IsAdmin()) {
+ if (!$this->Application->isAdminUser) {
$where_clause = '(Archived = 0) AND (StartDate < '.adodb_mktime().' OR StartDate = 0) AND (EndOn > '.adodb_mktime().' OR EndOn IS NULL)';
$object->addFilter('archived_filter', $where_clause);
}