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


PHP DBUtil::selectObjectByID方法代码示例

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


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

示例1: getref

    /**
     * Return a reference depending on this reference name
     *
     * @param    int     $args['ref']    Id of the reference that have to be returned
     * @return   array   array of items, or false on failure
     */
    public function getref($args) {
        if (!isset($args['ref'])) {
            return LogUtil::registerError(__('Error! Could not do what you wanted. Please check your input.'));
        }

        return DBUtil::selectObjectByID('IWwebbox', $args['ref'], 'ref', '', '');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:13,代码来源:User.php

示例2: get

    /**
     * get a specific item
     *
     * @param $args['pageid'] id of example item to get
     *
     * @return mixed item array, or false on failure
     */
    public function get($args)
    {
        // Argument check
        if ((!isset($args['pageid']) || !is_numeric($args['pageid'])) &&
                !isset($args['title'])) {
            return LogUtil::registerArgsError();
        }

        // define the permission filter to apply
        $permFilter   = array();
        $permFilter[] = array('component_left'  => 'Pages',
                'instance_left'   => 'title',
                'instance_right'  => 'pageid',
                'level'           => ACCESS_READ);

        if (isset($args['pageid']) && is_numeric($args['pageid'])) {
            $item = DBUtil::selectObjectByID('pages', $args['pageid'], 'pageid', '', $permFilter);
        } else {
            $item = DBUtil::selectObjectByID('pages', $args['title'], 'urltitle', '', $permFilter);
        }

        // need to do this here as the category expansion code can't know the
        // root category which we need to build the relative path component
        if ($item && isset($args['catregistry']) && $args['catregistry']) {
            ObjectUtil::postProcessExpandedObjectCategories($item, $args['catregistry']);
        }

        if (ModUtil::getVar('Pages', 'enablecategorization') && !empty($item['__CATEGORIES__'])) {
            if (!CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'Pages')) {
                return false;
            }
        }

        return $item;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:42,代码来源:User.php

示例3: Admin_Messages_userapi_get

/**
 * get a specific admin messages item
 * @author Mark West
 * @param int $args['mid'] id of message to get
 * @return mixed item array, or false on failure
 */
function Admin_Messages_userapi_get($args)
{
    // Argument check
    if (!isset($args['mid']) || !is_numeric($args['mid'])) {
        return LogUtil::registerArgsError();
    }
    // define the permission filter to apply
    $permFilter = array(array('realm' => 0, 'component_left' => 'Admin_Messages', 'instance_left' => 'title', 'instance_right' => 'mid', 'level' => ACCESS_READ));
    return DBUtil::selectObjectByID('message', $args['mid'], 'mid', '', $permFilter);
}
开发者ID:robbrandt,项目名称:AdminMessages,代码行数:16,代码来源:pnuserapi.php

示例4: get

 /**
  * Get an user files information
  * @author:    Albert Pérez Monfort
  * @param:     UserId
  * @return:    And array with the users
 */
 public function get($args)
 {
     $userId = (isset($args['userId'])) ? $args['userId'] : UserUtil::getVar('uid');
     // security check
     if (!SecurityUtil::checkPermission( 'Files::', '::', ACCESS_ADD)) {
         return LogUtil::registerPermissionError();
     }
     $item = DBUtil::selectObjectByID('Files', $userId, 'userId');
     // error message and return
     if ($item === false) {
         return LogUtil::registerError ($this->__('Error! Could not load items.'));
     }
     return $item;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:20,代码来源:User.php

示例5: get

    public function get($args) {
        $mdid = FormUtil::getPassedValue('mdid', isset($args['mdid']) ? $args['mdid'] : null, 'GET');

        if (!SecurityUtil::checkPermission('IWtimeframes::', "::", ACCESS_READ)) {
            return LogUtil::registerError($this->__('Not authorized to manage timeFrames.'), 403);
        }

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

        $item = DBUtil::selectObjectByID('IWtimeframes_definition', $mdid, 'mdid');

        return $item;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:15,代码来源:User.php

示例6: get

    public function get($args) {

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

        $items = DBUtil::selectObjectByID('groups', $args['gid'], 'gid');

        // Check for an error with the database code, and if so set an appropriate
        // error message and return
        if ($items === false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }

        // Return the items
        return $items;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:17,代码来源:User.php

示例7: mediashare_sourcesapi_OnOffsources

function mediashare_sourcesapi_OnOffsources($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if ($args['id'] === false) {
        return false;
    }
    $source = DBUtil::selectObjectByID('mediashare_sources', $args['id']);
    if ($args['active'] === flase) {
        $source['active'] = 0;
    } else {
        $source['active'] = $args['active'];
        // todo turn off same mimeTypes
    }
    $result = DBUTil::updateObject($source, 'mediashare_sources');
    if ($result === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('mediahandlerapi.addHandler', 'Could not change source status.'), $dom));
    }
    //turn off same mimeTypes
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:20,代码来源:pnsourcesapi.php

示例8: upgrade

 /**
  * upgrade the module from an old version
  *
  * This function must consider all the released versions of the module!
  * If the upgrade fails at some point, it returns the last upgraded version.
  *
  * @param        string   $oldVersion   version number string to upgrade from
  * @return       mixed    true on success, last valid version string or false if fails
  */
 public function upgrade($oldversion)
 {
     // Upgrade dependent on old version number
     switch ($oldversion) {
         case '2.1':
             // change value of defaultgroup from name to gid
             $gid = \DBUtil::selectObjectByID('groups', $this->getVar('defaultgroup'), 'name');
             $this->setVar('defaultgroup', $gid['gid']);
         case '2.2':
         case '2.3':
         case '2.3.0':
         case '2.3.1':
             // Set read-only primaryadmingroup so it is accessible by other modules.
             $this->setVar('primaryadmingroup', 2);
         case '2.3.2':
             // future upgrade routines
     }
     // Update successful
     return true;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:29,代码来源:Installer.php

示例9: restoreVersion

 public function restoreVersion($args)
 {
     $versionId = $args['id'];
     $version = DBUtil::selectObjectByID('content_history', $versionId);
     if (empty($version)) {
         return LogUtil::registerError($this->__f('Error! Unknown version ID [%s]', $versionId));
     }
     $version['data'] = unserialize($version['data']);
     $versionData = $version['data'];
     $page = $versionData['page'];
     $pageId = $page['id'];
     $content = $page['content'];
     $pageTranslations = $versionData['pageTranslations'];
     $contentTranslations = $versionData['contentTranslations'];
     unset($page['layoutData']);
     unset($page['isTranslated']);
     unset($page['layoutTemplate']);
     unset($page['content']);
     $currentPage = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $pageId, 'editing' => false, 'filter' => array('checkActive' => false), 'enableEscape' => true, 'translate' => false, 'includeContent' => false, 'includeCategories' => false));
     if ($currentPage === false) {
         // is a deleted page
         $retval = ModUtil::apiFunc('Content', 'Page', 'reinsertPage', array('page' => $page));
         if ($retval === false) {
             return LogUtil::registerError($this->__('Error! Could not reinsert page'));
         }
         $pageId = $page['id'] = $retval['id'];
         $page['urlname'] = $retval['urlname'];
     }
     unset($page['parentPageId']);
     unset($page['position']);
     unset($page['level']);
     unset($page['setLeft']);
     unset($page['setRight']);
     unset($page['cr_date']);
     unset($page['cr_uid']);
     unset($page['lu_date']);
     unset($page['lu_uid']);
     unset($page['translatedTitle']);
     unset($page['translated']);
     unset($page['uname']);
     $ok = ModUtil::apiFunc('Content', 'Page', 'updatePage', array('page' => $page, 'pageId' => $pageId, 'revisionText' => '_CONTENT_HISTORYPAGERESTORED' . "|revisionNo={$version['revisionNo']}"));
     if ($ok === false) {
         return false;
     }
     $currentContentItems = ModUtil::apiFunc('Content', 'Content', 'getSimplePageContent', array('pageId' => $pageId));
     if ($currentContentItems === false) {
         return false;
     }
     $currentContentItemsIdMap = array();
     foreach ($currentContentItems as $currentContentItem) {
         $currentContentItemsIdMap[$currentContentItem['id']] = $currentContentItem;
     }
     // Iterate through old content items
     // - if not exist today, then create new, otherwise update existing
     foreach (array_keys($content) as $i) {
         foreach (array_keys($content[$i]) as $j) {
             $contentItem = $content[$i][$j];
             //echo "($i,$j : {$content[$i][$j]['type']}) ";
             if (isset($currentContentItemsIdMap[$contentItem['id']])) {
                 //echo "Update $contentItem[id]! ";
                 $ok = ModUtil::apiFunc('Content', 'Content', 'updateContent', array('content' => $contentItem, 'id' => $contentItem['id'], 'addVersion' => false));
                 if (!$ok) {
                     return false;
                 }
                 unset($currentContentItemsIdMap[$contentItem['id']]);
             } else {
                 //echo "Insert $contentItem[id]! ";
                 $newContentItem = array();
                 $aKeys = array_keys($contentItem);
                 $aVals = array_values($contentItem);
                 // copy all direct keys/values
                 for ($x = 0; $x < count($aKeys); $x++) {
                     $newContentItem[$aKeys[$x]] = $aVals[$x];
                 }
                 $id = ModUtil::apiFunc('Content', 'Content', 'newContent', array('content' => $newContentItem, 'pageId' => $pageId, 'contentAreaIndex' => $contentItem['areaIndex'], 'position' => $contentItem['position'], 'addVersion' => false));
                 if ($id === false) {
                     return false;
                 }
                 if ($id != $contentItem['id']) {
                     return LogUtil::registerError($this->__("Error! Re-created old content item but did not restore old ID."));
                 }
                 unset($currentContentItemsIdMap[$contentItem['id']]);
             }
         }
     }
     // Iterate through new items
     // - if not exist in old items then delete it
     foreach (array_keys($currentContentItemsIdMap) as $id) {
         //echo "Delete $id! ";
         $ok = ModUtil::apiFunc('Content', 'Content', 'deleteContent', array('contentId' => $id, 'addVersion' => false));
         if (!$ok) {
             return false;
         }
     }
     // Delete all translations and replace with old translations
     $ok = ModUtil::apiFunc('Content', 'Page', 'deleteTranslation', array('pageId' => $pageId, 'addVersion' => false));
     if ($ok === false) {
         return false;
     }
     foreach ($pageTranslations as $translation) {
//.........这里部分代码省略.........
开发者ID:robbrandt,项目名称:Content,代码行数:101,代码来源:History.php

示例10: getCategoryByID

 /**
  * Return a category object by ID.
  *
  * @param intiger $cid The category-ID to retrieve.
  *
  * @return The resulting folder object
  */
 public static function getCategoryByID($cid)
 {
     if (!$cid) {
         return false;
     }
     $permFilter = array();
     $permFilter[] = array('realm' => 0, 'component_left' => 'Categories', 'component_middle' => '', 'component_right' => 'Category', 'instance_left' => 'id', 'instance_middle' => 'path', 'instance_right' => 'ipath', 'level' => ACCESS_OVERVIEW);
     $result = DBUtil::selectObjectByID('categories_category', (int) $cid, 'id', null, $permFilter);
     if ($result) {
         $result['display_name'] = DataUtil::formatForDisplayHTML(unserialize($result['display_name']));
         $result['display_desc'] = DataUtil::formatForDisplayHTML(unserialize($result['display_desc']));
     }
     return $result;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:21,代码来源:CategoryUtil.php

示例11: getVars

 /**
  * Get all user variables, maps new style attributes to old style user data.
  *
  * @param integer $id              The user id of the user (required).
  * @param boolean $force           True to force loading from database and ignore the cache.
  * @param string  $idfield         Field to use as id (possible values: uid, uname or email).
  * @param bool    $getRegistration Indicates whether a "regular" user record or a pending registration
  *                                      is to be returned. False (default) for a user record and true
  *                                      for a registration. If false and the user record is a pending
  *                                      registration, then the record is not returned and false is returned
  *                                      instead; likewise, if true and the user record is not a registration,
  *                                      then false is returned; (Defaults to false).
  *
  * @return array|bool An associative array with all variables for a user (or pending registration);
  *                      false on error.
  */
 public static function getVars($id, $force = false, $idfield = '', $getRegistration = false)
 {
     if (empty($id)) {
         return false;
     }
     // assign a value for the parameter idfield if it is necessary and prevent from possible typing mistakes
     if ($idfield == '' || $idfield != 'uid' && $idfield != 'uname' && $idfield != 'email') {
         $idfield = 'uid';
         if (!is_numeric($id)) {
             $idfield = 'uname';
             if (strpos($id, '@')) {
                 $idfield = 'email';
             }
         }
     }
     static $cache = array(), $unames = array(), $emails = array();
     // caching
     $user = null;
     if ($force == false) {
         if ($idfield == 'uname' && isset($unames[$id])) {
             if ($unames[$id] !== false) {
                 $user = $cache[$unames[$id]];
             } else {
                 return false;
             }
         }
         if ($idfield == 'email' && isset($emails[$id])) {
             if ($emails[$id] !== false) {
                 $user = $cache[$emails[$id]];
             } else {
                 return false;
             }
         }
         if (isset($cache[$id])) {
             $user = $cache[$id];
         }
     }
     if (!isset($user) || $force) {
         // load the Users database information
         ModUtil::dbInfoLoad('Users', 'Users');
         // get user info, don't cache as this information must be up-to-date
         // NOTE: Do not use a permission filter, or you will enter an infinite nesting loop where getVars calls checkPermission (from within
         // DBUtil), which will call getVars to find out who you are, which will call checkPermission, etc., etc.
         // Do your permission check in the API that is using UserUtil.
         $user = DBUtil::selectObjectByID('users', $id, $idfield, null, null, null, false);
         // If $idfield is email, make sure that we are getting a unique record.
         if ($user && $idfield == 'email') {
             $emailCount = self::getEmailUsageCount($id);
             if ($emailCount > 1 || $emailCount === false) {
                 $user = false;
             }
         }
         // update cache
         // user can be false (error) or empty array (no such user)
         if ($user === false || empty($user)) {
             switch ($idfield) {
                 case 'uid':
                     $cache[$id] = false;
                     break;
                 case 'uname':
                     $unames[$id] = false;
                     break;
                 case 'email':
                     $emails[$id] = false;
                     break;
             }
             if ($user === false) {
                 return LogUtil::registerError(__('Error! Could not load data.'));
             }
             return false;
         } else {
             // This check should come at the very end, here, so that if $force is true the vars get
             // reloaded into cache no matter what $getRegistration is set to. If not, and this is
             // called from setVar(), and setVar() changed the 'activated' value, then we'd have trouble.
             if ($getRegistration && $user['activated'] != Users_Constant::ACTIVATED_PENDING_REG || !$getRegistration && $user['activated'] == Users_Constant::ACTIVATED_PENDING_REG) {
                 return false;
             }
             $user = self::postProcessGetRegistration($user);
             $cache[$user['uid']] = $user;
             $unames[$user['uname']] = $user['uid'];
             $emails[$user['email']] = $user['uid'];
         }
     } elseif ($getRegistration && $user['activated'] != Users_Constant::ACTIVATED_PENDING_REG || !$getRegistration && $user['activated'] == Users_Constant::ACTIVATED_PENDING_REG) {
         return false;
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:UserUtil.php

示例12: get

 /**
  * Get Quote
  * @author The Zikula Development Team
  * @author Greg Allan
  * @param 'args['qid']' quote id
  * @return array item array
  */
 public function get($args)
 {
     // argument check
     if (!isset($args['qid']) || !is_numeric($args['qid'])) {
         return LogUtil::registerArgsError();
     }
     // define the permissions filter to use
     $permFilter = array();
     $permFilter[] = array('realm' => 0, 'component_left' => 'Quotes', 'component_middle' => '', 'component_right' => '', 'instance_left' => 'author', 'instance_middle' => '', 'instance_right' => 'qid', 'level' => ACCESS_READ);
     // get the quote
     $quote = DBUtil::selectObjectByID('quotes', $args['qid'], 'qid', null, $permFilter);
     // return the fetched object or false
     return $quote ? $quote : false;
 }
开发者ID:nmpetkov,项目名称:Quotes,代码行数:21,代码来源:User.php

示例13: edititem

 function edititem()
 {
     // Confirm the forms authorisation key
     $this->checkCsrfToken();
     // get passed values
     $ot = FormUtil::getPassedValue('ot', 'address', 'POST');
     $startnum = FormUtil::getPassedValue('startnum', 1, 'GET');
     $letter = FormUtil::getPassedValue('letter', 0);
     $sort = FormUtil::getPassedValue('sort', ModUtil::getVar('AddressBook', 'addressbooktype') == 1 ? 'sortname ASC' : 'sortcompany ASC');
     $search = FormUtil::getPassedValue('search', 0);
     $category = FormUtil::getPassedValue('category', 0);
     $private = FormUtil::getPassedValue('private', 0);
     $returnid = FormUtil::getPassedValue('returnid', 0, 'POST');
     // build standard return url
     if (!empty($returnid)) {
         $url = ModUtil::url('AddressBook', 'user', 'display', array('id' => $returnid, 'ot' => $ot, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     } else {
         $url = ModUtil::url('AddressBook', 'user', 'view', array('ot' => $ot, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     }
     $object = new AddressBook_DBObject_Address();
     //$data =& $object->getDataFromInput();
     $data = $object->getDataFromInput();
     // permission check
     if (UserUtil::isLoggedIn()) {
         $user_id = UserUtil::getVar('uid');
     } else {
         $user_id = 0;
     }
     if (!(SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_EDIT) || $user_id > 0 && $user_id == $data['user_id'])) {
         return LogUtil::registerPermissionError();
     }
     // validation
     if (!$object->validate()) {
         return System::redirect(ModUtil::url('AddressBook', 'user', 'edit'));
     }
     // check for duplication request and return to the form
     if (FormUtil::getPassedValue('btn_duplicate', null, 'POST')) {
         $url = ModUtil::url('AddressBook', 'user', 'edit', array('ot' => $ot, 'id' => $data['id'], 'duplicate' => 1, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
         return System::redirect($url);
     }
     // check for company update - part 1: get the old data
     if (isset($data['id']) && $data['id']) {
         $oldObject = DBUtil::selectObjectByID('addressbook_address', $data['id']);
         if ($oldObject['company'] && ($oldObject['company'] != $data['company'] || $oldObject['address1'] != $data['address1'] || $oldObject['address2'] != $data['address2'] || $oldObject['zip'] != $data['zip'] || $oldObject['city'] != $data['city'] || $oldObject['state'] != $data['state'] || $oldObject['country'] != $data['country'])) {
             $companyHasChanged = true;
             $url = ModUtil::url('AddressBook', 'user', 'change_company', array('ot' => $ot, 'id' => $data['id'], 'oldvalue' => $oldObject['company'], 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
         }
     }
     // save or update the object
     $object->save();
     // create a status message
     LogUtil::registerStatus($this->__('Done! The address was saved.'));
     // clear respective cache
     ModUtil::apiFunc('AddressBook', 'user', 'clearItemCache', $data);
     // clear the the session from FailedObjects
     FormUtil::clearValidationFailedObjects('address');
     // check for save and duplicate request and return to the form
     if (FormUtil::getPassedValue('btn_save_duplicate', null, 'POST')) {
         $url = ModUtil::url('AddressBook', 'user', 'edit', array('ot' => $ot, 'id' => $data['id'], 'duplicate' => 1, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     }
     // return to standard return url
     return System::redirect($url);
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:63,代码来源:User.php

示例14: get

    /**
     * get a specific item
     * @param $args['fid'] id of example item to get
     * @return mixed item array, or false on failure
     */
    public function get($args)
    {
        // optional arguments
        if (isset($args['objectid'])) {
            $args['fid'] = $args['objectid'];
        }

        if ((!isset($args['fid']) || !is_numeric($args['fid'])) &&
                !isset($args['title'])) {
            return LogUtil::registerArgsError();
        }

        // define the permission filter to apply
        $permFilter = array(array('realm'           => 0,
                        'component_left'  => 'Feeds',
                        'component_right' => 'item',
                        'instance_left'   => 'name',
                        'instance_right'  => 'fid',
                        'level'           => ACCESS_READ));

        if (isset($args['fid']) && is_numeric($args['fid'])) {
            return DBUtil::selectObjectByID('feeds', $args['fid'], 'fid', '', $permFilter);
        } else {
            return DBUtil::selectObjectByID('feeds', $args['title'], 'urltitle', '', $permFilter);
        }
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:31,代码来源:User.php

示例15: get

    /**
     * Gets a menu item
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @param:		id of the item to get
     * @return:		An array with the item information
     */
    public function get($args) {
        // Security check
        if (!SecurityUtil::checkPermission('IWmenu::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }

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

        // get the objects from the db
        $items = DBUtil::selectObjectByID('IWmenu', $args['mid'], 'mid');

        // Check for an error with the database code, and if so set an appropriate
        // error message and return
        if ($items === false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }

        // Return the items
        return $items;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:29,代码来源:Admin.php


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