本文整理汇总了PHP中FWLanguage::getLanguageArray方法的典型用法代码示例。如果您正苦于以下问题:PHP FWLanguage::getLanguageArray方法的具体用法?PHP FWLanguage::getLanguageArray怎么用?PHP FWLanguage::getLanguageArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWLanguage
的用法示例。
在下文中一共展示了FWLanguage::getLanguageArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runRepublishing
public function runRepublishing()
{
$this->initRepublishing();
FWLanguage::init();
$langIds = array_keys(FWLanguage::getLanguageArray());
foreach ($langIds as $id) {
$this->createRSS($id);
}
}
示例2: init
/**
* Initialize the mail template array
*
* Uses the given language ID, if any, or the language set in the
* LANG_ID global constant.
* Upon success, stores the language ID used in the $lang_id class
* variable.
* @param integer $lang_id The optional language ID
* @return boolean True on success, false otherwise
*/
static function init($lang_id = 0)
{
global $objDatabase;
// The array has been initialized with that language already
if (self::$lang_id === $lang_id) {
return true;
}
// Reset the language ID used
self::$lang_id = false;
// Use the current language if none is specified
if (empty($lang_id)) {
$lang_id = FRONTEND_LANG_ID;
}
self::$arrTemplate = array();
$arrLanguages = FWLanguage::getLanguageArray();
foreach ($arrLanguages as $arrLanguage) {
if ($arrLanguage['frontend'] && $arrLanguage['is_default'] == 'true') {
$defaultLangId = $arrLanguage['id'];
break;
}
}
$objResult = $objDatabase->Execute("\n SELECT `mail`.`id`, `mail`.`tplname`, `mail`.`protected`\n FROM `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_mail` AS `mail`");
if (!$objResult) {
return false;
}
while (!$objResult->EOF) {
$id = $objResult->fields['id'];
self::$arrTemplate[$id] = array('id' => $id, 'name' => $objResult->fields['tplname'], 'protected' => $objResult->fields['protected'], 'available' => false);
$objResult->MoveNext();
}
$objResult = $objDatabase->Execute("\n SELECT `content`.`tpl_id`,\n `content`.`from_mail`, `content`.`xsender`,\n `content`.`subject`, `content`.`message`\n FROM `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_mail_content` AS `content`\n ORDER BY FIELD(`content`.`lang_id`, {$defaultLangId}, {$lang_id}) DESC");
if (!$objResult) {
return false;
}
while (!$objResult->EOF) {
$id = $objResult->fields['tpl_id'];
if (!self::$arrTemplate[$id]['available']) {
self::$arrTemplate[$id]['available'] = true;
self::$arrTemplate[$id]['from'] = $objResult->fields['from_mail'];
self::$arrTemplate[$id]['sender'] = $objResult->fields['xsender'];
self::$arrTemplate[$id]['subject'] = $objResult->fields['subject'];
self::$arrTemplate[$id]['message'] = $objResult->fields['message'];
}
$objResult->MoveNext();
}
// Remember the language used
self::$lang_id = $lang_id;
return true;
}
示例3: write
/**
* Writes the XML-Sitemap in all langs (if activated in config)
* @global type $_CONFIG
* @global type $_CORELANG
* @return boolean True on success (including deactivated), false otherwise
*/
public static function write()
{
global $_CONFIG, $_CORELANG;
if ($_CONFIG['xmlSitemapStatus'] == 'on') {
$arrActiveLanguages = array();
foreach (\FWLanguage::getLanguageArray() as $arrLanguage) {
if ($arrLanguage['frontend'] == 1) {
$arrActiveLanguages[$arrLanguage['id']] = $arrLanguage['lang'];
}
}
$arrFailed = array();
foreach ($arrActiveLanguages as $langId => $langCode) {
$langSitemap = new static(\Env::get('em'), \Env::get('cx')->getLicense(), 0, null, $langId);
if (!$langSitemap->writeXML()) {
$arrFailed[] = sprintf($_CORELANG['TXT_CORE_XML_SITEMAP_NOT_WRITABLE'], sprintf(self::$strFileNameWithLang, $langCode));
}
}
if (count($arrFailed)) {
return implode('<br />', $arrFailed);
}
}
return true;
}
示例4: setNames
public function setNames($arrNames)
{
$this->arrName = array();
foreach ($arrNames as $langId => $name) {
$this->arrName[intval($langId)] = $name;
}
// add text for inactive languages too
$defaultLangId = \FWLanguage::getDefaultLangId();
foreach (\FWLanguage::getLanguageArray() as $langId => $langInfo) {
if (!isset($arrNames[$langId])) {
$this->arrName[$langId] = $this->arrName[$defaultLangId];
}
}
$this->arrAttributes[$this->id]['names'] = $this->arrName;
}
示例5: settingsGeneral
/**
* Loads and saves general settings
*
* @access private
* @global array $_ARRAYLANG
* @global array $_CORELANG
* @global array $_CONFIG
* @global object $objDatabase
*/
private function settingsGeneral()
{
global $objDatabase, $_CORELANG, $_ARRAYLANG, $_CONFIG;
$this->_objTpl->addBlockfile('NEWS_SETTINGS_CONTENT', 'settings_content', 'module_news_settings_general.html');
// Show settings
$objResult = $objDatabase->Execute("SELECT lang FROM " . DBPREFIX . "languages WHERE id='" . $this->langId . "'");
if ($objResult !== false) {
$newsFeedPath = 'http://' . $_SERVER['SERVER_NAME'] . ASCMS_FEED_WEB_PATH . '/news_headlines_' . $objResult->fields['lang'] . '.xml';
}
if (intval($this->arrSettings['news_feed_status']) == 1) {
$status = 'checked="checked"';
$icon = "<a href='" . $newsFeedPath . "' target='_blank' title='" . $newsFeedPath . "'><img src='" . ASCMS_CORE_MODULE_WEB_PATH . "/News/View/Media/rss.gif' border='0' alt='" . $newsFeedPath . "' /></a>";
} else {
$status = '';
$icon = '';
}
// set language vars
$arrLanguages = \FWLanguage::getLanguageArray();
$newsFeedTitle = '';
$newsFeedDescription = '';
foreach ($arrLanguages as $langId => $arrLanguage) {
if ($arrLanguage['is_default'] == 'true') {
$newsFeedTitle = $this->arrSettings['news_feed_title'][$langId];
$newsFeedDescription = $this->arrSettings['news_feed_description'][$langId];
}
$this->_objTpl->setVariable(array('NEWS_FEED_LANG_NAME' => contrexx_raw2xhtml($arrLanguage['name']), 'NEWS_FEED_TITLE_VALUE' => contrexx_raw2xhtml($this->arrSettings['news_feed_title'][$langId]), 'NEWS_FEED_TITLE_LANG_ID' => $langId));
$this->_objTpl->parse('news_feed_title_list');
$this->_objTpl->setVariable(array('NEWS_FEED_LANG_NAME' => contrexx_raw2xhtml($arrLanguage['name']), 'NEWS_FEED_DESCRIPTION_VALUE' => contrexx_raw2xhtml($this->arrSettings['news_feed_description'][$langId]), 'NEWS_FEED_DESCRIPTION_LANG_ID' => $langId));
$this->_objTpl->parse('news_feed_description_list');
}
$assignedAuthorGroups = '';
$existingAuthorGroups = '';
$assignedPublisherGroups = '';
$existingPublisherGroups = '';
$availableUserGroups = $this->_getAllUserGroups();
$arrAssignedAuthorGroups = explode(',', $this->arrSettings['news_assigned_author_groups']);
$arrAssignedPublisherGroups = explode(',', $this->arrSettings['news_assigned_publisher_groups']);
foreach ($availableUserGroups as $id => $name) {
if (in_array($id, $arrAssignedAuthorGroups)) {
$assignedAuthorGroups .= '<option value="' . $id . '">' . $name . "</option>\n";
} else {
$existingAuthorGroups .= '<option value="' . $id . '">' . $name . "</option>\n";
}
}
foreach ($availableUserGroups as $id => $name) {
if (in_array($id, $arrAssignedPublisherGroups)) {
$assignedPublisherGroups .= '<option value="' . $id . '">' . $name . "</option>\n";
} else {
$existingPublisherGroups .= '<option value="' . $id . '">' . $name . "</option>\n";
}
}
$this->_objTpl->setVariable(array('NEWS_FEED_TITLE' => contrexx_raw2xhtml($newsFeedTitle), 'NEWS_FEED_STATUS' => $status, 'NEWS_FEED_ICON' => $icon, 'NEWS_FEED_DESCRIPTION' => contrexx_raw2xhtml($newsFeedDescription), 'NEWS_FEED_IMAGE' => contrexx_raw2xhtml($this->arrSettings['news_feed_image']), 'NEWS_HEADLINES_LIMIT' => intval($this->arrSettings['news_headlines_limit']), 'NEWS_RECENT_MESSAGES_LIMIT' => intval($this->arrSettings['recent_news_message_limit']), 'NEWS_FEED_PATH' => $newsFeedPath, 'NEWS_SUBMIT_NEWS' => $this->arrSettings['news_submit_news'] == '1' ? 'checked="checked"' : '', 'NEWS_SUBMIT_NEWS_CONFIGURATION_DISPLAY' => $this->arrSettings['news_submit_news'] == '1' ? '' : 'none', 'NEWS_SUBMIT_ONLY_COMMUNITY' => $this->arrSettings['news_submit_only_community'] == '1' ? 'checked="checked"' : '', 'NEWS_ACTIVATE_SUBMITTED_NEWS' => $this->arrSettings['news_activate_submitted_news'] == '1' ? 'checked="checked"' : '', 'NEWS_USE_TEASERS_CHECKED' => $_CONFIG['newsTeasersStatus'] == '1' ? 'checked="checked"' : '', 'NEWS_USE_TEASERS_CONFIGURATION_DISPLAY' => $_CONFIG['newsTeasersStatus'] == '1' ? '' : 'none', 'NEWS_USE_TEASER_TEXT_CHECKED' => $this->arrSettings['news_use_teaser_text'] == '1' ? 'checked="checked"' : '', 'NEWS_USE_TYPES_CHECKED' => $this->arrSettings['news_use_types'] == '1' ? 'checked="checked"' : '', 'NEWS_USE_RELATED_NEWS_CHECKED' => $this->arrSettings['use_related_news'] == '1' ? 'checked="checked"' : '', 'NEWS_USE_TAGS_CHECKED' => $this->arrSettings['news_use_tags'] == '1' ? 'checked="checked"' : '', 'TXT_STORE' => $_ARRAYLANG['TXT_STORE'], 'TXT_NAME' => $_ARRAYLANG['TXT_NAME'], 'TXT_VALUE' => $_ARRAYLANG['TXT_VALUE'], 'TXT_NEWS_SETTINGS' => $_ARRAYLANG['TXT_NEWS_SETTINGS'], 'TXT_NEWS_FEED_STATUS' => $_ARRAYLANG['TXT_NEWS_FEED_STATUS'], 'TXT_NEWS_FEED_TITLE' => $_ARRAYLANG['TXT_NEWS_FEED_TITLE'], 'TXT_NEWS_FEED_DESCRIPTION' => $_ARRAYLANG['TXT_NEWS_FEED_DESCRIPTION'], 'TXT_NEWS_FEED_IMAGE' => $_ARRAYLANG['TXT_NEWS_FEED_IMAGE'], 'TXT_BROWSE' => $_ARRAYLANG['TXT_BROWSE'], 'TXT_NEWS_HEADLINES_LIMIT' => $_ARRAYLANG['TXT_NEWS_HEADLINES_LIMIT'], 'TXT_NEWS_SETTINGS_SAVED' => $_ARRAYLANG['TXT_NEWS_SETTINGS_SAVED'], 'TXT_SUBMIT_NEWS' => $_ARRAYLANG['TXT_SUBMIT_NEWS'], 'TXT_ALLOW_USERS_SUBMIT_NEWS' => $_ARRAYLANG['TXT_ALLOW_USERS_SUBMIT_NEWS'], 'TXT_ALLOW_ONLY_MEMBERS_SUBMIT_NEWS' => $_ARRAYLANG['TXT_ALLOW_ONLY_MEMBERS_SUBMIT_NEWS'], 'TXT_AUTO_ACTIVATE_SUBMITTED_NEWS' => $_ARRAYLANG['TXT_AUTO_ACTIVATE_SUBMITTED_NEWS'], 'TXT_USE_TEASERS' => $_ARRAYLANG['TXT_USE_TEASERS'], 'TXT_USE_TEASER_TEXT' => $_ARRAYLANG['TXT_USE_TEASER_TEXT'], 'TXT_USE_TYPES' => $_ARRAYLANG['TXT_USE_TYPES'], 'TXT_USE_RELATED_NEWS' => $_ARRAYLANG['TXT_USE_RELATED_NEWS'], 'TXT_USE_TAGS' => $_ARRAYLANG['TXT_USE_TAGS'], 'TXT_NOTIFY_GROUP' => $_ARRAYLANG['TXT_NOTIFY_GROUP'], 'TXT_NOTIFY_USER' => $_ARRAYLANG['TXT_NOTIFY_USER'], 'TXT_DEACTIVATE' => $_ARRAYLANG['TXT_DEACTIVATE'], 'NEWS_NOTIFY_GROUP_LIST' => $this->_generate_notify_group_list(), 'NEWS_NOTIFY_USER_LIST' => $this->_generate_notify_user_list(), 'TXT_NEWS_PROTECTION' => $_ARRAYLANG['TXT_NEWS_PROTECTION'], 'TXT_NEWS_ACTIVE' => $_ARRAYLANG['TXT_NEWS_ACTIVE'], 'TXT_NEWS_MESSAGE_PROTECTION_RESTRICTED' => $_ARRAYLANG['TXT_NEWS_MESSAGE_PROTECTION_RESTRICTED'], 'NEWS_MESSAGE_PROTECTION_CHECKED' => $this->arrSettings['news_message_protection'] == '1' ? 'checked="checked"' : '', 'NEWS_MESSAGE_PROTECTION_RESTRICTED_DISPLAY' => $this->arrSettings['news_message_protection'] == '1' ? '' : 'none', 'NEWS_MESSAGE_PROTECTION_RESTRICTED_CHECKED' => $this->arrSettings['news_message_protection_restricted'] == '1' ? 'checked="checked"' : '', 'NEWS_SETTINGS_COMMENTS_STATUS_CHECKED' => $this->arrSettings['news_comments_activated'] == '1' ? 'checked="checked"' : '', 'NEWS_COMMENTS_STATUS_STYLE' => $this->arrSettings['news_comments_activated'] == '1' ? '' : 'none', 'NEWS_SETTINGS_COMMENTS_ALLOW_ANONYMOUS_CHECKED' => $this->arrSettings['news_comments_anonymous'] == '1' ? 'checked="checked"' : '', 'NEWS_SETTINGS_COMMENTS_AUTO_ACTIVATE_CHECKED' => $this->arrSettings['news_comments_autoactivate'] == '1' ? 'checked="checked"' : '', 'NEWS_SETTINGS_COMMENTS_NOTIFICATION_CHECKED' => $this->arrSettings['news_comments_notification'] == '1' ? 'checked="checked"' : '', 'NEWS_SETTINGS_COMMENTS_TIMEOUT' => intval($this->arrSettings['news_comments_timeout']), 'TXT_NEWS_COMMENTS' => $_ARRAYLANG['TXT_NEWS_COMMENTS'], 'TXT_NEWS_SETTINGS_COMMENTS_ALLOW_HELP' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_ALLOW_HELP'], 'TXT_NEWS_SETTINGS_COMMENTS_ALLOW_ANONYMOUS' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_ALLOW_ANONYMOUS'], 'TXT_NEWS_SETTINGS_COMMENTS_ALLOW_ANONYMOUS_HELP' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_ALLOW_ANONYMOUS_HELP'], 'TXT_NEWS_SETTINGS_COMMENTS_AUTO_ACTIVATE' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_AUTO_ACTIVATE'], 'TXT_NEWS_SETTINGS_COMMENTS_AUTO_ACTIVATE_HELP' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_AUTO_ACTIVATE_HELP'], 'TXT_NEWS_SETTINGS_COMMENTS_NOTIFICATION' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_NOTIFICATION'], 'TXT_NEWS_SETTINGS_COMMENTS_NOTIFICATION_HELP' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_NOTIFICATION_HELP'], 'TXT_NEWS_SETTINGS_COMMENTS_TIMEOUT' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_TIMEOUT'], 'TXT_NEWS_SETTINGS_COMMENTS_TIMEOUT_HELP' => $_ARRAYLANG['TXT_NEWS_SETTINGS_COMMENTS_TIMEOUT_HELP'], 'TXT_NEWS_SETTINGS_RECENT_MESSAGES_LIMIT_HELP' => $_ARRAYLANG['TXT_NEWS_SETTINGS_RECENT_MESSAGES_LIMIT_HELP'], 'TXT_NEWS_DEFAULT_TEASERS' => $_ARRAYLANG['TXT_NEWS_DEFAULT_TEASERS'], 'TXT_NEWS_DEFAULT_TEASERS_HELP' => $_ARRAYLANG['TXT_NEWS_DEFAULT_TEASERS_HELP'], 'TXT_NEWS_EXTENDED' => $_ARRAYLANG['TXT_NEWS_EXTENDED'], 'TXT_NEWS_TOP' => $_ARRAYLANG['TXT_NEWS_TOP'], 'TXT_NEWS_TOP_LABEL' => $_ARRAYLANG['TXT_NEWS_TOP_LABEL'], 'TXT_NEWS_TOP_DAYS' => $_ARRAYLANG['TXT_NEWS_TOP_DAYS'], 'TXT_NEWS_TOP_LIMIT' => $_ARRAYLANG['TXT_NEWS_TOP_LIMIT'], 'TXT_NEWS_AUTHOR_SELECTION' => $_ARRAYLANG['TXT_NEWS_AUTHOR_SELECTION'], 'TXT_NEWS_PUBLISHER_SELECTION' => $_ARRAYLANG['TXT_NEWS_PUBLISHER_SELECTION'], 'TXT_NEWS_LIST_ALL' => $_ARRAYLANG['TXT_NEWS_LIST_ALL'], 'TXT_NEWS_LIST_SELECTED' => $_ARRAYLANG['TXT_NEWS_LIST_SELECTED'], 'TXT_NEWS_AVAILABLE_GROUPS' => $_ARRAYLANG['TXT_NEWS_AVAILABLE_GROUPS'], 'TXT_NEWS_ASSIGNED_GROUPS' => $_ARRAYLANG['TXT_NEWS_ASSIGNED_GROUPS'], 'TXT_NEWS_CHECK_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_NEWS_UNCHECK_ALL' => $_ARRAYLANG['TXT_NEWS_UNCHECK_ALL'], 'TXT_NEWS_AVAILABLE_GROUPS' => $_ARRAYLANG['TXT_NEWS_AVAILABLE_GROUPS'], 'TXT_NEWS_ASSIGNED_GROUPS' => $_ARRAYLANG['TXT_NEWS_ASSIGNED_GROUPS'], 'TXT_NEWS_RECENT_MESSAGES_LIMIT' => $_ARRAYLANG['TXT_NEWS_RECENT_MESSAGES_LIMIT'], 'NEWS_FILTER_AUTHOR_ACTIVE' => $this->arrSettings['news_assigned_author_groups'] ? 'checked="checked"' : '', 'NEWS_FILTER_AUTHOR_INACTIVE' => $this->arrSettings['news_assigned_author_groups'] ? '' : 'checked="checked"', 'NEWS_FILTER_AUTHOR_DISPLAY' => $this->arrSettings['news_assigned_author_groups'] ? 'block' : 'none', 'NEWS_FILTER_PUBLISHER_ACTIVE' => $this->arrSettings['news_assigned_publisher_groups'] ? 'checked="checked"' : '', 'NEWS_FILTER_PUBLISHER_INACTIVE' => $this->arrSettings['news_assigned_publisher_groups'] ? '' : 'checked="checked"', 'NEWS_FILTER_PUBLISHER_DISPLAY' => $this->arrSettings['news_assigned_publisher_groups'] ? 'block' : 'none', 'NEWS_EXISTING_AUTHOR_GROUPS' => $existingAuthorGroups, 'NEWS_ASSIGNED_AUTHOR_GROUPS' => $assignedAuthorGroups, 'NEWS_EXISTING_PUBLISHER_GROUPS' => $existingPublisherGroups, 'NEWS_ASSIGNED_PUBLISHER_GROUPS' => $assignedPublisherGroups, 'NEWS_USE_TOP_CHECKED' => $this->arrSettings['news_use_top'] == '1' ? 'checked="checked"' : '', 'NEWS_MESSAGE_TOP_DISPLAY' => $this->arrSettings['news_use_top'] == '1' ? '' : 'none', 'NEWS_TOP_DAYS' => intval($this->arrSettings['news_top_days']), 'NEWS_TOP_LIMIT' => intval($this->arrSettings['news_top_limit']), 'NEWS_MEDIA_BROWSER_BROWSE_BUTTON' => self::getMediaBrowserButton(array('type' => 'button', 'id' => 'newsFeedImage', 'data-cx-mb-views' => 'filebrowser', 'style' => 'width:110px;'), 'SetUrl')));
$this->_objTpl->setGlobalVariable(array('TXT_ACTIVATED' => $_CORELANG['TXT_ACTIVATED'], 'TXT_DEACTIVATED' => $_CORELANG['TXT_DEACTIVATED']));
// get list of all teasers
$objTeaser = new \Cx\Core_Modules\News\Controller\Teasers(true);
$arrNewsDefaultTeasers = explode(';', $this->arrSettings['news_default_teasers']);
$frameIds = '';
foreach ($objTeaser->arrTeaserFrameNames as $frameName => $frameId) {
$this->_objTpl->setVariable(array('NEWS_TEASER_NAME' => contrexx_raw2xhtml($frameName), 'NEWS_TEASER_ID' => $frameId, 'NEWS_TEASER_CHECKED' => in_array($frameId, $arrNewsDefaultTeasers) ? 'checked="checked"' : ''));
$this->_objTpl->parse('defaultTeasers');
}
$this->_objTpl->parse('settings_content');
}
示例6: _configModifyAttribute
function _configModifyAttribute()
{
global $_ARRAYLANG;
$setStatus = true;
$associatedGroups = '';
$notAssociatedGroups = '';
$objFWUser = \FWUser::getFWUserObject();
$objAttribute = $objFWUser->objUser->objAttribute->getById(isset($_REQUEST['id']) ? $_REQUEST['id'] : 0);
if (isset($_POST['access_store_attribute']) || isset($_POST['access_add_child'])) {
// only administrators are allowed to modify the config
if (!\Permission::hasAllAccess()) {
\Permission::noAccess();
}
if (isset($_POST['access_attribute_name']) && is_array($_POST['access_attribute_name'])) {
$objAttribute->setNames(array_map('contrexx_stripslashes', $_POST['access_attribute_name']));
}
if (isset($_POST['access_attribute_type'])) {
$objAttribute->setType($_POST['access_attribute_type']);
}
if (isset($_POST['access_attribute_sort_type'])) {
$objAttribute->setSortType($_POST['access_attribute_sort_type']);
}
if ($objAttribute->getSortType() == 'custom' && isset($_POST['access_attribute_sort_order']) && is_array($_POST['access_attribute_sort_order'])) {
$objAttribute->setChildOrder($_POST['access_attribute_sort_order']);
}
if (isset($_POST['access_attribute_parent_id'])) {
$setStatus = $objAttribute->setParent($_POST['access_attribute_parent_id']);
}
if (isset($_POST['access_attribute_all_access']) && $_POST['access_attribute_all_access']) {
$objAttribute->removeProtection();
} else {
$objAttribute->setProtection(isset($_POST['access_attribute_associated_groups']) && is_array($_POST['access_attribute_associated_groups']) ? $_POST['access_attribute_associated_groups'] : array());
$objAttribute->setSpecialProtection(isset($_POST['access_attribute_special_menu_access']) ? $_POST['access_attribute_special_menu_access'] : '');
}
$objAttribute->setMultiline(isset($_POST['access_text_multiline_option']) && intval($_POST['access_text_multiline_option']));
$objAttribute->setMandatory(isset($_POST['access_attribute_mandatory']) ? intval($_POST['access_attribute_mandatory']) : 0);
if ($setStatus && $objAttribute->store()) {
if (isset($_POST['access_add_child'])) {
$objAttribute->createChild($objAttribute->getId());
} elseif (isset($_POST['access_add_other_after_store'])) {
$objAttribute->createChild($objAttribute->getParent());
} else {
self::$arrStatusMsg['ok'][] = $this->errorMsg = $objAttribute->getType() == 'menu_option' ? $_ARRAYLANG['TXT_ACCESS_SUCCESS_STORE_MENU_OPTION'] : ($objAttribute->getType() == 'frame' ? $_ARRAYLANG['TXT_ACCESS_SUCCESS_STORE_FRAME'] : $_ARRAYLANG['TXT_ACCESS_SUCCESS_STORE_ATTRIBUTE']);
if ($objAttribute->getParent()) {
$objAttribute->load($objAttribute->getParent());
} else {
$this->_configAttributes();
return;
}
}
} else {
self::$arrStatusMsg['error'][] = $objAttribute->getErrorMsg();
}
}
$this->_objTpl->addBlockfile('ACCESS_CONFIG_TEMPLATE', 'module_access_config_attribute_modify', 'module_access_config_attribute_modify.html');
$this->attachJavaScriptFunction('accessSetWebsite');
$this->attachJavaScriptFunction('accessSelectAllGroups');
$this->attachJavaScriptFunction('accessDeselectAllGroups');
$this->attachJavaScriptFunction('accessAddGroupToList');
$this->attachJavaScriptFunction('accessRemoveGroupFromList');
$this->_objTpl->setVariable(array('ACCESS_PROFILE_OPERATION_TITLE' => $objAttribute->getId() ? $_ARRAYLANG['TXT_ACCESS_PROFILE_ATTRIBUTE_MODIFY'] : $_ARRAYLANG['TXT_ACCESS_ADD_NEW_PROFILE_ATTRIBUTE'], 'ACCESS_ADD_CHILD_TXT' => $objAttribute->getType() == 'menu' ? $_ARRAYLANG['TXT_ACCESS_ADD_NEW_MENU_OPTION'] : ($objAttribute->getType() == 'group' ? $_ARRAYLANG['TXT_ACCESS_ADD_NEW_GROUP_FRAME'] : $_ARRAYLANG['TXT_ACCESS_ADD_NEW_PROFILE_ATTRIBUTE']), 'ACCESS_PARENT_TYPE_TITLE' => $objAttribute->getParentTypeDescription(), 'ACCESS_PARENT_TYPE' => $objAttribute->isCoreAttribute($objAttribute->getId()) ? $_ARRAYLANG['TXT_ACCESS_NEW_ATTRIBUTE'] : ($objAttribute->hasMovableOption() ? $objAttribute->getParentMenu('name="access_attribute_parent_id" style="width:300px;" onchange="accessCheckParentAttribute()"') : '<input type="hidden" name="access_attribute_parent_id" value="' . $objAttribute->getParent() . '" />' . $objAttribute->getParentType()), 'ACCESS_PARENT_ID' => $objAttribute->getParent(), 'ACCESS_CANCEL_RETURN_SECTION' => $objAttribute->getParent() ? 'modifyAttribute' : 'attributes', 'ACCESS_MUST_STORE_BEFORE_CONTINUE_MSG' => $objAttribute->getId() ? $_ARRAYLANG['TXT_ACCESS_STORE_CHANGED_ATTRIBUTE_MSG'] : $_ARRAYLANG['TXT_ACCESS_MUST_STORE_NEW_ATTRIBUTE_MSG'], 'ACCESS_IS_NEW_ATTRIBUTE' => $objAttribute->getId() ? 'false' : 'true', 'ACCESS_JAVASCRIPT_FUNCTIONS' => $this->getJavaScriptCode(), 'ACCESS_SORTABLE_TYPE_LIST' => implode("', '", $objAttribute->getSortableTypes()), 'ACCESS_MANDATORY_TYPE_LIST' => implode("', '", $objAttribute->getMandatoryTypes()), 'TXT_ACCESS_INVALID_PARENT_ATTRIBUTE' => $_ARRAYLANG['TXT_ACCESS_INVALID_PARENT_ATTRIBUTE'], 'TXT_ACCESS_CHANGES_WILL_BE_LOST' => $_ARRAYLANG['TXT_ACCESS_CHANGES_WILL_BE_LOST'], 'TXT_ACCESS_EXTENDED' => $_ARRAYLANG['TXT_ACCESS_EXTENDED'], 'TXT_ACCESS_TYPE' => $_ARRAYLANG['TXT_ACCESS_TYPE'], 'TXT_ACCESS_MANDATORY_FIELD' => $_ARRAYLANG['TXT_ACCESS_MANDATORY_FIELD'], 'TXT_ACCESS_NO' => $_ARRAYLANG['TXT_ACCESS_NO'], 'TXT_ACCESS_YES' => $_ARRAYLANG['TXT_ACCESS_YES'], 'TXT_ACCESS_ATTRIBUTE' => $_ARRAYLANG['TXT_ACCESS_ATTRIBUTE'], 'TXT_ACCESS_PREVIEW' => $_ARRAYLANG['TXT_ACCESS_PREVIEW'], 'TXT_ACCESS_BACK' => $_ARRAYLANG['TXT_ACCESS_BACK'], 'TXT_ACCESS_SAVE' => $_ARRAYLANG['TXT_ACCESS_SAVE'], 'TXT_ACCESS_FUNCTIONS' => $_ARRAYLANG['TXT_ACCESS_FUNCTIONS'], 'TXT_ACCESS_MULTILINE_TEXT' => $_ARRAYLANG['TXT_ACCESS_MULTILINE_TEXT'], 'TXT_ACCESS_SORT' => $_ARRAYLANG['TXT_ACCESS_SORT'], 'TXT_ACCESS_MODIFICATION_ACCESS' => $_ARRAYLANG['TXT_ACCESS_MODIFICATION_ACCESS'], 'TXT_ACCESS_EVERYONE_MOD_PERM' => $_ARRAYLANG['TXT_ACCESS_EVERYONE_MOD_PERM'], 'TXT_ACCESS_AVAILABLE_GROUPS' => $_ARRAYLANG['TXT_ACCESS_AVAILABLE_GROUPS'], 'TXT_ACCESS_CHECK_ALL' => $_ARRAYLANG['TXT_ACCESS_CHECK_ALL'], 'TXT_ACCESS_UNCHECK_ALL' => $_ARRAYLANG['TXT_ACCESS_UNCHECK_ALL'], 'TXT_ACCESS_ASSOCIATED_GROUPS' => $_ARRAYLANG['TXT_ACCESS_ASSOCIATED_GROUPS'], 'TXT_ACCESS_MODIFICATION_ACCESS' => $_ARRAYLANG['TXT_ACCESS_MODIFICATION_ACCESS'], 'TXT_ACCESS_MODIFY_PROFILE_ATTRIBUTE_MSG' => $_ARRAYLANG['TXT_ACCESS_MODIFY_PROFILE_ATTRIBUTE_MSG'], 'TXT_ACCESS_SELECT_ALLOWED_MODIFY_GROUPS' => $_ARRAYLANG['TXT_ACCESS_SELECT_ALLOWED_MODIFY_GROUPS'], 'TXT_ACCESS_SPECIAL_MENU_PERM' => $_ARRAYLANG['TXT_ACCESS_SPECIAL_MENU_PERM'], 'TXT_ACCESS_NONE' => $_ARRAYLANG['TXT_ACCESS_NONE'], 'TXT_ACCESS_ONLY_HIGHER_OPTION_ACCESS' => $_ARRAYLANG['TXT_ACCESS_ONLY_HIGHER_OPTION_ACCESS'], 'TXT_ACCESS_ONLY_LOWER_OPTION_ACCESS' => $_ARRAYLANG['TXT_ACCESS_ONLY_LOWER_OPTION_ACCESS'], 'TXT_ACCESS_FRAMES' => $_ARRAYLANG['TXT_ACCESS_FRAMES'], 'TXT_ACCESS_FRAME' => $_ARRAYLANG['TXT_ACCESS_FRAME'], 'TXT_ACCESS_ADD_NEW_FRAME' => $_ARRAYLANG['TXT_ACCESS_ADD_NEW_FRAME'], 'TXT_ACCESS_SELECT_OPTION' => $_ARRAYLANG['TXT_ACCESS_SELECT_OPTION'], 'TXT_ACCESS_SELECT_OPTIONS' => $_ARRAYLANG['TXT_ACCESS_SELECT_OPTIONS'], 'TXT_ACCESS_ADD_NEW_SELECT_OPTION' => $_ARRAYLANG['TXT_ACCESS_ADD_NEW_SELECT_OPTION'], 'TXT_ACCESS_ID' => $_ARRAYLANG['TXT_ACCESS_ID']));
$this->_objTpl->setGlobalVariable(array('TXT_ACCESS_NAME' => $_ARRAYLANG['TXT_ACCESS_NAME'], 'TXT_ACCESS_MODIFY_ATTRIBUTE' => $_ARRAYLANG['TXT_ACCESS_MODIFY_ATTRIBUTE'], 'TXT_ACCESS_DELETE_ATTRIBUTE' => $_ARRAYLANG['TXT_ACCESS_DELETE_ATTRIBUTE'], 'TXT_ACCESS_CONFIRM_DELETE_ATTRIBUTE_MSG' => str_replace("\n", '\\n', $_ARRAYLANG['TXT_ACCESS_CONFIRM_DELETE_ATTRIBUTE_MSG']), 'TXT_ACCESS_OPERATION_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACCESS_OPERATION_IRREVERSIBLE'], 'TXT_ACCESS_MOVE_UP' => $_ARRAYLANG['TXT_ACCESS_MOVE_UP'], 'TXT_ACCESS_MOVE_DOWN' => $_ARRAYLANG['TXT_ACCESS_MOVE_DOWN'], 'TXT_ACCESS_GENERAL' => $_ARRAYLANG['TXT_ACCESS_GENERAL'], 'TXT_ACCESS_PROFILE_ATTRIBUTES' => $_ARRAYLANG['TXT_ACCESS_PROFILE_ATTRIBUTES'], 'ACCESS_CHILD_SORT_ORDER_DISPLAY' => $objAttribute->getSortType() == 'custom' ? 'inline' : 'none'));
if ((!$objAttribute->getId() || $objAttribute->isCustomAttribute($objAttribute->getId())) && $objAttribute->getParent() !== 'title') {
foreach (\FWLanguage::getLanguageArray() as $langId => $arrLanguage) {
if ($arrLanguage['frontend']) {
$this->_objTpl->setVariable(array('ACCESS_ATTRIBUTE_LANG_ID' => $langId, 'ACCESS_ATTRIBUTE_LANG_NAME' => htmlentities(\FWLanguage::getLanguageParameter($langId, 'name'), ENT_QUOTES, CONTREXX_CHARSET), 'ACCESS_ATTRIBUTE_NAME' => htmlentities($objAttribute->getName($langId), ENT_QUOTES, CONTREXX_CHARSET)));
$this->_objTpl->parse('access_attribute_name_list');
}
}
$this->_objTpl->touchBlock('access_attribute_name');
$this->_objTpl->hideBlock('access_attribute_core_name_edit');
$this->_objTpl->hideBlock('access_attribute_core_name');
} else {
$this->_objTpl->setVariable('ACCESS_ATTRIBUTE_NAME', htmlentities($objAttribute->getName(), ENT_QUOTES, CONTREXX_CHARSET));
$this->_objTpl->hideBlock('access_attribute_name');
if ($objAttribute->isNamesModifiable()) {
// only core child attributes should be allowed to be modifiable
$this->_objTpl->touchBlock('access_attribute_core_name_edit');
$this->_objTpl->hideBlock('access_attribute_core_name');
} else {
$this->_objTpl->hideBlock('access_attribute_core_name_edit');
$this->_objTpl->touchBlock('access_attribute_core_name');
}
}
$objGroup = $objFWUser->objGroup->getGroups();
while (!$objGroup->EOF) {
$var = in_array($objAttribute->getAccessId(), $objGroup->getDynamicPermissionIds()) ? 'associatedGroups' : 'notAssociatedGroups';
${$var} .= "<option value=\"" . $objGroup->getId() . "\">" . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . " [" . $objGroup->getType() . "]</option>\n";
$objGroup->next();
}
$this->_objTpl->setVariable(array('ACCESS_ATTRIBUTE_ID' => $objAttribute->getId(), 'ACCESS_ATTRIBUTE_NAME' => htmlentities($objAttribute->getName(), ENT_QUOTES, CONTREXX_CHARSET), 'ACCESS_ATTRIBUTE_TYPE' => $objAttribute->getId() ? $objAttribute->getTypeDescription() : $objAttribute->getTypeMenu('name="access_attribute_type" onchange="accessSwitchType(this.value)" style="width:300px;"'), 'ACCESS_TEXT_MULTILINE_OPTION_DISPLAY' => $objAttribute->isTypeModifiable() && in_array($objAttribute->getType(), array('text', 'textarea')) ? 'inline' : 'none', 'ACCESS_TEXT_MULTILINE_CHECKED' => $objAttribute->isMultiline() ? 'checked="checked"' : '', 'ACCESS_ATTRIBUTE_MANDATORY_FRAME_DISPLAY' => $objAttribute->hasMandatoryOption() ? '' : 'none', 'ACCESS_ATTRIBUTE_MANDATORY_YES' => $objAttribute->isMandatory() ? 'checked="checked"' : '', 'ACCESS_ATTRIBUTE_MANDATORY_NO' => $objAttribute->isMandatory() ? '' : 'checked="checked"', 'ACCESS_ATTRIBUTE_CHILD_FRAME_DISPLAY' => $objAttribute->hasChildOption() ? '' : 'none', 'ACCESS_ATTRIBUTE_CHILD_FRAME_ROWS' => count($objAttribute->getChildren()) + 2, 'ACCESS_ATTRIBUTE_SORT_FRAME_DISPLAY' => $objAttribute->hasChildOption() ? '' : 'none', 'ACCESS_ATTRIBUTE_SORT_FRAME_ROW' => $objAttribute->hasMandatoryOption() && $objAttribute->hasSortableOption() ? 'row1' : 'row2', 'ACCESS_ATTRIBUTE_SORT_TYPE' => $objAttribute->isSortOrderModifiable() ? $objAttribute->getSortTypeMenu('name="access_attribute_sort_type" style="width:300px;" onchange="accessSwitchSortType(this.value)"') : $objAttribute->getSortTypeDescription(), 'ACCESS_ATTRIBUTE_NOT_ASSOCIATED_GROUPS' => $notAssociatedGroups, 'ACCESS_USER_ASSOCIATED_GROUPS' => $associatedGroups, 'ACCESS_ATTRIBUTE_SELECT_ACCESS_DISPLAY' => $objAttribute->isProtected() ? '' : 'none', 'ACCESS_ATTRIBUTE_ACCESS_ALL_CHECKED' => $objAttribute->isProtected() ? '' : 'checked="checked"', 'ACCESS_PERMISSON_TAB_DISPLAY' => $objAttribute->hasProtectionOption() ? '' : 'none', 'ACCESS_ATTRIBUTE_SPECIAL_MENU_ACCESS' => $objAttribute->getType() == 'menu' ? '' : 'none', 'ACCESS_ATTRIBUTE_SPECIAL_NONE_CHECKED' => $objAttribute->getSpecialProtection() == '' ? 'checked="checked"' : '', 'ACCESS_ATTRIBUTE_SPECIAL_HIGHER_CHECKED' => $objAttribute->getSpecialProtection() == 'menu_select_higher' ? 'checked="checked"' : '', 'ACCESS_ATTRIBUTE_SPECIAL_LOWER_CHECKED' => $objAttribute->getSpecialProtection() == 'menu_select_lower' ? 'checked="checked"' : '', 'ACCESS_CHILDREN_TAB_DISPLAY' => in_array($objAttribute->getType(), array('frame', 'history')) ? '' : 'none', 'ACCESS_MENU_OPTION_TAB_DISPLAY' => $objAttribute->getType() == 'menu' ? '' : 'none', 'ACCESS_FRAMES_TAB_DISPLAY' => $objAttribute->getType() == 'group' ? '' : 'none'));
if ($objAttribute->getParent()) {
switch ($objAttribute->getType()) {
case 'menu_option':
$addOtherchildTxt = $_ARRAYLANG['TXT_ACCESS_ADD_OTHER_MENU_OPTION'];
break;
case 'frame':
$addOtherchildTxt = $_ARRAYLANG['TXT_ACCESS_ADD_OTHER_FRAME'];
break;
default:
//.........这里部分代码省略.........
示例7: modifyLanguage
/**
* add and modify language values
*
* @global array
* @global ADONewConnection
* @return boolean True on success, false on failure
*/
function modifyLanguage()
{
global $_ARRAYLANG, $_CONFIG, $objDatabase;
$langRemovalStatus = isset($_POST['removeLangVersion']) ? contrexx_input2raw($_POST['removeLangVersion']) : false;
if (!empty($_POST['submit']) and isset($_POST['addLanguage']) && $_POST['addLanguage'] == "true") {
//-----------------------------------------------
// Add new language with all variables
//-----------------------------------------------
if (!empty($_POST['newLangName']) and !empty($_POST['newLangShortname'])) {
$newLangShortname = addslashes(strip_tags($_POST['newLangShortname']));
$newLangName = addslashes(strip_tags($_POST['newLangName']));
$newLangCharset = addslashes(strip_tags($_POST['newLangCharset']));
$objResult = $objDatabase->Execute("SELECT lang FROM " . DBPREFIX . "languages WHERE lang='" . $newLangShortname . "'");
if ($objResult !== false) {
if ($objResult->RecordCount() >= 1) {
$this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
return false;
} else {
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "languages SET lang='" . $newLangShortname . "',\n name='" . $newLangName . "',\n charset='" . $newLangCharset . "',\n is_default='false'");
$newLanguageId = $objDatabase->Insert_ID();
if (!empty($newLanguageId)) {
$objResult = $objDatabase->SelectLimit("SELECT id FROM " . DBPREFIX . "languages WHERE is_default='true'", 1);
if ($objResult !== false && !$objResult->EOF) {
$defaultLanguage = $objResult->fields['id'];
$objResult = $objDatabase->Execute("SELECT varid,content,module FROM " . DBPREFIX . "language_variable_content WHERE 1 AND lang=" . $defaultLanguage);
if ($objResult !== false) {
while (!$objResult->EOF) {
$arrayLanguageContent[$objResult->fields['varid']] = stripslashes($objResult->fields['content']);
$arrayLanguageModule[$objResult->fields['varid']] = $objResult->fields['module'];
$objResult->MoveNext();
}
foreach ($arrayLanguageContent as $varid => $content) {
$LanguageModule = $arrayLanguageModule[$varid];
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "language_variable_content SET varid=" . $varid . ", content='" . addslashes($content) . "', module=" . $LanguageModule . ", lang=" . $newLanguageId . ", status=0");
}
$this->strOkMessage = $_ARRAYLANG['TXT_NEW_LANGUAGE_ADDED_SUCCESSFUL'];
return true;
}
}
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
return false;
}
}
}
}
} elseif (!empty($_POST['submit']) and $_POST['modLanguage'] == "true") {
$eventArgs = array('langRemovalStatus' => $langRemovalStatus);
$frontendLangIds = array_keys(\FWLanguage::getActiveFrontendLanguages());
$postLangIds = array_keys($_POST['langActiveStatus']);
foreach (array_keys(\FWLanguage::getLanguageArray()) as $langId) {
$isLangInPost = in_array($langId, $postLangIds);
$isLangInFrontend = in_array($langId, $frontendLangIds);
if ($isLangInPost == $isLangInFrontend) {
continue;
}
$eventArgs['langData'][] = array('langId' => $langId, 'status' => $isLangInPost && !$isLangInFrontend);
}
//Trigger the event 'languageStatusUpdate'
//if the language is activated/deactivated for frontend
if (!empty($eventArgs)) {
$evm = \Cx\Core\Core\Controller\Cx::instanciate()->getEvents();
$evm->triggerEvent('languageStatusUpdate', array($eventArgs, new \Cx\Core\Model\RecursiveArrayAccess(array())));
}
//-----------------------------------------------
// Update languages
//-----------------------------------------------
foreach ($_POST['langName'] as $id => $name) {
$active = 0;
if (isset($_POST['langActiveStatus'][$id]) && $_POST['langActiveStatus'][$id] == 1) {
$languageCode = \FWLanguage::getLanguageCodeById($id);
$pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
$alias = $pageRepo->findBy(array('type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS, 'slug' => $languageCode), true);
if (count($alias)) {
if (is_array($alias)) {
$alias = $alias[0];
}
$id = $alias->getNode()->getId();
$config = \Env::get('config');
$link = 'http://' . $config['domainUrl'] . ASCMS_PATH_OFFSET . '/' . $alias->getSlug();
$lang = \Env::get('lang');
$this->strErrMessage = $lang['TXT_CORE_REMOVE_ALIAS_TO_ACTIVATE_LANGUAGE'] . ':<br />
<a href="index.php?cmd=Alias&act=modify&id=' . $id . '" target="_blank">' . $link . '</a>';
return false;
}
$active = 1;
}
$status = "false";
if ($_POST['langDefaultStatus'] == $id) {
$status = "true";
}
$adminstatus = 0;
if (isset($_POST['langAdminStatus'][$id]) && $_POST['langAdminStatus'][$id] == 1) {
//.........这里部分代码省略.........
示例8: processCreateDirectory
private function processCreateDirectory($objCategory)
{
if (empty($_POST['downloads_category_name'])) {
return;
} else {
$name = contrexx_stripslashes($_POST['downloads_category_name']);
}
\Cx\Core\Csrf\Controller\Csrf::check_code();
// check for sufficient permissiosn
if ($objCategory->getAddSubcategoriesAccessId() && !\Permission::checkAccess($objCategory->getAddSubcategoriesAccessId(), 'dynamic', true) && $objCategory->getOwnerId() != $this->userId) {
return;
}
// parse name and description attributres
$arrLanguageIds = array_keys(\FWLanguage::getLanguageArray());
foreach ($arrLanguageIds as $langId) {
$arrNames[$langId] = $name;
$arrDescriptions[$langId] = '';
}
$objSubcategory = new Category();
$objSubcategory->setParentId($objCategory->getId());
$objSubcategory->setActiveStatus(true);
$objSubcategory->setVisibility($objCategory->getVisibility());
$objSubcategory->setNames($arrNames);
$objSubcategory->setDescriptions($arrDescriptions);
$objSubcategory->setPermissions(array('read' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'add_subcategories' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'manage_subcategories' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'add_files' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array()), 'manage_files' => array('protected' => (bool) $objCategory->getAddSubcategoriesAccessId(), 'groups' => array())));
//
// foreach ($this->arrPermissionTypes as $protectionType) {
// $arrCategoryPermissions[$protectionType]['protected'] = isset($_POST['downloads_category_'.$protectionType]) && $_POST['downloads_category_'.$protectionType];
// $arrCategoryPermissions[$protectionType]['groups'] = !empty($_POST['downloads_category_'.$protectionType.'_associated_groups']) ? array_map('intval', $_POST['downloads_category_'.$protectionType.'_associated_groups']) : array();
// }
//
// $objCategory->setPermissionsRecursive(!empty($_POST['downloads_category_apply_recursive']));
// $objCategory->setPermissions($arrCategoryPermissions);
if (!$objSubcategory->store()) {
$this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $objSubcategory->getErrorMsg());
}
}
示例9: showCrawlerRuns
/**
* Show all the runs and last runs detail
*
* @global array $_ARRAYLANG
*/
public function showCrawlerRuns()
{
global $_ARRAYLANG;
//show the last runs details
$lastRunResult = $this->crawlerRepository->getLatestRunDetails();
if ($lastRunResult) {
$this->template->setVariable(array($this->moduleNameLang . '_LAST_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getStartTime()), $this->moduleNameLang . '_LAST_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($lastRunResult[0]->getStartTime(), $lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_TOTAL_LINKS' => $lastRunResult[0]->getTotalLinks(), $this->moduleNameLang . '_LAST_RUN_BROKEN_LINKS' => $lastRunResult[0]->getTotalBrokenLinks()));
} else {
if ($this->template->blockExists('showLastRun')) {
$this->template->hideBlock('showLastRun');
}
}
//show Crawler Runs table
//get parameters
$pos = isset($_GET['pos']) ? $_GET['pos'] : 0;
$langArray = \FWLanguage::getLanguageArray();
//set the settings value from DB
\Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
$pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager');
$parameter = './index.php?cmd=' . $this->moduleName;
$this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->crawlerRepository->crawlerEntryCount(), $pageLimit, true, $pos, 'pos'));
$crawlers = $this->crawlerRepository->getCrawlerRunEntries($pos, $pageLimit);
$i = 1;
if ($crawlers && $crawlers->count() > 0) {
foreach ($crawlers as $crawler) {
$this->template->setVariable(array($this->moduleNameLang . '_CRAWLER_RUN_ID' => $crawler->getId(), $this->moduleNameLang . '_CRAWLER_RUN_LANGUAGE' => $langArray[$crawler->getLang()]['name'], $this->moduleNameLang . '_CRAWLER_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getStartTime()), $this->moduleNameLang . '_CRAWLER_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($crawler->getStartTime(), $crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_TOTAL_LINKS' => $crawler->getTotalLinks(), $this->moduleNameLang . '_CRAWLER_RUN_BROKEN_LINKS' => $crawler->getTotalBrokenLinks(), $this->moduleNameLang . '_CRAWLER_RUN_STATUS' => ucfirst($crawler->getRunStatus()), $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1)));
$this->template->parse($this->moduleName . 'CrawlerRuns');
}
$this->template->hideBlock($this->moduleName . 'NoCrawlerRunsFound');
} else {
$this->template->touchBlock($this->moduleName . 'NoCrawlerRunsFound');
}
}
示例10: migrateCategories
/**
* migrate old categories to new category table
*/
protected function migrateCategories()
{
try {
$where = '';
if (!empty($_SESSION['contrexx_update']['calendar']['categories'])) {
$where = ' WHERE `id` > ' . $_SESSION['contrexx_update']['calendar']['categories'];
}
$result = \Cx\Lib\UpdateUtil::sql("SELECT `id`, `name`, `status`, `pos`, `lang` FROM `" . CALENDAR_OLD_CATEGORY_TABLE . "`" . $where . " ORDER BY `id`");
$languages = \FWLanguage::getLanguageArray();
while (!$result->EOF) {
\Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . CALENDAR_NEW_CATEGORY_TABLE . "` (`id`, `pos`,`status`)\r\n VALUES (\r\n " . intval($result->fields['id']) . ",\r\n " . intval($result->fields['pos']) . ",\r\n " . intval($result->fields['status']) . "\r\n )");
foreach ($languages as $id => $languageData) {
\Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . CALENDAR_NEW_CATEGORY_NAME_TABLE . "` (`cat_id`,`lang_id`,`name`)\r\n VALUES (\r\n " . intval($result->fields['id']) . ",\r\n " . intval($id) . ",\r\n '" . contrexx_raw2db($result->fields['name']) . "'\r\n )");
}
$_SESSION['contrexx_update']['calendar']['categories'] = intval($result->fields['id']);
if (!checkMemoryLimit() || !checkTimeoutLimit()) {
return 'timeout';
}
$result->MoveNext();
}
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例11: download
private function download()
{
global $_ARRAYLANG, $_LANGID;
$objFWUser = \FWUser::getFWUserObject();
$objDownload = new Download();
$objDownload->load(isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
if ($objDownload->getId() && !\Permission::checkAccess(143, 'static', true) && (($objFWUser = \FWUser::getFWUserObject()) == false || !$objFWUser->objUser->login() || $objDownload->getOwnerId() != $objFWUser->objUser->getId())) {
$this->arrStatusMsg['error'][] = $_ARRAYLANG['TXT_DOWNLOADS_MODIFY_DOWNLOAD_PROHIBITED'];
return $this->downloads();
}
$arrAssociatedGroupOptions = array();
$arrNotAssociatedGroupOptions = array();
$arrAssociatedGroups = array();
$arrAssociatedCategoryOptions = array();
$arrNotAssociatedCategoryOptions = array();
$arrAssociatedCategories = array();
$arrAssociatedDownloadOptions = array();
$arrNotAssociatedDownloadOptions = array();
if (isset($_POST['downloads_download_save'])) {
$objDownload->setNames(isset($_POST['downloads_download_name']) ? array_map('trim', array_map('contrexx_stripslashes', $_POST['downloads_download_name'])) : array());
$objDownload->setDescriptions(isset($_POST['downloads_download_description']) ? array_map('trim', array_map('contrexx_stripslashes', $_POST['downloads_download_description'])) : array());
$this->arrConfig['use_attr_metakeys'] ? $objDownload->setMetakeys(isset($_POST['downloads_download_metakeys']) ? array_map('trim', array_map('contrexx_stripslashes', $_POST['downloads_download_metakeys'])) : array()) : null;
$objDownload->setType(isset($_POST['downloads_download_type']) ? contrexx_stripslashes($_POST['downloads_download_type']) : '');
$objDownload->setSources(isset($_POST['downloads_download_' . $objDownload->getType() . '_source']) ? array_map('trim', array_map('contrexx_stripslashes', $_POST['downloads_download_' . $objDownload->getType() . '_source'])) : array());
$objDownload->setActiveStatus(!empty($_POST['downloads_download_is_active']));
$objDownload->setMimeType(isset($_POST['downloads_download_mime_type']) ? contrexx_stripslashes($_POST['downloads_download_mime_type']) : '');
$this->arrConfig['use_attr_size'] ? $objDownload->setSize(isset($_POST['downloads_download_size']) ? intval($_POST['downloads_download_size']) : '') : null;
$this->arrConfig['use_attr_license'] ? $objDownload->setLicense(isset($_POST['downloads_download_license']) ? contrexx_stripslashes($_POST['downloads_download_license']) : '') : null;
$this->arrConfig['use_attr_version'] ? $objDownload->setVersion(isset($_POST['downloads_download_version']) ? contrexx_stripslashes($_POST['downloads_download_version']) : '') : null;
$this->arrConfig['use_attr_author'] ? $objDownload->setAuthor(isset($_POST['downloads_download_author']) ? contrexx_stripslashes($_POST['downloads_download_author']) : '') : null;
$this->arrConfig['use_attr_website'] ? $objDownload->setWebsite(isset($_POST['downloads_download_website']) ? contrexx_stripslashes($_POST['downloads_download_website']) : '') : null;
$objDownload->setImage(isset($_POST['downloads_download_image']) ? contrexx_stripslashes($_POST['downloads_download_image']) : '');
$objDownload->setValidityTimePeriod(!empty($_POST['downloads_download_validity']) ? intval($_POST['downloads_download_validity']) : 0);
$objDownload->setVisibility(!empty($_POST['downloads_download_visibility']));
$objDownload->setProtection(!empty($_POST['downloads_download_access']));
$objDownload->setGroups($objDownload->getProtection() && !empty($_POST['downloads_download_access_associated_groups']) ? array_map('intval', $_POST['downloads_download_access_associated_groups']) : array());
$objDownload->setCategories(!empty($_POST['downloads_download_associated_categories']) ? array_map('intval', $_POST['downloads_download_associated_categories']) : array(0));
$objDownload->setDownloads(!empty($_POST['downloads_download_associated_downloads']) ? array_map('intval', $_POST['downloads_download_associated_downloads']) : array());
$objDownload->updateMTime();
if ($objDownload->store()) {
if (!empty($this->parentCategoryId)) {
header('location: ' . \Cx\Core\Csrf\Controller\Csrf::enhanceURI('index.php?cmd=Downloads&act=categories&parent_id=' . $this->parentCategoryId));
} else {
return $this->downloads();
}
} else {
$this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $objDownload->getErrorMsg());
}
}
$this->_pageTitle = $objDownload->getId() ? $_ARRAYLANG['TXT_DOWNLOADS_EDIT_DOWNLOAD'] : $_ARRAYLANG['TXT_DOWNLOADS_ADD_DOWNLOAD'];
$this->objTemplate->addBlockFile('DOWNLOADS_DOWNLOAD_TEMPLATE', 'module_downloads_downloads', 'module_downloads_download_modify.html');
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_GENERAL' => $_ARRAYLANG['TXT_DOWNLOADS_GENERAL'], 'TXT_DOWNLOADS_PERMISSIONS' => $_ARRAYLANG['TXT_DOWNLOADS_PERMISSIONS'], 'TXT_DOWNLOADS_DOWNLOAD_VISIBILITY_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOAD_VISIBILITY_DESC'], 'TXT_DOWNLOADS_NAME' => $_ARRAYLANG['TXT_DOWNLOADS_NAME'], 'TXT_DOWNLOADS_DESCRIPTION' => $_ARRAYLANG['TXT_DOWNLOADS_DESCRIPTION'], 'TXT_DOWNLOADS_SOURCE' => $_ARRAYLANG['TXT_DOWNLOADS_SOURCE'], 'TXT_DOWNLOADS_LOCAL_FILE' => $_ARRAYLANG['TXT_DOWNLOADS_LOCAL_FILE'], 'TXT_DOWNLOADS_URL' => $_ARRAYLANG['TXT_DOWNLOADS_URL'], 'TXT_DOWNLOADS_BROWSE' => $_ARRAYLANG['TXT_DOWNLOADS_BROWSE'], 'TXT_DOWNLOADS_STATUS' => $_ARRAYLANG['TXT_DOWNLOADS_STATUS'], 'TXT_DOWNLOADS_VALIDITY_EXPIRATION' => $_ARRAYLANG['TXT_DOWNLOADS_VALIDITY_EXPIRATION'], 'TXT_DOWNLOADS_ACTIVE' => $_ARRAYLANG['TXT_DOWNLOADS_ACTIVE'], 'TXT_DOWNLOADS_TYPE' => $_ARRAYLANG['TXT_DOWNLOADS_TYPE'], 'TXT_DOWNLOADS_METAKEYS' => $_ARRAYLANG['TXT_DOWNLOADS_METAKEYS'], 'TXT_DOWNLOADS_SIZE' => $_ARRAYLANG['TXT_DOWNLOADS_SIZE'], 'TXT_DOWNLOADS_LICENSE' => $_ARRAYLANG['TXT_DOWNLOADS_LICENSE'], 'TXT_DOWNLOADS_VERSION' => $_ARRAYLANG['TXT_DOWNLOADS_VERSION'], 'TXT_DOWNLOADS_AUTHOR' => $_ARRAYLANG['TXT_DOWNLOADS_AUTHOR'], 'TXT_DOWNLOADS_WEBSITE' => $_ARRAYLANG['TXT_DOWNLOADS_WEBSITE'], 'TXT_DOWNLOADS_IMAGE' => $_ARRAYLANG['TXT_DOWNLOADS_IMAGE'], 'TXT_DOWNLOADS_CATEGORIES' => $_ARRAYLANG['TXT_DOWNLOADS_CATEGORIES'], 'TXT_DOWNLOADS_AVAILABLE_CATEGORIES' => $_ARRAYLANG['TXT_DOWNLOADS_AVAILABLE_CATEGORIES'], 'TXT_DOWNLOADS_ASSIGNED_CATEGORIES' => $_ARRAYLANG['TXT_DOWNLOADS_ASSIGNED_CATEGORIES'], 'TXT_DOWNLOADS_RELATED_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_RELATED_DOWNLOADS'], 'TXT_DOWNLOADS_AVAILABLE_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_AVAILABLE_DOWNLOADS'], 'TXT_DOWNLOADS_ASSIGNED_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_ASSIGNED_DOWNLOADS'], 'TXT_DOWNLOADS_DOWNLOAD_ALL_ACCESS_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOAD_ALL_ACCESS_DESC'], 'TXT_DOWNLOADS_DOWNLOAD_SELECTED_ACCESS_DESC' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOAD_SELECTED_ACCESS_DESC'], 'TXT_DOWNLOADS_AVAILABLE_USER_GROUPS' => $_ARRAYLANG['TXT_DOWNLOADS_AVAILABLE_USER_GROUPS'], 'TXT_DOWNLOADS_ASSIGNED_USER_GROUPS' => $_ARRAYLANG['TXT_DOWNLOADS_ASSIGNED_USER_GROUPS'], 'TXT_DOWNLOADS_CHECK_ALL' => $_ARRAYLANG['TXT_DOWNLOADS_CHECK_ALL'], 'TXT_DOWNLOADS_UNCHECK_ALL' => $_ARRAYLANG['TXT_DOWNLOADS_UNCHECK_ALL'], 'TXT_DOWNLOADS_CANCEL' => $_ARRAYLANG['TXT_DOWNLOADS_CANCEL'], 'TXT_DOWNLOADS_SAVE' => $_ARRAYLANG['TXT_DOWNLOADS_SAVE']));
// parse sorting & paging of the categories overview section
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_CATEGORY_SORT' => !empty($_GET['category_sort']) ? $_GET['category_sort'] : '', 'DOWNLOADS_DOWNLOAD_CATEGORY_SORT_BY' => !empty($_GET['category_by']) ? $_GET['category_by'] : '', 'DOWNLOADS_DOWNLOAD_DOWNLOAD_SORT' => !empty($_GET['download_sort']) ? $_GET['download_sort'] : '', 'DOWNLOADS_DOWNLOAD_DOWNLOAD_BY' => !empty($_GET['download_by']) ? $_GET['download_by'] : '', 'DOWNLOADS_DOWNLOAD_CATEGORY_OFFSET' => !empty($_GET['category_pos']) ? intval($_GET['category_pos']) : 0, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_OFFSET' => !empty($_GET['download_pos']) ? intval($_GET['download_pos']) : 0));
// parse id
$this->objTemplate->setVariable('DOWNLOADS_DOWNLOAD_ID', $objDownload->getId());
// parse name and description attributres
$arrLanguages = \FWLanguage::getLanguageArray();
foreach ($arrLanguages as $langId => $arrLanguage) {
if ($arrLanguage['frontend'] == 1) {
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_NAME' => htmlentities($objDownload->getName($langId), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_DOWNLOAD_LANG_ID' => $langId, 'DOWNLOADS_DOWNLOAD_LANG_NAME' => htmlentities($arrLanguage['name'], ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->parse('downloads_download_name_list');
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_DESCRIPTION' => htmlentities($objDownload->getDescription($langId), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_DOWNLOAD_LANG_ID' => $langId, 'DOWNLOADS_DOWNLOAD_LANG_DESCRIPTION' => htmlentities($arrLanguage['name'], ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->parse('downloads_download_description_list');
if ($this->arrConfig['use_attr_metakeys']) {
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_METAKEYS' => htmlentities($objDownload->getMetakeys($langId), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_DOWNLOAD_LANG_ID' => $langId, 'DOWNLOADS_DOWNLOAD_LANG_METAKEYS' => htmlentities($arrLanguage['name'], ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->parse('downloads_download_metakeys_list');
}
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_LANG_ID' => $langId, 'DOWNLOADS_DOWNLOAD_FILE_SOURCE' => $objDownload->getType() == 'file' ? htmlentities($objDownload->getSource($langId), ENT_QUOTES, CONTREXX_CHARSET) : '', 'TXT_DOWNLOADS_BROWSE' => $_ARRAYLANG['TXT_DOWNLOADS_BROWSE'], 'DOWNLOADS_DOWNLOAD_LANG_NAME' => htmlentities($arrLanguage['name'], ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->parse('downloads_download_file_source_list');
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_LANG_ID' => $langId, 'DOWNLOADS_DOWNLOAD_URL_SOURCE' => $objDownload->getType() == 'url' ? htmlentities($objDownload->getSource($langId), ENT_QUOTES, CONTREXX_CHARSET) : 'http://', 'TXT_DOWNLOADS_BROWSE' => $_ARRAYLANG['TXT_DOWNLOADS_BROWSE'], 'DOWNLOADS_DOWNLOAD_LANG_NAME' => htmlentities($arrLanguage['name'], ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->parse('downloads_download_url_source_list');
}
}
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_NAME' => htmlentities($objDownload->getName(), ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DOWNLOADS_EXTENDED' => $_ARRAYLANG['TXT_DOWNLOADS_EXTENDED']));
$this->objTemplate->parse('downloads_download_name');
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_DESCRIPTION' => htmlentities($objDownload->getDescription(), ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DOWNLOADS_EXTENDED' => $_ARRAYLANG['TXT_DOWNLOADS_EXTENDED']));
$this->objTemplate->parse('downloads_download_description');
// parse metakeys
if ($this->arrConfig['use_attr_metakeys']) {
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_METAKEYS' => htmlentities($objDownload->getMetakeys(), ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DOWNLOADS_EXTENDED' => $_ARRAYLANG['TXT_DOWNLOADS_EXTENDED']));
$this->objTemplate->parse('downloads_download_metakeys');
$this->objTemplate->parse('downloads_download_attr_metakeys');
} else {
$this->objTemplate->hideBlock('downloads_download_attr_metakeys');
}
// parse type
$this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_TYPE_FILE_CHECKED' => $objDownload->getType() == 'file' ? 'checked="checked"' : '', 'DOWNLOADS_DOWNLOAD_TYPE_URL_CHECKED' => $objDownload->getType() == 'url' ? 'checked="checked"' : '', 'DOWNLOADS_DOWNLOAD_TYPE_FILE_CONFIG_DISPLAY' => $objDownload->getType() == 'file' ? 'block' : 'none', 'DOWNLOADS_DOWNLOAD_TYPE_URL_CONFIG_DISPLAY' => $objDownload->getType() == 'url' ? 'block' : 'none', 'DOWNLOADS_DOWNLOAD_FILE_SOURCE' => $objDownload->getType() == 'file' ? $objDownload->getSource() : '', 'DOWNLOADS_DOWNLOAD_URL_SOURCE' => $objDownload->getType() == 'url' ? $objDownload->getSource() : 'http://', 'TXT_DOWNLOADS_BROWSE' => $_ARRAYLANG['TXT_DOWNLOADS_BROWSE'], 'TXT_DOWNLOADS_EXTENDED' => $_ARRAYLANG['TXT_DOWNLOADS_EXTENDED']));
foreach (Download::$arrMimeTypes as $mimeType => $arrMimeType) {
if (!count($arrMimeType['extensions'])) {
continue;
}
$this->objTemplate->setVariable(array('DOWNLOADS_MIME_TYPE' => $mimeType, 'DOWNLOADS_FILE_EXTENSION_REGEXP' => implode('|', $arrMimeType['extensions'])));
$this->objTemplate->parse('downloads_download_file_ext_regexp');
}
// parse mime type
$this->objTemplate->setVariable('DOWNLOADS_DOWNLOAD_MIME_TYPE_MENU', $this->getDownloadMimeTypeMenu($objDownload->getMimeType()));
$attrRow = 0;
// parse size
if ($this->arrConfig['use_attr_size']) {
//.........这里部分代码省略.........
示例12: _settings
function _settings()
{
global $_ARRAYLANG, $_CONFIG;
$arrSettingsTabs = array("general", "block");
$defaultTab = 'general';
$selectedTab = !empty($_POST['podcast_settings_tab']) ? strtolower($_POST['podcast_settings_tab']) : $defaultTab;
$this->_objTpl->loadTemplatefile('module_podcast_settings.html');
$this->_pageTitle = $_ARRAYLANG['TXT_PODCAST_SETTINGS'];
$this->_objTpl->setVariable(array('TXT_PODCAST_SETTINGS' => $_ARRAYLANG['TXT_PODCAST_SETTINGS'], 'TXT_PODCAST_STANDARD_DIMENSIONS' => $_ARRAYLANG['TXT_PODCAST_STANDARD_DIMENSIONS'], 'TXT_PODCAST_PIXEL_WIDTH' => $_ARRAYLANG['TXT_PODCAST_PIXEL_WIDTH'], 'TXT_PODCAST_PIXEL_HEIGHT' => $_ARRAYLANG['TXT_PODCAST_PIXEL_HEIGHT'], 'TXT_PODCAST_LATEST_MEDIA_COUNT' => $_ARRAYLANG['TXT_PODCAST_LATEST_MEDIA_COUNT'], 'TXT_PODCAST_FEED_TITLE' => $_ARRAYLANG['TXT_PODCAST_FEED_TITLE'], 'TXT_PODCAST_FEED_DESCRIPTION' => $_ARRAYLANG['TXT_PODCAST_FEED_DESCRIPTION'], 'TXT_PODCAST_FEED_IMAGE' => $_ARRAYLANG['TXT_PODCAST_FEED_IMAGE'], 'TXT_PODCAST_FEED_LINK' => $_ARRAYLANG['TXT_PODCAST_FEED_LINK'], 'TXT_PODCAST_SAVE' => $_ARRAYLANG['TXT_PODCAST_SAVE'], 'TXT_PODCAST_PLACEHOLDERS' => $_ARRAYLANG['TXT_PODCAST_PLACEHOLDERS'], 'TXT_PODCAST_GENERAL' => $_ARRAYLANG['TXT_PODCAST_GENERAL'], 'TXT_PODCAST_BLOCK_TEMPLATE' => $_ARRAYLANG['TXT_PODCAST_BLOCK_TEMPLATE'], 'TXT_PODCAST_BLOCK_SETTINGS' => $_ARRAYLANG['TXT_PODCAST_BLOCK_SETTINGS'], 'TXT_PODCAST_SHOW_HOME_CONTENT' => $_ARRAYLANG['TXT_PODCAST_SHOW_HOME_CONTENT'], 'TXT_PODCAST_DEACTIVATE' => $_ARRAYLANG['TXT_PODCAST_DEACTIVATE'], 'TXT_PODCAST_ACTIVATE' => $_ARRAYLANG['TXT_PODCAST_ACTIVATE'], 'TXT_PODCAST_HOMECONTENT_USAGE' => $_ARRAYLANG['TXT_PODCAST_HOMECONTENT_USAGE'], 'TXT_PODCAST_HOMECONTENT_USAGE_TEXT' => $_ARRAYLANG['TXT_PODCAST_HOMECONTENT_USAGE_TEXT'], 'TXT_PODCAST_CATEGORIES' => $_ARRAYLANG['TXT_PODCAST_CATEGORIES'], 'TXT_PODCAST_THUMB_MAX_SIZE' => $_ARRAYLANG['TXT_PODCAST_THUMB_MAX_SIZE'], 'TXT_PODCAST_THUMB_MAX_SIZE_HOMECONTENT' => $_ARRAYLANG['TXT_PODCAST_THUMB_MAX_SIZE_HOMECONTENT'], 'TXT_PODCAST_PIXEL' => $_ARRAYLANG['TXT_PODCAST_PIXEL'], 'TXT_PODCAST_PLAY' => $_ARRAYLANG['TXT_PODCAST_PLAY'], 'TXT_PODCAST_MEDIA_DATE' => $_ARRAYLANG['TXT_PODCAST_MEDIA_DATE'], 'TXT_PODCAST_MEDIA_TITLE' => $_ARRAYLANG['TXT_PODCAST_MEDIA_TITLE'], 'TXT_PODCAST_MEDIA_PLAYLENGTH' => $_ARRAYLANG['TXT_PODCAST_MEDIA_PLAYLENGTH'], 'TXT_PODCAST_MEDIA_ID' => $_ARRAYLANG['TXT_PODCAST_MEDIA_ID'], 'TXT_PODCAST_MEDIA_VIEWS_COUNT' => $_ARRAYLANG['TXT_PODCAST_MEDIA_VIEWS_COUNT'], 'TXT_PODCAST_MEDIA_VIEWS' => $_ARRAYLANG['TXT_PODCAST_MEDIA_VIEWS'], 'TXT_PODCAST_MEDIA_AUTHOR' => $_ARRAYLANG['TXT_PODCAST_MEDIA_AUTHOR'], 'TXT_PODCAST_MEDIA_SHORT_PLAYLENGTH' => $_ARRAYLANG['TXT_PODCAST_MEDIA_SHORT_PLAYLENGTH'], 'TXT_PODCAST_MEDIA_PLAYLENGTH' => $_ARRAYLANG['TXT_PODCAST_MEDIA_PLAYLENGTH'], 'TXT_PODCAST_MEDIA_URL' => $_ARRAYLANG['TXT_PODCAST_MEDIA_URL'], 'TXT_PODCAST_MEDIA_THUMBNAIL' => $_ARRAYLANG['TXT_PODCAST_MEDIA_THUMBNAIL'], 'TXT_PODCAST_MEDIA_SHORT_DATE' => $_ARRAYLANG['TXT_PODCAST_MEDIA_SHORT_DATE'], 'TXT_PODCAST_MEDIA_DESCRIPTION' => $_ARRAYLANG['TXT_PODCAST_MEDIA_DESCRIPTION'], 'TXT_PODCAST_AUTO_VALIDATE' => $_ARRAYLANG['TXT_PODCAST_AUTO_VALIDATE'], 'PODCAST_BROWSE' => self::getMediaBrowserButton($_ARRAYLANG['TXT_PODCAST_BROWSE'], array('data-cx-mb-views' => 'filebrowser', 'type' => 'button', 'style' => 'width:110px;'), 'mediaBrowserCallback')));
if (isset($_POST['podcast_save_settings'])) {
$arrNewSettings['auto_validate'] = $_POST['podcast_settings_auto_validate'] > 0 ? 1 : 0;
if (!empty($_POST['podcast_settings_default_width'])) {
$arrNewSettings['default_width'] = intval($_POST['podcast_settings_default_width']);
}
if (!empty($_POST['podcast_settings_default_height'])) {
$arrNewSettings['default_height'] = intval($_POST['podcast_settings_default_height']);
}
$arrNewSettings['latest_media_count'] = !empty($_POST['podcast_settings_latest_media_count']) && intval($_POST['podcast_settings_latest_media_count']) > 0 ? intval($_POST['podcast_settings_latest_media_count']) : 1;
$arrNewSettings['thumb_max_size'] = !empty($_POST['podcast_settings_thumb_max_size']) && intval($_POST['podcast_settings_thumb_max_size']) > 0 ? intval($_POST['podcast_settings_thumb_max_size']) : 50;
$arrNewSettings['thumb_max_size_homecontent'] = !empty($_POST['podcast_settings_thumb_max_size_homecontent']) && intval($_POST['podcast_settings_thumb_max_size_homecontent']) > 0 ? intval($_POST['podcast_settings_thumb_max_size_homecontent']) : 50;
$arrNewSettings['feed_title'] = isset($_POST['podcast_settings_feed_title']) ? $_POST['podcast_settings_feed_title'] : '';
$arrNewSettings['feed_description'] = isset($_POST['podcast_settings_feed_description']) ? $_POST['podcast_settings_feed_description'] : '';
$arrNewSettings['feed_image'] = isset($_POST['podcast_settings_feed_image']) ? $_POST['podcast_settings_feed_image'] : '';
if ($this->_updateSettings($arrNewSettings) && $this->_updateHomeContentSettings()) {
$this->_createRSS();
$this->_strOkMessage = $_ARRAYLANG['TXT_PODCAST_UPDATE_SETTINGS_SUCCESSFULL'];
} else {
$this->_strErrMessage = $_ARRAYLANG['TXT_PODCAST_UPDATE_SETTINGS_FAILED'];
}
}
$this->_objTpl->setVariable(array('PODCAST_SETTINGS_DEFAULT_WIDTH' => $this->_arrSettings['default_width'], 'PODCAST_SETTINGS_DEFAULT_HEIGHT' => $this->_arrSettings['default_height'], 'PODCAST_SETTINGS_LATEST_MEDIA_COUNT' => $this->_arrSettings['latest_media_count'], 'PODCAST_SETTINGS_THUMB_MAX_SIZE' => $this->_arrSettings['thumb_max_size'], 'PODCAST_SETTINGS_THUMB_MAX_SIZE_HOMECONTENT' => $this->_arrSettings['thumb_max_size_homecontent'], 'PODCAST_SETTINGS_SHOW_HOMECONTENT_' . $_CONFIG['podcastHomeContent'] => 'checked="checked"', 'PODCAST_SETTINGS_AUTO_VALIDATE_' . $this->_arrSettings['auto_validate'] => 'checked="checked"', 'PODCAST_SETTINGS_FEED_TITLE' => $this->_arrSettings['feed_title'], 'PODCAST_SETTINGS_FEED_DESCRIPTION' => $this->_arrSettings['feed_description'], 'PODCAST_SETTINGS_FEED_IMAGE' => $this->_arrSettings['feed_image'], 'PODCAST_SETTINGS_TAB' => $selectedTab, 'PODCAST_SETTINGS_FEED_URL' => ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_FEED_WEB_PATH . '/podcast.xml'));
if (!in_array($selectedTab, $arrSettingsTabs)) {
$selectedTab = $defaultTab;
}
foreach ($arrSettingsTabs as $tab) {
$this->_objTpl->setVariable(array('PODCAST_SETTINGS_' . strtoupper($tab) . '_DIV_DISPLAY' => sprintf('style="display: %s;"', $selectedTab == $tab ? 'block' : 'none'), 'PODCAST_SETTINGS_' . strtoupper($tab) . '_TAB_CLASS' => $selectedTab == $tab ? 'class="active"' : ''));
}
$mediumCategories = array();
if (isset($_POST['podcast_save_settings'])) {
$arrPostCategories = !empty($_POST['podcast_medium_associated_category']) ? $_POST['podcast_medium_associated_category'] : array();
foreach ($arrPostCategories as $categoryId => $status) {
if (intval($status) == 1) {
array_push($mediumCategories, intval($categoryId));
}
}
$this->_setHomecontentCategories($mediumCategories);
} else {
$mediumCategories = $this->_getHomecontentCategories();
}
$arrCategories =& $this->_getCategories();
$categoryNr = 0;
$arrLanguages = \FWLanguage::getLanguageArray();
foreach ($arrCategories as $categoryId => $arrCategory) {
$column = $categoryNr % 3;
$arrCatLangIds =& $this->_getLangIdsOfCategory($categoryId);
array_walk($arrCatLangIds, create_function('&$cat, $k, $arrLanguages', '$cat = $arrLanguages[$cat]["lang"];'), $arrLanguages);
$arrCategory['title'] .= ' (' . implode(', ', $arrCatLangIds) . ')';
$this->_objTpl->setVariable(array('PODCAST_CATEGORY_ID' => $categoryId, 'PODCAST_CATEGORY_ASSOCIATED' => in_array($categoryId, $mediumCategories) ? 'checked="checked"' : '', 'PODCAST_SHOW_MEDIA_OF_CATEGORY_TXT' => sprintf($_ARRAYLANG['TXT_PODCAST_SHOW_MEDIA_OF_CATEGORY'], $arrCategory['title']), 'PODCAST_CATEGORY_NAME' => $arrCategory['title']));
$this->_objTpl->parse('podcast_medium_associated_category_' . $column);
$categoryNr++;
}
}
示例13: loadLanguageAccountAttribute
private function loadLanguageAccountAttribute()
{
global $_CORELANG;
$arrScope = array('frontend', 'backend');
$this->arrAccountAttributes['frontend_language']['children'][0] = $this->arrAccountAttributes['backend_language']['children'][0] = $_CORELANG['TXT_ACCESS_DEFAULT'];
foreach (\FWLanguage::getLanguageArray() as $langId => $arrLanguage) {
foreach ($arrScope as $scope) {
if ($arrLanguage[$scope]) {
$this->arrAccountAttributes[$scope . '_language']['children'][$langId] = $arrLanguage['name'];
}
}
}
}
示例14: _modifyForm
/**
* Modify Form
*
* Shows the modifying page.
* @access private
* @param bool $copy If the form should be copied or not
*/
function _modifyForm($copy = false)
{
global $_ARRAYLANG, $_CONFIG, $objDatabase;
\JS::activate('cx');
if ($copy) {
$this->initContactForms();
}
$this->_objTpl->loadTemplateFile('module_contact_form_modify.html');
$formId = isset($_REQUEST['formId']) ? intval($_REQUEST['formId']) : 0;
$this->_pageTitle = !$copy && $formId != 0 ? $_ARRAYLANG['TXT_CONTACT_MODIFY_CONTACT_FORM'] : $_ARRAYLANG['TXT_CONTACT_ADD_NEW_CONTACT_FORM'];
$actionTitle = $_ARRAYLANG['TXT_CONTACT_ADD_NEW_CONTACT_FORM'];
$showForm = 0;
$useCaptcha = 1;
$saveDataInCRM = 0;
$useCustomStyle = 0;
$sendCopy = 0;
$useEmailOfSender = 0;
$sendHtmlMail = 1;
$sendAttachment = 0;
$emails = $_CONFIG['contactFormEmail'];
$crmCustomerGroups = array();
$arrActiveSystemFrontendLanguages = \FWLanguage::getActiveFrontendLanguages();
if (count($arrActiveSystemFrontendLanguages) == 1) {
$this->_objTpl->setVariable('CONTACT_LANGUAGE_TABS_DISPLAY', 'display: none');
}
if (isset($this->arrForms[$formId])) {
// editing
$actionTitle = $_ARRAYLANG['TXT_CONTACT_MODIFY_CONTACT_FORM'];
$showForm = $this->arrForms[$formId]['showForm'];
$useCaptcha = $this->arrForms[$formId]['useCaptcha'];
$saveDataInCRM = $this->arrForms[$formId]['saveDataInCRM'];
$useCustomStyle = $this->arrForms[$formId]['useCustomStyle'];
$sendCopy = $this->arrForms[$formId]['sendCopy'];
$useEmailOfSender = $this->arrForms[$formId]['useEmailOfSender'];
$sendHtmlMail = $this->arrForms[$formId]['htmlMail'];
$sendAttachment = $this->arrForms[$formId]['sendAttachment'];
$emails = $this->arrForms[$formId]['emails'];
$crmCustomerGroups = !empty($this->arrForms[$formId]['crmCustomerGroups']) ? $this->arrForms[$formId]['crmCustomerGroups'] : array();
}
if (count($arrActiveSystemFrontendLanguages) > 0) {
$intLanguageCounter = 0;
$arrLanguages = array(0 => '', 1 => '', 2 => '');
$strJsTabToDiv = '';
foreach ($arrActiveSystemFrontendLanguages as $langId => $arrLanguage) {
// Bugfix: if only one language is activated, it must be true, so the fields can be saved
if (count($arrActiveSystemFrontendLanguages) == 1) {
$boolLanguageIsActive = true;
} elseif ($formId) {
$boolLanguageIsActive = isset($this->arrForms[$formId]['lang'][$langId]) && $this->arrForms[$formId]['lang'][$langId]['is_active'];
} else {
$boolLanguageIsActive = $langId == FRONTEND_LANG_ID;
}
$arrLanguages[$intLanguageCounter % 3] .= '<input id="languagebar_' . $langId . '" ' . ($boolLanguageIsActive ? 'checked="checked"' : '') . ' type="checkbox" name="contactFormLanguages[' . $langId . ']" value="1" onclick="switchBoxAndTab(this, \'addFrom_' . $langId . '\');" /><label for="languagebar_' . $langId . '">' . contrexx_raw2xhtml($arrLanguage['name']) . ' [' . $arrLanguage['lang'] . ']</label><br />';
$strJsTabToDiv .= 'arrTabToDiv["addFrom_' . $langId . '"] = "langTab_' . $langId . '";' . "\n";
++$intLanguageCounter;
}
$this->_objTpl->setVariable(array('TXT_CONTACT_LANGUAGE' => $_ARRAYLANG['TXT_CONTACT_LANGUAGE'], 'EDIT_LANGUAGES_1' => $arrLanguages[0], 'EDIT_LANGUAGES_2' => $arrLanguages[1], 'EDIT_LANGUAGES_3' => $arrLanguages[2], 'EDIT_JS_TAB_TO_DIV' => $strJsTabToDiv));
}
// TODO: this might be a bug. Shouldn't this be the MAX(of used IDs) when modifying a form
$lastFieldId = 0;
if (empty($_POST['saveForm'])) {
// get the saved fields
$fields = $this->getFormFields($formId);
$recipients = $this->getRecipients($formId);
} else {
$fields = $this->_getFormFieldsFromPost();
$recipients = $this->getRecipientsFromPost();
}
$objCrmLibrary = new \Cx\Modules\Crm\Controller\CrmLibrary('Crm');
$memberships = array_keys($objCrmLibrary->getMemberships());
$objCrmLibrary->getMembershipDropdown($this->_objTpl, $memberships, "contactMembership", $crmCustomerGroups);
// make an empty one so at least one is parsed
if (empty($fields)) {
foreach ($arrActiveSystemFrontendLanguages as $lang) {
$fields[0] = array('type' => 'text', 'order_id' => 0, 'is_required' => false, 'check_type' => 1, 'editType' => 'new');
$fields[0]['lang'][$lang['id']] = array('name' => '', 'value' => '');
}
}
if (!$formId) {
$selectedInterfaceLanguage = FRONTEND_LANG_ID;
} elseif (isset($this->arrForms[$formId]['lang'][FRONTEND_LANG_ID])) {
$selectedInterfaceLanguage = FRONTEND_LANG_ID;
} elseif (isset($this->arrForms[$formId]['lang'][\FWLanguage::getDefaultLangId()])) {
$selectedInterfaceLanguage = \FWLanguage::getDefaultLangId();
} elseif (count($this->arrForms[$formId]['lang'])) {
$selectedInterfaceLanguage = key($this->arrForms[$formId]['lang']);
}
foreach (\FWLanguage::getLanguageArray() as $language) {
if ($language['id'] == $selectedInterfaceLanguage && $language["frontend"] == 0) {
$selectedInterfaceLanguage = \FWLanguage::getDefaultLangId();
}
}
//Get the fallback languages array
//.........这里部分代码省略.........
示例15: catch
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}
$arrContentSites = array('media1', 'media2', 'media3', 'media4');
// replace source url to image
foreach ($arrContentSites as $module) {
try {
\Cx\Lib\UpdateUtil::migrateContentPage($module, '', 'images/modules/media/_base.gif', 'core_modules/media/View/Media/_base.gif', '3.1.2');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}
// update calendar data to version 3.2.0
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.2.0')) {
$languages = FWLanguage::getLanguageArray();
try {
$result = \Cx\Lib\UpdateUtil::sql('SELECT `id`, `invitation_email_template`, `email_template` FROM `' . DBPREFIX . 'module_calendar_event`');
if ($result && $result->RecordCount() > 0) {
while (!$result->EOF) {
// if the event has been already migrated, continue
if (intval($result->fields['invitation_email_template']) != $result->fields['invitation_email_template']) {
$result->MoveNext();
continue;
}
$invitationEmailTemplate = array();
$emailTemplate = array();
foreach ($languages as $langId => $langData) {
$invitationEmailTemplate[$langId] = $result->fields['invitation_email_template'];
$emailTemplate[$langId] = $result->fields['email_template'];
}