本文整理汇总了PHP中contrexx_addslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP contrexx_addslashes函数的具体用法?PHP contrexx_addslashes怎么用?PHP contrexx_addslashes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contrexx_addslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSettings
function setSettings($arrSettings)
{
global $objDatabase;
$status = true;
foreach ($arrSettings as $key => $arrSetting) {
if ($objDatabase->Execute('UPDATE `' . DBPREFIX . 'access_settings` SET `value` = \'' . contrexx_addslashes($arrSetting['value']) . '\', `status` = ' . intval($arrSetting['status']) . ' WHERE `key` = \'' . contrexx_addslashes($key) . '\'') === false) {
$status = false;
}
}
return $status;
}
示例2: getUserID
/**
*
* Selects the username with the id of the user who has loggged on.
* @global $objDatabase
*/
function getUserID($userName)
{
global $objDatabase;
$arrSettings = \User_Setting::getSettings();
$where = array();
$where[] = '`email` = "' . $userName . '"';
if ($arrSettings['use_usernames']['status']) {
$where[] = '`username` = "' . $userName . '"';
}
$userName = contrexx_addslashes($userName);
$selUserID = 'SELECT id FROM ' . DBPREFIX . 'access_users
WHERE (' . implode(' OR ', $where) . ') AND
active=1';
$objResult = $objDatabase->Execute($selUserID);
while (!$objResult->EOF) {
$ID = $objResult->fields['id'];
$objResult->MoveNext();
}
return $ID;
}
示例3: storeTemplate
/**
* Update or add new template
*/
function storeTemplate()
{
global $objDatabase;
if (empty($_POST['mails'])) {
return '';
}
// Use the posted template ID only if the "store as new" checkbox
// hasn't been marked
$template_id = empty($_POST['shopMailSaveNew']) && !empty($_POST['tplId']) ? $_POST['tplId'] : 0;
if (empty($_POST['langId'])) {
return '';
}
$lang_id = $_POST['langId'];
self::init($lang_id);
if ($template_id) {
$arrTemplate = self::$arrTemplate[$template_id];
if (!$arrTemplate) {
// Template not found. Clear the ID.
$template_id = 0;
}
}
// If the template ID is known, update.
// Note that the protected flag is not changed.
// For newly inserted templates, the protected flag is always 0 (zero).
$query = $template_id && isset(self::$arrTemplate[$template_id]) ? "UPDATE " . DBPREFIX . "module_shop" . MODULE_INDEX . "_mail\n SET `tplname`='" . contrexx_addslashes($_POST['shopMailTemplate']) . "'\n WHERE `id`={$template_id}" : "INSERT INTO " . DBPREFIX . "module_shop" . MODULE_INDEX . "_mail (\n `protected`, `tplname`\n ) VALUES (\n 0,\n '" . contrexx_addslashes($_POST['shopMailTemplate']) . "'\n )";
$objResult = $objDatabase->Execute($query);
if (!$objResult) {
return false;
}
if (empty($template_id)) {
$template_id = $objDatabase->Insert_ID();
}
$query = $template_id && self::$arrTemplate[$template_id]['available'] ? "UPDATE " . DBPREFIX . "module_shop" . MODULE_INDEX . "_mail_content\n SET `from_mail`='" . contrexx_addslashes($_POST['shopMailFromAddress']) . "',\n `xsender`='" . contrexx_addslashes($_POST['shopMailFromName']) . "',\n `subject`='" . contrexx_addslashes($_POST['shopMailSubject']) . "',\n `message`='" . contrexx_addslashes($_POST['shopMailBody']) . "'\n WHERE `tpl_id`={$template_id}\n AND `lang_id`={$lang_id}" : "INSERT INTO " . DBPREFIX . "module_shop" . MODULE_INDEX . "_mail_content (\n `tpl_id`, `lang_id`,\n `from_mail`, `xsender`,\n `subject`, `message`\n ) VALUES (\n {$template_id}, {$lang_id},\n '" . contrexx_addslashes($_POST['shopMailFromAddress']) . "',\n '" . contrexx_addslashes($_POST['shopMailFromName']) . "',\n '" . contrexx_addslashes($_POST['shopMailSubject']) . "',\n '" . contrexx_addslashes($_POST['shopMailBody']) . "'\n )";
$objResult = $objDatabase->Execute($query);
if (!$objResult) {
return false;
}
return true;
}
示例4: 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;
}
}
}
示例5: _handleUpload
/**
* handles the upload of a file
*
* @param string $inputName name of the HTML input element used to upload the file
*
* @return array $uploadedFileInfo array containing the properties for the uploaded file,
* false when upload has failed
*/
function _handleUpload($inputName)
{
global $_ARRAYLANG, $sessionObj;
$fileName = isset($_POST[$inputName]) ? contrexx_input2raw($_POST[$inputName]) : '';
if (empty($fileName)) {
return array('name' => '', 'path' => '', 'size' => 0);
}
$uploaderId = isset($_POST['forumUploaderId']) ? contrexx_input2raw($_POST['forumUploaderId']) : '';
if (empty($uploaderId)) {
\DBG::log('Uploader id is empty');
return false;
}
//Re-initialize the $sessionObj if it is empty
if (empty($sessionObj)) {
$sessionObj = \cmsSession::getInstance();
}
$tempPath = $sessionObj->getTempPath() . '/' . $uploaderId . '/' . $fileName;
if (!\Cx\Lib\FileSystem\FileSystem::exists($tempPath)) {
return false;
}
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$filePath = $cx->getWebsiteMediaForumUploadPath() . '/';
$pathinfo = pathinfo($fileName);
$i = 1;
while (\Cx\Lib\FileSystem\FileSystem::exists($filePath . $fileName)) {
$fileName = $pathinfo['filename'] . '_' . $i++ . '.' . $pathinfo['extension'];
}
if (\Cx\Lib\FileSystem\FileSystem::move($tempPath, $filePath . $fileName, true) === false) {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', $filePath . $fileName . ': ' . $_ARRAYLANG['TXT_FORUM_UPLOAD_NOT_MOVABLE']);
return false;
}
return array('name' => contrexx_addslashes($fileName), 'path' => $filePath, 'size' => filesize($filePath . $fileName));
}
示例6: addContent
/**
* Add content data for a category
*
* Add the content data for a category that later will be inserted
* @param int $lang
* @param string $name
*/
public function addContent($lang, $name)
{
$this->insertContent[] = array('lang' => intval($lang), 'name' => contrexx_addslashes($name));
}
示例7: updateBanner
/**
* Update values for a banner
*
* @global object $objDatabase
* @global array $_ARRAYLANG
* @return integer $intReturn: The old group of the changed banner
*/
function updateBanner()
{
global $objDatabase, $_ARRAYLANG;
$intBannerId = intval($_POST['bannerId']);
$strName = htmlspecialchars(addslashes($_POST['bannerName']), ENT_QUOTES, CONTREXX_CHARSET);
$intGroupId = intval($_POST['bannerGroupId']);
$intStatus = intval($_POST['bannerStatus']);
$strCode = contrexx_addslashes($_POST['bannerCode']);
if (!empty($strName) && $intGroupId != 0) {
$objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_banner_system
SET parent_id=' . $intGroupId . ',
name="' . $strName . '",
banner_code="' . $strCode . '",
status=' . $intStatus . '
WHERE id=' . $intBannerId . '
LIMIT 1
');
$objDatabase->Execute(' DELETE
FROM ' . DBPREFIX . 'module_banner_relations
WHERE banner_id=' . $intBannerId . '
');
if (is_array($_POST['selectedPages'])) {
foreach ($_POST['selectedPages'] as $intPageId) {
$objDatabase->Execute(' INSERT
INTO ' . DBPREFIX . 'module_banner_relations
SET banner_id=' . $intBannerId . ',
group_id=' . $intGroupId . ',
page_id=' . $intPageId . ',
type="content"
');
}
}
if (is_array($_POST['selectedNews'])) {
foreach ($_POST['selectedNews'] as $intPageId) {
$objDatabase->Execute(' INSERT
INTO ' . DBPREFIX . 'module_banner_relations
SET banner_id=' . $intBannerId . ',
group_id=' . $intGroupId . ',
page_id=' . $intPageId . ',
type="news"
');
}
}
if (is_array($_POST['selectedTeaser'])) {
foreach ($_POST['selectedTeaser'] as $intPageId) {
$objDatabase->Execute(' INSERT
INTO ' . DBPREFIX . 'module_banner_relations
SET banner_id=' . $intBannerId . ',
group_id=' . $intGroupId . ',
page_id=' . $intPageId . ',
type="teaser"
');
}
}
$this->strOkMessage = $_ARRAYLANG['TXT_BANNER_UPDATE_DONE'];
}
return $intGroupId;
}
示例8: __construct
/**
* Loads the event manager configuration
*
* @param integer $startDate Start date Unix timestamp
* @param integer $endDate End date timestamp
* @param integer $categoryId Category Id
* @param string $searchTerm Search Term
* @param boolean $showSeries Show Series
* @param boolean $needAuth Need authorization
* @param boolean $onlyActive Only active Events
* @param integer $startPos Start position
* @param integer $numEvents Number of events
* @param string $sortDirection Sort direction, possible values ASC, DESC
* @param boolean $onlyConfirmed only confirmed Entries
* @param string $author author name
*/
function __construct($startDate = null, $endDate = null, $categoryId = null, $searchTerm = null, $showSeries = true, $needAuth = false, $onlyActive = false, $startPos = 0, $numEvents = 'n', $sortDirection = 'ASC', $onlyConfirmed = true, $author = null, $listType = 'all')
{
$this->startDate = intval($startDate);
$this->endDate = intval($endDate);
$this->categoryId = intval($categoryId);
$this->showSeries = $showSeries;
$this->searchTerm = contrexx_addslashes($searchTerm);
$this->needAuth = $needAuth;
$this->onlyActive = $onlyActive;
$this->startPos = $startPos;
$this->numEvents = $numEvents;
$this->sortDirection = $sortDirection;
$this->onlyConfirmed = $onlyConfirmed;
$this->author = $author;
$this->listType = $listType;
}
示例9: saveLevel
function saveLevel($arrData, $intLevelId = null)
{
global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
//get data
$intId = intval($intLevelId);
$intParentId = intval($arrData['levelPosition']);
$intShowEntries = intval($arrData['levelShowEntries']);
$intShowSublevels = isset($arrData['levelShowSublevels']) ? contrexx_input2int($arrData['levelShowSublevels']) : 0;
$intShowCategories = intval($arrData['levelShowCategories']);
$intActive = intval($arrData['levelActive']);
$strPicture = contrexx_addslashes(contrexx_strip_tags($arrData['levelImage']));
$arrName = $arrData['levelName'];
$arrDescription = $arrData['levelDescription'];
if (empty($intId)) {
//insert new category
$objInsertAttributes = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_levels\n SET\n `parent_id`='" . $intParentId . "',\n `order`=0,\n `show_entries`='" . $intShowEntries . "',\n `show_sublevels`='" . $intShowSublevels . "',\n `show_categories`='" . $intShowCategories . "',\n `picture`='" . $strPicture . "',\n `active`='" . $intActive . "'\n ");
if ($objInsertAttributes !== false) {
$intId = $objDatabase->Insert_ID();
foreach ($this->arrFrontendLanguages as $key => $arrLang) {
if (empty($arrName[0])) {
$arrName[0] = "[[" . $_ARRAYLANG['TXT_MEDIADIR_NEW_LEVEL'] . "]]";
}
if (empty($arrDescription[0])) {
$arrDescription[0] = isset($arrDescription[$_LANGID]) ? $arrDescription[$_LANGID] : '';
}
$strName = $arrName[$arrLang['id']];
$strDescription = $arrDescription[$arrLang['id']];
if (empty($strName)) {
$strName = $arrName[0];
}
if (empty($strDescription)) {
$strDescription = $arrDescription[0];
}
$objInsertNames = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_level_names\n SET\n `lang_id`='" . intval($arrLang['id']) . "',\n `level_id`='" . intval($intId) . "',\n `level_name`='" . contrexx_raw2db(contrexx_input2raw($strName)) . "',\n `level_description`='" . contrexx_raw2db(contrexx_input2raw($strDescription)) . "'\n ");
}
if ($objInsertNames !== false) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
//update category
if ($intParentId == $intLevelId) {
$parentSql = null;
} else {
$parentSql = "`parent_id`='" . $intParentId . "',";
}
$objUpdateAttributes = $objDatabase->Execute("\n UPDATE\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_levels\n SET\n " . $parentSql . "\n `show_entries`='" . $intShowEntries . "',\n `show_sublevels`='" . $intShowSublevels . "',\n `show_categories`='" . $intShowCategories . "',\n `picture`='" . $strPicture . "',\n `active`='" . $intActive . "'\n WHERE\n `id`='" . $intId . "'\n ");
if ($objUpdateAttributes !== false) {
$objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_level_names WHERE level_id='" . $intId . "'");
foreach ($this->arrFrontendLanguages as $key => $arrLang) {
if (empty($arrName[0])) {
$arrName[0] = "[[" . $_ARRAYLANG['TXT_MEDIADIR_NEW_LEVEL'] . "]]";
}
if (empty($arrDescription[0])) {
$arrDescription[0] = isset($arrDescription[$_LANGID]) ? $arrDescription[$_LANGID] : '';
}
$strName = $arrName[$arrLang['id']];
$strDescription = $arrDescription[$arrLang['id']];
if (empty($strName)) {
$strName = $arrName[0];
}
if (empty($strDescription)) {
$strDescription = $arrDescription[0];
}
$objInsertNames = $objDatabase->Execute("\n INSERT INTO\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_level_names\n SET\n `lang_id`='" . intval($arrLang['id']) . "',\n `level_id`='" . intval($intId) . "',\n `level_name`='" . contrexx_raw2db(contrexx_input2raw($strName)) . "',\n `level_description`='" . contrexx_raw2db(contrexx_input2raw($strDescription)) . "'\n ");
}
if ($objInsertNames !== false) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
示例10: _memberList
/**
* Memberlist
*
* @access private
* @global ADONewConnection
* @global array
* @global array
*/
function _memberList()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
$this->setDirs(0, true);
$this->_objTpl->setTemplate($this->pageContent, true, true);
$dirid = intval($_GET['id']);
$this->_objTpl->setGlobalVariable(array("TXT_OVERVIEW" => $_ARRAYLANG['TXT_OVERVIEW']));
$treeid = $dirid;
$tree = array();
while ($treeid > 0) {
$temp = array('id' => $treeid, 'name' => $this->directories[$treeid]['name']);
$tree[] = $temp;
$treeid = $this->directories[$treeid]['parentdir'];
}
$tree = array_reverse($tree);
foreach ($tree as $branch) {
$this->_objTpl->setVariable(array("MEMBERDIR_DIRID" => $branch['id'], "MEMBERDIR_DIRNAME" => $branch['name']));
$this->_objTpl->parse("tree-element");
}
$this->_objTpl->parse("tree");
if ($this->directories[$dirid]['displaymode'] == 0 || $this->directories[$dirid]['displaymode'] == 1) {
$lastlevel = 0;
if ($this->directories[$dirid]['has_children']) {
$this->_objTpl->setVariable(array("TXT_CATEGORY_TREE_DESC" => "<div style=\"margin-bottom: 5px;\">" . $_ARRAYLANG['TXT_SUBDIRECTORIES'] . "</div>", 'TXT_MEMBERDIR_EXPORT_CONTACT_AS_VCARD' => $_ARRAYLANG['TXT_MEMBERDIR_EXPORT_CONTACT_AS_VCARD']));
}
foreach ($this->directories as $dirkey => $directory) {
// check language
if ($directory['lang'] != 0 && $directory['lang'] != $this->langId) {
continue;
}
if ($directory['active'] && $directory['parentdir'] == $dirid && $dirkey != 0) {
$this->_objTpl->setVariable(array("MEMBERDIR_DIR_ID" => $dirkey, "MEMBERDIR_DIR_NAME" => $directory['name'], "MEMBERDIR_IMAGE_SRC" => "pixel.gif"));
$this->_objTpl->parse("category");
}
}
$this->_objTpl->parse("category_list");
$this->_objTpl->hideBlock("category_show");
}
if ($this->directories[$dirid]['displaymode'] == 0 || $this->directories[$dirid]['displaymode'] == 2) {
if (empty($_GET['sort'])) {
$_GET['sort'] = "";
}
if (empty($_GET['search'])) {
$_GET['search'] = "";
}
$keyword = isset($_GET['keyword']) ? contrexx_addslashes($_GET['keyword']) : "";
$sort = contrexx_addslashes($_GET['sort']);
$this->_objTpl->setGlobalVariable(array("MEMBERDIR_DIRID" => $dirid, "MEMBERDIR_CHAR_LIST" => $this->_getCharList(CONTREXX_DIRECTORY_INDEX . "?section=MemberDir&cmd=" . htmlentities($_GET['cmd'], ENT_QUOTES, CONTREXX_CHARSET) . "&id=" . $dirid . "&sort={$sort}"), "MEMBERDIR_DESCRIPTION" => nl2br($this->directories[$dirid]['description'])));
$sortField = $this->directories[$dirid]['sort'];
if ($sort == "sc") {
/* Special Chars */
$query = "SELECT *\n FROM " . DBPREFIX . "module_memberdir_values\n WHERE `1` REGEXP '^[^a-zA-Z]' AND\n `dirid` = '{$dirid}'";
} elseif (preg_match("%^[a-z]\$%i", $sort)) {
/* Sort by char */
$query = "SELECT *\n FROM " . DBPREFIX . "module_memberdir_values\n WHERE `1` REGEXP '^" . $sort . "' AND\n `dirid` = '{$dirid}'";
} elseif ($_GET['search'] == "search") {
/* Search */
$query = "SELECT *\n FROM " . DBPREFIX . "module_memberdir_values\n WHERE (\n `1` LIKE '%{$keyword}%' OR\n `2` LIKE '%{$keyword}%' OR\n `3` LIKE '%{$keyword}%' OR\n `4` LIKE '%{$keyword}%' OR\n `5` LIKE '%{$keyword}%' OR\n `6` LIKE '%{$keyword}%' OR\n `7` LIKE '%{$keyword}%' OR\n `8` LIKE '%{$keyword}%' OR\n `9` LIKE '%{$keyword}%' OR\n `10` LIKE '%{$keyword}%' OR\n `11` LIKE '%{$keyword}%' OR\n `12` LIKE '%{$keyword}%' OR\n `13` LIKE '%{$keyword}%' OR\n `14` LIKE '%{$keyword}%' OR\n `15` LIKE '%{$keyword}%' OR\n `16` LIKE '%{$keyword}%' OR\n `17` LIKE '%{$keyword}%' OR\n `18` LIKE '%{$keyword}%'\n ) ";
if ($dirid != 0) {
$query .= " AND `dirid` = '{$dirid}'";
}
$objResult = $objDatabase->Execute($query);
} elseif ($sort == "all") {
/* All */
$query = "SELECT *\n FROM " . DBPREFIX . "module_memberdir_values\n WHERE `dirid` = '{$dirid}'";
} else {
if ($this->options['default_listing']) {
$query = "SELECT *\n FROM " . DBPREFIX . "module_memberdir_values\n WHERE `dirid` = '{$dirid}'";
}
}
if ($this->options['default_listing']) {
$query .= " ORDER BY `" . $sortField . "` ASC";
$pos = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
$objResult = $objDatabase->Execute($query);
}
if ($objResult) {
$count = $objResult->RecordCount();
$paging = getPaging($count, $pos, "&section=MemberDir&cmd=" . htmlentities($_GET['cmd'], ENT_QUOTES, CONTREXX_CHARSET) . "&id={$dirid}&sort={$sort}&search=" . htmlentities(contrexx_stripslashes($_GET['search']), ENT_QUOTES, CONTREXX_CHARSET) . "&keyword={$keyword}", "<b>" . $_ARRAYLANG['TXT_MEMBERDIR_ENTRIES'] . "</b>", true, $_CONFIG['corePagingLimit']);
$this->_objTpl->setVariable("MEMBERDIR_PAGING", $paging);
$objResult = $objDatabase->SelectLimit($query, $_CONFIG['corePagingLimit'], $pos);
if ($objResult) {
$rowid = 1;
while (!$objResult->EOF) {
$fieldnames = $this->getFieldData($dirid);
for ($i = 1; $i < 17; $i++) {
$placeholder = $this->getPlaceholderName($fieldnames[$i]['name']);
$replace[$placeholder] = $objResult->fields["{$i}"];
}
if ($dirid == 0) {
$replace["FIELD_CATEGORY"] = $_ARRAYLANG['TXT_DIRECTORY'] . ": <strong>" . $this->directories[$objResult->fields['dirid']]['name'] . "</strong><br />";
}
if ($this->directories[$objResult->fields['dirid']] && $objResult->fields['pic1'] != "none") {
//.........这里部分代码省略.........
示例11: interfaces
function interfaces()
{
global $_ARRAYLANG, $_CORELANG;
\Permission::checkAccess(MediaDirectoryAccessIDs::Interfaces, 'static');
$this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_interfaces.html', true, true);
$this->pageTitle = $_ARRAYLANG['TXT_MEDIADIR_INTERFACES'];
$objInterfaces = new MediaDirectoryInterfaces($this->moduleName);
$tpl = isset($_GET['tpl']) ? $_GET['tpl'] : '';
$step = isset($_GET['step']) ? $_GET['step'] : '';
if (isset($_POST['submitInterfacesForm'])) {
$strStatus = null;
switch ($tpl) {
case 'import':
$objImport = new MediaDirectoryImport($this->moduleName);
switch ($step) {
case 'insertSQL':
$strStatus = $objImport->importSQL(contrexx_addslashes($_POST['interfacesImportSqlTable']), contrexx_addslashes($_POST['pairs_left_keys']), contrexx_addslashes($_POST['pairs_right_keys']), intval($_POST['interfacesImportSqlType']), intval($_POST['interfacesImportSqlForm']), intval($_POST['interfacesImportSqlCategory']), intval($_POST['interfacesImportSqlLevel']));
break;
case 'insertCSV':
$strStatus = $objImport->importCSV();
break;
}
break;
case 'export':
$objExport = new MediaDirectoryExport($this->moduleName);
switch ($_POST['step']) {
case 'exportCSV':
$strStatus = $objExport->exportCSV(intval($_POST['interfacesExportForm']), $_POST['interfacesExportSelectedCategories'], $_POST['interfacesExportSelectedLevels'], intval($_POST['interfacesExportMask']));
break;
}
}
if ($strStatus === true) {
$this->strOkMessage = "Ok";
} else {
if ($strStatus === false) {
$this->strErrMessage = "Not Ok";
}
}
}
$this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_IMPORT' => $_ARRAYLANG['TXT_MEDIADIR_IMPORT'], 'TXT_' . $this->moduleLangVar . '_EXPORT' => $_ARRAYLANG['TXT_MEDIADIR_EXPORT'], 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], 'TXT_' . $this->moduleLangVar . '_DO_IMPORT' => $_ARRAYLANG['TXT_MEDIADIR_DO_IMPORT'], 'TXT_' . $this->moduleLangVar . '_DO_EXPORT' => $_ARRAYLANG['TXT_MEDIADIR_DO_EXPORT'], 'TXT_' . $this->moduleLangVar . '_SELECT_TABLE' => $_ARRAYLANG['TXT_MEDIADIR_SELECT_TABLE'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_CORELANG['TXT_DELETE'], 'TXT_' . $this->moduleLangVar . '_ACTIVATE' => $_ARRAYLANG['TXT_MEDIADIR_ACTIVATE'], 'TXT_' . $this->moduleLangVar . '_DEACTIVATE' => $_ARRAYLANG['TXT_MEDIADIR_DEAVTIVATE']));
switch ($tpl) {
case 'import':
$objInterfaces->showImport($step, $this->_objTpl);
break;
case 'export':
default:
$objInterfaces->showExport($step, $this->_objTpl);
break;
}
}
示例12: updateInputFields
/**
* Update form inputfields
*
* Before calling this method Remove the existing form inputfield entries from db
* for avoiding the duplicate entries in db.
*
* @param integer $intFieldId Form InputField id
* @param array $arrFieldNames Form inputField Names array, the key is refered as the language id
* @param array $arrFieldDefaultValues Form inputField Default values array, the key is refered as the language id
* @param array $arrFieldInfos Form inputField Information values array the key is refered as the language id
*
* @return boolean true | false
*/
public function updateInputFields($intFieldId, $arrFieldNames, $arrFieldDefaultValues, $arrFieldInfos)
{
global $_LANGID, $objDatabase;
foreach ($this->arrFrontendLanguages as $key => $arrLang) {
if (empty($arrFieldNames[0])) {
$arrFieldNames[0] = '';
}
$strFieldName = $arrFieldNames[$arrLang['id']];
$strFieldDefaultValue = $arrFieldDefaultValues[$arrLang['id']];
$strFieldInfo = $arrFieldInfos[$arrLang['id']];
if ($arrLang['id'] == $_LANGID) {
if ($this->arrInputfields[$intFieldId]['name'][0] == $arrFieldNames[0] && $this->arrInputfields[$intFieldId]['name'][$arrLang['id']] != $arrFieldNames[$arrLang['id']]) {
$strFieldName = $arrFieldNames[$_LANGID];
}
if ($this->arrInputfields[$intFieldId]['default_value'][0] == $strFieldDefaultValue && $this->arrInputfields[$intFieldId]['default_value'][$arrLang['id']] != $arrFieldDefaultValues[$arrLang['id']]) {
$strFieldDefaultValue = $arrFieldDefaultValues[$_LANGID];
}
if ($this->arrInputfields[$intFieldId]['info'][0] == $arrFieldInfos[0] && $this->arrInputfields[$intFieldId]['info'][$arrLang['id']] != $arrFieldInfos[$arrLang['id']]) {
$strFieldInfo = $arrFieldInfos[$_LANGID];
}
if ($this->arrInputfields[$intFieldId]['name'][0] != $arrFieldNames[0] && $this->arrInputfields[$intFieldId]['name'][$arrLang['id']] == $arrFieldNames[$arrLang['id']] || $this->arrInputfields[$intFieldId]['name'][0] != $arrFieldNames[0] && $this->arrInputfields[$intFieldId]['name'][$arrLang['id']] != $arrFieldNames[$arrLang['id']] || $this->arrInputfields[$intFieldId]['name'][0] == $arrFieldNames[0] && $this->arrInputfields[$intFieldId]['name'][$arrLang['id']] == $arrFieldNames[$arrLang['id']]) {
$strFieldName = $arrFieldNames[0];
}
if ($this->arrInputfields[$intFieldId]['default_value'][0] != $arrFieldDefaultValues[0] && $this->arrInputfields[$intFieldId]['default_value'][$arrLang['id']] == $arrFieldDefaultValues[$arrLang['id']] || $this->arrInputfields[$intFieldId]['default_value'][0] != $arrFieldDefaultValues[0] && $this->arrInputfields[$intFieldId]['default_value'][$arrLang['id']] != $arrFieldDefaultValues[$arrLang['id']] || $this->arrInputfields[$intFieldId]['default_value'][0] == $arrFieldDefaultValues[0] && $this->arrInputfields[$intFieldId]['default_value'][$arrLang['id']] == $arrFieldDefaultValues[$arrLang['id']]) {
$strFieldDefaultValue = $arrFieldDefaultValues[0];
}
if ($this->arrInputfields[$intFieldId]['info'][0] != $arrFieldInfos[0] && $this->arrInputfields[$intFieldId]['info'][$arrLang['id']] == $arrFieldInfos[$arrLang['id']] || $this->arrInputfields[$intFieldId]['info'][0] != $arrFieldInfos[0] && $this->arrInputfields[$intFieldId]['info'][$arrLang['id']] != $arrFieldInfos[$arrLang['id']] || $this->arrInputfields[$intFieldId]['info'][0] == $arrFieldInfos[0] && $this->arrInputfields[$intFieldId]['info'][$arrLang['id']] == $arrFieldInfos[$arrLang['id']]) {
$strFieldInfo = $arrFieldInfos[0];
}
}
if (empty($strFieldName)) {
$strFieldName = $arrFieldNames[0];
}
if (empty($strFieldDefaultValue)) {
$strFieldDefaultValue = $arrFieldDefaultValues[0];
}
if (empty($strFieldInfo)) {
$strFieldInfo = $arrFieldInfos[0];
}
$objSaveInputfieldName = $objDatabase->Execute('
INSERT INTO
' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_inputfield_names
SET
`lang_id` = "' . contrexx_raw2db($arrLang['id']) . '",
`form_id` = "' . contrexx_raw2db($this->intFormId) . '",
`field_id` = "' . contrexx_raw2db($intFieldId) . '",
`field_name` = "' . contrexx_raw2db($strFieldName) . '",
`field_default_value` = "' . contrexx_raw2db($strFieldDefaultValue) . '",
`field_info` = "' . contrexx_addslashes(htmlentities($strFieldInfo, ENT_QUOTES, CONTREXX_CHARSET)) . '"
');
if (!$objSaveInputfieldName) {
return false;
}
}
return true;
}
示例13: _modifyMedium
//.........这里部分代码省略.........
// Class in /core_modules/index.class.php is named Cache
// Class in /core_modules/admin.class.php is named CacheManager
$pageId = \Cx\Core\Core\Controller\Cx::instanciate()->getPage()->getId();
$cacheManager = new \Cx\Core_Modules\Cache\Controller\CacheManager();
$cacheManager->deleteSingleFile($pageId);
$this->_createRSS();
if ($_REQUEST['section'] != 'Podcast') {
$this->_strOkMessage = $_ARRAYLANG['TXT_PODCAST_MEDIUM_UPDATED_SUCCESSFULL'];
return $this->_media();
} else {
if ($this->_objTpl->blockExists('podcastThanks')) {
$this->_objTpl->touchBlock('podcastThanks');
}
if ($this->_objTpl->blockExists('podcastForm')) {
$this->_objTpl->hideBlock('podcastForm');
}
return true;
}
} else {
$this->_strErrMessage = $_ARRAYLANG['TXT_PODCAST_MEDIUM_UPDATED_FAILED'];
}
}
}
} elseif ($mediumId > 0 && ($arrMedium =& $this->_getMedium($mediumId)) !== false && $_REQUEST['section'] != 'Podcast') {
$mediumTitle = $arrMedium['title'];
$mediumAuthor = $arrMedium['author'];
$mediumDescription = $arrMedium['description'];
$mediumYoutubeID = $arrMedium['youtube_id'];
$mediumSource = $arrMedium['source'];
$mediumThumbnail = $arrMedium['thumbnail'];
$mediumTemplate = $arrMedium['template_id'];
$mediumWidth = $arrMedium['width'];
$mediumHeight = $arrMedium['height'];
$mediumStatus = $arrMedium['status'];
$mediumCategories = $arrMedium['category'];
$mediumPlaylength = $arrMedium['playlength'];
$mediumSize = $arrMedium['size'];
} elseif ($mediumId == 0) {
$mediumSource = '';
if (isset($_POST['podcast_medium_source_type']) && in_array($_POST['podcast_medium_source_type'], array('local', 'remote', 'youtube'))) {
if ($_POST['podcast_medium_source_type'] == 'local') {
if (isset($_POST['podcast_medium_local_source'])) {
if (strpos($_POST['podcast_medium_local_source'], ASCMS_PATH_OFFSET) === 0) {
$mediumSource = ASCMS_PROTOCOL . '://%domain%%offset%' . substr($_POST['podcast_medium_local_source'], strlen(ASCMS_PATH_OFFSET));
} else {
$mediumSource = ASCMS_PROTOCOL . '://%domain%%offset%' . $_POST['podcast_medium_local_source'];
}
}
} elseif ($_POST['podcast_medium_source_type'] == 'youtube') {
$mediumYoutubeID = contrexx_addslashes(trim($_POST['youtubeID']));
$mediumSource = 'http://youtube.com/v/' . $mediumYoutubeID;
} elseif (isset($_POST['podcast_medium_remote_source'])) {
$mediumSource = $_POST['podcast_medium_remote_source'];
}
}
if (empty($mediumSource)) {
return $this->_selectMediumSource();
}
if (!empty($mediumYoutubeID)) {
$mediumTitle = $this->_getYoutubeTitle($mediumYoutubeID);
$mediumThumbnail = ASCMS_PATH_OFFSET . $this->_saveYoutubeThumbnail($mediumYoutubeID);
$mediumTemplate =& $this->_getYoutubeTemplate();
$mediumDescription =& $this->_getYoutubeDescription($mediumYoutubeID);
$mediumWidth = $this->_youTubeDefaultWidth;
$mediumSize = 0;
$mediumHeight = $this->_youTubeDefaultHeight;
} else {
$mediumTitle = ($lastSlash = strrpos($mediumSource, '/')) !== false ? substr($mediumSource, $lastSlash + 1) : $mediumSource;
$mediumTemplate =& $this->_getSuitableTemplate($mediumSource);
$dimensions = isset($_POST['podcast_medium_local_source']) && \Cx\Core_Modules\Media\Controller\MediaLibrary::_isImage(ASCMS_PATH . $_POST['podcast_medium_local_source']) ? @getimagesize(ASCMS_PATH . $_POST['podcast_medium_local_source']) : false;
if ($dimensions) {
$mediumWidth = $dimensions[0];
$mediumHeight = $dimensions[1];
} else {
$mediumWidth = $this->_arrSettings['default_width'];
$mediumHeight = $this->_arrSettings['default_height'];
}
$mediumSize = isset($_POST['podcast_medium_local_source']) ? filesize(ASCMS_PATH . $_POST['podcast_medium_local_source']) : 0;
$mediumSource = htmlentities(str_replace(array('%domain%', '%offset%'), array($_CONFIG['domainUrl'], ASCMS_PATH_OFFSET), $mediumSource), ENT_QUOTES, CONTREXX_CHARSET);
}
}
$this->_objTpl->setVariable(array('PODCAST_MODIFY_TITLE' => $mediumId > 0 ? $_ARRAYLANG['TXT_PODCAST_MODIFY_MEDIUM'] : $_ARRAYLANG['TXT_PODCAST_ADD_MEDIUM'] . ' (' . $_ARRAYLANG['TXT_PODCAST_STEP'] . ' 2: ' . $_ARRAYLANG['TXT_PODCAST_CONFIG_MEDIUM'] . ')', 'PODCAST_MEDIUM_ID' => $mediumId, 'PODCAST_MEDIUM_TITLE' => htmlentities($mediumTitle, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_AUTHOR' => htmlentities($mediumAuthor, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_DESCRIPTION' => htmlentities($mediumDescription, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_SOURCE' => $mediumSource, 'PODCAST_MEDIUM_SOURCE_URL' => htmlentities($mediumSource, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_TEMPLATE_MENU' => $this->_getTemplateMenu($mediumTemplate, 'name="podcast_medium_template" style="width:450px;"'), 'PODCAST_MEDIUM_WIDTH' => $mediumWidth, 'PODCAST_MEDIUM_HEIGHT' => $mediumHeight, 'PODCAST_MEDIUM_PLAYLENGHT' => $this->_getShortPlaylengthFormatOfTimestamp($mediumPlaylength), 'PODCAST_MEDIUM_PLAYLENGTH' => $this->_getShortPlaylengthFormatOfTimestamp($mediumPlaylength), 'PODCAST_MEDIUM_FILESIZE' => $mediumSize, 'PODCAST_MEDIUM_THUMBNAIL_SRC' => !empty($mediumThumbnail) ? $mediumThumbnail : $this->_noThumbnail, 'PODCAST_MEDIUM_STATUS' => $mediumStatus == 1 ? 'checked="checked"' : '', 'PODCAST_MEDIUM_YOUTUBE_DISABLED' => !empty($mediumYoutubeID) ? 'disabled="disabled"' : '', 'PODCAST_MEDIUM_YOUTUBE_ID' => !empty($mediumYoutubeID) ? $mediumYoutubeID : '', 'PODCAST_THUMB_BROWSE' => self::getMediaBrowserButton('', array('data-cx-mb-views' => 'filebrowser', 'type' => 'button', 'style' => 'display:none', 'id' => 'podcast_thumbnail_browser'), 'mediaBrowserCallback')));
$arrCategories =& $this->_getCategories();
$categoryNr = 0;
$arrLanguages = \FWLanguage::getLanguageArray();
foreach ($arrCategories as $categoryId => $arrCategory) {
if ($_REQUEST['section'] == 'Podcast') {
if (!in_array($categoryId, $this->_communityCategories) && !empty($this->_communityCategories)) {
continue;
}
}
$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++;
}
}
示例14: addContent
/**
* Add content that is to be inserted
*
* @param int $lang
* @param string $question
* @param string $answer
*/
public function addContent($lang, $question, $answer)
{
$this->insertContent[] = array('lang' => intval($lang), 'question' => contrexx_addslashes($question), 'answer' => contrexx_addslashes($answer));
}
示例15: voteFeed
/**
* votes for feeds
* @access public
*/
function voteFeed()
{
global $objDatabase, $_ARRAYLANG;
$this->_objTpl->setTemplate($this->pageContent, true, true);
$client = "";
//client/proxy info
$this->arrClient['useragent'] = htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, CONTREXX_CHARSET);
if (stristr($this->arrClient['useragent'], "phpinfo")) {
$this->arrClient['useragent'] = "<b>p_h_p_i_n_f_o() Possible Hacking Attack</b>";
}
$this->arrClient['language'] = htmlspecialchars($_SERVER['HTTP_ACCEPT_LANGUAGE'], ENT_QUOTES, CONTREXX_CHARSET);
$this->_getProxyInformations();
$client = md5($this->arrClient['ip'] . $this->arrClient['useragent'] . $this->arrClient['language'] . $this->arrProxy['ip'] . $this->arrProxy['host']);
$time = time();
$voteNEW = intval($_GET['vote']);
$id = intval($_GET['id']);
$cid = intval($_GET['cid']);
$lid = intval($_GET['lid']);
//get clients
$objResult = $objDatabase->SelectLimit("\n SELECT client, vote, count\n FROM " . DBPREFIX . "module_directory_vote\n WHERE feed_id='{$id}'\n ", 1);
if ($objResult) {
while (!$objResult->EOF) {
$clientOLD = $objResult->fields['client'];
$voteOLD = $objResult->fields['vote'];
$countOLD = $objResult->fields['count'];
$objResult->MoveNext();
}
}
$feedTitle = '';
if (!checkForSpider() && isset($id) && isset($voteNEW) && $client != $clientOLD) {
if ($voteNEW > 10) {
$voteNEW = 10;
} elseif ($voteNEW < 1) {
$voteNEW = 1;
}
if (id !== "") {
//insert votes
if ($objResult->RecordCount() != 0) {
$vote = $voteNEW + $voteOLD;
$count = $countOLD + 1;
$objResult = $objDatabase->Execute("\n UPDATE " . DBPREFIX . "module_directory_vote\n SET vote='" . contrexx_addslashes($vote) . "',\n count='" . contrexx_addslashes($count) . "',\n client='" . contrexx_addslashes($client) . "',\n time='" . contrexx_addslashes($time) . "'\n WHERE feed_id='" . contrexx_addslashes($id) . "'\n ");
} else {
$objResult = $objDatabase->Execute("\n INSERT INTO " . DBPREFIX . "module_directory_vote\n SET feed_id=" . contrexx_addslashes($id) . ",\n count='1',\n vote='" . contrexx_addslashes($voteNEW) . "',\n client='" . contrexx_addslashes($client) . "',\n time='" . contrexx_addslashes($time) . "'\n ");
}
}
$title = $_ARRAYLANG['TXT_DIRECTORY_VOTING_SUCCESFULL'];
// TODO: $feedTitle is not defined! No idea on what to place there.
$link = '<a href="' . CONTREXX_SCRIPT_PATH . '?section=Directory&cmd=detail&id=' . $id . '" target="_blank">' . $feedTitle . '</a>';
// $link = '<a href="'.CONTREXX_SCRIPT_PATH.'?section=Directory&cmd=detail&id='.$id.'" target="_blank">???</a>';
$text = str_replace('%LINK%', $link, $_ARRAYLANG['TXT_DIRECTORY_VOTING_SUCCESFULL_TEXT']);
$text = str_replace('%VOTE%', $voteNEW, $text);
} else {
$title = $_ARRAYLANG['TXT_DIRECTORY_VOTING_FAILED'];
$text = $_ARRAYLANG['TXT_DIRECTORY_VOTING_FAILED_TEXT'];
}
//get navtree
$this->getNavtree($lid, $cid);
//get search
$this->getSearch();
// set variables
$this->_objTpl->setVariable(array('DIRECTORY_CATEGORY_NAVI' => $this->navtree, 'DIRECTORY_VOTE_TITLE' => $title, 'DIRECTORY_VOTE_TEXT' => $text, 'DIRECTORY_BACK' => '<a href="javascript:history.go(-1);">' . $_ARRAYLANG['TXT_DIRECTORY_BACK'] . '</a>', 'TXT_DIRECTORY_DIR' => $_ARRAYLANG['TXT_DIR_DIRECTORY']));
}