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


PHP DataUtil::formatForStore方法代码示例

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


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

示例1: mediashare_mediahandlerapi_getHandlerInfo

function mediashare_mediahandlerapi_getHandlerInfo($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $mimeType = strtolower($args['mimeType']);
    $filename = strtolower($args['filename']);
    if (!empty($filename)) {
        $dotPos = strpos($filename, '.');
        if ($dotPos === false) {
            $fileType = '';
        } else {
            $fileType = substr($filename, $dotPos + 1);
        }
    } else {
        $fileType = '';
    }
    $pntable = pnDBGetTables();
    $handlersTable = $pntable['mediashare_mediahandlers'];
    $handlersColumn = $pntable['mediashare_mediahandlers_column'];
    $sql = "SELECT DISTINCT {$handlersColumn['handler']},\r\n                            {$handlersColumn['foundMimeType']},\r\n                            {$handlersColumn['foundFileType']}\r\n                       FROM {$handlersTable}\r\n                      WHERE {$handlersColumn['mimeType']} = '" . DataUtil::formatForStore($mimeType) . "'\r\n                         OR {$handlersColumn['fileType']} = '" . DataUtil::formatForStore($fileType) . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND {$handlersColumn['active']} =\t1 ";
    $result = DBUtil::executeSQL($sql);
    $errormsg = __f('Unable to locate media handler for \'%1$s\' (%2$s)', array($filename, $mimeType), $dom);
    if ($result === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('mediahandlerapi.getHandlerInfo', $errormsg), $dom));
    }
    if (!$result) {
        return LogUtil::registerError($errormsg);
    }
    $colArray = array('handlerName', 'mimeType', 'fileType');
    $handler = DBUtil::marshallObjects($result, $colArray);
    return $handler[0];
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:31,代码来源:pnmediahandlerapi.php

示例2: EZComments_migrateapi_pnFlashGames

/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 * @since    0.2
 */
function EZComments_migrateapi_pnFlashGames()
{
    // Security check
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('pnFlashGames comments migration: Not Admin');
    }
    // Get datbase setup
    $tables = DBUtil::getTables();
    $Commentstable = $tables['pnFlashGames_comments'];
    $Commentscolumn = $tables['pnFlashGames_comments_column'];
    $Usertable = $tables['users'];
    $Usercolumn = $tables['users_column'];
    $sql = "SELECT {$Commentscolumn['gid']},\n                   {$Commentscolumn['uname']},\n                   {$Commentscolumn['date']},\n                   {$Commentscolumn['comment']},\n                   {$Usercolumn['uid']}\n             FROM  {$Commentstable}\n         LEFT JOIN {$Usertable}\n                ON {$Commentscolumn['uname']} = {$Usercolumn['uname']}";
    $result = DBUtil::executeSQL($sql);
    if ($result == false) {
        return LogUtil::registerError('pnFlashGames migration: DB Error: ' . $sql . ' -- ' . mysql_error());
    }
    // loop through the old comments and insert them one by one into the DB
    $items = DBUtil::marshalObjects($result, array('gid', 'uname', 'date', 'comment', 'uid'));
    foreach ($items as $item) {
        // set the correct user id for anonymous users
        if (empty($item['uid'])) {
            $item['uid'] = 1;
        }
        $id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'pnFlashGames', 'objectid' => DataUtil::formatForStore($item['gid']), 'url' => ModUtil::url('pnFlashGames', 'user', 'display', array('id' => $item['gid'])), 'comment' => $item['comment'], 'subject' => '', 'uid' => $item['uid'], 'date' => $item['date']));
        if (!$id) {
            return LogUtil::registerError('pnFlashGames migration: Error creating comment');
        }
    }
    return LogUtil::registerStatus('pnFlashGames migration successful');
}
开发者ID:rmaiwald,项目名称:EZComments,代码行数:39,代码来源:pnFlashGames.php

示例3: search

 /**
  * Search
  *
  * do the actual search and display the results
  *
  * @return output the search results
  */
 public function search($args)
 {
     if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_READ)) {
         return true;
     }
     $minlen = 3;
     $maxlen = 30;
     if (strlen($args['q']) < $minlen || strlen($args['q']) > $maxlen) {
         return LogUtil::registerStatus($this->__f('The comments can only be searched for words that are longer than %1$s and less than %2$s characters!', array($minlen, $maxlen)));
     }
     ModUtil::dbInfoLoad('Search');
     $tables = DBUtil::getTables();
     // ezcomments tables
     $ezcommentstable = $tables['EZComments'];
     $ezcommentscolumn = $tables['EZComments_column'];
     // our own tables
     $searchTable = $tables['search_result'];
     $searchColumn = $tables['search_result_column'];
     // where
     $where = Search_Api_User::construct_where($args, array($ezcommentscolumn['subject'], $ezcommentscolumn['comment']));
     $where .= " AND " . $ezcommentscolumn['url'] . " != ''";
     $sessionId = session_id();
     $insertSql = "INSERT INTO {$searchTable}\n              ({$searchColumn['title']},\n               {$searchColumn['text']},\n               {$searchColumn['extra']},\n               {$searchColumn['module']},\n               {$searchColumn['created']},\n               {$searchColumn['session']})\n            VALUES\n            ";
     $comments = DBUtil::selectObjectArray('EZComments', $where);
     foreach ($comments as $comment) {
         $sql = $insertSql . '(' . '\'' . DataUtil::formatForStore($comment['subject']) . '\', ' . '\'' . DataUtil::formatForStore($comment['comment']) . '\', ' . '\'' . DataUtil::formatForStore($comment['url']) . '\', ' . '\'' . 'EZComments' . '\', ' . '\'' . DataUtil::formatForStore($comment['date']) . '\', ' . '\'' . DataUtil::formatForStore($sessionId) . '\')';
         $insertResult = DBUtil::executeSQL($sql);
         if (!$insertResult) {
             return LogUtil::registerError($this->__('Error! Could not load items.'));
         }
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:EZComments,代码行数:40,代码来源:Search.php

示例4: update

 /**
  * Update attributes of a block.
  *
  * @param int $args ['bid'] the ID of the block to update.
  * @param string $args ['title'] the new title of the block.
  * @param string $args ['description'] the new description of the block.
  * @param string $args ['positions'] the new positions of the block.
  * @param string $args ['url'] the new URL of the block.
  * @param string $args ['language'] the new language of the block.
  * @param string $args ['content'] the new content of the block.
  *
  * @return bool true on success, false on failure.
  */
 public function update($args)
 {
     // Optional arguments
     if (!isset($args['url'])) {
         $args['url'] = '';
     }
     if (!isset($args['content'])) {
         $args['content'] = '';
     }
     // Argument check
     if (!isset($args['bid']) || !is_numeric($args['bid']) || !isset($args['content']) || !isset($args['title']) || !isset($args['description']) || !isset($args['language']) || !isset($args['collapsable']) || !isset($args['defaultstate'])) {
         return LogUtil::registerArgsError();
     }
     $block = DBUtil::selectObjectByID('blocks', $args['bid'], 'bid');
     // Security check
     // this function is called durung the init process so we have to check in _ZINSTALLVER
     // is set as alternative to the correct permission check
     if (!System::isInstalling() && !SecurityUtil::checkPermission('Blocks::', "{$block['bkey']}:{$block['title']}:{$block['bid']}", ACCESS_EDIT)) {
         return LogUtil::registerPermissionError();
     }
     $item = array('bid' => isset($args['bid']) ? $args['bid'] : $block['bid'], 'content' => isset($args['content']) ? $args['content'] : $block['content'], 'title' => isset($args['title']) ? $args['title'] : $block['title'], 'description' => isset($args['description']) ? $args['description'] : $block['description'], 'filter' => isset($args['filter']) ? serialize($args['filter']) : $block['filter'], 'url' => isset($args['url']) ? $args['url'] : $block['url'], 'refresh' => isset($args['refresh']) ? $args['refresh'] : $block['refresh'], 'language' => isset($args['language']) ? $args['language'] : $block['language'], 'collapsable' => isset($args['collapsable']) ? $args['collapsable'] : $block['collapsable'], 'defaultstate' => isset($args['defaultstate']) ? $args['defaultstate'] : $block['defaultstate']);
     $res = DBUtil::updateObject($item, 'blocks', '', 'bid');
     if (!$res) {
         return LogUtil::registerError($this->__('Error! Could not save your changes.'));
     }
     // leave unchanged positions as is, delete removed positions from placements table
     // and add placement for new positions
     if (isset($args['positions'])) {
         // Get all existing block positions. We do not use the userapi function here because we need
         // an associative array for the next steps: key = pid (position id)
         $allblockspositions = DBUtil::selectObjectArray('block_positions', null, 'pid', -1, -1, 'pid', null);
         foreach ($allblockspositions as $positionid => $blockposition) {
             if (in_array($positionid, $args['positions'])) {
                 // position name is present in the array submitted from the user
                 $where = "WHERE pid = '" . DataUtil::formatForStore($positionid) . '\'';
                 $blocksinposition = DBUtil::selectObjectArray('block_placements', $where, 'sortorder', -1, -1, 'bid');
                 if (array_key_exists($item['bid'], $blocksinposition)) {
                     // block is already in this position, placement did not change, this means we do nothing
                 } else {
                     // add the block to the given position as last entry (max(sortorder) +1
                     $newplacement = array('pid' => $blockposition['pid'], 'bid' => $item['bid'], 'order' => count($blocksinpositions));
                     $res = DBUtil::insertObject($newplacement, 'block_placements', 'bid', true);
                     if (!$res) {
                         return LogUtil::registerError($this->__('Error! Could not perform the insertion.'));
                     }
                 }
             } else {
                 // position name is NOT present in the array submitted from the user
                 // delete the block id from the placements table for this position
                 $where = '(bid = \'' . DataUtil::formatForStore($item['bid']) . '\' AND pid = \'' . DataUtil::formatForStore($blockposition['pid']) . '\')';
                 $res = DBUtil::deleteWhere('block_placements', $where);
                 if (!$res) {
                     return LogUtil::registerError($this->__('Error! Could not save your changes.'));
                 }
             }
         }
     }
     return true;
 }
开发者ID:,项目名称:,代码行数:72,代码来源:

示例5: userOnline

 /**
  * @param int args[uid]     userid
  */
 public function userOnline($args)
 {
     $uid = $args['uid'];
     $tables = DBUtil::getTables();
     $columns = $tables['session_info_column'];
     $where = "{$columns['uid']} = '" . DataUtil::formatForStore($uid) . "'";
     return DBUtil::selectObject('session_info', $where);
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:11,代码来源:Selection.php

示例6: mediashare_adminapi_setTemplateGlobally

/**
 * Set plugins
 */
function mediashare_adminapi_setTemplateGlobally($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $new = array('template' => DataUtil::formatForStore($args['template']));
    if (!DBUtil::updateObject($new, 'mediashare_albums', '1=1', 'id')) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('adminapi.setTemplateGlobally', 'Could not set the template.'), $dom));
    }
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:12,代码来源:pnadminapi.php

示例7: hookAreaDelete

 /**
  * Listener for installer.subscriberarea.uninstalled
  *
  * @param Zikula_Event $event
  *
  * @return void
  */
 public static function hookAreaDelete(Zikula_Event $event)
 {
     $areaId = $event['areaid'];
     // Database information
     ModUtil::dbInfoLoad('EZComments');
     $tables = DBUtil::getTables();
     $columns = $tables['EZComments_column'];
     // Get items
     $where = "WHERE {$columns['areaid']} = '" . DataUtil::formatForStore($areaId) . "'";
     DBUtil::deleteWhere('EZComments', $where);
 }
开发者ID:rmaiwald,项目名称:EZComments,代码行数:18,代码来源:EventHandlers.php

示例8: genFilter

 function genFilter($filter = array())
 {
     $wheres = array();
     $filterFields = array('name', 'tag', 'value', 'page', 'uid', 'username', 'ip', 'impact', 'date');
     foreach ($filterFields as $fieldName) {
         if (isset($filter[$fieldName]) && $filter[$fieldName]) {
             $wheres[] = "ids_" . $fieldName . " = '" . \DataUtil::formatForStore($filter[$fieldName]) . "'";
         }
     }
     $where = implode(' AND ', $wheres);
     return $where;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:12,代码来源:IntrusionArray.php

示例9: EZComments_migrateapi_news

/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 * @since    0.2
 */
function EZComments_migrateapi_news()
{
    // Security check
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('News migration: Not Admin');
    }
    // Get datbase setup
    $tables = DBUtil::getTables();
    $EZCommentstable = $tables['EZComments'];
    $EZCommentscolumn = $tables['EZComments_column'];
    $Commentstable = $tables['comments'];
    $Commentscolumn = $tables['comments_column'];
    if (version_compare(PN_VERSION_NUM, '1', '>=')) {
        EZComments_get76xcolumns_news($Commentstable, $Commentscolumn);
    }
    if (is_null($Commentstable) || is_null($Commentscolumn)) {
        return LogUtil::registerError('News migration: Comments tables not found');
    }
    $Usertable = $tables['users'];
    $Usercolumn = $tables['users_column'];
    $sql = "SELECT {$Commentscolumn['tid']},\n                   {$Commentscolumn['sid']},\n                   {$Commentscolumn['date']}, \n                   {$Usercolumn['uid']},\n                   {$Commentscolumn['comment']},\n                   {$Commentscolumn['subject']},\n                   {$Commentscolumn['pid']}\n              FROM {$Commentstable}\n         LEFT JOIN {$Usertable}\n                ON {$Commentscolumn['name']} = {$Usercolumn['uname']}";
    $result = DBUtil::executeSQL($sql);
    if ($result == false) {
        return LogUtil::registerError('News migration: DB Error');
    }
    // array to rebuild the patents
    $comments = array(0 => array('newid' => -1));
    // loop through the old comments and insert them one by one into the DB
    $items = DBUtil::marshalObjects($result, array('tid', 'sid', 'date', 'uid', 'comment', 'subject', 'replyto'));
    foreach ($items as $item) {
        // set the correct user id for anonymous users
        if (empty($item['uid'])) {
            $item['uid'] = 1;
        }
        $id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'News', 'objectid' => DataUtil::formatForStore($item['sid']), 'url' => ModUtil::url('News', 'user', 'display', array('sid' => $item['sid'])), 'comment' => $item['comment'], 'subject' => $item['subject'], 'uid' => $item['uid'], 'date' => $item['date']));
        if (!$id) {
            return LogUtil::registerError('News migration: Error creating comment');
        }
        $comments[$item['tid']] = array('newid' => $id, 'pid' => $item['replyto']);
    }
    // rebuild the links to the parents
    $tids = array_keys($comments);
    foreach ($tids as $tid) {
        if ($tid != 0) {
            $v = $comments[$tid];
            $sql = "UPDATE {$EZCommentstable}\n                       SET {$EZCommentscolumn['replyto']} = '" . $comments[$v['pid']]['newid'] . "'\n                     WHERE {$EZCommentscolumn['id']} = '{$v['newid']}'";
            $result = DBUtil::executeSQL($sql);
        }
    }
    // activate the ezcomments hook for the news module
    ModUtil::apiFunc('Modules', 'admin', 'enablehooks', array('callermodname' => 'News', 'hookmodname' => 'EZComments'));
    return LogUtil::registerStatus('News migration successful');
}
开发者ID:rmaiwald,项目名称:EZComments,代码行数:61,代码来源:news.php

示例10: deletefavourite

 function deletefavourite()
 {
     $objectid = FormUtil::getPassedValue('objectid', null, 'POST');
     $userid = FormUtil::getPassedValue('userid', null, 'POST');
     if (!SecurityUtil::checkPermission('AddressBook::', "::", ACCESS_COMMENT)) {
         AjaxUtil::error($this->__('Error! No authorization to access this module.'));
     }
     $ztables = DBUtil::getTables();
     $fav_column = $ztables['addressbook_favourites_column'];
     $where = "{$fav_column['favadr_id']} = '" . DataUtil::formatForStore($objectid) . "' AND {$fav_column['favuser_id']} = '" . DataUtil::formatForStore($userid) . "'";
     DBUtil::deleteWhere('addressbook_favourites', $where);
     return;
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:13,代码来源:Ajax.php

示例11: smarty_block_muboardform

/**
 * Smarty function to wrap MUBoard_Form_View generated form controls with suitable form tags.
 *
 * @param array            $params  Parameters passed in the block tag.
 * @param string           $content Content of the block.
 * @param Zikula_Form_View $view    Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_block_muboardform($params, $content, $view)
{
    if ($content) {
        PageUtil::addVar('stylesheet', 'system/Theme/style/form/style.css');
        $encodingHtml = array_key_exists('enctype', $params) ? " enctype=\"{$params['enctype']}\"" : '';
        $action = htmlspecialchars(System::getCurrentUri());
        $classString = '';
        if (isset($params['cssClass'])) {
            $classString = "class=\"{$params['cssClass']}\" ";
        }
        $request = new Zikula_Request_Http();
        $id = $request->getGet()->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
        $forumid = $request->getGet()->filter('forum', 0, FILTER_SANITIZE_NUMBER_INT);
        // we check if the entrypoint is part of the url
        $stripentrypoint = ModUtil::getVar('ZConfig', 'shorturlsstripentrypoint');
        // get url name
        $tables = DBUtil::getTables();
        $modcolumn = $tables['modules_column'];
        $module = 'MUBoard';
        $where = "{$modcolumn['name']} = '" . DataUtil::formatForStore($module) . "'";
        $module = DBUtil::selectObject('modules', $where);
        $urlname = $module['url'];
        if (ModUtil::getVar('ZConfig', 'shorturls') == 0) {
            if (strpos($action, "func=display") !== false) {
                $action = 'index.php?module=' . $urlname . '&amp;type=user&amp;func=edit&amp;ot=posting&amp;answer=1';
            }
            if (strpos($action, "func=edit&ot=posting") !== false && $forumid > 0) {
                $action = 'index.php?module=' . $urlname . '&amp;type=user&amp;func=edit&amp;ot=posting&amp;forum' . $forumid;
            }
        } else {
            if (strpos($action, $urlname . "/posting/id.") !== false) {
                if ($stripentrypoint == 1) {
                    $action = $urlname . '/edit/ot/posting/answer/1';
                } elseif ($stripentrypoint == 0) {
                    $action = 'index.php/' . $urlname . '/edit/ot/posting/answer/1';
                }
            }
            if (strpos($action, "edit/ot/posting/forum/") !== false && $forumid > 0) {
                if ($stripentrypoint == 1) {
                    $action = $urlname . '/edit/ot/posting/forum/' . $forumid;
                } elseif ($stripentrypoint == 0) {
                    $action = 'index.php/' . $urlname . '/edit/ot/posting/forum/' . $forumid;
                }
            }
        }
        $view->postRender();
        $formId = $view->getFormId();
        $out = "\n        <form id=\"{$formId}\" {$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}>\n        {$content}\n        <div>\n        {$view->getStateHTML()}\n        {$view->getStateDataHTML()}\n        {$view->getIncludesHTML()}\n        {$view->getCsrfTokenHtml()}\n        <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n        <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n        <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n        <script type=\"text/javascript\">\n        <!--\n        function FormDoPostBack(eventTarget, eventArgument)\n        {\n        var f = document.getElementById('{$formId}');\n        if (!f.onsubmit || f.onsubmit())\n        {\n        f.FormEventTarget.value = eventTarget;\n        f.FormEventArgument.value = eventArgument;\n        f.submit();\n    }\n    }\n    // -->\n    </script>\n    </div>\n    </form>\n    ";
        return $out;
    }
}
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:60,代码来源:block.muboardform.php

示例12: search

    /**
     * Search plugin main function
     **/
    public function search($args)
    {
        ModUtil::dbInfoLoad('Search');
        $dbtables = DBUtil::getTables();

        $searchTable = $dbtables['search_result'];
        $searchColumn = $dbtables['search_result_column'];
        $pageTable = $dbtables['content_page'];
        $pageColumn = $dbtables['content_page_column'];
        $contentTable = $dbtables['content_content'];
        $contentColumn = $dbtables['content_content_column'];
        $contentSearchTable = $dbtables['content_searchable'];
        $contentSearchColumn = $dbtables['content_searchable_column'];

        $sessionId = session_id();

        $where = Search_Api_User::construct_where($args, 
				array($contentSearchColumn['text']), null);
        $wheretitle = Search_Api_User::construct_where($args, 
				array($pageColumn['title']), $pageColumn['language']);

		// Direct SQL way of searching in titles and searchable content items 
		// for Pages and Content items that are visible/active
		// Optimization and conversion into DBUtil calls should be done
        $sql = "INSERT INTO $searchTable
            ($searchColumn[title],
            $searchColumn[text],
            $searchColumn[module],
            $searchColumn[extra],
            $searchColumn[created],
            $searchColumn[session])
            SELECT DISTINCT $pageColumn[title],
            $contentSearchColumn[text],
            'Content',
            $pageColumn[id],
            $pageColumn[cr_date] AS createdDate,
            '" . DataUtil::formatForStore($sessionId) . "'
            FROM $pageTable
            JOIN $contentTable
            ON $contentColumn[pageId] = $pageColumn[id]
            JOIN $contentSearchTable
            ON $contentSearchColumn[contentId] = $contentColumn[id]
            WHERE ($where or $wheretitle) AND $pageColumn[active] = 1 AND ($pageColumn[activeFrom] IS NULL OR $pageColumn[activeFrom] <= NOW()) AND ($pageColumn[activeTo] IS NULL OR $pageColumn[activeTo] >= NOW()) AND $contentColumn[active] = 1 AND $contentColumn[visiblefor] " . (UserUtil::isLoggedIn() ? '<=1' : '>=1');

        $dbresult = DBUtil::executeSQL($sql);
        if (!$dbresult) {
            return LogUtil::registerError($this->__('Error! Could not load any Content pages or items.'));
        }
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:53,代码来源:Search.php

示例13: changeorder

 /**
  *
  * @param permorder array of sorted permissions (value = permission id)
  * @return mixed true or Ajax error
  */
 public function changeorder()
 {
     $this->checkAjaxToken();
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Permissions::', '::', ACCESS_ADMIN));
     $permorder = $this->request->getPost()->get('permorder');
     $dbtable = DBUtil::getTables();
     $permcolumn = $dbtable['group_perms_column'];
     for ($cnt = 0; $cnt < count($permorder); $cnt++) {
         $where = "WHERE {$permcolumn['pid']} = '" . (int) DataUtil::formatForStore($permorder[$cnt]) . "'";
         $obj = array('sequence' => $cnt);
         DBUtil::updateObject($obj, 'group_perms', $where, 'pid');
     }
     return new Zikula_Response_Ajax(array('result' => true));
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例14: _process_args

 /**
  * process user input and form a WHERE clause
  * @return string SQL where clause
  */
 private function _process_args(&$args)
 {
     // optional arguments.
     if (!isset($args['startnum']) || !is_numeric($args['startnum'])) {
         $args['startnum'] = -1;
     }
     if (!isset($args['numitems']) || !is_numeric($args['numitems'])) {
         $args['numitems'] = -1;
     }
     if (!isset($args['author'])) {
         $args['author'] = null;
     }
     if (!isset($args['keyword'])) {
         $args['keyword'] = null;
     }
     if (!isset($args['category'])) {
         $args['category'] = null;
     }
     if (!isset($args['catFilter']) || !is_numeric($args['catFilter'])) {
         $args['catFilter'] = array();
     }
     if (!isset($args['rootCat'])) {
         $args['rootCat'] = 0;
     }
     // build the where clause
     $wheres = array();
     if (isset($args['qid'])) {
         $wheres[] = "qid = " . DataUtil::formatForStore($args['qid']);
     }
     if ($args['author']) {
         $wheres[] = "author = '" . DataUtil::formatForStore($args['author']) . "'";
     }
     if (isset($args['status'])) {
         $wheres[] = "status = '" . DataUtil::formatForStore($args['status']) . "'";
     }
     if ($args['category']) {
         if (is_array($args['category'])) {
             $args['catFilter'] = $args['category'];
         } else {
             $args['catFilter'][] = $args['category'];
         }
         $args['catFilter']['__META__'] = array('module' => 'Quotes');
     }
     if ($args['keyword']) {
         $wheres[] = "quote LIKE '%" . DataUtil::formatForStore($args['keyword']) . "%'";
     }
     $args['where'] = implode(' AND ', $wheres);
     return $args['where'];
 }
开发者ID:nmpetkov,项目名称:Quotes,代码行数:53,代码来源:User.php

示例15: mediashare_sourcesapi_getSources

function mediashare_sourcesapi_getSources($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $pntable = pnDBGetTables();
    $sourcesTable = $pntable['mediashare_sources'];
    $sourcesColumn = $pntable['mediashare_sources_column'];
    $where = "";
    if ($args['active']) {
        $where = "WHERE {$sourcesColumn['active']} = '" . DataUtil::formatForStore($args['active']) . "'";
    }
    $result = DBUtil::selectObjectArray('mediashare_sources', $where);
    if ($result === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('sourcesapi.getSources', 'Could not retrieve the sources.'), $dom));
    }
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:16,代码来源:pnsourcesapi.php


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