本文整理汇总了PHP中Permission::hasAllAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::hasAllAccess方法的具体用法?PHP Permission::hasAllAccess怎么用?PHP Permission::hasAllAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission::hasAllAccess方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHomeTopNews
function getHomeTopNews($catId = 0)
{
global $_CORELANG, $objDatabase;
$catId = intval($catId);
$i = 0;
$this->_objTemplate->setTemplate($this->_pageContent, true, true);
if ($this->_objTemplate->blockExists('newsrow')) {
$this->_objTemplate->setCurrentBlock('newsrow');
} else {
return null;
}
$newsLimit = intval($this->arrSettings['news_top_limit']);
if ($newsLimit > 50) {
//limit to a maximum of 50 news
$newsLimit = 50;
}
if ($newsLimit < 1) {
//do not get any news if 0 was specified as the limit.
$objResult = false;
} else {
//fetch news
$objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . FRONTEND_LANG_ID . "\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY\n (SELECT COUNT(*) FROM " . DBPREFIX . "module_news_stats_view WHERE news_id=tblN.id AND time>'" . date_format(date_sub(date_create('now'), date_interval_create_from_date_string(intval($this->arrSettings['news_top_days']) . ' day')), 'Y-m-d H:i:s') . "') DESC", $newsLimit);
}
if ($objResult !== false && $objResult->RecordCount()) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['id'];
$newstitle = $objResult->fields['title'];
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher)));
if (!empty($image)) {
$this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage));
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->parse('news_image');
}
} else {
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTemplate->parseCurrentBlock();
$i++;
$objResult->MoveNext();
}
} else {
$this->_objTemplate->hideBlock('newsrow');
}
$this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']);
return $this->_objTemplate->get();
}
示例2: getHomeHeadlines
function getHomeHeadlines($catId = 0)
{
global $_CORELANG, $objDatabase, $_LANGID;
$i = 0;
$catId = intval($catId);
$this->_objTemplate->setTemplate($this->_pageContent, true, true);
$newsLimit = intval($this->arrSettings['news_headlines_limit']);
if ($newsLimit > 50) {
//limit to a maximum of 50 news
$newsLimit = 50;
}
if ($newsLimit < 1) {
//do not get any news if 0 was specified as the limit.
$objResult = false;
} else {
//fetch news
$objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.text NOT REGEXP '^(<br type=\"_moz\" />)?\$' AS newscontent,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . $_LANGID . "\n AND tblL.is_active=1\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY date DESC", $newsLimit);
}
if ($objResult !== false && $objResult->RecordCount() >= 0) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['id'];
$newstitle = $objResult->fields['title'];
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? empty($objResult->fields['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle), 'headlineLink');
$htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
// in case that the message is a stub, we shall just display the news title instead of a html-a-tag with no href target
if (empty($htmlLinkTitle)) {
$htmlLinkTitle = contrexx_raw2xhtml($newstitle);
}
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK_TITLE' => $htmlLinkTitle, 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'HEADLINE_ID' => $newsid, 'HEADLINE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'HEADLINE_TEXT' => nl2br($objResult->fields['teaser_text']), 'HEADLINE_LINK' => $htmlLinkTitle, 'HEADLINE_AUTHOR' => contrexx_raw2xhtml($author)));
if (!empty($image)) {
$this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage, 'HEADLINE_IMAGE_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_path']), 'HEADLINE_THUMBNAIL_PATH' => contrexx_raw2xhtml($imageSource)));
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->parse('news_image');
}
} else {
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTemplate->parse('headlines_row');
$i++;
$objResult->MoveNext();
}
} else {
$this->_objTemplate->hideBlock('headlines_row');
}
$this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']);
return $this->_objTemplate->get();
}
示例3: initializeTeasers
function initializeTeasers()
{
global $objDatabase, $_CORELANG;
$this->arrTeasers = array();
$this->getSettings();
$objResult = $objDatabase->Execute("\n SELECT tblN.id,\n tblN.date,\n tblN.userid,\n tblN.teaser_frames,\n tblN.redirect,\n tblN.teaser_show_link,\n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblL.title,\n tblL.text AS teaser_full_text,\n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n WHERE tblL.lang_id=" . FRONTEND_LANG_ID . ($this->administrate == false ? " AND tblN.validated='1'\n AND tblN.status='1'\n AND tblL.is_active=1\n AND (tblN.startdate<='" . date('Y-m-d H:i:s') . "' OR tblN.startdate='0000-00-00 00:00:00') AND (tblN.enddate>='" . date('Y-m-d H:i:s') . "' OR tblN.enddate='0000-00-00 00:00:00')" : "") . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (tblN.frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid = " . $objFWUser->objUser->getId() . ") " : " AND tblN.frontend_access_id=0 " : '') . "\n ORDER BY date DESC");
if ($objResult !== false) {
while (!$objResult->EOF) {
$arrFrames = explode(';', $objResult->fields['teaser_frames']);
foreach ($arrFrames as $frameId) {
if (!isset($this->arrFrameTeaserIds[$frameId])) {
$this->arrFrameTeaserIds[$frameId] = array();
}
array_push($this->arrFrameTeaserIds[$frameId], $objResult->fields['id']);
}
if (!empty($objResult->fields['redirect'])) {
$extUrl = substr($objResult->fields['redirect'], 7);
$tmp = explode('/', $extUrl);
$extUrl = "(" . $tmp[0] . ")";
} else {
$extUrl = "";
}
if ($this->administrate == false) {
$objFWUser = \FWUser::getFWUserObject();
$objUser = $objFWUser->objUser->getUser($objResult->fields['userid']);
if ($objUser) {
$firstname = $objUser->getProfileAttribute('firstname');
$lastname = $objUser->getProfileAttribute('lastname');
if (!empty($firstname) && !empty($lastname)) {
$author = contrexx_raw2xhtml($firstname . ' ' . $lastname);
} else {
$author = contrexx_raw2xhtml($objUser->getUsername());
}
} else {
$author = $_CORELANG['TXT_ANONYMOUS'];
}
} else {
$author = '';
}
if (!empty($objResult->fields['teaser_image_thumbnail_path'])) {
$image = $objResult->fields['teaser_image_thumbnail_path'];
} elseif (!empty($objResult->fields['teaser_image_path']) && file_exists(ASCMS_PATH . \ImageManager::getThumbnailFilename($objResult->fields['teaser_image_path']))) {
$image = \ImageManager::getThumbnailFilename($objResult->fields['teaser_image_path']);
} elseif (!empty($objResult->fields['teaser_image_path'])) {
$image = $objResult->fields['teaser_image_path'];
} else {
$image = ASCMS_CORE_MODULE_WEB_PATH . '/News/View/Media/pixel.gif';
}
$newsCategories = $this->getCategoriesByNewsId($objResult->fields['id']);
$this->arrTeasers[$objResult->fields['id']] = array('id' => $objResult->fields['id'], 'date' => $objResult->fields['date'], 'title' => $objResult->fields['title'], 'teaser_frames' => $objResult->fields['teaser_frames'], 'redirect' => $objResult->fields['redirect'], 'ext_url' => $extUrl, 'category' => implode(', ', contrexx_raw2xhtml($newsCategories)), 'category_id' => array_keys($newsCategories), 'teaser_full_text' => $objResult->fields['teaser_full_text'], 'teaser_text' => $objResult->fields['teaser_text'], 'teaser_show_link' => $objResult->fields['teaser_show_link'], 'author' => $author, 'teaser_image_path' => $image);
$objResult->MoveNext();
}
}
}
示例4: getTopNews
/**
* Gets the list with the top news
*
* @global array
* @global ADONewConnection
* @global array
* @return string parsed content
*/
private function getTopNews()
{
global $_CONFIG, $objDatabase, $_ARRAYLANG;
$newsfilter = '';
$paging = '';
$pos = 0;
$i = 0;
if (isset($_GET['pos'])) {
$pos = intval($_GET['pos']);
}
$this->_objTpl->setVariable(array('TXT_DATE' => $_ARRAYLANG['TXT_DATE'], 'TXT_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_NEWS_MESSAGE' => $_ARRAYLANG['TXT_NEWS_MESSAGE']));
$query = ' SELECT n.id AS newsid,
n.userid AS newsuid,
n.date AS newsdate,
n.teaser_image_path,
n.teaser_image_thumbnail_path,
n.redirect,
n.publisher,
n.publisher_id,
n.author,
n.author_id,
nl.title AS newstitle,
nl.text NOT REGEXP \'^(<br type="_moz" />)?$\' AS newscontent,
nl.teaser_text
FROM ' . DBPREFIX . 'module_news AS n
INNER JOIN ' . DBPREFIX . 'module_news_locale AS nl ON nl.news_id = n.id
WHERE status = 1
AND nl.is_active=1
AND nl.lang_id=' . FRONTEND_LANG_ID . '
AND (n.startdate<=\'' . date('Y-m-d H:i:s') . '\' OR n.startdate="0000-00-00 00:00:00")
AND (n.enddate>=\'' . date('Y-m-d H:i:s') . '\' OR n.enddate="0000-00-00 00:00:00")
' . $newsfilter . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid = " . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . 'ORDER BY (SELECT COUNT(*) FROM ' . DBPREFIX . 'module_news_stats_view WHERE news_id=n.id AND time>"' . date_format(date_sub(date_create('now'), date_interval_create_from_date_string(intval($this->arrSettings['news_top_days']) . ' day')), 'Y-m-d H:i:s') . '") DESC';
/***start paging ****/
$objResult = $objDatabase->Execute($query);
$count = $objResult->RecordCount();
if ($count > intval($_CONFIG['corePagingLimit'])) {
$paging = getPaging($count, $pos, '§ion=News&cmd=topnews', $_ARRAYLANG['TXT_NEWS_MESSAGES'], true);
}
$this->_objTpl->setVariable('NEWS_PAGING', $paging);
$objResult = $objDatabase->SelectLimit($query, $_CONFIG['corePagingLimit'], $pos);
/*** end paging ***/
if ($count >= 1) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['newsid'];
$newstitle = $objResult->fields['newstitle'];
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? empty($objResult->fields['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', array_keys($newsCategories)), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml('[' . $_ARRAYLANG['TXT_NEWS_MORE'] . '...]'));
$htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
// in case that the message is a stub, we shall just display the news title instead of a html-a-tag with no href target
if (empty($htmlLinkTitle)) {
$htmlLinkTitle = contrexx_raw2xhtml($newstitle);
}
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$this->_objTpl->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['newsdate']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['newsdate']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['newsdate']), 'NEWS_LINK_TITLE' => $htmlLinkTitle, 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_CATEGORY' => implode(', ', contrexx_raw2xhtml($newsCategories)), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author)));
if (!empty($image)) {
$this->_objTpl->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage));
if ($this->_objTpl->blockExists('news_image')) {
$this->_objTpl->parse('news_image');
}
} else {
if ($this->_objTpl->blockExists('news_image')) {
$this->_objTpl->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTpl, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTpl, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTpl->parse('newsrow');
$i++;
$objResult->MoveNext();
}
if ($this->_objTpl->blockExists('news_list')) {
$this->_objTpl->parse('news_list');
}
if ($this->_objTpl->blockExists('news_menu')) {
$this->_objTpl->parse('news_menu');
}
if ($this->_objTpl->blockExists('news_status_message')) {
$this->_objTpl->hideBlock('news_status_message');
}
} else {
$this->_objTpl->setVariable('TXT_NEWS_NO_NEWS_FOUND', $_ARRAYLANG['TXT_NEWS_NO_NEWS_FOUND']);
if ($this->_objTpl->blockExists('news_status_message')) {
$this->_objTpl->parse('news_status_message');
}
if ($this->_objTpl->blockExists('news_menu')) {
$this->_objTpl->parse('news_menu');
}
if ($this->_objTpl->blockExists('news_list')) {
$this->_objTpl->hideBlock('news_list');
//.........这里部分代码省略.........
示例5: _checkAuth
/**
* check for permission
*
* @param integer $intCatId
* @param string|array $mixedMode
* @return bool hasAccess
*/
function _checkAuth($intCatId, $mixedMode = 'read')
{
if (\Permission::hasAllAccess()) {
return true;
}
$arrAccess = $this->createAccessArray($intCatId);
if (is_array($mixedMode)) {
foreach ($mixedMode as $mode) {
if ($this->_checkGroupAccess($arrAccess, $mode)) {
return true;
}
}
} elseif (is_string($mixedMode)) {
return $this->_checkGroupAccess($arrAccess, $mixedMode);
}
return false;
}
示例6: getNewsFilterQuery
/**
* Get News Filter Condition Query
*
* @param string $tableAlias
* @param array $filters
* @param string $filterCategory category filter
*
* @return string sql query
*/
public function getNewsFilterQuery($tableAlias, $filters, $filterCategory)
{
$filterCondition = " AND {$tableAlias}.status = 1\n AND nl.is_active=1\n AND nl.lang_id=" . FRONTEND_LANG_ID . "\n AND ({$tableAlias}.startdate<='" . date('Y-m-d H:i:s') . "' OR {$tableAlias}.startdate=\"0000-00-00 00:00:00\")\n AND ({$tableAlias}.enddate>='" . date('Y-m-d H:i:s') . "' OR {$tableAlias}.enddate=\"0000-00-00 00:00:00\")" . ($this->arrSettings['news_message_protection'] == '1' && !Permission::hasAllAccess() ? ($objFWUser = FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid = " . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '');
if (!empty($filters)) {
$additionalFilter = '';
foreach ($filters as $field => $values) {
$additionalFilter .= ' AND (`' . $tableAlias . '`.`' . $field . '` IN (' . implode(',', contrexx_input2int($values)) . '))';
}
$filterCondition .= $additionalFilter;
}
if (!empty($filterCategory)) {
$filterCondition .= $filterCategory;
}
return $filterCondition;
}
示例7: parseDownloads
private function parseDownloads($objCategory)
{
global $_CONFIG, $_ARRAYLANG;
if (!$this->objTemplate->blockExists('downloads_file_list')) {
return;
}
$limitOffset = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
$includeDownloadsOfSubcategories = false;
// set downloads filter
$filter = array('expiration' => array('=' => 0, '>' => time()));
if ($objCategory->getId()) {
$filter['category_id'] = $objCategory->getId();
if (!empty($this->searchKeyword)) {
$includeDownloadsOfSubcategories = true;
}
}
$objDownload = new Download();
$sortOrder = $this->downloadsSortingOptions[$this->arrConfig['downloads_sorting_order']];
$objDownload->loadDownloads($filter, $this->searchKeyword, $sortOrder, null, $_CONFIG['corePagingLimit'], $limitOffset, $includeDownloadsOfSubcategories);
$categoryId = $objCategory->getId();
$allowdDeleteFiles = false;
if (!$objCategory->EOF) {
$allowdDeleteFiles = !$objCategory->getManageFilesAccessId() || \Permission::checkAccess($objCategory->getManageFilesAccessId(), 'dynamic', true) || $this->userId && $objCategory->getOwnerId() == $this->userId;
} elseif (\Permission::hasAllAccess()) {
$allowdDeleteFiles = true;
}
if ($objDownload->EOF) {
$this->objTemplate->hideBlock('downloads_file_list');
} else {
$row = 1;
while (!$objDownload->EOF) {
// select category
if ($objCategory->EOF) {
$arrAssociatedCategories = $objDownload->getAssociatedCategoryIds();
$categoryId = $arrAssociatedCategories[0];
}
// parse download info
$this->parseDownloadAttributes($objDownload, $categoryId, $allowdDeleteFiles);
$this->objTemplate->setVariable('DOWNLOADS_FILE_ROW_CLASS', 'row' . ($row++ % 2 + 1));
$this->objTemplate->parse('downloads_file');
$objDownload->next();
}
$downloadCount = $objDownload->getFilteredSearchDownloadCount();
if ($downloadCount > $_CONFIG['corePagingLimit']) {
if (\Env::get('cx')->getPage()->getModule() != 'Downloads') {
$this->objTemplate->setVariable('DOWNLOADS_FILE_PAGING', getPaging($downloadCount, $limitOffset, '', "<b>" . $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADS'] . "</b>"));
} else {
$this->objTemplate->setVariable('DOWNLOADS_FILE_PAGING', getPaging($downloadCount, $limitOffset, '&' . substr($this->moduleParamsHtml, 1) . '&category=' . $objCategory->getId() . '&downloads_search_keyword=' . htmlspecialchars($this->searchKeyword), "<b>" . $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADS'] . "</b>"));
}
}
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_FILES' => $_ARRAYLANG['TXT_DOWNLOADS_FILES'], 'TXT_DOWNLOADS_DOWNLOAD' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOAD'], 'TXT_DOWNLOADS_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADS']));
$this->objTemplate->parse('downloads_file_list');
}
}
示例8: showSettings
/**
* Set the cms system settings
* @global ADONewConnection
* @global array Core language
* @global \Cx\Core\Html\Sigma
*/
function showSettings()
{
global $objTemplate, $_ARRAYLANG;
$template = new \Cx\Core\Html\Sigma();
$objTemplate->addBlockfile('ADMIN_CONTENT', 'settings_system', 'settings.html');
$templateObj = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/Config/View/Template/Backend');
$templateObj->loadTemplateFile('development_tools.html');
$templateObj->setVariable(array('TXT_TITLE_SET5' => $_ARRAYLANG['TXT_SETTINGS_TITLE_DEVELOPMENT'], 'TXT_DEBUGGING_STATUS' => $_ARRAYLANG['TXT_DEBUGGING_STATUS'], 'TXT_DEBUGGING_FLAGS' => $_ARRAYLANG['TXT_DEBUGGING_FLAGS'], 'TXT_SETTINGS_DEBUGGING_FLAG_LOG' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_LOG'], 'TXT_SETTINGS_DEBUGGING_FLAG_PHP' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_PHP'], 'TXT_SETTINGS_DEBUGGING_FLAG_DB' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_DB'], 'TXT_SETTINGS_DEBUGGING_FLAG_DB_TRACE' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_DB_TRACE'], 'TXT_SETTINGS_DEBUGGING_FLAG_DB_CHANGE' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_DB_CHANGE'], 'TXT_SETTINGS_DEBUGGING_FLAG_DB_ERROR' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_DB_ERROR'], 'TXT_SETTINGS_DEBUGGING_FLAG_LOG_FILE' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_LOG_FILE'], 'TXT_SETTINGS_DEBUGGING_FLAG_LOG_FIREPHP' => $_ARRAYLANG['TXT_SETTINGS_DEBUGGING_FLAG_LOG_FIREPHP'], 'TXT_DEBUGGING_EXPLANATION' => $_ARRAYLANG['TXT_DEBUGGING_EXPLANATION'], 'TXT_SAVE_CHANGES' => $_ARRAYLANG['TXT_SAVE'], 'TXT_RADIO_ON' => $_ARRAYLANG['TXT_ACTIVATED'], 'TXT_RADIO_OFF' => $_ARRAYLANG['TXT_DEACTIVATED']));
if (in_array('SystemInfo', \Env::get('cx')->getLicense()->getLegalComponentsList())) {
if (isset($_POST['debugging'])) {
$this->updateDebugSettings($_POST['debugging']);
}
$this->setDebuggingVariables($templateObj);
}
\Cx\Core\Setting\Controller\Setting::init('Config', null, 'Yaml', null, \Cx\Core\Setting\Controller\Setting::REPOPULATE);
\Cx\Core\Setting\Controller\Setting::storeFromPost();
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'site');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', $_ARRAYLANG['TXT_CORE_CONFIG_SITE'], $_ARRAYLANG['TXT_CORE_CONFIG_SITE'], 'TXT_CORE_CONFIG_', !$this->isWritable());
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'contactInformation');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', $_ARRAYLANG['TXT_CORE_CONFIG_CONTACTINFORMATION'], $_ARRAYLANG['TXT_CORE_CONFIG_CONTACTINFORMATION'], 'TXT_CORE_CONFIG_', !$this->isWritable());
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'administrationArea');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', $_ARRAYLANG['TXT_CORE_CONFIG_ADMINISTRATIONAREA'], $_ARRAYLANG['TXT_CORE_CONFIG_ADMINISTRATIONAREA'], 'TXT_CORE_CONFIG_', !$this->isWritable());
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'security');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', $_ARRAYLANG['TXT_CORE_CONFIG_SECURITY'], $_ARRAYLANG['TXT_CORE_CONFIG_SECURITY'], 'TXT_CORE_CONFIG_', !$this->isWritable());
if (in_array('SystemInfo', \Env::get('cx')->getLicense()->getLegalComponentsList())) {
\Cx\Core\Setting\Controller\Setting::show_external($template, $_ARRAYLANG['TXT_SETTINGS_TITLE_DEVELOPMENT'], $templateObj->get());
}
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'otherConfigurations');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', $_ARRAYLANG['TXT_CORE_CONFIG_OTHERCONFIGURATIONS'], $_ARRAYLANG['TXT_CORE_CONFIG_OTHERCONFIGURATIONS'], 'TXT_CORE_CONFIG_', !$this->isWritable());
// show also hidden settins
if (in_array('SystemInfo', \Env::get('cx')->getLicense()->getLegalComponentsList()) && \Permission::hasAllAccess() && isset($_GET['all'])) {
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'core');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', 'CORE', 'CORE', 'TXT_CORE_CONFIG_', true);
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'release');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', 'RELEASE', 'RELEASE', 'TXT_CORE_CONFIG_', true);
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'component');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', 'COMPONENT', 'COMPONENT', 'TXT_CORE_CONFIG_', !$this->isWritable());
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'license');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', 'LICENSE', 'LICENSE', 'TXT_CORE_CONFIG_', true);
\Cx\Core\Setting\Controller\Setting::setEngineType('Config', 'Yaml', 'cache');
\Cx\Core\Setting\Controller\Setting::show($template, 'index.php?cmd=Config', 'CACHE', 'CACHE', 'TXT_CORE_CONFIG_', true);
}
$this->checkFtpAccess();
$objTemplate->setVariable('SETTINGS_TABLE', $template->get());
$objTemplate->parse('settings_system');
}
示例9: delEntry
function delEntry()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG;
$this->_objTpl->setTemplate($this->pageContent, true, true);
if (!$this->settings['editEntry'] == '1' || !$this->communityModul && $this->settings['addEntry_only_community'] == '1') {
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_POST['id']);
exit;
} elseif ($this->settings['addEntry_only_community'] == '1') {
$objFWUser = \FWUser::getFWUserObject();
if ($objFWUser->objUser->login()) {
if (!\Permission::checkAccess(101, 'static', true)) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&cmd=noaccess");
exit;
}
} else {
$link = base64_encode(CONTREXX_DIRECTORY_INDEX . '?' . $_SERVER['QUERY_STRING']);
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&redirect=" . $link);
exit;
}
} else {
$objFWUser = \FWUser::getFWUserObject();
}
//get search
$this->getSearch();
if (isset($_GET['id'])) {
$entryId = contrexx_addslashes($_GET['id']);
$objResult = $objDatabase->Execute('SELECT id, userid, catid FROM ' . DBPREFIX . 'module_market WHERE id = ' . $entryId . ' LIMIT 1');
if ($objResult !== false) {
while (!$objResult->EOF) {
if ($objFWUser->objUser->login() && $objFWUser->objUser->getId() == $objResult->fields['userid'] || \Permission::hasAllAccess()) {
$this->_objTpl->setVariable(array('MARKET_ENTRY_ID' => $entryId, 'TXT_MARKET_DEL' => $_ARRAYLANG['TXT_MARKET_DELETE_ADVERTISEMENT'], 'TXT_MARKET_ABORT' => $_CORELANG['TXT_CANCEL'], 'TXT_MARKET_CONFIRM_DEL' => $_ARRAYLANG['TXT_MARKET_ADVERTISEMENT_DELETE']));
//get navigatin
$this->getNavigation($objResult->fields['catid']);
$objResult->MoveNext();
} else {
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_GET['id']);
exit;
}
}
}
} else {
if (isset($_POST['submitEntry'])) {
$arrDelete = array();
$arrDelete[0] = $_POST['id'];
$this->removeEntry($arrDelete);
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market');
exit;
} else {
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market');
exit;
}
}
}
示例10: update
/**
* Update news
*
* @global ADONewConnection
* @global array
* @global array
* @param integer $newsid
* @return boolean result
*/
function update()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
if (!$this->hasCategories()) {
return $this->manageCategories();
}
if (isset($_POST['newsId'])) {
$objFWUser = \FWUser::getFWUserObject();
$id = intval($_POST['newsId']);
$userId = $objFWUser->objUser->getId();
$changelog = mktime();
$date = $this->dateFromInput($_POST['newsDate']);
$redirect = !empty($_POST['newsRedirect']) && $_POST['newsTypeRadio'] == 'redirect' ? contrexx_strip_tags($_POST['newsRedirect']) : '';
$source = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsSource']));
$url1 = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsUrl1']));
$url2 = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsUrl2']));
$newsPublisherName = !empty($_POST['newsPublisherName']) ? contrexx_input2raw($_POST['newsPublisherName']) : '';
$newsAuthorName = !empty($_POST['newsAuthorName']) ? contrexx_input2raw($_POST['newsAuthorName']) : '';
$newsPublisherId = !empty($_POST['newsPublisherId']) ? contrexx_input2raw($_POST['newsPublisherId']) : '0';
$newsAuthorId = !empty($_POST['newsAuthorId']) ? contrexx_input2raw($_POST['newsAuthorId']) : '0';
$newsCategories = !empty($_POST['newsCat']) ? contrexx_input2raw($_POST['newsCat']) : array();
$typeId = !empty($_POST['newsType']) ? intval($_POST['newsType']) : 0;
$newsScheduledActive = !empty($_POST['newsScheduled']) ? intval($_POST['newsScheduled']) : 0;
$status = empty($_POST['status']) ? $status = 0 : intval($_POST['status']);
$newsTeaserOnly = isset($_POST['newsUseOnlyTeaser']) ? intval($_POST['newsUseOnlyTeaser']) : 0;
$newsTeaserShowLink = isset($_POST['newsTeaserShowLink']) ? intval($_POST['newsTeaserShowLink']) : 0;
$newsTeaserImagePath = contrexx_addslashes($_POST['newsTeaserImagePath']);
$newsTeaserImageThumbnailPath = contrexx_addslashes($_POST['newsTeaserImageThumbnailPath']);
$newsTeaserFrames = '';
$newsComments = !empty($_POST['allowComment']) ? intval($_POST['allowComment']) : 0;
if (isset($_POST['newsTeaserFramesAsso']) && count($_POST['newsTeaserFramesAsso']) > 0) {
foreach ($_POST['newsTeaserFramesAsso'] as $frameId) {
intval($frameId) > 0 ? $newsTeaserFrames .= ';' . intval($frameId) : false;
}
}
$startDate = $this->dateFromInput($_POST['startDate']);
$endDate = $this->dateFromInput($_POST['endDate']);
$newsFrontendAccess = !empty($_POST['news_read_access']);
$newsFrontendGroups = $newsFrontendAccess && isset($_POST['news_read_access_associated_groups']) && is_array($_POST['news_read_access_associated_groups']) ? array_map('intval', $_POST['news_read_access_associated_groups']) : array();
$newsBackendAccess = !empty($_POST['news_modify_access']);
$newsBackendGroups = $newsBackendAccess && isset($_POST['news_modify_access_associated_groups']) && is_array($_POST['news_modify_access_associated_groups']) ? array_map('intval', $_POST['news_modify_access_associated_groups']) : array();
$objResult = $objDatabase->SelectLimit('SELECT `frontend_access_id`, `backend_access_id`, `userid` FROM `' . DBPREFIX . 'module_news` WHERE `id` = ' . $id, 1);
if ($objResult && $objResult->RecordCount() == 1) {
$newsFrontendAccessId = $objResult->fields['frontend_access_id'];
$newsBackendAccessId = $objResult->fields['backend_access_id'];
$newsUserId = $objResult->fields['userid'];
} else {
$newsFrontendAccessId = 0;
$newsBackendAccessId = 0;
$newsUserId = 0;
}
if ($this->arrSettings['news_message_protection'] == '1') {
if ($newsBackendAccessId && !\Permission::hasAllAccess() && !\Permission::checkAccess($newsBackendAccessId, 'dynamic', true) && $newsUserId != $objFWUser->objUser->getId()) {
return false;
}
if ($newsFrontendAccess) {
if ($newsFrontendAccessId) {
$objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $newsFrontendAccessId));
$arrFormerFrontendGroupIds = $objGroup ? $objGroup->getLoadedGroupIds() : array();
$arrNewGroups = array_diff($newsFrontendGroups, $arrFormerFrontendGroupIds);
$arrRemovedGroups = array_diff($arrFormerFrontendGroupIds, $newsFrontendGroups);
if ($this->arrSettings['news_message_protection_restricted'] == '1' && !\Permission::hasAllAccess()) {
$arrUserGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
$arrUnknownNewGroups = array_diff($arrNewGroups, $arrUserGroupIds);
foreach ($arrUnknownNewGroups as $groupId) {
if (!in_array($groupId, $arrFormerFrontendGroupIds)) {
unset($arrNewGroups[array_search($groupId, $arrNewGroups)]);
}
}
$arrUnknownRemovedGroups = array_diff($arrRemovedGroups, $arrUserGroupIds);
foreach ($arrUnknownRemovedGroups as $groupId) {
if (in_array($groupId, $arrFormerFrontendGroupIds)) {
unset($arrRemovedGroups[array_search($groupId, $arrRemovedGroups)]);
}
}
}
if (count($arrRemovedGroups)) {
\Permission::removeAccess($newsFrontendAccessId, 'dynamic', $arrRemovedGroups);
}
if (count($arrNewGroups)) {
\Permission::setAccess($newsFrontendAccessId, 'dynamic', $arrNewGroups);
}
} else {
if ($this->arrSettings['news_message_protection_restricted'] == '1' && !\Permission::hasAllAccess()) {
$arrUserGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
$newsFrontendGroups = array_intersect($newsFrontendGroups, $arrUserGroupIds);
}
$newsFrontendAccessId = \Permission::createNewDynamicAccessId();
if (count($newsFrontendGroups)) {
\Permission::setAccess($newsFrontendAccessId, 'dynamic', $newsFrontendGroups);
}
//.........这里部分代码省略.........
示例11: _configDeleteMail
function _configDeleteMail()
{
global $_ARRAYLANG;
// only administrators are allowed to modify the config
if (!\Permission::hasAllAccess()) {
\Permission::noAccess();
}
if (empty($_REQUEST['type'])) {
return;
}
$objFWUser = \FWUser::getFWUserObject();
$objUserMail = $objFWUser->getMail();
if (!$objUserMail->load(contrexx_addslashes($_REQUEST['type']), !empty($_REQUEST['access_mail_lang']) ? intval($_REQUEST['access_mail_lang']) : null)) {
return;
}
// TODO: Do you really need to reinitialize that?
$objFWUser = \FWUser::getFWUserObject();
if ($objUserMail->delete()) {
self::$arrStatusMsg['ok'][] = $_ARRAYLANG['TXT_ACCESS_EMAIL_DEL_SUCCESS'];
} else {
self::$arrStatusMsg['error'] = array_merge(self::$arrStatusMsg['error'], $objUserMail->getErrorMsg());
}
}
示例12: showMaintenance
/**
* Shows the database-maintenance page.
*
* @global \Cx\Core\Html\Sigma
* @global ADONewConnection
* @global array
*/
function showMaintenance()
{
global $objTemplate, $objDatabase, $_ARRAYLANG;
$this->_strPageTitle = $_ARRAYLANG['TXT_DBM_MAINTENANCE_TITLE'];
$objTemplate->addBlockfile('ADMIN_CONTENT', 'maintenance', 'dbm_maintenance.html');
$objTemplate->setVariable(array('TXT_MAINTENANCE_OPTIMIZE_TITLE' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_OPTIMIZE_DB'], 'TXT_MAINTENANCE_OPTIMIZE_BUTTON' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_OPTIMIZE_START'], 'TXT_MAINTENANCE_OPTIMIZE_DESC' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_OPTIMIZE_DESC'], 'TXT_MAINTENANCE_REPAIR_TITLE' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_REPAIR_DB'], 'TXT_MAINTENANCE_REPAIR_BUTTON' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_REPAIR_START'], 'TXT_MAINTENANCE_REPAIR_DESC' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_REPAIR_DESC'], 'TXT_MAINTENANCE_TITLE_TABLES' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_TABLES'], 'TXT_MAINTENANCE_TABLES_NAME' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_TABLENAME'], 'TXT_MAINTENANCE_TABLES_ROWS' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_ROWS'], 'TXT_MAINTENANCE_TABLES_DATA' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_DATA_SIZE'], 'TXT_MAINTENANCE_TABLES_INDEXES' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_INDEX_SIZE'], 'TXT_MAINTENANCE_TABLES_BACKLOG' => $_ARRAYLANG['TXT_DBM_STATUS_BACKOG'], 'TXT_MAINTENANCE_TABLES_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_MAINTENANCE_TABLES_DESELECT_ALL' => $_ARRAYLANG['TXT_DESELECT_ALL'], 'TXT_MAINTENANCE_TABLES_SUBMIT_SELECT' => $_ARRAYLANG['TXT_MULTISELECT_SELECT'], 'TXT_MAINTENANCE_TABLES_SUBMIT_OPTIMIZE' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_OPTIMIZE_START'], 'TXT_MAINTENANCE_TABLES_SUBMIT_REPAIR' => $_ARRAYLANG['TXT_DBM_MAINTENANCE_REPAIR_START']));
//Get tables
$objResult = $objDatabase->Execute('SHOW TABLE STATUS LIKE "' . DBPREFIX . '%"');
$intRowCounter = 0;
//Iterate through tables
while (!$objResult->EOF) {
$isInnoDbEngine = $objResult->fields['Engine'] == 'InnoDB';
$objTemplate->setGlobalVariable(array('TXT_MAINTENANCE_SHOW_TABLE' => $_ARRAYLANG['TXT_DBM_SHOW_TABLE_TITLE'], 'MAINTENANCE_TABLES_NAME' => $objResult->fields['Name']));
$objTemplate->setVariable(array('MAINTENANCE_TABLES_ROW' => !$isInnoDbEngine && $objResult->fields['Data_free'] != 0 ? 'Warn' : ($intRowCounter % 2 == 0 ? 2 : 1), 'MAINTENANCE_TABLES_ROWS' => $objResult->fields['Rows'], 'MAINTENANCE_TABLES_DATA' => $this->convertBytesToKBytes($objResult->fields['Data_length']), 'MAINTENANCE_TABLES_INDEXES' => $this->convertBytesToKBytes($objResult->fields['Index_length']), 'MAINTENANCE_TABLES_BACKLOG' => $isInnoDbEngine ? '0' : $this->convertBytesToKBytes($objResult->fields['Data_free'])));
if (\Permission::hasAllAccess()) {
$objTemplate->touchblock('showTableContentLink');
$objTemplate->hideBlock('showTableContentNoLink');
} else {
$objTemplate->touchblock('showTableContentNoLink');
$objTemplate->hideBlock('showTableContentLink');
}
$objTemplate->parse('showTables');
++$intRowCounter;
$objResult->MoveNext();
}
}