当前位置: 首页>>代码示例>>PHP>>正文


PHP DBUtil::deleteObject方法代码示例

本文整理汇总了PHP中DBUtil::deleteObject方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::deleteObject方法的具体用法?PHP DBUtil::deleteObject怎么用?PHP DBUtil::deleteObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBUtil的用法示例。


在下文中一共展示了DBUtil::deleteObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteContant

    /**
     * delete a contact from user's list
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @param: fuid identity of the user to delete
     * @return:	true if success and false otherwise
     */
    public function deleteContant($args) {

        // Security check
        if (!SecurityUtil::checkPermission('IWusers::', '::', ACCESS_READ)) {
            throw new Zikula_Exception_Forbidden();
        }
        $pntables = DBUtil::getTables();
        $c = $pntables['IWusers_friends_column'];
        $where = "WHERE $c[uid]=" . UserUtil::getVar('uid') . " AND $c[fuid]=" . $args['fuid'];
        if (!DBUtil::deleteObject(array(), 'IWusers_friends', $where)) {
            return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
        }
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:20,代码来源:User.php

示例2: deleteTranslation

 public function deleteTranslation($args)
 {
     $contentId = (int) $args['contentId'];
     $language = isset($args['language']) ? $args['language'] : null;
     $includeHistory = isset($args['includeHistory']) ? $args['includeHistory'] : true;
     $translatedData = array('contentId' => $contentId);
     if ($language !== null) {
         $translatedData['language'] = $language;
     }
     DBUtil::deleteObject($translatedData, 'content_translatedcontent', '', 'contentId');
     $searchableLanguage = $language !== null ? $language : ZLanguage::getLanguageCode();
     $dbtables = DBUtil::getTables();
     $contentSearchColumn = $dbtables['content_searchable_column'];
     $where = $contentSearchColumn['contentId'] . ' = ' . $contentId . ' AND ' . $contentSearchColumn['language'] . ' = \'' . DataUtil::formatForStore($searchableLanguage) . '\'';
     DBUtil::deleteWhere('content_searchable', $where);
     // Get content to find page ID
     if ($includeHistory) {
         $content = $this->getContent(array('id' => $contentId));
         if ($content === false) {
             return false;
         }
         $ok = ModUtil::apiFunc('Content', 'History', 'addPageVersion', array('pageId' => $content['pageId'], 'action' => '_CONTENT_HISTORYTRANSLATIONDEL'));
         if ($ok === false) {
             return false;
         }
     }
     Content_Util::clearCache();
     return true;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:29,代码来源:Content.php

示例3: deleteObjectMetaData

 /**
  * Delete a meta data object.
  *
  * @param array  &$obj      The object we wish to delete metadata for.
  * @param string $tablename The object's tablename.
  * @param string $idcolumn  The object's idcolumn (optional) (default='id').
  *
  * @return The result from the metadata insert operation
  */
 public static function deleteObjectMetaData(&$obj, $tablename, $idcolumn = 'id')
 {
     self::fixObjectMetaData($obj, $tablename, $idcolumn);
     if (isset($obj['__META__']['id']) && $obj['__META__']['id']) {
         $rc = DBUtil::deleteObjectByID($obj['__META__'], 'objectdata_meta');
     } elseif (isset($obj['__META__']['idcolumn']) && $obj['__META__']['obj_id']) {
         $dbtables = DBUtil::getTables();
         $meta_column = $dbtables['objectdata_meta_column'];
         $meta = $obj['__META__'];
         $where = "WHERE {$meta_column['module']}='" . DataUtil::formatForStore($meta['module']) . "'\n                        AND {$meta_column['table']}='" . DataUtil::formatForStore($meta['table']) . "'\n                        AND {$meta_column['idcolumn']}='" . DataUtil::formatForStore($meta['idcolumn']) . "'\n                        AND {$meta_column['obj_id']}='" . DataUtil::formatForStore($meta['obj_id']) . "'";
         $rc = DBUtil::deleteObject(array(), 'objectdata_meta', $where);
     }
     $dbtables = DBUtil::getTables();
     if (isset($dbtables[$tablename])) {
         DBUtil::flushCache($tablename);
     }
     return (bool) $rc;
 }
开发者ID:Silwereth,项目名称:core,代码行数:27,代码来源:ObjectUtil.php

示例4: deleteUser

        /**
     * Delete one or more user account records, or mark one or more account records for deletion.
     *
     * If records are marked for deletion, they remain in the system and accessible by the system, but are given an
     * 'activated' status that prevents the user from logging in. Records marked for deletion will not appear on the
     * regular users list. The delete hook and delete events are not triggered if the records are only marked for
     * deletion.
     *
     * Parameters passed in the $args array:
     * -------------------------------------
     * numeric|array $args['uid']  A single (numeric integer) user id, or an array of user ids to delete.
     * boolean       $args['mark'] If true, then mark for deletion, but do not actually delete.
     *                                  defaults to false.
     *
     * @param array $args All parameters passed to this function.
     *
     * @return bool True if successful, false otherwise.
     */
    public function deleteUser($args)
    {
        if (!SecurityUtil::checkPermission("{$this->name}::", 'ANY', ACCESS_DELETE)) {
            return false;
        }

        if (!isset($args['uid']) || (!is_numeric($args['uid']) && !is_array($args['uid']))) {
            $this->registerError("Error! Illegal argument were passed to 'deleteuser'");
            return false;
        }

        if (isset($args['mark']) && is_bool($args['mark'])) {
            $markOnly = $args['mark'];
        } else {
            $markOnly = false;
        }

        // ensure we always have an array
        if (!is_array($args['uid'])) {
            $args['uid'] = array($args['uid']);
        }

        $curUserUid = UserUtil::getVar('uid');
        $userList = array();

        foreach ($args['uid'] as $uid) {             
            if (!is_numeric($uid) || ((int)$uid != $uid) || ($uid == $curUserUid)) {
                return false;
            }
            $userObj = UserUtil::getVars($uid);
            if (!$userObj) {
                return false;
            } elseif (!SecurityUtil::checkPermission("{$this->name}::", "{$userObj['uname']}::{$userObj['uid']}", ACCESS_DELETE)) {
                return false;
            }

            $userList[] = $userObj;
        }


        foreach ($userList as $userObj) {
            if ($markOnly) {
                UserUtil::setVar('activated', Users_Constant::ACTIVATED_PENDING_DELETE, $userObj['uid']);
            } else {
                // TODO - This should be in the Groups module, and happen as a result of an event.
                if (!DBUtil::deleteObjectByID('group_membership', $userObj['uid'], 'uid')) {
                    return false;
                }

                ModUtil::apiFunc($this->name, 'admin', 'resetVerifyChgFor', array('uid' => $userObj['uid']));
                DBUtil::deleteObjectByID('session_info', $userObj['uid'], 'uid');

                if (!DBUtil::deleteObject($userObj, 'users', '', 'uid')) {
                    return false;
                }

                // Let other modules know we have deleted an item
                $deleteEvent = new Zikula_Event('user.account.delete', $userObj);
                $this->eventManager->notify($deleteEvent);
            }
        }

        return $args['uid'];
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:82,代码来源:Admin.php

示例5: sendVerificationCode


//.........这里部分代码省略.........
                return false;
            }
            $reginfo = $args['reginfo'];
            if (!$reginfo || !is_array($reginfo) || !isset($reginfo['uid']) || !is_numeric($reginfo['uid'])) {
                $this->registerError(LogUtil::getErrorMsgArgs());

                return false;
            }
        } elseif (!isset($args['uid']) || !is_numeric($args['uid']) || ((int)$args['uid'] != $args['uid'])) {
            $this->registerError(LogUtil::getErrorMsgArgs());

            return false;
        } else {
            // Got just a uid.
            $reginfo = UserUtil::getVars($args['uid'], false, 'uid', true);
            if (!$reginfo || empty($reginfo)) {
                $this->registerError($this->__f('Error! Unable to retrieve registration record with uid \'%1$s\'', $uid));

                return false;
            }
            if (!isset($reginfo['email'])) {
                $this->registerError($this->__f('Error! The registration record with uid \'%1$s\' does not contain an e-mail address.', $uid));

                return false;
            }
        }

        if ($this->currentUserIsAdmin() && isset($args['force']) && $args['force']) {
            $forceVerification = true;
        } else {
            $forceVerification = false;
        }

        if (isset($args['rendererArgs']) && is_array($args['rendererArgs'])) {
            $rendererArgs = $args['rendererArgs'];
        } else {
            $rendererArgs = array();
        }

        $approvalOrder = $this->getVar('moderation_order', Users_Constant::APPROVAL_BEFORE);

        // Set the verification code
        if (isset($reginfo['isverified']) && $reginfo['isverified']) {
            $this->registerError($this->__f('Error! A verification code cannot be sent for the registration record for \'%1$s\'. It is already verified.', $reginfo['uname']));

            return false;
        } elseif (!$forceVerification && ($approvalOrder == Users_Constant::APPROVAL_BEFORE) && isset($reginfo['approvedby']) && !empty($reginfo['approved_by'])) {
            $this->registerError($this->__f('Error! A verification code cannot be sent for the registration record for \'%1$s\'. It must first be approved.', $reginfo['uname']));

            return false;
        }

        $nowUTC = new DateTime(null, new DateTimeZone('UTC'));
        $verificationCode = UserUtil::generatePassword();

        ModUtil::apiFunc($this->name, 'user', 'resetVerifyChgFor', array(
            'uid'       => $reginfo['uid'],
            'changetype'=> Users_Constant::VERIFYCHGTYPE_REGEMAIL,
        ));

        $verifyChgObj = array(
            'changetype'=> Users_Constant::VERIFYCHGTYPE_REGEMAIL,
            'uid'       => $reginfo['uid'],
            'newemail'  => $reginfo['email'],
            'verifycode'=> UserUtil::getHashedPassword($verificationCode),
            'created_dt'=> $nowUTC->format(Users_Constant::DATETIME_FORMAT),
        );
        $verifyChgObj = DBUtil::insertObject($verifyChgObj, 'users_verifychg');

        if (!$verifyChgObj) {
            $this->registerError($this->__f('Error! Unable to save the verification code for the registration for \'%1$s\'.', $reginfo['uname']));

            return false;
        }

        if (empty($rendererArgs)) {
            $siteurl   = System::getBaseUrl();

            $rendererArgs = array();
            $rendererArgs['sitename'] = System::getVar('sitename');
            $rendererArgs['siteurl'] = substr($siteurl, 0, strlen($siteurl)-1);
        }
        $rendererArgs['reginfo'] = $reginfo;
        $rendererArgs['verifycode'] = $verificationCode;
        $rendererArgs['approvalorder'] = $approvalOrder;

        $codeSent = ModUtil::apiFunc($this->name, 'user', 'sendNotification', array(
            'toAddress'         => $reginfo['email'],
            'notificationType'  => 'regverifyemail',
            'templateArgs'      => $rendererArgs,
        ));

        if ($codeSent) {
            return $verifyChgObj['created_dt'];
        } else {
            DBUtil::deleteObject($verifyChgObj, 'users_verifychg');

            return false;
        }
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Registration.php

示例6: deletemessage

    /**
     * Delete the specified message
     * @author Sara Arjona Téllez (sarjona@xtec.cat)
     * @param $args['qvmid'] ID of the message
     * @return bool true on success, false on failure
     */
    public function deletemessage($args) {

        // Security check
        if (!SecurityUtil::checkPermission('IWqv::', '::', ACCESS_ADD)) {
            return LogUtil::registerError($this->__('Sorry! No authorization to access this module.'));
        }

        // Argument check
        if (!isset($args['qvmid']) || !is_numeric($args['qvmid'])) {
            return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
        }

        $item = ModUtil::apiFunc('IWqv', 'user', 'getmessage', array('qvmid' => $args[qvmid]));
        if ($item == false) {
            return LogUtil::registerError($this->__('No such item found.'));
        }

        // Delete the message and the read messages mark
        $pntable = DBUtil::getTables();
        $c = $pntable['IWqv_messages_read_column'];
        $where = " $c[qvmid]=$args[qvmid] ";
        if (!DBUtil::deleteObject(array(), 'IWqv_messages_read', $where)) {
            return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
        }

        if (!DBUtil::deleteObjectByID('IWqv_messages', $args['qvmid'], 'qvmid')) {
            return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
        }

        // Let the calling process know that we have finished successfully
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:38,代码来源:User.php

示例7: deleteTranslation

    public function deleteTranslation($args)
    {
        $contentId = (int) $args['contentId'];
        $language = isset($args['language']) ? $args['language'] : null;
        $includeHistory = isset($args['includeHistory']) ? $args['includeHistory'] : true;

        $translatedData = array('contentId' => $contentId);
        if ($language != null) {
            $translatedData['language'] = $language;
        }
        DBUtil::deleteObject($translatedData, 'content_translatedcontent', '', 'contentId');

        // Get content to find page ID
        if ($includeHistory) {
            $content = $this->getContent(array('id' => $contentId));
            if ($content === false) {
                return false;
            }
            $ok = ModUtil::apiFunc('Content', 'History', 'addPageVersion', array('pageId' => $content['pageId'], 'action' => '_CONTENT_HISTORYTRANSLATIONDEL' /* delayed translation */));
            if ($ok === false) {
                return false;
            }
        }

        Content_Util::clearCache();
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:Content.php


注:本文中的DBUtil::deleteObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。