function deleteItem() { if ($this->request('hash') != $this->hash()) { $this->redirect('404'); } if ((int) $this->request('i')) { $table = new model_core_table('comments', 'coreresource'); $item = $table->getItem((int) $this->request('i')); if ($item->rcm_id) { $table->deleteItem($item); } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }
/** * Deletes the answer from vote * @return JS */ function deleteAnswer() { if ($this->request('hash') == $this->hash()) { $item_id = (int) $this->request('id', $this->request('i')); if ($item_id) { $model = new model_core_table('votes_questions', 'coreothers'); $rows = $model->deleteItem(new struct_coreothers_votes_questions(array('vtq_id' => $item_id))); echo 'RADVotesQuestions.message("' . addslashes($this->lang('deletedrows.sustem.message')) . ': ' . $rows . '");'; if ($rows) { echo 'RADVotesQuestions.refresh();'; } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }
/** * Saves the type showed fields * @param integer $type_id */ private function saveTypeFieldsShow($type_id) { if ($type_id) { $model = new model_core_table('ct_showing', 'corecatalog'); $model->setState('where', ' cts_vl_id=' . $type_id . ' '); $items = $model->getItems(); if (count($items)) { foreach ($items as $id) { $model->deleteItem($id); } //foreach } //if $added_items = array(); if ($this->_showinlist) { if ($this->request('CTshowing_showinlist_catalog_option')) { $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinlistID)); } } if ($this->_showindetail) { if ($this->request('CTshowing_showindetail_catalog_option')) { $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showindetailID)); } } if ($this->_showinbin) { if ($this->request('CTshowing_showinbin_catalog_option')) { $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinbinID)); } } $rows = 0; if (count($added_items)) { foreach ($added_items as $id) { $rows += $model->insertItem($id); } if (!count($rows)) { throw new rad_exception('Can\'t save the showing type! file: ' . __FILE__ . ', line: ' . __LINE__); } return $rows; } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }
function deleteTheme() { $theme = trim($this->request('theme')); $alias_id = (int) $this->request('alias_id'); if ($alias_id) { $this->clearAliasCache(rad_instances::get('model_core_aliases')->getItem($alias_id)); if (strlen($theme) and is_dir(THEMESPATH . $theme)) { $table = new model_core_table('themes'); $table->setState('where', 'theme_aliasid=' . $alias_id . ' and theme_folder="' . $theme . '"'); $item = $table->getItem(); $table->deleteItem($item); } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }