本文整理汇总了PHP中DBUtil::deleteObjectByID方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::deleteObjectByID方法的具体用法?PHP DBUtil::deleteObjectByID怎么用?PHP DBUtil::deleteObjectByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::deleteObjectByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* delete a reference
*
* @param $args['pid'] ID of the item
* @return bool true on success, false on failure
*/
public function delete($args) {
// Argument check
if (!isset($args['pid']) || !is_numeric($args['pid'])) {
return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
}
// Get the current faq
$item = ModUtil::apiFunc('IWwebbox', 'user', 'get', array('pid' => $args['pid']));
if (!$item) {
return LogUtil::registerError($this->__('No such item found.'));
}
// Security check
if (!SecurityUtil::checkPermission('IWwebbox::', "$args[pid]::", ACCESS_DELETE)) {
return LogUtil::registerPermissionError();
}
if (!DBUtil::deleteObjectByID('IWwebbox', $args['pid'], 'pid')) {
return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
}
// Let any hooks know that we have deleted an item
ModUtil::callHooks('item', 'delete', $args['pid'], array('module' => 'IWwebbox'));
// The item has been deleted, so we clear all cached pages of this item.
$view = Zikula_View::getInstance('IWwebbox');
$view->clear_cache(null, $args['pid']);
return true;
}
示例2: delete
/**
* delete a News item
*
* @author Mark West
* @param $args['sid'] ID of the item
* @return bool true on success, false on failure
*/
public function delete($args)
{
// Argument check
if (!isset($args['sid']) || !is_numeric($args['sid'])) {
return LogUtil::registerArgsError();
}
// Get the news story
$item = ModUtil::apiFunc('News', 'user', 'get', array('sid' => $args['sid']));
if ($item == false) {
return LogUtil::registerError($this->__('Error! No such article found.'));
}
$this->throwForbiddenUnless(SecurityUtil::checkPermission('News::', $item['cr_uid'] . '::' . $item['sid'], ACCESS_DELETE), LogUtil::getErrorMsgPermission());
if (!DBUtil::deleteObjectByID('news', $args['sid'], 'sid')) {
return LogUtil::registerError($this->__('Error! Could not delete article.'));
}
// delete News images
$modvars = $this->getVars();
if ($modvars['picupload_enabled'] && $item['pictures'] > 0) {
News_ImageUtil::deleteImagesBySID($modvars['picupload_uploaddir'], $item['sid'], $item['pictures']);
}
// Let the calling process know that we have finished successfully
return true;
}
示例3: esborra
/**
* Delete a topic from the database
* @author: Albert Pï¿œrez Monfort (aperezm@xtec.cat)
* @param: args The id of the topic
* @return: true if success and false if fails
*/
public function esborra($args) {
$tid = FormUtil::getPassedValue('tid', isset($args['tid']) ? $args['tid'] : null, 'POST');
// Security check
if (!SecurityUtil::checkPermission('IWnoteboard::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Argument check
if (!isset($tid) || !is_numeric($tid)) {
return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
}
// Get the item
$item = ModUtil::apiFunc('IWnoteboard', 'user', 'gettema', array('tid' => $tid));
if (!$item) {
return LogUtil::registerError($this->__('No such item found.'));
}
if (!DBUtil::deleteObjectByID('IWnoteboard_topics', $tid, 'tid')) {
return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
}
// The item has been deleted, so we clear all cached pages of this item.
$view = Zikula_View::getInstance('IWnoteboard');
$view->clear_cache(null, $tid);
return true;
}
示例4: Admin_Messages_adminapi_delete
/**
* delete an Admin_Messages item
* @author Mark West
* @param int $args['mid'] ID of the admin message to delete
* @return bool true on success, false on failure
*/
function Admin_Messages_adminapi_delete($args)
{
$dom = ZLanguage::getModuleDomain('Admin_Messages');
// Argument check
if (!isset($args['mid'])) {
return LogUtil::registerArgsError();
}
// Get the existing admin message
$item = ModUtil::apiFunc('Admin_Messages', 'user', 'get', array('mid' => $args['mid']));
if ($item == false) {
return LogUtil::registerError(__('Sorry! No such item found.', $dom));
}
// Security check
if (!SecurityUtil::checkPermission('Admin_Messages::', "{$item['title']}::{$args['mid']}", ACCESS_DELETE)) {
return LogUtil::registerPermissionError();
}
if (!DBUtil::deleteObjectByID('message', $args['mid'], 'mid')) {
return LogUtil::registerError(__('Error! Could not perform the deletion.', $dom));
}
// Let any hooks know that we have deleted an item.
ModUtil::callHooks('item', 'delete', $args['mid'], array('module' => 'Admin_Messages'));
// The item has been modified, so we clear all cached pages of this item.
$view = Zikula_View::getInstance('Admin_Messages');
$view->clear_cache(null, UserUtil::getVar('uid'));
// Let the calling process know that we have finished successfully
return true;
}
示例5: delete
/**
* delete a RSS item
* @param $args['fid'] ID of the item
* @return bool true on success, false on failure
*/
public function delete($args)
{
// Argument check
if (!isset($args['fid']) || !is_numeric($args['fid'])) {
return LogUtil::registerArgsError();
}
// Get the feed
$item = ModUtil::apiFunc('Feeds', 'user', 'get', array('fid' => $args['fid']));
if (!$item) {
return LogUtil::registerError($this->__('No such Feed found.'));
}
// Security check
if (!SecurityUtil::checkPermission('Feeds::Item', "$item[name]::$args[fid]", ACCESS_DELETE)) {
return LogUtil::registerPermissionError();
}
if (!DBUtil::deleteObjectByID('feeds', $args['fid'], 'fid')) {
return LogUtil::registerError($this->__('Error! Deletion attempt failed.'));
}
// Let the calling process know that we have finished successfully
return true;
}
示例6: delete
/**
* Delete an item
*
* @param $args['id'] ID of the item
* @return bool true on success, false on failure
*/
public function delete($args)
{
// Argument check
if (!isset($args['id']) || !is_numeric($args['id'])) {
return LogUtil::registerArgsError();
}
// The user API function is called.
$item = ModUtil::apiFunc('EZComments', 'user', 'get', array('id' => $args['id']));
if (!$item) {
return LogUtil::registerError($this->__('No such item found.'));
}
// Security check
$securityCheck = ModUtil::apiFunc('EZComments', 'user', 'checkPermission', array('module' => '', 'objectid' => '', 'commentid' => $args['id'], 'level' => ACCESS_DELETE));
if (!$securityCheck) {
return LogUtil::registerPermissionError(ModUtil::url('EZComments', 'admin', 'main'));
}
// Check for an error with the database code
if (!DBUtil::deleteObjectByID('EZComments', (int) $args['id'])) {
return LogUtil::registerError($this->__('Error! Deletion attempt failed.'));
}
// clear respective cache
ModUtil::apiFunc('EZComments', 'user', 'clearItemCache', $item);
// Let the calling process know that we have finished successfully
return true;
}
示例7: deleteCategory
public function deleteCategory($args) {
// Security check
if (!SecurityUtil::checkPermission('IWdocmanager::', "::", ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden();
}
if (!DBUtil::deleteObjectByID('IWdocmanager_categories', $args['categoryId'], 'categoryId')) {
return LogUtil::registerError($this->__('Error! Delete attempt failed.'));
}
return true;
}
示例8: delete
/**
* Delete Ephemeride
* @author The Zikula Development Team
* @param 'eid' the id of the ephemerid
* @return true if success, false otherwise
*/
public function delete($args)
{
// argument check
if (!isset($args['eid']) || !is_numeric($args['eid'])) {
return LogUtil::registerArgsError();
}
// get the existing item
$item = ModUtil::apiFunc('Ephemerides', 'user', 'get', array('eid' => $args['eid']));
if (!$item) {
return LogUtil::registerError($this->__('No such Ephemeride found.'));
}
// delete the item and check the return value for error
$res = DBUtil::deleteObjectByID('ephem', $args['eid'], 'eid');
if (!$res) {
return LogUtil::registerError($this->__('Error! Ephemeride deletion failed.'));
}
// delete any object category mappings for this item
ObjectUtil::deleteObjectCategories($item, 'ephem', 'eid');
return true;
}
示例9: delete_hour
public function delete_hour($args) {
if (!SecurityUtil::checkPermission('IWtimeframes::', "::", ACCESS_ADMIN)) {
return LogUtil::registerError($this->__('Not authorized to manage timeFrames.'), 403);
}
$hid = FormUtil::getPassedValue('hid', isset($args['hid']) ? $args['hid'] : null, 'GET');
//Comprovem que el parï¿œmetre id hagi arribat correctament
if (!isset($hid)) {
return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
}
//Carreguem l'API de l'usuari per carregar les dades del registre
if (!ModUtil::loadApi('IWtimeframes', 'user')) {
return LogUtil::registerError($this->__('Error! Could not load module.'));
}
DBUtil::deleteObjectByID('IWtimeframes', $hid, 'hid');
//Retornem true ja que el procï¿œs ha finalitzat amb ï¿œxit
return true;
}
示例10: deleteBlock
public function deleteBlock($bid)
{
// Ensure that $bid is 1 or higher.
if (!is_numeric($bid) || $bid < 1) {
$this->setError(__('Block ID Invalid'));
return false;
}
// Ensure block exists.
if (!BlockUtil::getBlockInfo($bid)) {
$this->setError(__('No Such Block Exists'));
return false;
}
// Delete block placements for this block.
if (!DBUtil::deleteObjectByID('block_placements', $bid, 'bid')) {
$this->setError(__('Block Placements Not Removed'));
return false;
}
// Delete the block itself.
if (!DBUtil::deleteObjectByID('blocks', $bid, 'bid')) {
$this->setError(__('Block Not Deleted'));
return false;
}
// Let other modules know we have deleted an item.
ModUtil::callHooks('item', 'delete', $bid, array('module' => 'Blocks'));
// Success.
return true;
}
示例11: remove
public function remove($id)
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_ADMIN));
return DBUtil::deleteObjectByID('llicencies', $id, 'codi_treball');
}
示例12: deleteNote
/**
* delete a note
* @author: Albert Pérez Monfort (aperezm@xtec.cat)
* @param: id of the note
* @return: An array with the note information
*/
public function deleteNote($args) {
$fmid = (isset($args['fmid'])) ? $args['fmid'] : null;
//get the note information
$note = ModUtil::apiFunc('IWforms', 'user', 'getNote', array('fmid' => $fmid));
//check user access to this form
$access = ModUtil::func('IWforms', 'user', 'access', array('fid' => $note['fid']));
if ($access['level'] < 7) {
return LogUtil::registerError($this->__('You do not have access to manage form'));
}
//Delete the note content
if (!DBUtil::deleteObjectByID('IWforms_note', $fmid, 'fmid')) {
return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
}
//Delete the note
if (!DBUtil::deleteObjectByID('IWforms', $fmid, 'fmid')) {
return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
}
return true;
}
示例13: performPreRemoveCallback
/**
* Pre-Process the data prior a delete operation.
* The event happens before the entity managers remove operation is executed for this entity.
*
* Restrictions:
* - no access to entity manager or unit of work apis
* - will not be called for a DQL DELETE statement
*
* @see MUVideo_Entity_Movie::preRemoveCallback()
* @return boolean true if completed successfully else false.
*/
protected function performPreRemoveCallback()
{
// delete workflow for this entity
$workflow = $this['__WORKFLOW__'];
if ($workflow['id'] > 0) {
$result = (bool) DBUtil::deleteObjectByID('workflows', $workflow['id']);
if ($result === false) {
$dom = ZLanguage::getModuleDomain('MUVideo');
return LogUtil::registerError(__('Error! Could not remove stored workflow. Deletion has been aborted.', $dom));
}
}
return true;
}
示例14: destroy
/**
* {@inheritdoc}
*/
public function destroy($sessionId)
{
if (isset($GLOBALS['_ZSession'])) {
unset($GLOBALS['_ZSession']);
}
// expire the cookie
setcookie(session_name(), '', 0, ini_get('session.cookie_path'));
// ensure we delete the stored session (not a regenerated one)
if (isset($GLOBALS['_ZSession']['regenerated']) && $GLOBALS['_ZSession']['regenerated'] == true) {
$sessionId = $GLOBALS['_ZSession']['sessid_old'];
} else {
$sessionId = session_id();
}
if (System::getVar('sessionstoretofile')) {
$path = DataUtil::formatForOS(session_save_path(), true);
return unlink("{$path}/{$sessionId}");
} else {
$res = DBUtil::deleteObjectByID('session_info', $sessionId, 'sessid');
return (bool) $res;
}
}
示例15: purgeExpired
/**
* Removes expired registrations from the users table.
*
* @return void
*/
protected function purgeExpired()
{
$dbinfo = DBUtil::getTables();
$verifyChgColumn = $dbinfo['users_verifychg_column'];
$regExpireDays = $this->getVar('reg_expiredays', 0);
if ($regExpireDays > 0) {
// Expiration date/times, as with all date/times in the Users module, are stored as UTC.
$staleRecordUTC = new DateTime(null, new DateTimeZone('UTC'));
$staleRecordUTC->modify("-{$regExpireDays} days");
$staleRecordUTCStr = $staleRecordUTC->format(Users_Constant::DATETIME_FORMAT);
// The zero date is there to guard against odd DB errors
$where = "WHERE ({$verifyChgColumn['changetype']} = " . Users_Constant::VERIFYCHGTYPE_REGEMAIL .") "
. "AND ({$verifyChgColumn['created_dt']} IS NOT NULL) "
. "AND ({$verifyChgColumn['created_dt']} != '0000-00-00 00:00:00') "
. "AND ({$verifyChgColumn['created_dt']} < '{$staleRecordUTCStr}')";
$staleVerifyChgRecs = DBUtil::selectObjectArray('users_verifychg', $where);
if (is_array($staleVerifyChgRecs) && !empty($staleVerifyChgRecs)) {
foreach ($staleVerifyChgRecs as $verifyChg) {
$registration = UserUtil::getVars($verifyChg['uid'], true, 'uid', true);
DBUtil::deleteObjectByID('users', $verifyChg['uid'], 'uid');
ModUtil::apiFunc($this->name, 'user', 'resetVerifyChgFor', array(
'uid' => $verifyChg['uid'],
'changetype'=> Users_Constant::VERIFYCHGTYPE_REGEMAIL,
));
$deleteEvent = new Zikula_Event('user.registration.delete', $registration);
$this->eventManager->notify($deleteEvent);
}
}
}
}