Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/db/cat_dbitem.php
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Line(s) | |||||
$cats_left = array_diff($category_ids, $delete_category_ids); | $cats_left = array_diff($category_ids, $delete_category_ids); | ||||
if ( !$cats_left ) { | if ( !$cats_left ) { | ||||
$sql = 'SELECT %s | $sql = 'SELECT %s | ||||
FROM %s | FROM %s | ||||
WHERE ResourceId = %s'; | WHERE ResourceId = %s'; | ||||
$ids = $this->Conn->GetCol(sprintf($sql, $id_field, $this->TableName, $resource_id)); | $ids = $this->Conn->GetCol(sprintf($sql, $id_field, $this->TableName, $resource_id)); | ||||
/** @var kTempTablesHandler $temp_handler */ | |||||
$temp_handler = $this->Application->recallObject($this->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler'); | $temp_handler = $this->Application->recallObject($this->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler'); | ||||
/* @var $temp_handler kTempTablesHandler */ | |||||
$temp_handler->DeleteItems($this->Prefix, $this->Special, $ids); | $temp_handler->DeleteItems($this->Prefix, $this->Special, $ids); | ||||
} | } | ||||
else { | else { | ||||
$this->Conn->Query( sprintf($delete_category_items_sql, $ci_table, $resource_id, implode(',', $delete_category_ids)) ); | $this->Conn->Query( sprintf($delete_category_items_sql, $ci_table, $resource_id, implode(',', $delete_category_ids)) ); | ||||
$sql = 'SELECT CategoryId | $sql = 'SELECT CategoryId | ||||
FROM %s | FROM %s | ||||
Show All 12 Lines | |||||
/** | /** | ||||
* replace not allowed symbols with "_" chars + remove duplicate "_" chars in result | * replace not allowed symbols with "_" chars + remove duplicate "_" chars in result | ||||
* | * | ||||
* @param string $filename | * @param string $filename | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function stripDisallowed($filename) | function stripDisallowed($filename) | ||||
{ | { | ||||
/** @var kFilenamesHelper $filenames_helper */ | |||||
$filenames_helper = $this->Application->recallObject('FilenamesHelper'); | $filenames_helper = $this->Application->recallObject('FilenamesHelper'); | ||||
/* @var $filenames_helper kFilenamesHelper */ | |||||
$table = $this->IsTempTable() ? $this->Application->GetTempName(TABLE_PREFIX.'CategoryItems', 'prefix:'.$this->Prefix) : TABLE_PREFIX.'CategoryItems'; | $table = $this->IsTempTable() ? $this->Application->GetTempName(TABLE_PREFIX.'CategoryItems', 'prefix:'.$this->Prefix) : TABLE_PREFIX.'CategoryItems'; | ||||
return $filenames_helper->stripDisallowed($table, 'ItemResourceId', $this->GetDBField('ResourceId'), $filename); | return $filenames_helper->stripDisallowed($table, 'ItemResourceId', $this->GetDBField('ResourceId'), $filename); | ||||
} | } | ||||
/* commented out because it's called only from stripDisallowed body, which is moved to helper | /* commented out because it's called only from stripDisallowed body, which is moved to helper | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Line(s) | |||||
if ( !($this->usePendingEditing && $original_id) ) { | if ( !($this->usePendingEditing && $original_id) ) { | ||||
// non-pending copy of original link | // non-pending copy of original link | ||||
return $this->ChangeStatus(STATUS_ACTIVE); | return $this->ChangeStatus(STATUS_ACTIVE); | ||||
} | } | ||||
if ( $this->raiseEvent('OnBeforeDeleteOriginal', null, Array ('original_id' => $original_id)) ) { | if ( $this->raiseEvent('OnBeforeDeleteOriginal', null, Array ('original_id' => $original_id)) ) { | ||||
// delete original item, because changes made in pending copy (this item) got to be approved in this method | // delete original item, because changes made in pending copy (this item) got to be approved in this method | ||||
/** @var kTempTablesHandler $temp_handler */ | |||||
$temp_handler = $this->Application->recallObject($this->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler'); | $temp_handler = $this->Application->recallObject($this->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler'); | ||||
/* @var $temp_handler kTempTablesHandler */ | |||||
$temp_handler->DeleteItems($this->Prefix, $this->Special, Array ($original_id)); | $temp_handler->DeleteItems($this->Prefix, $this->Special, Array ($original_id)); | ||||
$this->raiseEvent('OnAfterDeleteOriginal', null, Array ('original_id' => $original_id)); | $this->raiseEvent('OnAfterDeleteOriginal', null, Array ('original_id' => $original_id)); | ||||
$this->SetDBField('OrgId', 0); | $this->SetDBField('OrgId', 0); | ||||
return $this->ChangeStatus(STATUS_ACTIVE, true); | return $this->ChangeStatus(STATUS_ACTIVE, true); | ||||
} | } | ||||
Show All 11 Lines | |||||
$original_id = $this->GetDBField('OrgId'); | $original_id = $this->GetDBField('OrgId'); | ||||
if ( !($this->usePendingEditing && $original_id) ) { | if ( !($this->usePendingEditing && $original_id) ) { | ||||
// non-pending copy of original link | // non-pending copy of original link | ||||
return $this->ChangeStatus(STATUS_DISABLED); | return $this->ChangeStatus(STATUS_DISABLED); | ||||
} | } | ||||
// delete this item, because changes made in pending copy (this item) will be declined in this method | // delete this item, because changes made in pending copy (this item) will be declined in this method | ||||
/** @var kTempTablesHandler $temp_handler */ | |||||
$temp_handler = $this->Application->recallObject($this->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler'); | $temp_handler = $this->Application->recallObject($this->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler'); | ||||
/* @var $temp_handler kTempTablesHandler */ | |||||
$temp_handler->DeleteItems($this->Prefix, $this->Special, Array ($this->GetID())); | $temp_handler->DeleteItems($this->Prefix, $this->Special, Array ($this->GetID())); | ||||
$this->sendEmails(STATUS_DISABLED, true); | $this->sendEmails(STATUS_DISABLED, true); | ||||
// original item is not changed here, because it is already enabled (thrus pending copy is visible to item's owner or admin with permission) | // original item is not changed here, because it is already enabled (thrus pending copy is visible to item's owner or admin with permission) | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |