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


PHP DatabaseConnection::sql_fetch_row方法代码示例

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


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

示例1: intval

 /**
  * Updates an already existing category record and stores it into the database.
  *
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2008-05-16
  * @return  void
  */
 function save_editCategory()
 {
     $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_forums', 'uid=' . intval($this->param['cid']));
     $ctg = $this->databaseHandle->sql_fetch_assoc($res);
     $updateArray = array('tstamp' => $GLOBALS['EXEC_TIME'], 'forum_name' => trim($this->param['ctg']['title']), 'grouprights_read' => $this->param['ctg']['authRead'], 'grouprights_write' => $this->param['ctg']['authWrite'], 'grouprights_mod' => $this->param['ctg']['authMod'], 'hidden' => $this->param['ctg']['hidden']);
     if (strlen($updateArray['forum_name']) == 0) {
         return array('title' => '<div class="mm_forum-fatalerror">' . $this->getLL('error.noTitle') . '</div>');
     }
     if ($this->param['ctg']['order'] == 'first') {
         $updateArray['sorting'] = 0;
         if ($ctg['sorting'] != 0) {
             $this->globalIncSorting(0, 1, $this->param['ctg']['parentID']);
         }
     } elseif ($this->param['ctg']['order'] == 'last') {
         $updateArray['sorting'] = $this->getMaxSorting() + 1;
     } else {
         if ($this->param['ctg']['order'] != $ctg['sorting']) {
             $this->globalIncSorting($this->param['ctg']['order'], 2, $this->param['ctg']['parentID']);
         }
         $updateArray['sorting'] = $this->param['ctg']['order'];
     }
     $this->databaseHandle->exec_UPDATEquery('tx_mmforum_forums', 'uid=' . intval($this->param['cid']), $updateArray);
     if ($updateArray['grouprights_read'] != $ctg['grouprights_read']) {
         $res = $this->databaseHandle->exec_SELECTquery('uid', 'tx_mmforum_forums', 'parentID=' . $ctg['uid']);
         while (list($fid) = $this->databaseHandle->sql_fetch_row($res)) {
             $this->delete_forumIndex($fid);
         }
     }
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:36,代码来源:class.tx_mmforum_forumadmin.php

示例2: getColumnNames

 /**
  * Get column names
  *
  * @since 1.0.0
  *
  * @param $table
  *
  * @return array
  */
 protected function getColumnNames($table)
 {
     $table = preg_replace('/[^a-z0-9_]/', '', $table);
     if (isset($this->tableColumnCache[$table])) {
         return $this->tableColumnCache[$table];
     } else {
         $result = $this->databaseConnection->exec_SELECTgetSingleRow('*', $table, '1 = 1');
         if ($result) {
             $columnNames = array_keys($result);
             $this->tableColumnCache[$table] = $columnNames;
         } else {
             $columnNames = array();
             $result = $this->databaseConnection->sql_query('SELECT DATABASE();');
             $row = $this->databaseConnection->sql_fetch_row($result);
             $databaseName = $row[0];
             $this->databaseConnection->sql_free_result($result);
             $result = $this->databaseConnection->sql_query("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" . $databaseName . "' AND TABLE_NAME = '" . $table . "';");
             while ($row = $this->databaseConnection->sql_fetch_row($result)) {
                 $columnNames[] = $row[0];
             }
             $this->databaseConnection->sql_free_result($result);
             $this->tableColumnCache[$table] = $columnNames;
         }
         return $columnNames;
     }
 }
开发者ID:mbrodala,项目名称:t3ext-yaml-configuration,代码行数:35,代码来源:AbstractCommandController.php

示例3: getForumUIDByTopic

 /**
  *
  * Retrievs a topic's forum UID.
  *
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2007-07-21
  * @param   int $topic_uid The topic's UID
  * @return  int            The forum's UID
  */
 function getForumUIDByTopic($topic_uid)
 {
     $topic_uid = intval($topic_uid);
     $res = $this->databaseHandle->exec_SELECTquery('forum_id', 'tx_mmforum_topics', 'uid=' . $topic_uid . ' AND deleted=0');
     if ($this->databaseHandle->sql_num_rows($res) > 0) {
         list($forum_uid) = $this->databaseHandle->sql_fetch_row($res);
         return $forum_uid;
     } else {
         return false;
     }
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:20,代码来源:class.tx_mmforum_postfactory.php

示例4: sqlFetchRowReturnsNumericArray

 /**
  * @test
  *
  * @return void
  */
 public function sqlFetchRowReturnsNumericArray()
 {
     $this->prepareTableForFetchTests();
     $res = $this->subject->admin_query("SELECT * FROM {$this->testTable} ORDER BY id");
     $expectedResult = [['1', null, null, 'Mr. Smith', '0', 'Oakland Road', 'Los Angeles', 'USA'], ['2', null, null, 'Ms. Smith', '0', 'Oakland Road', 'Los Angeles', 'USA'], ['3', null, null, 'Alice im Wunderland', '0', 'Große Straße', 'Königreich der Herzen', 'Wunderland'], ['4', null, null, 'Agent Smith', '1', 'Unbekannt', 'Unbekannt', 'Matrix']];
     $i = 0;
     while ($row = $this->subject->sql_fetch_row($res)) {
         $this->assertSame($expectedResult[$i], $row);
         $i++;
     }
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:16,代码来源:DatabaseConnectionTest.php

示例5: getFeedDescription

    /**
     * Gets the RSS feed's description
     *
     * @author  Martin Helmich <m.helmich@mittwald.de>
     * @version 2008-07-17
     * @return  string The RSS feed's description.
     */
    function getFeedDescription()
    {
        if ($this->piVars['tid']) {
            $res = $this->databaseHandle->exec_SELECTquery('topic_title', 'tx_mmforum_topics t
				 LEFT JOIN tx_mmforum_forums f ON f.uid = t.forum_id
				 LEFT JOIN tx_mmforum_forums c ON c.uid = f.parentID', 'uid=' . intval($this->piVars['tid']) . $this->pObj->getMayRead_forum_query('f') . $this->pObj->getMayRead_forum_query('c'));
        } elseif ($this->piVars['fid']) {
            $res = $this->databaseHandle->exec_SELECTquery('f.forum_name', 'tx_mmforum_forums f
				 LEFT JOIN tx_mmforum_forums c ON c.uid = f.parentID', 'f.uid=' . intval($this->piVars['fid']) . $this->pObj->getMayRead_forum_query('f') . $this->pObj->getMayRead_forum_query('c'));
        } else {
            return '';
        }
        list($result) = $this->databaseHandle->sql_fetch_row($res);
        return $result;
    }
开发者ID:rabe69,项目名称:mm_forum,代码行数:22,代码来源:class.tx_mmforum_rss.php

示例6: getUserGroupList

 /**
  * Determines the groups a user is in.
  *
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2007-06-06
  * @param   int   $user_id The UID of the user whose groups are to be
  *                         determined.
  * @return  array          An array containing all groups the user is a
  *                         member of.
  */
 function getUserGroupList($user_id)
 {
     if ($user_id == $GLOBALS['TSFE']->fe_user->user['uid']) {
         $groups = $GLOBALS['TSFE']->fe_user->user['usergroup'];
     } else {
         $res = $this->databaseHandle->exec_SELECTquery('usergroup', 'fe_users', 'uid=' . intval($user_id));
         if ($this->databaseHandle->sql_num_rows($res) == 0) {
             return 0;
         } else {
             list($groups) = $this->databaseHandle->sql_fetch_row($res);
         }
     }
     $aGroup = GeneralUtility::intExplode(',', $groups);
     $aGroup = tx_mmforum_tools::processArray_numeric($aGroup);
     return $aGroup;
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:26,代码来源:class.tx_mmforum_ranksfe.php

示例7: search

 /**
  * Search for users and returns usernames as result
  *
  * @param string $sword search string
  * @return array Array of usernames
  */
 public function search($sword)
 {
     $result = array();
     if (!$this->is_init) {
         $this->init();
     }
     if (!$this->validateName($this->field)) {
         return $result;
     }
     /** @see https://buzz.typo3.org/teams/security/article/correct-usage-of-typo3-database-api/ */
     $sword = '"' . $this->databaseHandle->escapeStrForLike($this->databaseHandle->quoteStr($sword, 'fe_users'), 'fe_users') . '%"';
     $res = $this->databaseHandle->exec_SELECTquery($this->field, 'fe_users', 'disable=0 AND deleted=0 AND ' . $this->field . ' LIKE ' . $sword . ' AND pid=' . $this->pid . ' AND FIND_IN_SET(' . $this->group_id . ', usergroup)', '', $this->field . ' ASC', '8');
     while (list($item) = $this->databaseHandle->sql_fetch_row($res)) {
         array_push($result, $item);
     }
     return $result;
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:23,代码来源:class.tx_mmforum_usersearch.php

示例8: wordAdd

 /**
  * Inserts a new word into the search index table and returns it's UID.
  * If the word already exists in the search index, just the UID is returned.
  * @param string $word The word to be inserted
  * @return int         The word's UID
  */
 function wordAdd($word)
 {
     // Attempt to load word from database
     $res = $this->databaseHandle->exec_SELECTquery('uid', 'tx_mmforum_wordlist', "word=" . $this->databaseHandle->fullQuoteStr($word, 'tx_mmforum_wordlist') . " " . $this->getPidQuery($this->conf));
     if (!$res) {
         echo $this->databaseHandle->sql_error() . '<hr>';
     }
     // If words already exists, just return the UID
     if ($this->databaseHandle->sql_num_rows($res) > 0) {
         list($uid) = $this->databaseHandle->sql_fetch_row($res);
     } else {
         // Compost insert query
         $insertArray = array('pid' => $this->getFirstPid($this->conf), 'word' => $word, 'metaphone' => metaphone($word));
         // Execute insert query
         $this->databaseHandle->exec_INSERTquery('tx_mmforum_wordlist', $insertArray);
         $uid = $this->databaseHandle->sql_insert_id();
     }
     return $uid;
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:25,代码来源:class.tx_mmforum_indexing.php

示例9: convertToTCEList

 /**
  *
  * Converts a commaseperated list of record UIDs to a TCEforms-readableformat.
  * This function converts a regular list of commaseperated record UIDs
  * (like e.g. "1,2,3") to a format that can be interpreted as form input
  * field default value by the t3lib_TCEforms class (like e.g.
  * "1|Username,2|Username_two,3|Username_three").
  *
  * @param   string $list The commaseperated list
  * @param   string $table The table the records' titles are to be
  *                            loaded from
  * @param   string $fieldname The fieldname used to identify the records,
  *                            like for example the username in the
  *                            fe_users table.
  *
  * @return string
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2007-04-23
  */
 function convertToTCEList($list, $table, $fieldname)
 {
     $items = GeneralUtility::trimExplode(',', $list);
     if (count($items) == 0) {
         return '';
     }
     $resultItems = array();
     foreach ($items as $item) {
         if ($item == '') {
             continue;
         }
         $res = $this->databaseHandle->exec_SELECTquery($fieldname, $table, 'uid="' . $item . '"');
         list($title) = $this->databaseHandle->sql_fetch_row($res);
         $resultItems[] = "{$item}|{$title}";
     }
     if (count($resultItems) == 0) {
         return '';
     }
     return implode(',', $resultItems);
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:39,代码来源:index.php

示例10: additionalStats

    /**
     * Displays additional statistics.
     *
     * @return  string The statistic table
     * @author  Martin Helmich <m.helmich@mittwald.de>
     * @version 2007-05-31
     */
    function additionalStats()
    {
        $startTime = $this->getStartTime();
        $span = $GLOBALS['EXEC_TIME'] - $startTime;
        $days = round($span / 86400);
        $res = $this->databaseHandle->exec_SELECTquery('COUNT(*)', 'tx_mmforum_posts', 'deleted=0');
        list($post_count) = $this->databaseHandle->sql_fetch_row($res);
        $post_average = round($post_count / $days, 4);
        $res = $this->databaseHandle->exec_SELECTquery('COUNT(*)', 'tx_mmforum_topics', 'deleted=0');
        list($topic_count) = $this->databaseHandle->sql_fetch_row($res);
        $topic_average = round($topic_count / $days, 4);
        $res = $this->databaseHandle->exec_SELECTquery('COUNT(*)', 'fe_users', 'deleted=0 AND crdate >= ' . $startTime);
        list($user_count) = $this->databaseHandle->sql_fetch_row($res);
        $user_average = round($user_count / $days, 4);
        $res = $this->databaseHandle->exec_SELECTquery('COUNT(*)', 'tx_mmforum_pminbox', 'deleted=0 AND sendtime > ' . $startTime);
        list($pm_count) = $this->databaseHandle->sql_fetch_row($res);
        $pm_count /= 2;
        $pm_average = round($pm_count / $days, 4);
        $content = '
	<table cellspacing="0" cellpadding="2">
		<tr>
			<td>' . $this->getLL('menu.table.posts') . ' (' . $this->getLL('additional.totavg') . ')</td>
			<td>' . $post_count . ' / ' . $post_average . '</td>
		</tr>
		<tr>
			<td>' . $this->getLL('menu.table.topics') . ' (' . $this->getLL('additional.totavg') . ')</td>
			<td>' . $topic_count . ' / ' . $topic_average . '</td>
		</tr>
		<tr>
			<td>' . $this->getLL('menu.table.users') . ' (' . $this->getLL('additional.totavg') . ')</td>
			<td>' . $user_count . ' / ' . $user_average . '</td>
		</tr>
		<tr>
			<td>' . $this->getLL('menu.table.pms') . ' (' . $this->getLL('additional.totavg') . ')</td>
			<td>' . $pm_count . ' / ' . $pm_average . '</td>
		</tr>
	</table>
';
        return $content;
    }
开发者ID:rabe69,项目名称:mm_forum,代码行数:47,代码来源:class.tx_mmforum_statistics.php

示例11: notifyForumSubscribers

    /**
     * Sends an e-mail to users who have subscribed to certain forumcategory
     * @param $topicId int The UID of the new topic that was created
     * @param $forumId int The UID of the forum about which the users are to be alerted.
     * @param \tx_mmforum_base $forumObj
     * @return void
     * @author Cyrill Helg
     */
    static function notifyForumSubscribers($topicId, $forumId, \tx_mmforum_base $forumObj)
    {
        $res = $this->databaseHandle->exec_SELECTquery('topic_title', 'tx_mmforum_topics', 'uid = ' . intval($topicId) . $forumObj->getStoragePIDQuery());
        list($topicName) = $this->databaseHandle->sql_fetch_row($res);
        $res = $this->databaseHandle->exec_SELECTquery('forum_name, parentID', 'tx_mmforum_forums', 'uid = ' . intval($forumId) . $forumObj->getStoragePIDQuery());
        list($forumName, $categoryId) = $this->databaseHandle->sql_fetch_row($res);
        // prepare the template (the variables that don't change all the time need only to be set once)
        $linkParams[$forumObj->prefixId] = array('action' => 'open_topic', 'id' => $topicId);
        $link = $forumObj->pi_getPageLink($GLOBALS['TSFE']->id, '', $linkParams);
        $link = $forumObj->tools->escapeBrackets($link);
        if (strlen($forumObj->conf['notifyingMail.']['topicLinkPrefix_override']) > 0) {
            $link = $forumObj->conf['notifyingMail.']['topicLinkPrefix_override'] . $link;
        }
        $template = $forumObj->pi_getLL('ntfMailForum.text');
        $marker = array('###LINK###' => $link, '###USERNAME###' => $toUsername, '###FORUMNAME###' => $forumName, '###TEAM###' => $forumObj->conf['teamName']);
        $subjectMarker = array('###TOPICNAME###' => $topicName, '###FORUMNAME###' => $forumName, '###BOARDNAME###' => $forumObj->conf['boardName']);
        // loop through each user who subscribed
        $res = $this->databaseHandle->exec_SELECTquery('DISTINCT tx_mmforum_forummail.user_id, fe_users.email, fe_users.' . $forumObj->getUserNameField(), 'tx_mmforum_forummail, fe_users', 'tx_mmforum_forummail.user_id = fe_users.uid AND
			 (tx_mmforum_forummail.forum_id = ' . intval($forumId) . ($categoryId > 0 ? ' OR tx_mmforum_forummail.forum_id = ' . $categoryId : '') . ') AND
			 fe_users.deleted = 0 AND
			 fe_users.disable = 0 AND
			 fe_users.email != "" AND
			 tx_mmforum_forummail.user_id != ' . intval($GLOBALS['TSFE']->fe_user->user['uid']) . $forumObj->getStoragePIDQuery('tx_mmforum_forummail'));
        while (list($toUserId, $toEmail, $toUsername) = $this->databaseHandle->sql_fetch_row($res)) {
            $marker['###USERNAME###'] = $forumObj->escape($toUsername);
            $mailtext = $forumObj->cObj->substituteMarkerArrayCached($template, $marker);
            // Compose mail and send
            $subject = $forumObj->cObj->substituteMarkerArray($forumObj->pi_getLL('ntfMailForum.subject'), $subjectMarker);
            $mail = GeneralUtility::makeInstance('t3lib_mail_Message');
            $mail->setFrom(array($forumObj->conf['notifyingMail.']['sender_address'] => $forumObj->conf['notifyingMail.']['sender']));
            $mail->setTo(array($toEmail => $toUsername));
            $mail->setSubject($subject);
            $mail->setBody($mailtext, 'text/plain');
            $mail->send();
        }
    }
开发者ID:rabe69,项目名称:mm_forum,代码行数:44,代码来源:class.tx_mmforum_havealook.php

示例12: displayArchiveMenu

 /**
  * generates the News archive menu
  *
  * @return	string		html code of the archive menu
  */
 function displayArchiveMenu()
 {
     if ($this->debugTimes) {
         $this->hObj->getParsetime(__METHOD__ . ' start');
     }
     $this->arcExclusive = 1;
     $selectConf = $this->getSelectConf('', 1);
     $selectConf['where'] .= $this->enableFields;
     // Finding maximum and minimum values:
     $row = $this->getArchiveMenuRange($selectConf);
     if ($row['minval'] || $row['maxval']) {
         // if ($row['minval']) {
         $dateArr = array();
         $arcMode = $this->config['archiveMode'];
         $c = 0;
         $theDate = 0;
         while ($theDate < $row['maxval']) {
             switch ($arcMode) {
                 case 'month':
                     $theDate = mktime(0, 0, 0, date('m', $row['minval']) + $c, 1, date('Y', $row['minval']));
                     break;
                 case 'quarter':
                     $theDate = mktime(0, 0, 0, floor(date('m', $row['minval']) / 3) + 1 + 3 * $c, 1, date('Y', $row['minval']));
                     break;
                 case 'year':
                     $theDate = mktime(0, 0, 0, 1, 1, date('Y', $row['minval']) + $c);
                     break;
             }
             $dateArr[] = $theDate;
             $c++;
             if ($c > 1000) {
                 break;
             }
         }
         if ($this->debugTimes) {
             $this->hObj->getParsetime(__METHOD__ . ' $dateArr');
         }
         //			$selectConf['where'] .= $this->enableFields;
         if ($selectConf['pidInList']) {
             $selectConf['where'] .= ' AND tt_news.pid IN (' . $selectConf['pidInList'] . ')';
         }
         $tmpWhere = $selectConf['where'];
         $cachedPeriodAccum = FALSE;
         $storeKey = FALSE;
         if ($this->cache_amenuPeriods) {
             $storeKey = md5(serialize(array($this->catExclusive, $this->config['catSelection'], $this->tsfe->sys_language_content, $selectConf['pidInList'], $arcMode)));
             //				$cachedPeriodAccum = $this->tsfe->sys_page->getHash($storeKey);
             $cachedPeriodAccum = $this->cache->get($storeKey);
         }
         if ($cachedPeriodAccum != '') {
             if ($this->writeCachingInfoToDevlog > 1) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('CACHE HIT (' . __CLASS__ . '::' . __FUNCTION__ . ')', 'tt_news', -1, array());
             }
             $periodAccum = unserialize($cachedPeriodAccum);
         } else {
             $periodAccum = array();
             foreach ($dateArr as $k => $v) {
                 $periodInfo = array();
                 $periodInfo['start'] = $v;
                 $periodInfo['active'] = $this->piVars['pS'] == $v ? 1 : 0;
                 $periodInfo['stop'] = $dateArr[$k + 1] - 1;
                 $periodInfo['HRstart'] = date('d-m-Y', $periodInfo['start']);
                 $periodInfo['HRstop'] = date('d-m-Y', $periodInfo['stop']);
                 $periodInfo['quarter'] = floor(date('m', $v) / 3) + 1;
                 $select_fields = 'COUNT(DISTINCT tt_news.uid)';
                 $from_table = 'tt_news';
                 $join = $selectConf['leftjoin'] ? ' LEFT JOIN ' . $selectConf['leftjoin'] : '';
                 $where_clause = $tmpWhere . ' AND tt_news.datetime>=' . $periodInfo['start'] . ' AND tt_news.datetime<' . $periodInfo['stop'];
                 $res = $this->db->exec_SELECTquery($select_fields, $from_table . $join, $where_clause);
                 $row = $this->db->sql_fetch_row($res);
                 $this->db->sql_free_result($res);
                 $periodInfo['count'] = $row[0];
                 if (!$this->conf['archiveMenuNoEmpty'] || $periodInfo['count']) {
                     $periodAccum[] = $periodInfo;
                 }
             }
             if ($this->cache_amenuPeriods && count($periodAccum)) {
                 if ($this->writeCachingInfoToDevlog) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('CACHE MISS (' . __CLASS__ . '::' . __FUNCTION__ . ')', 'tt_news', 2, array());
                 }
                 //					$this->tsfe->sys_page->storeHash($storeKey, serialize($periodAccum), 'news_amenuPeriodsCache');
                 $this->cache->set($storeKey, serialize($periodAccum), __FUNCTION__);
             }
         }
         if ($this->debugTimes) {
             $this->hObj->getParsetime(__METHOD__ . ' periodAccum');
         }
         // get template subpart
         $t['total'] = $this->getNewsSubpart($this->templateCode, $this->spMarker('###TEMPLATE_ARCHIVE###'));
         $t['item'] = $this->getLayouts($t['total'], $this->alternatingLayouts, 'MENUITEM');
         $renderMarkers = $this->getMarkers($t['total']);
         $this->renderMarkers = array_unique($renderMarkers);
         $tCount = count($t['item']);
         $cc = 0;
         $veryLocal_cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
//.........这里部分代码省略.........
开发者ID:mrmoree,项目名称:vkmh_typo3,代码行数:101,代码来源:class.tx_ttnews.php

示例13: versionizeRecord

 /**
  * Creates a new version of a record
  * (Requires support in the table)
  *
  * @param string $table Table name
  * @param int $id Record uid to versionize
  * @param string $label Version label
  * @param bool $delete If TRUE, the version is created to delete the record.
  * @return int|NULL Returns the id of the new version (if any)
  * @see copyRecord()
  */
 public function versionizeRecord($table, $id, $label, $delete = false)
 {
     $id = (int) $id;
     // Stop any actions if the record is marked to be deleted:
     // (this can occur if IRRE elements are versionized and child elements are removed)
     if ($this->isElementToBeDeleted($table, $id)) {
         return null;
     }
     if (!$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] || $id <= 0) {
         if ($this->enableLogging) {
             $this->newlog('Versioning is not supported for this table "' . $table . '" / ' . $id, 1);
         }
         return null;
     }
     if (!$this->doesRecordExist($table, $id, 'show')) {
         if ($this->enableLogging) {
             $this->newlog('You didn\'t have correct permissions to make a new version (copy) of this record "' . $table . '" / ' . $id, 1);
         }
         return null;
     }
     // Select main record:
     $row = $this->recordInfo($table, $id, 'pid,t3ver_id,t3ver_state');
     if (!is_array($row)) {
         if ($this->enableLogging) {
             $this->newlog('Record "' . $table . ':' . $id . '" you wanted to versionize did not exist!', 1);
         }
         return null;
     }
     // Record must be online record
     if ($row['pid'] < 0) {
         if ($this->enableLogging) {
             $this->newlog('Record "' . $table . ':' . $id . '" you wanted to versionize was already a version in archive (pid=-1)!', 1);
         }
         return null;
     }
     // Record must not be placeholder for moving.
     if (VersionState::cast($row['t3ver_state'])->equals(VersionState::MOVE_PLACEHOLDER)) {
         if ($this->enableLogging) {
             $this->newlog('Record cannot be versioned because it is a placeholder for a moving operation', 1);
         }
         return null;
     }
     if ($delete && $this->cannotDeleteRecord($table, $id)) {
         if ($this->enableLogging) {
             $this->newlog('Record cannot be deleted: ' . $this->cannotDeleteRecord($table, $id), 1);
         }
         return null;
     }
     // Look for next version number:
     $res = $this->databaseConnection->exec_SELECTquery('t3ver_id', $table, '((pid=-1 && t3ver_oid=' . $id . ') OR uid=' . $id . ')' . $this->deleteClause($table), '', 't3ver_id DESC', '1');
     list($highestVerNumber) = $this->databaseConnection->sql_fetch_row($res);
     $this->databaseConnection->sql_free_result($res);
     // Look for version number of the current:
     $subVer = $row['t3ver_id'] . '.' . ($highestVerNumber + 1);
     // Set up the values to override when making a raw-copy:
     $overrideArray = array('t3ver_id' => $highestVerNumber + 1, 't3ver_oid' => $id, 't3ver_label' => $label ?: $subVer . ' / ' . date('d-m-Y H:m:s'), 't3ver_wsid' => $this->BE_USER->workspace, 't3ver_state' => (string) ($delete ? new VersionState(VersionState::DELETE_PLACEHOLDER) : new VersionState(VersionState::DEFAULT_STATE)), 't3ver_count' => 0, 't3ver_stage' => 0, 't3ver_tstamp' => 0);
     if ($GLOBALS['TCA'][$table]['ctrl']['editlock']) {
         $overrideArray[$GLOBALS['TCA'][$table]['ctrl']['editlock']] = 0;
     }
     // Checking if the record already has a version in the current workspace of the backend user
     if ($this->BE_USER->workspace !== 0) {
         // Look for version already in workspace:
         $versionRecord = BackendUtility::getWorkspaceVersionOfRecord($this->BE_USER->workspace, $table, $id, 'uid');
     }
     // Create new version of the record and return the new uid
     if (empty($versionRecord['uid'])) {
         // Create raw-copy and return result:
         // The information of the label to be used for the workspace record
         // as well as the information whether the record shall be removed
         // must be forwarded (creating remove placeholders on a workspace are
         // done by copying the record and override several fields).
         $workspaceOptions = array('delete' => $delete, 'label' => $label);
         return $this->copyRecord_raw($table, $id, -1, $overrideArray, $workspaceOptions);
         // Reuse the existing record and return its uid
         // (prior to TYPO3 CMS 6.2, an error was thrown here, which
         // did not make much sense since the information is available)
     } else {
         return $versionRecord['uid'];
     }
     return null;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:92,代码来源:DataHandler.php

示例14: isSetForUser

 /**
  * Determines if there is a value set for this field for a specific user.
  *
  * @param  int  $userId The UID of the user that is to be checked.
  * @return bool         TRUE, if there is a value stored for this user, otherwise
  *                      false.
  *
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2009-02-16
  */
 function isSetForUser($userId)
 {
     $res = $this->databaseHandle->exec_SELECTquery('COUNT(*)', 'tx_mmforum_userfields_contents', 'user_id=' . intval($userId) . ' AND field_id=' . intval($this->getUID()) . ' AND deleted=0');
     list($count) = $this->databaseHandle->sql_fetch_row($res);
     return $count > 0;
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:16,代码来源:class.tx_mmforum_userfield.php

示例15: intval

 /**
  * Returns the board UID of a topic
  * @param  int $topicId The topic UID
  * @return int          The board UID
  **/
 function get_forum_id($topicId)
 {
     $res = $this->databaseHandle->exec_SELECTquery('forum_id', 'tx_mmforum_topics', 'uid = ' . intval($topicId) . $this->getStoragePIDQuery());
     list($forumId) = $this->databaseHandle->sql_fetch_row($res);
     return $forumId;
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:11,代码来源:class.tx_mmforum_base.php


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