コード例 #1
0
 /**
  * Constructor
  */
 function __construct($intAction, $intEntryId, $name)
 {
     global $objDatabase, $_CONFIG;
     parent::__construct('.', $name);
     $this->intAction = intval($intAction);
     $this->intEntryId = intval($intEntryId);
     $objRSCheckAction = $objDatabase->Execute("SELECT default_recipient, need_auth FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_mail_actions WHERE id='" . $this->intAction . "' LIMIT 1");
     if ($objRSCheckAction !== false) {
         $this->intNeedAuth = $objRSCheckAction->fields['need_auth'];
         $objRSEntryUserId = $objDatabase->Execute("SELECT added_by FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_entries WHERE id='" . $this->intEntryId . "' LIMIT 1");
         $objFWUser = \FWUser::getFWUserObject();
         if (!($this->objUser = $objFWUser->objUser->getUser($id = intval($objRSEntryUserId->fields['added_by'])))) {
             $this->objUser = false;
         }
         if ($objRSCheckAction->fields['default_recipient'] == 'admin') {
             $this->arrRecipients[] = $_CONFIG['coreAdminEmail'];
         } else {
             if ($this->objUser != false) {
                 $this->arrRecipients[] = $this->objUser->getEmail();
             }
         }
     }
     if (!empty($this->arrRecipients)) {
         self::loadTemplate();
         if (!empty($this->strTemplate) && !empty($this->strTitle)) {
             self::parsePlaceholders();
             self::sendMail();
         }
     }
 }
コード例 #2
0
 /**
  * Constructor
  */
 function __construct($intLevelId = null, $intParentId = null, $bolGetChildren = 1, $name)
 {
     $this->intLevelId = intval($intLevelId);
     $this->intParentId = intval($intParentId);
     $this->bolGetChildren = intval($bolGetChildren);
     parent::__construct('.', $name);
     parent::getSettings();
     parent::getFrontendLanguages();
     $this->arrLevels = self::getLevels($this->intLevelId, $this->intParentId);
 }
コード例 #3
0
 /**
  * Constructor
  */
 function __construct($intCategoryId = null, $intParentId = null, $bolGetChildren = 1, $name)
 {
     $this->intCategoryId = intval($intCategoryId);
     $this->intParentId = intval($intParentId);
     $this->bolGetChildren = intval($bolGetChildren);
     parent::__construct('.', $name);
     parent::getSettings();
     parent::getFrontendLanguages();
     $this->loadCategories();
 }
コード例 #4
0
 /**
  * Constructor
  */
 function __construct($intFormId = null, $bolExpSearch = false, $arrTranslationStatus = null, $name)
 {
     //get active frontent languages
     parent::__construct('.', $name);
     parent::getFrontendLanguages();
     parent::getSettings();
     $this->intFormId = intval($intFormId);
     $this->bolExpSearch = $bolExpSearch;
     $this->arrTranslationStatus = $arrTranslationStatus;
     $this->arrInputfields = self::getInputfields();
 }
コード例 #5
0
 function __construct($name)
 {
     parent::__construct('.', $name);
 }
コード例 #6
0
 function modifyEntry()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     parent::getSettings();
     $bolFileSizesStatus = true;
     $strOkMessage = '';
     $strErrMessage = '';
     $strOnSubmit = '';
     //count forms
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     $arrActiveForms = array();
     foreach ($objForms->arrForms as $intFormId => $arrForm) {
         if ($arrForm['formActive'] == 1) {
             $arrActiveForms[] = $intFormId;
         }
     }
     //check id and form
     if (!empty($_REQUEST['eid']) || !empty($_REQUEST['entryId'])) {
         if (!empty($_REQUEST['eid'])) {
             $intEntryId = intval($_REQUEST['eid']);
         }
         if (!empty($_REQUEST['entryId'])) {
             $intEntryId = intval($_REQUEST['entryId']);
         }
         $intFormId = intval(substr($_GET['cmd'], 4));
     } else {
         $intEntryId = null;
         $intFormId = intval(substr($_GET['cmd'], 3));
     }
     $intCountForms = count($arrActiveForms);
     if ($intCountForms > 0) {
         //check form
         if (intval($intEntryId) == 0 && empty($_REQUEST['selectedFormId']) && empty($_POST['formId']) && $intCountForms > 1 && $intFormId == 0) {
             $intFormId = null;
             //get form selector
             $objForms = new MediaDirectoryForm(null, $this->moduleName);
             $objForms->listForms($this->_objTpl, 3, $intFormId);
             //parse blocks
             $this->_objTpl->hideBlock($this->moduleNameLC . 'Inputfields');
         } else {
             //save entry data
             if (isset($_POST['submitEntryModfyForm'])) {
                 $objEntry = new MediaDirectoryEntry($this->moduleName);
                 $strStatus = $objEntry->saveEntry($_POST, intval($_POST['entryId']));
                 if (!empty($_POST['entryId'])) {
                     $objEntry->getEntries(intval($_POST['entryId']));
                     if ($strStatus == true) {
                         if (intval($_POST['readyToConfirm']) == 1) {
                             if ($objEntry->arrEntries[intval($_POST['entryId'])]['entryConfirmed'] == 1) {
                                 $bolReadyToConfirmMessage = false;
                                 $bolSaveOnlyMessage = false;
                             } else {
                                 $bolReadyToConfirmMessage = true;
                                 $bolSaveOnlyMessage = false;
                             }
                         } else {
                             $bolReadyToConfirmMessage = false;
                             $bolSaveOnlyMessage = true;
                         }
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_EDITED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_EDITED'];
                     }
                 } else {
                     if ($strStatus == true) {
                         if (intval($_POST['readyToConfirm']) == 1) {
                             $bolReadyToConfirmMessage = true;
                             $bolSaveOnlyMessage = false;
                         } else {
                             $bolReadyToConfirmMessage = false;
                             $bolSaveOnlyMessage = true;
                         }
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_ADDED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_ADDED'];
                     }
                 }
                 if (!empty($_POST['entryId'])) {
                     if ($strStatus == true) {
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_EDITED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_EDITED'];
                     }
                 } else {
                     if ($strStatus == true) {
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_ADDED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_ADDED'];
                     }
                 }
             } else {
                 //get form id
                 if (intval($intEntryId) != 0) {
                     //get entry data
                     $objEntry = new MediaDirectoryEntry($this->moduleName);
                     if ($this->arrSettings['settingsReadyToConfirm'] == 1) {
                         $objEntry->getEntries($intEntryId, null, null, null, null, null, true, null, 'n', null, null, null, true);
                     } else {
                         $objEntry->getEntries($intEntryId);
                     }
                     $intFormId = $objEntry->arrEntries[$intEntryId]['entryFormId'];
                 } else {
                     //set form id
                     if ($intCountForms == 1) {
                         $intFormId = intval($arrActiveForms[0]);
                     } else {
                         if ($intFormId == 0) {
                             $intFormId = intval($_REQUEST['selectedFormId']);
                         }
                     }
                 }
                 //get inputfield object
                 $objInputfields = new MediaDirectoryInputfield($intFormId, false, null, $this->moduleName);
                 //list inputfields
                 $objInputfields->listInputfields($this->_objTpl, 2, $intEntryId);
                 //get translation status date
                 if ($this->arrSettings['settingsTranslationStatus'] == 1) {
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         if ($arrLang['id'] == 2) {
                             $strLangStatus = 'checked="checked" disabled="disabled"';
                         } elseif ($intEntryId != 0) {
                             if (in_array($arrLang['id'], $objEntry->arrEntries[$intEntryId]['entryTranslationStatus'])) {
                                 $strLangStatus = 'checked="checked"';
                             } else {
                                 $strLangStatus = '';
                             }
                         } else {
                             $strLangStatus = '';
                         }
                         $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_TRANSLATION_LANG_NAME' => htmlspecialchars($arrLang['name'], ENT_QUOTES, CONTREXX_CHARSET), $this->moduleLangVar . '_TRANSLATION_LANG_ID' => intval($arrLang['id']), $this->moduleLangVar . '_TRANSLATION_LANG_STATUS' => $strLangStatus));
                         $this->_objTpl->parse($this->moduleNameLC . 'TranslationLangList');
                     }
                 } else {
                     $this->_objTpl->hideBlock($this->moduleNameLC . 'TranslationStatus');
                 }
                 //get ready to confirm
                 if ($this->arrSettings['settingsReadyToConfirm'] == 1 && empty($objEntry->arrEntries[$intEntryId]['entryReadyToConfirm']) && empty($objEntry->arrEntries[$intEntryId]['entryConfirmed'])) {
                     $objForm = new MediaDirectoryForm($intFormId, $this->moduleName);
                     if ($objForm->arrForms[$intFormId]['formUseReadyToConfirm'] == 1) {
                         $strReadyToConfirm = '<p><input class="' . $this->moduleNameLC . 'InputfieldCheckbox" name="readyToConfirm" id="' . $this->moduleNameLC . 'Inputfield_ReadyToConfirm" value="1" type="checkbox">&nbsp;' . $_ARRAYLANG['TXT_MEDIADIR_READY_TO_CONFIRM'] . '</p>';
                     } else {
                         $strReadyToConfirm = '<input type="hidden" name="readyToConfirm" value="1" />';
                     }
                 } else {
                     $strReadyToConfirm = '<input type="hidden" name="readyToConfirm" value="1" />';
                 }
                 $this->_objTpl->setVariable(array($this->moduleLangVar . '_READY_TO_CONFIRM' => $strReadyToConfirm));
                 //generate javascript
                 parent::setJavascript($this->getSelectorJavascript());
                 parent::setJavascript($objInputfields->getInputfieldJavascript());
                 //parent::setJavascript("\$J().ready(function(){ \$J('.mediadirInputfieldHint').inputHintBox({className:'mediadirInputfieldInfobox',incrementLeft:3,incrementTop:-6}); });");
                 //get form onsubmit
                 $strOnSubmit = parent::getFormOnSubmit($objInputfields->arrJavascriptFormOnSubmit);
                 //parse blocks
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'Forms');
             }
         }
         if (!empty($_SESSION[$this->moduleNameLC]) && empty($_SESSION[$this->moduleNameLC]['bolFileSizesStatus'])) {
             $strFileMessage = '<div class="' . $this->moduleNameLC . 'FileErrorMessage">' . $_ARRAYLANG['TXT_MEDIADIR_IMAGE_ERROR_MESSAGE'] . '</div>';
             unset($_SESSION[$this->moduleNameLC]['bolFileSizesStatus']);
         } else {
             $strFileMessage = '';
         }
         //parse global variables
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_ID' => $intEntryId, $this->moduleLangVar . '_FORM_ID' => $intFormId, 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], $this->moduleLangVar . '_FORM_ONSUBMIT' => $strOnSubmit, 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_MEDIADIR_PLEASE_CHECK_INPUT'], 'TXT_' . $this->moduleLangVar . '_OK_MESSAGE' => $strOkMessage . $strFileMessage, 'TXT_' . $this->moduleLangVar . '_ERROR_MESSAGE' => $strErrMessage . $strFileMessage, $this->moduleLangVar . '_MAX_CATEGORY_SELECT' => $strErrMessage, 'TXT_' . $this->moduleLangVar . '_TRANSLATION_STATUS' => $_ARRAYLANG['TXT_MEDIADIR_TRANSLATION_STATUS']));
         if (!empty($strOkMessage)) {
             $this->_objTpl->touchBlock($this->moduleNameLC . 'EntryOkMessage');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryErrMessage');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryModifyForm');
             if ($bolReadyToConfirmMessage) {
                 $this->_objTpl->touchBlock($this->moduleNameLC . 'EntryReadyToConfirmMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
             }
             if ($bolSaveOnlyMessage) {
                 $this->_objTpl->touchBlock($this->moduleNameLC . 'EntrySaveOnlyMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
             }
         } else {
             if (!empty($strErrMessage)) {
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
                 $this->_objTpl->touchBlock($this->moduleNameLC . 'EntryErrMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryModifyForm');
             } else {
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryErrMessage');
                 $this->_objTpl->parse($this->moduleNameLC . 'EntryModifyForm');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryReadyToConfirmMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntrySaveOnlyMessage');
             }
         }
     } else {
         header("Location: index.php?section=" . $_GET['section']);
         exit;
     }
 }
コード例 #7
0
 function manageEntries()
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_manage_entries.html', true, true);
     $this->pageTitle = $_ARRAYLANG['TXT_MEDIADIR_MANAGE_ENTRIES'];
     $this->initFilterSession();
     if (isset($_REQUEST['cat_id'])) {
         $_SESSION[$this->moduleName]['searchFilter']['cat_id'] = intval($_REQUEST['cat_id']);
     }
     if (isset($_REQUEST['level_id'])) {
         $_SESSION[$this->moduleName]['searchFilter']['level_id'] = intval($_REQUEST['level_id']);
     }
     if (isset($_REQUEST['form_id'])) {
         $_SESSION[$this->moduleName]['searchFilter']['form_id'] = intval($_REQUEST['form_id']);
     }
     if (isset($_REQUEST['term'])) {
         $_SESSION[$this->moduleName]['searchFilter']['term'] = $_REQUEST['term'] != $_ARRAYLANG['TXT_MEDIADIR_ID_OR_SEARCH_TERM'] ? $_REQUEST['term'] : null;
     }
     //assign the searchFilter session values to corresponding variables
     $intCategoryId = $_SESSION[$this->moduleName]['searchFilter']['cat_id'];
     $intLevelId = $_SESSION[$this->moduleName]['searchFilter']['level_id'];
     $intFormId = $_SESSION[$this->moduleName]['searchFilter']['form_id'];
     $strTerm = $_SESSION[$this->moduleName]['searchFilter']['term'];
     $objCategories = new MediaDirectoryCategory(null, null, 1, $this->moduleName);
     $catDropdown = $objCategories->listCategories(null, 3, $intCategoryId);
     $objLevels = new MediaDirectoryLevel(null, null, 1, $this->moduleName);
     $levelDropdown = $objLevels->listLevels(null, 3, $intLevelId);
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     $formDropdown = $objForms->listForms(null, 4, $intFormId);
     //parse global variables
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_PAGE_TITLE' => $this->pageTitle, 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], 'TXT_EDIT' => $_ARRAYLANG['TXT_MEDIADIR_EDIT'], 'TXT_SEARCH' => $_CORELANG['TXT_SEARCH'], 'TXT_MEDIADIR_STATUS' => $_CORELANG['TXT_STATUS'], 'TXT_SELECT_ALL' => $_CORELANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_CORELANG['TXT_DESELECT_ALL'], 'TXT_SELECT_ACTION' => $_CORELANG['TXT_MULTISELECT_SELECT'], 'TXT_FUNCTIONS' => $_ARRAYLANG['TXT_MEDIADIR_FUNCTIONS'], 'TXT_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_DELETE'], 'TXT_DELETE_ALL' => $_CORELANG['TXT_MULTISELECT_DELETE'], 'TXT_' . $this->moduleLangVar . '_VOTING' => $_ARRAYLANG['TXT_MEDIADIR_VOTING'], 'TXT_' . $this->moduleLangVar . '_COMMENTS' => $_ARRAYLANG['TXT_MEDIADIR_COMMENTS'], 'TXT_' . $this->moduleLangVar . '_NAME' => $_CORELANG['TXT_NAME'], 'TXT_' . $this->moduleLangVar . '_DATE' => $_CORELANG['TXT_DATE'], 'TXT_' . $this->moduleLangVar . '_AUTHOR' => $_ARRAYLANG['TXT_MEDIADIR_AUTHOR'], 'TXT_' . $this->moduleLangVar . '_HITS' => $_ARRAYLANG['TXT_MEDIADIR_HITS'], 'TXT_' . $this->moduleLangVar . '_ACTION' => $_CORELANG['TXT_HISTORY_ACTION'], $this->moduleLangVar . '_SEARCH_TERM' => $strTerm != null ? $strTerm : $_ARRAYLANG['TXT_MEDIADIR_ID_OR_SEARCH_TERM'], 'TXT_' . $this->moduleLangVar . '_ID_OR_SEARCH_TERM' => $_ARRAYLANG['TXT_MEDIADIR_ID_OR_SEARCH_TERM'], $this->moduleLangVar . '_SEARCH_CATEGORY_ID' => $intCategoryId, $this->moduleLangVar . '_SEARCH_LEVEL_ID' => $intLevelId, 'TXT_' . $this->moduleLangVar . '_MOVE_ALL' => $_ARRAYLANG['TXT_MEDIADIR_MOVE_ALL'], 'TXT_' . $this->moduleLangVar . '_RESTORE_VOTING_ALL' => $_ARRAYLANG['TXT_MEDIADIR_RESTORE_VOTING_ALL'], 'TXT_' . $this->moduleLangVar . '_RESTORE_COMMENTS_ALL' => $_ARRAYLANG['TXT_MEDIADIR_RESTORE_COMMENTS_ALL'], 'TXT_' . $this->moduleLangVar . '_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_MEDIADIR_CONFIRM_DELETE_DATA'], 'TXT_' . $this->moduleLangVar . '_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_MEDIADIR_ACTION_IS_IRREVERSIBLE'], 'TXT_' . $this->moduleLangVar . '_MAKE_SELECTION' => $_ARRAYLANG['TXT_MEDIADIR_MAKE_SELECTION'], 'TXT_SELECT_ALL' => $_CORELANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_CORELANG['TXT_DESELECT_ALL'], 'TXT_SELECT_ACTION' => $_CORELANG['TXT_MULTISELECT_SELECT'], 'TXT_DELETE_ALL' => $_CORELANG['TXT_MULTISELECT_DELETE'], 'TXT_' . $this->moduleLangVar . '_MOVE_ALL' => $_ARRAYLANG['TXT_MEDIADIR_MOVE_ALL'], 'TXT_' . $this->moduleLangVar . '_ALL_LEVELS' => $_ARRAYLANG['TXT_MEDIADIR_ALL_LEVELS'], 'TXT_' . $this->moduleLangVar . '_ALL_CATEGORIES' => $_ARRAYLANG['TXT_MEDIADIR_ALL_CATEGORIES'], 'TXT_' . $this->moduleLangVar . '_ALL_FORMS' => $_ARRAYLANG['TXT_MEDIADIR_ALL_FORMS'], $this->moduleLangVar . '_CATEGORIES_DROPDOWN_OPTIONS' => $catDropdown, $this->moduleLangVar . '_LEVELS_DROPDOWN_OPTIONS' => $levelDropdown, $this->moduleLangVar . '_FORMS_DROPDOWN_OPTIONS' => $formDropdown, 'TXT_' . $this->moduleLangVar . '_FORM' => $_ARRAYLANG['TXT_MEDIADIR_FORM']));
     //get seting values
     parent::getSettings();
     if ($this->arrSettings['settingsShowLevels'] == 1) {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'LevelDropdown');
     } else {
         $this->_objTpl->hideBlock($this->moduleNameLC . 'LevelDropdown');
     }
     if (count($objForms->arrForms) > 1) {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'FormDropdown');
     } else {
         $this->_objTpl->hideBlock($this->moduleNameLC . 'FormDropdown');
     }
     $objEntries = new MediaDirectoryEntry($this->moduleName);
     if (isset($_POST['submitEntriesOrderForm'])) {
         if ($objEntries->saveOrder($_POST)) {
             $this->strOkMessage = $_CORELANG['TXT_SETTINGS_UPDATED'];
         } else {
             $this->strErrMessage = $_CORELANG['TXT_DATABASE_QUERY_ERROR'];
         }
     }
     $objSettings = new MediaDirectorySettings($this->moduleName);
     if ($this->_objTpl->blockExists('mediadirTableHeaderComments')) {
         if ($objSettings->arrSettings['settingsAllowComments']) {
             $this->_objTpl->touchBlock('mediadirTableHeaderComments');
         }
     }
     if ($this->_objTpl->blockExists('mediadirTableHeaderVotes')) {
         if ($objSettings->arrSettings['settingsAllowVotes']) {
             $this->_objTpl->touchBlock('mediadirTableHeaderVotes');
         }
     }
     switch ($_GET['act']) {
         case 'move_entry':
             $this->strErrMessage = "Diese Funktion ist zurzeit noch nicht implementiert.";
             break;
         case 'delete_entry':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objEntries->deleteEntry(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objEntries->deleteEntry(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
             }
             break;
         case 'restore_voting':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             $objVotes = new MediaDirectoryVoting($this->moduleName);
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objVotes->restoreVoting(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objVotes->restoreVoting(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_VOTING'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_VOTING'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
             }
             break;
         case 'restore_comments':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             $objComments = new MediaDirectoryComment($this->moduleName);
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objComments->restoreComments(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objComments->restoreComments(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_COMMENTS'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_COMMENTS'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
             }
             break;
             break;
         case 'confirm_entry':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objEntries->confirmEntry(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objEntries->confirmEntry(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_CONFIRM'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_CONFIRM'];
             }
             break;
     }
     $objEntries->getEntries(null, $intLevelId, $intCategoryId, $strTerm, null, null, null, null, 'n', null, null, $intFormId, null, $this->limit, $this->offset);
     $objEntries->listEntries($this->_objTpl, 1);
     // Paging
     $count = $objEntries->countEntries();
     $filter = (!empty($strTerm) ? '&term=' . $strTerm : '') . (!empty($intCategoryId) ? '&cat_id=' . $intCategoryId : '') . (!empty($intFormId) ? '&form_id=' . $intFormId : '') . (!empty($intLevelId) ? '&level_id=' . $intLevelId : '');
     $term = !empty($strTerm) ? '&term=' . $strTerm : '';
     $paging = getPaging($count, $this->offset, '&cmd=' . $this->moduleName . '&act=entries' . $filter, '', true);
     $this->_objTpl->setGlobalVariable($this->moduleLangVar . '_PAGING', $paging);
     if (!empty($strTerm)) {
         $this->_objTpl->setVariable($this->moduleLangVar . '_SEARCH_TERM_PARAMETER', '&term=' . $strTerm);
     }
     if (empty($objEntries->arrEntries)) {
         $this->_objTpl->hideBlock($this->moduleNameLC . 'EntriesSelectAction');
     } else {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'EntriesSelectAction');
     }
 }
コード例 #8
0
 /**
  * Constructor
  */
 function __construct($name)
 {
     parent::__construct('.', $name);
     parent::getSettings();
 }
コード例 #9
0
 function saveSettings($arrSettings)
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase;
     foreach ($arrSettings as $strName => $varValue) {
         switch ($strName) {
             case 'settingsNumEntries':
                 $objSaveSettings = $objDatabase->Execute("TRUNCATE TABLE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_num_entries");
                 foreach ($varValue as $intGroupId => $strNum) {
                     $objSaveSettings = $objDatabase->Execute("\n                            INSERT INTO\n                                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_num_entries\n                            SET\n                                `group_id` = '" . intval($intGroupId) . "',\n                                `num_entries` = '" . contrexx_addslashes($strNum) . "'\n                            ");
                     if ($objSaveSettings === false) {
                         return false;
                     }
                 }
                 break;
             case 'settingsNumCategories':
                 $objSaveSettings = $objDatabase->Execute("TRUNCATE TABLE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_num_categories");
                 foreach ($varValue as $intGroupId => $strNum) {
                     $objSaveSettings = $objDatabase->Execute("\n                            INSERT INTO\n                                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_num_categories\n                            SET\n                                `group_id` = '" . intval($intGroupId) . "',\n                                `num_categories` = '" . contrexx_addslashes($strNum) . "'\n                            ");
                     if ($objSaveSettings === false) {
                         return false;
                     }
                 }
                 break;
             case 'settingsNumLevels':
                 $objSaveSettings = $objDatabase->Execute("TRUNCATE TABLE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_num_levels");
                 foreach ($varValue as $intGroupId => $strNum) {
                     $objSaveSettings = $objDatabase->Execute("\n                            INSERT INTO\n                                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_num_levels\n                            SET\n                                `group_id` = '" . intval($intGroupId) . "',\n                                `num_levels` = '" . contrexx_addslashes($strNum) . "'\n                            ");
                     if ($objSaveSettings === false) {
                         return false;
                     }
                 }
                 break;
             case 'settingsActiveLanguages':
                 $varValue = join(",", $varValue);
             default:
                 $objSaveSettings = $objDatabase->Execute("\n                        UPDATE\n                            " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings\n                        SET\n                            `value`='" . contrexx_addslashes($varValue) . "'\n                        WHERE\n                            `name`='" . contrexx_addslashes($strName) . "'\n                    ");
                 if ($objSaveSettings === false) {
                     return false;
                 }
                 break;
         }
     }
     parent::getSettings();
     parent::getCommunityGroups();
     return true;
 }
コード例 #10
0
 function saveForm($arrData, $intFormId = null)
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
     $intId = intval($intFormId);
     $strPicture = contrexx_addslashes(contrexx_strip_tags($arrData['formImage']));
     $arrName = $arrData['formName'];
     $arrDescription = $arrData['formDescription'];
     $strCmd = strtolower(contrexx_addslashes(contrexx_strip_tags($arrData['formCmd'])));
     $intUseCategory = intval($arrData['formUseCategory']);
     $intUseLevel = isset($arrData['formUseLevel']) ? contrexx_input2int($arrData['formUseLevel']) : 0;
     $intUseReadyToConfirm = isset($arrData['formUseReadyToConfirm']) ? contrexx_input2int($arrData['formUseReadyToConfirm']) : 0;
     $intEntriesPerPage = isset($arrData['formEntriesPerPage']) ? contrexx_input2int($arrData['formEntriesPerPage']) : 0;
     if (empty($intId)) {
         //insert new form
         $objInsertAttributes = $objDatabase->Execute("\n                INSERT INTO\n                    " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_forms\n                SET\n                    `order`='99',\n                    `picture`='" . $strPicture . "',\n                    `cmd`='" . $strCmd . "',\n                    `use_category`='" . $intUseCategory . "',\n                    `use_level`='" . $intUseLevel . "',\n                    `use_ready_to_confirm`='" . $intUseReadyToConfirm . "',\n                    `entries_per_page`='" . $intEntriesPerPage . "',\n                    `active`='0'\n            ");
         if ($objInsertAttributes !== false) {
             $intId = $objDatabase->Insert_ID();
             foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                 if (empty($arrName[0])) {
                     $arrName[0] = "";
                 }
                 $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 . "_form_names\n                        SET\n                            `lang_id`='" . intval($arrLang['id']) . "',\n                            `form_id`='" . intval($intId) . "',\n                            `form_name`='" . contrexx_raw2db(contrexx_input2raw($strName)) . "',\n                            `form_description`='" . contrexx_raw2db(contrexx_input2raw($strDescription)) . "'\n                    ");
             }
             $objCreateCatSelectors = $objDatabase->Execute("\n                    INSERT INTO\n                        " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_order_rel_forms_selectors\n                    SET\n                        `selector_id`='9',\n                        `form_id`='" . intval($intId) . "',\n                        `selector_order`='0',\n                        `exp_search`='1'\n                ");
             $objCreateLevelSelectors = $objDatabase->Execute("\n                    INSERT INTO\n                        " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_order_rel_forms_selectors\n                    SET\n                        `selector_id`='10',\n                        `form_id`='" . intval($intId) . "',\n                        `selector_order`='1',\n                        `exp_search`='1'\n                ");
             //permissions
             parent::getCommunityGroups();
             foreach ($this->arrCommunityGroups as $intGroupId => $arrGroup) {
                 $objInsertPerm = $objDatabase->Execute("\n                        INSERT INTO\n                            " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_perm_group_forms\n                        SET\n                            `group_id`='" . intval($intGroupId) . "',\n                            `form_id`='" . intval($intId) . "',\n                            `status_group`='1'\n                    ");
             }
             if ($objInsertNames !== false && $objCreateCatSelectors !== false && $objCreateLevelSelectors !== false) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         //update form
         $objUpdateAttributes = $objDatabase->Execute("\n                UPDATE\n                    " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_forms\n                SET\n                    `picture`='" . $strPicture . "',\n                    `cmd`='" . $strCmd . "',\n                    `use_category`='" . $intUseCategory . "',\n                    `use_level`='" . $intUseLevel . "',\n                    `use_ready_to_confirm`='" . $intUseReadyToConfirm . "',\n                    `entries_per_page`='" . $intEntriesPerPage . "'\n                WHERE\n                    `id`='" . $intId . "'\n            ");
         if ($objUpdateAttributes !== false) {
             //permissions
             $objDeletePerm = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_perm_group_forms WHERE form_id='" . $intId . "'");
             $settingsPermissionGroupForm = isset($arrData['settingsPermGroupForm'][$intId]) ? $arrData['settingsPermGroupForm'][$intId] : array();
             foreach ($settingsPermissionGroupForm as $intGroupId => $intGroupStatus) {
                 $objInsertPerm = $objDatabase->Execute("\n                        INSERT INTO\n                            " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings_perm_group_forms\n                        SET\n                            `group_id`='" . intval($intGroupId) . "',\n                            `form_id`='" . intval($intId) . "',\n                            `status_group`='" . intval($intGroupStatus) . "'\n                    ");
             }
             $objInsertNames = $this->updateFormLocale($arrName, $arrDescription, $intId);
             if ($objInsertNames !== false) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     }
 }