Esempio n. 1
0
 /**
  * Delete an object from the database
  * @see XoopsPersistableObjectHandler
  *
  * @param XoopsObject $obj
  * @param bool           $force
  *
  * @return bool
  */
 public function delete(XoopsObject $obj, $force = false)
 {
     if (parent::delete($obj, $force)) {
         $field_handler = xoops_getModuleHandler('field');
         return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')), $force);
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Delete an object from the database
  * @see XoopsPersistableObjectHandler
  *
  * @param profileRegstep $obj
  * @param bool $force
  *
  * @return bool
  */
 function delete($obj, $force = false)
 {
     if (parent::delete($obj, $force)) {
         $field_handler =& xoops_getmodulehandler('field');
         return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')));
     }
     return false;
 }
Esempio n. 3
0
 function delete(&$forum)
 {
     global $xoopsModule;
     // RMV-NOTIFY
     xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'forum', $forum->getVar('forum_id'));
     // Get list of all topics in forum, to delete them too
     $topic_handler =& xoops_getmodulehandler('topic', 'newbb');
     $topic_handler->deleteAll(new Criteria("forum_id", $forum->getVar('forum_id')), true, true);
     $this->updateAll("parent_forum", $forum->getVar('parent_forum'), new Criteria("parent_forum", $forum->getVar('forum_id')));
     $this->deletePermission($forum);
     return parent::delete($forum);
 }
Esempio n. 4
0
 function delete(&$category)
 {
     global $xoopsModule;
     $forum_handler =& xoops_getmodulehandler('forum', 'newbb');
     $forum_handler->deleteAll(new Criteria("cat_id", $category->getVar('cat_id')), true, true);
     if ($result = parent::delete($category)) {
         // Delete group permissions
         return $this->deletePermission($category);
     } else {
         $category->setErrors("delete category error: " . $sql);
         return false;
     }
 }
Esempio n. 5
0
 /**
  * Mark a message as to_delete = 1 or removes it if the sender has also deleted it
  * @param 	object 	$pm 	{@link XoopsPrivmessage} object
  * @return 	bool
  **/
 function setTodelete(&$pm, $val = 1)
 {
     if ($pm->getVar('from_delete') == 0) {
         return $this->updateAll('to_delete', intval($val), new Criteria('msg_id', $pm->getVar('msg_id')));
     } else {
         return parent::delete($pm);
     }
 }
 function delete(&$obj, $force = false)
 {
     $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $this->db->prefix('block_module_link'), $obj->getVar('instanceid'));
     if ($this->db->query($sql)) {
         $groupperm_handler =& xoops_gethandler('groupperm');
         $criteria = new CriteriaCompo(new Criteria('gperm_modid', 1));
         $criteria->add(new Criteria('gperm_name', 'block_read'));
         $criteria->add(new Criteria('gperm_itemid', $obj->getVar('instanceid')));
         if ($groupperm_handler->deleteAll($criteria)) {
             return parent::delete($obj, $force);
         }
     }
     //@TODO: LOCALIZE
     $obj->setErrors("Could not delete instance link");
     return false;
 }
Esempio n. 7
0
 /**
  * delete an item from the database
  *
  * @param object $item reference to the ITEM to delete
  * @param bool   $force
  *
  * @return bool FALSE if failed.
  */
 public function delete(&$item, $force = false)
 {
     // Deleting the files
     if (!$this->publisher->getHandler('file')->deleteItemFiles($item)) {
         $item->setErrors('An error while deleting a file.');
     }
     if (!parent::delete($item, $force)) {
         $item->setErrors('An error while deleting.');
         return false;
     }
     // Removing tags information
     if (xoops_isActiveModule('tag')) {
         $tag_handler = xoops_getmodulehandler('tag', 'tag');
         $tag_handler->updateByItem('', $item->getVar('itemid'), PUBLISHER_DIRNAME, 0);
     }
     return true;
 }
Esempio n. 8
0
 /**
  * Mark a message as to_delete = 1 or removes it if the sender has also deleted it or sent by anonymous
  *
  * @param XoopsObject|PmMessage $pm
  * @param int $val
  * @return bool
  */
 public function setTodelete(PmMessage $pm, $val = 1)
 {
     if ($pm->getVar('from_delete') == 0 && $pm->getVar('from_userid') == 0) {
         return $this->updateAll('to_delete', (int) $val, new Criteria('msg_id', $pm->getVar('msg_id')));
     } else {
         return parent::delete($pm);
     }
 }
Esempio n. 9
0
 /**
  * delete a category from the database
  *
  * @param object $category reference to the category to delete
  * @param bool   $force
  *
  * @return bool FALSE if failed.
  */
 public function delete(&$category, $force = false)
 {
     // Deleting this category ITEMs
     $criteria = new Criteria('categoryid', $category->categoryid());
     $this->publisher->getHandler('item')->deleteAll($criteria);
     unset($criteria);
     // Deleting the sub categories
     $subcats =& $this->getCategories(0, 0, $category->categoryid());
     foreach ($subcats as $subcat) {
         $this->delete($subcat);
     }
     if (!parent::delete($category, $force)) {
         $category->setErrors('An error while deleting.');
         return false;
     }
     $moduleId = $this->publisher->getModule()->getVar('mid');
     xoops_groupperm_deletebymoditem($moduleId, 'category_read', $category->categoryid());
     xoops_groupperm_deletebymoditem($moduleId, 'item_submit', $category->categoryid());
     xoops_groupperm_deletebymoditem($moduleId, 'category_moderation', $category->categoryid());
     return true;
 }
Esempio n. 10
0
 /**
  * delete a file from the database
  *
  * @param object $file reference to the file to delete
  * @param bool   $force
  *
  * @return bool FALSE if failed.
  */
 public function delete(&$file, $force = false)
 {
     $ret = false;
     // Delete the actual file
     if (is_file($file->getFilePath()) && unlink($file->getFilePath())) {
         $ret = parent::delete($file, $force);
     }
     return $ret;
 }
Esempio n. 11
0
 /**
  * delete a user from the database
  * 
  * @param object $user reference to the user to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$user, $force = false)
 {
     if (!parent::delete($user, $force)) {
         return false;
     }
     // delete user profile
     return $this->_pHandler->delete($user->getProfile(), $force);
 }
Esempio n. 12
0
 /**
  * delete a profile field from the database
  *
  * @param object $obj reference to the object to delete
  * @param bool $force
  * @return bool FALSE if failed.
  **/
 function delete(&$obj, $force = false)
 {
     $profile_handler =& xoops_getmodulehandler('profile', 'profile');
     // remove column from table
     $sql = "ALTER TABLE " . $profile_handler->table . " DROP `" . $obj->getVar('field_name', 'n') . "`";
     if ($this->db->query($sql)) {
         //change this to update the cached field information storage
         if (!parent::delete($obj, $force)) {
             return false;
         }
         if ($obj->getVar('field_show') || $obj->getVar('field_edit')) {
             $module_handler =& xoops_gethandler('module');
             $profile_module = $module_handler->getByDirname('profile');
             if (is_object($profile_module)) {
                 // Remove group permissions
                 $groupperm_handler =& xoops_gethandler('groupperm');
                 $criteria = new CriteriaCompo(new Criteria('gperm_modid', $profile_module->getVar('mid')));
                 $criteria->add(new Criteria('gperm_itemid', $obj->getVar('field_id')));
                 return $groupperm_handler->deleteAll($criteria);
             }
         }
     }
     return false;
 }
Esempio n. 13
0
 /**
  * delete an object as well as links relying on it
  *
  * @param    object    $object        {@link NewbbType}
  * @param     bool     $force         flag to force the query execution despite security settings
  * @return     bool
  */
 function delete(&$object, $force = true)
 {
     if (!is_object($object) || !$object->getVar($this->keyName)) {
         return false;
     }
     $queryFunc = empty($force) ? "query" : "queryF";
     /*
      * Remove forum-type links
      */
     $sql = "DELETE" . " FROM " . $this->db->prefix("bb_type_forum") . " WHERE  " . $this->keyName . " = " . $object->getVar($this->keyName);
     if (($result = $this->db->{$queryFunc}($sql)) == false) {
         // xoops_error($this->db->error());
     }
     /*
      * Reset topic type linked to this type
      */
     $sql = "UPATE" . " " . $this->db->prefix("bb_topics") . " SET {$this->keyName}=0" . " WHERE {$this->keyName} = " . $object->getVar($this->keyName);
     if (($result = $this->db->{$queryFunc}($sql)) == false) {
         //xoops_error($this->db->error());
     }
     return parent::delete($object, $force);
 }
Esempio n. 14
0
 /**
  * delete an object as well as links relying on it
  * 
  * @param    object    $object        {@link TagTag}
  * @param     bool     $force         flag to force the query execution despite security settings
  * @return     bool
  */
 function delete(&$object, $force = true)
 {
     if (!is_object($object) || !$object->getVar($this->keyName)) {
         return false;
     }
     $queryFunc = empty($force) ? "query" : "queryF";
     /*
      * Remove item-tag links
      */
     $sql = "DELETE" . " FROM {$this->table_link}" . " WHERE  {$this->keyName} = " . $object->getVar($this->keyName);
     if (($result = $this->db->{$queryFunc}($sql)) == false) {
         // xoops_error($this->db->error());
     }
     /*
      * Remove stats-tag links
      */
     $sql = "DELETE" . " FROM {$this->table_stats}" . " WHERE  {$this->keyName} = " . $object->getVar($this->keyName);
     if (($result = $this->db->{$queryFunc}($sql)) == false) {
         // xoops_error($this->db->error());
     }
     return parent::delete($object, $force);
 }
Esempio n. 15
0
 /**
  * delete a block from the database
  * 
  * @param object XoopsBlock $block reference to the block to delete 
  * @param bool $force
  *
  * @return bool TRUE if succesful
  **/
 function delete(&$block, $force = false)
 {
     $instance_handler =& xoops_gethandler('blockinstance');
     $instances =& $instance_handler->getObjects(new Criteria('bid', $block->getVar('bid')));
     if (count($instances) > 0) {
         foreach (array_keys($instances) as $i) {
             if (!$instance_handler->delete($instances[$i], $force)) {
                 //@TODO: LOCALIZE!
                 $block->setErrors("could not delete block instance " . $instances[$i]->getVar('title') . "<br />" . implode('<br />', $instances[$i]->getErrors()));
                 return false;
             }
         }
     }
     if ($block->getVar('template') != '') {
         $tplfile_handler =& xoops_gethandler('tplfile');
         $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block->getVar('bid'));
         if (count($btemplate) > 0) {
             $tplfile_handler->delete($btemplate[0]);
         }
     }
     return parent::delete($block, $force);
 }
Esempio n. 16
0
 /**
  * delete an article from the database
  * 
  * {@link Text}
  *
  * @param    object    $article     {@link Article} reference to Article
  * @param     bool     $force         flag to force the query execution despite security settings
  * @return     bool     true on success
  */
 function delete(&$article, $force = true)
 {
     /*
     if (empty($force) && xoops_comment_count($GLOBALS["xoopsModule"]->getVar("mid"), $article->getVar("art_id"))) {
         return false;
     }
     */
     // placeholder for files
     /*
     $file_handler =&  xoops_getmodulehandler("file", $GLOBALS["artdirname"]);
     $file_handler->deleteAll(new Criteria("art_id", $article->getVar("art_id")));
     */
     $this->deleteKeywords($article);
     parent::delete($article, $force);
     unset($article);
     return true;
 }