public function saveToDb($languageId)
 {
     global $parametersMod;
     $tmpModule = \Db::getModule(null, $this->moduleGroupName, $this->moduleName);
     if ($tmpModule && sizeof($this->parameters) > 0) {
         $tmpParameterGroup = Db::getParameterGroup($tmpModule['id'], $this->name);
         if ($tmpParameterGroup) {
             $parameterGroupId = $tmpParameterGroup['id'];
             Db::renameParameterGroup($tmpParameterGroup['id'], $this->translation);
         } else {
             $parameterGroupId = $tmpParameterGroup = Db::createParameterGroup($tmpModule['id'], $this->name, $this->translation, $this->admin);
         }
         foreach ($this->parameters as $parameterKey => $parameter) {
             $tmpParameter = \Db::getParameter($tmpModule['id'], 'module_id', $this->name, $parameter['name']);
             if ($tmpParameter === false) {
                 Db::insertParameter($parameterGroupId, $parameter);
             } elseif ($tmpParameter['type'] != $parameter['type']) {
                 Db::deleteParameter($tmpParameter['id'], $tmpParameter['type']);
                 Db::insertParameter($parameterGroupId, $parameter);
             } else {
                 $this->saveParameter($tmpParameter, $parameter['value'], $languageId);
                 Db::renameParameter($tmpParameter['id'], $parameter['translation']);
             }
         }
     }
 }
Esempio n. 2
0
 public function saveParameters($moduleGroup = null, $moduleName = null, $allowCreateLanguage = true)
 {
     global $parametersMod;
     $this->languageId = Db::getLanguageId($this->cachedLanguage['code']);
     if ($this->languageId === false) {
         if ($allowCreateLanguage) {
             $this->languageId = Db::insertLanguage($this->cachedLanguage);
             \Modules\standard\languages\Db::createEmptyTranslations($this->languageId, 'par_lang');
         } else {
             $siteLanguages = \Modules\standard\languages\Db::getLanguages();
             $this->languageId = $siteLanguages[0]['id'];
         }
     }
     foreach ($this->parameterGroups as $groupKey => $group) {
         if ($moduleGroup == null || $moduleName == null || $moduleGroup == $group->moduleGroupName && $moduleName == $group->moduleName) {
             if ($parametersMod->getValue('standard', 'configuration', 'advanced_options', 'administrator_interface_language') == $this->languageCode) {
                 //set module group translation
                 $tmpGroup = Db::getGroup($group->moduleGroupName);
                 if ($tmpGroup && $group->moduleGroupTranslation) {
                     Db::updateModuleGroupTranslation($tmpGroup['id'], $group->moduleGroupTranslation);
                 }
                 //set module translation
                 $tmpModule = \Db::getModule(null, $group->moduleGroupName, $group->moduleName);
                 if ($tmpModule && $group->moduleTranslation) {
                     Db::updateModuleTranslation($tmpModule['id'], $group->moduleTranslation);
                 }
             }
             $group->saveToDb($this->languageId);
         }
     }
 }
Esempio n. 3
0
 function before_delete($id)
 {
     $module = Db::getModule($id);
     if ($module) {
         if (file_exists(BASE_DIR . MODULE_DIR . "standard/content_management/widgets/" . $module['group_name'] . "/" . $module['module_name'] . "/uninstall/script.php")) {
             require_once BASE_DIR . MODULE_DIR . "standard/content_management/widgets/" . $module['group_name'] . "/" . $module['module_name'] . "/uninstall/script.php";
         }
     }
 }
Esempio n. 4
0
 function before_delete($id)
 {
     $module = \Db::getModule($id);
     if (!$module['core']) {
         Db::deletePermissions($id);
         if (file_exists(BASE_DIR . PLUGIN_DIR . $module['g_name'] . '/' . $module['m_name'] . '/uninstall/script.php')) {
             require_once BASE_DIR . PLUGIN_DIR . $module['g_name'] . '/' . $module['m_name'] . '/uninstall/script.php';
             eval('$uninstallObject = new \\Modules\\' . $module['g_name'] . '\\' . $module['m_name'] . '\\Uninstall();');
             $uninstallObject->execute();
         }
     }
 }
Esempio n. 5
0
 public static function install($groupName, $moduleName)
 {
     if (file_exists(MODULE_DIR . 'standard/content_management/widgets/' . $groupName . '/' . $moduleName . '/install/config.ini')) {
         $configFile = file(MODULE_DIR . 'standard/content_management/widgets/' . $groupName . '/' . $moduleName . '/install/config.ini');
         $config = array();
         foreach ($configFile as $key => $configRow) {
             $configName = substr($configRow, 0, strpos($configRow, ':'));
             $value = substr($configRow, strpos($configRow, ':') + 1);
             $value = str_replace("\n", "", str_replace("\r", "", $value));
             $config[$configName] = $value;
         }
     } else {
         $config = array();
     }
     $config['module_group_key'] = $groupName;
     if (!isset($config['module_group_name'])) {
         $config['module_group_name'] = $groupName;
     }
     if (!isset($config['module_group_admin'])) {
         $config['module_group_admin'] = 0;
     }
     $config['module_key'] = $moduleName;
     if (!isset($config['module_name'])) {
         $config['module_name'] = $moduleName;
     }
     if (!isset($config['module_admin'])) {
         $config['module_admin'] = 0;
     }
     if (!isset($config['module_managed'])) {
         $config['module_managed'] = 1;
     }
     if (!isset($config['version'])) {
         $config['version'] = 1.0;
     }
     $group = Db::getModuleGroup($groupName);
     if ($group === false) {
         Db::insertModuleGroup($config['module_group_name'], $config['module_group_key']);
         $group = Db::getModuleGroup($groupName);
     }
     if ($group !== false) {
         Db::insertModule($config['module_name'], $config['module_key'], $group['id'], $config['version']);
         $module = Db::getModule($moduleName);
         if (file_exists(BASE_DIR . MODULE_DIR . 'standard/content_management/widgets/' . $config['module_group_key'] . '/' . $config['module_key'] . '/install/script.php')) {
             require_once BASE_DIR . MODULE_DIR . 'standard/content_management/widgets/' . $config['module_group_key'] . '/' . $config['module_key'] . '/install/script.php';
         }
         ModulesInstallation::importConfig($groupName, $moduleName);
     }
 }
    function tep_title_input()
    {
        global $parametersMod;
        global $cms;
        $lock = $this->db_module->menuElement($this->current_element);
        $tmp_module = \Db::getModule('', 'standard', 'content_management');
        if ($lock['rss'] == 1) {
            $rss = '1';
        } else {
            $rss = '0';
        }
        if ($lock['visible'] == 1) {
            $visible = '1';
        } else {
            $visible = '0';
        }
        $answer = '
          <form onsubmit="mod_management.changed = false; menu_saver.save_to_db(); return false;" id="f_main_fields" action="' . BASE_URL . BACKEND_WORKER_FILE . "?module_id=" . $tmp_module['id'] . '&security_token=' . $_SESSION['backend_session']['security_token'] . '" method="post" enctype="multipart/form-data">  
            <span class="ipCmsTitle">' . $parametersMod->getValue('standard', 'content_management', 'admin_translations', 'man_additional_button_title') . '</span>
            <input onfocus="mod_management.setChanged(true);" name="page_button_title" type="text" value="' . htmlspecialchars($lock['button_title']) . '" />
            <a class="ipCmsAdvancedButton" onclick="f_main_fields_popup_show();">' . $parametersMod->getValue('standard', 'content_management', 'admin_translations', 'advanced') . '</a>  
						
            <input name="page_page_title" type="hidden" value="' . htmlspecialchars($lock['page_title']) . '" />
            <input name="keywords" type="hidden" value="' . htmlspecialchars($lock['keywords']) . '"/>  
            <input name="description" type="hidden" value="' . htmlspecialchars($lock['description']) . '" />
            <input name="url" type="hidden" value="' . htmlspecialchars($lock['url']) . '"/>               
            <input name="created_on" type="hidden" value="' . htmlspecialchars(substr($lock['created_on'], 0, 10)) . '"/>               
            <input name="type" type="hidden" value="' . htmlspecialchars($lock['type']) . '"/>               
            <input name="redirect_url" type="hidden" value="' . htmlspecialchars($lock['redirect_url']) . '"/>               
            <input name="rss" style="display: none;" type="hidden" value="' . $rss . '" />               
            <input name="visible" style="display: none;" type="hidden" value="' . $visible . '" />               
            <input type="hidden" name="action" value="set_main_fields" />  
            <input type="hidden" id="f_main_fields_answer_function" name="answer_function" value="" /> 
            <input type="hidden" id="f_main_fields_id" name="id" value="" />    
          </form>       

					<span class="ipCmsControllButtons">' . $this->tep_preview_save_cancel_buttons() . '</span>
';
        return $answer;
    }
Esempio n. 7
0
    function generateManagement($modGroup, $module, $parGroup, $parameter)
    {
        global $site;
        if ($site->managementState() && $site->getZone($site->currentZone)->getAssociatedModuleGroup() == 'standard' && $site->getZone($site->currentZone)->getAssociatedModule() == 'content_management') {
            $answer = '';
            $tmpModule = \Db::getModule(null, $modGroup, $module);
            $tmpParameter = \Db::getParameter($tmpModule['id'], 'module_id', $parGroup, $parameter);
            $tmpParameter['id'];
            switch ($tmpParameter['type']) {
                case "string":
                case "integer":
                case "lang":
                    $tmpType = 'string';
                    break;
                case "textarea":
                case "lang_textarea":
                    $tmpType = 'textarea';
                    break;
                case "string_wysiwyg":
                case "lang_wysiwyg":
                    $tmpType = 'wysiwyg';
                    break;
                default:
                    $tmpType = 'string';
            }
            $tmp_value = $this->getValue($modGroup, $module, $parGroup, $parameter);
            /*<span id="mod_content_management_parameter_span'.$tmpParameter['id'].'" onclick="">
              </span>*/
            if ($tmpType != 'wysiwyg') {
                $tmp_value = htmlspecialchars($tmp_value);
            }
            if ($tmp_value == '') {
                $tmp_value_preview = '&nbsp;&nbsp;&nbsp;&nbsp;';
            } else {
                $tmp_value_preview = $tmp_value;
            }
            $answer .= '
            <img style="display: none;" class="mod_content_management_parameter_buttons"  id="mod_content_management_parameter_buttons_' . $tmpParameter['id'] . '" border="0" onclick="mod_content_management_parameter_manage( ' . $tmpParameter['id'] . ', \'' . $tmpParameter['translation'] . '\', \'' . $tmpType . '\'); LibDefault.cancelBubbling(event); return false;" src="' . BASE_URL . MODULE_DIR . 'standard/content_management/design/icon_edit.gif" onmouseout="this.src=\'' . BASE_URL . MODULE_DIR . 'standard/content_management/design/icon_edit.gif\'" onmouseover="this.src=\'' . BASE_URL . MODULE_DIR . 'standard/content_management/design/icon_edit_hover.gif\'" title="Edit"/>
';
            $languageId = '';
            if ($tmpParameter['type'] == 'lang' || $tmpParameter['type'] == 'lang_textarea' || $tmpParameter['type'] == 'lang_wysiwyg') {
                $languageId = $site->currentLanguage['id'];
            }
            if (!defined('MOD_CONTENT_MANAGEMENT_PARAMETERS')) {
                $tmp_init = 'var mod_content_management_parameters = new Array();';
                define('MOD_CONTENT_MANAGEMENT_PARAMETERS', 1);
            } else {
                $tmp_init = '';
            }
            $answer .= "\n         <script type=\"text/javascript\">\n          //<![CDATA[  \n          " . $tmp_init . "\n          mod_content_management_parameters_" . $tmpParameter['id'] . " = new Array();\n          mod_content_management_parameters_" . $tmpParameter['id'] . "[0] = " . $tmpParameter['id'] . ";\n          mod_content_management_parameters_" . $tmpParameter['id'] . "[1] = '" . str_replace("\r", " ", str_replace("\n", " ", str_replace("'", "\\'", $tmp_value))) . "';\n          mod_content_management_parameters_" . $tmpParameter['id'] . "[2] = '" . $languageId . "';\n          mod_content_management_parameters_" . $tmpParameter['id'] . "[3] = false; //changed = false\n          mod_content_management_parameters.push(mod_content_management_parameters_" . $tmpParameter['id'] . ");        \n          function mod_content_management_parameter_mouseover_" . $tmpParameter['id'] . "(){\n            if(menu_saver){\n              document.getElementById('mod_content_management_parameter_buttons_" . $tmpParameter['id'] . "').style.display = 'block';\n            }\n          }\n          function mod_content_management_parameter_mouseout_" . $tmpParameter['id'] . "(){\n            document.getElementById('mod_content_management_parameter_buttons_" . $tmpParameter['id'] . "').style.display = 'none';\n          }\n          LibDefault.addEvent(document.getElementById('mod_content_management_parameter_buttons_" . $tmpParameter['id'] . "').parentNode, 'mouseover', mod_content_management_parameter_mouseover_" . $tmpParameter['id'] . ");\n          LibDefault.addEvent(document.getElementById('mod_content_management_parameter_buttons_" . $tmpParameter['id'] . "').parentNode, 'mouseout', mod_content_management_parameter_mouseout_" . $tmpParameter['id'] . ");\n          //]]>\n        </script>";
            $answer .= '
        ' . $tmp_value_preview . '
        ';
            if ($tmpType == 'wysiwyg') {
                $answer = '<div>' . $answer . '</div>';
            } else {
                $answer = '<span>' . $answer . '</span>';
            }
            return $answer;
        } else {
            $tmpType = $this->getType($modGroup, $module, $parGroup, $parameter);
            if ($tmpType != 'string_wysiwyg' && $tmpType != 'lang_wysiwyg') {
                return htmlspecialchars($this->getValue($modGroup, $module, $parGroup, $parameter));
            } else {
                return $this->getValue($modGroup, $module, $parGroup, $parameter);
            }
        }
    }
 public static function saveParameters($file, $ignoreLanguage = false)
 {
     //require_once(MODULE_DIR."standard/seo/db.php");
     global $site;
     require $file;
     $answer = '';
     //get languageId
     $languages = \Db_100::getLanguages();
     $languageId = $languages[0];
     if (isset($parameterGroupTitle)) {
         foreach ($parameterGroupTitle as $groupName => $group) {
             foreach ($group as $moduleName => $module) {
                 foreach ($module as $parameterGroupName => $value) {
                     $tmpModule = Db::getModule($groupName, $moduleName);
                     if ($tmpModule) {
                         $tmpParameterGroup = Db::getParameterGroup($tmpModule['id'], $parameterGroupName);
                         if ($tmpParameterGroup) {
                             Db::setParameterGroupTitle($tmpParameterGroup['id'], $value);
                         } else {
                             if (isset($parameterGroupAdmin[$groupName][$moduleName][$parameterGroupName])) {
                                 $admin = $parameterGroupAdmin[$groupName][$moduleName][$parameterGroupName];
                             } else {
                                 $admin = 1;
                             }
                             $tmpParameterGroup = Db::createParameterGroup($tmpModule['id'], $parameterGroupName, $value, $admin);
                         }
                     }
                 }
             }
         }
     }
     if (isset($parameterValue)) {
         foreach ($parameterValue as $groupName => $moduleGroup) {
             foreach ($moduleGroup as $moduleName => $module) {
                 $tmpModule = Db::getModule($groupName, $moduleName);
                 if ($tmpModule) {
                     foreach ($module as $parameterGroupName => $parameterGroup) {
                         $tmpParameterGroup = Db::getParameterGroup($tmpModule['id'], $parameterGroupName);
                         if (!$tmpParameterGroup) {
                             if (isset($parameterGroupAdmin[$groupName][$moduleName][$parameterGroupName])) {
                                 $admin = $parameterGroupAdmin[$groupName][$moduleName][$parameterGroupName];
                             } else {
                                 $admin = 1;
                             }
                             $tmpParameterGroup['id'] = Db::createParameterGroup($tmpModule['id'], $parameterGroupName, $parameterGroupName, $admin);
                         }
                         foreach ($parameterGroup as $parameterName => $value) {
                             if (!self::exist($groupName, $moduleName, $parameterGroupName, $parameterName)) {
                                 $parameter = array();
                                 $parameter['name'] = $parameterName;
                                 if (isset($parameterAdmin[$groupName][$moduleName][$parameterGroupName][$parameterName])) {
                                     $parameter['admin'] = $parameterAdmin[$groupName][$moduleName][$parameterGroupName][$parameterName];
                                 } else {
                                     $parameter['admin'] = 1;
                                 }
                                 if (isset($parameterTitle[$groupName][$moduleName][$parameterGroupName][$parameterName])) {
                                     $parameter['translation'] = $parameterTitle[$groupName][$moduleName][$parameterGroupName][$parameterName];
                                 } else {
                                     $parameter['translation'] = $parameterName;
                                 }
                                 if (isset($parameterType[$groupName][$moduleName][$parameterGroupName][$parameterName])) {
                                     $parameter['type'] = $parameterType[$groupName][$moduleName][$parameterGroupName][$parameterName];
                                 } else {
                                     $parameter['type'] = 'string';
                                 }
                                 $parameter['value'] = str_replace("\r\n", "\n", $value);
                                 //user can edit parameters file and change line endings. So, we convert them back
                                 $parameter['value'] = str_replace("\r", "\n", $parameter['value']);
                                 Db::insertParameter($tmpParameterGroup['id'], $parameter);
                             }
                         }
                     }
                 }
             }
         }
     }
     if (isset($parameterTitle)) {
         foreach ($parameterTitle as $moduleGroupName => $moduleGroup) {
             foreach ($moduleGroup as $moduleName => $module) {
                 foreach ($module as $parameterGroupName => $parameterGroup) {
                     foreach ($parameterGroup as $parameterName => $title) {
                         Db::setParameterTitle($moduleGroupName, $moduleName, $parameterGroupName, $parameterName, $title);
                     }
                 }
             }
         }
     }
     if (isset($moduleGroupTitle)) {
         foreach ($moduleGroupTitle as $groupName => $value) {
             Db::setModuleGroupTitle($groupName, $value);
         }
     }
     if (isset($moduleTitle)) {
         foreach ($moduleTitle as $groupName => $group) {
             foreach ($group as $moduleName => $value) {
                 Db::setModuleTitle($groupName, $moduleName, $value);
             }
         }
     }
     return $answer;
 }
Esempio n. 9
0
 private function _adminAccess()
 {
     require BASE_DIR . BACKEND_DIR . 'db.php';
     if (!isset($_REQUEST['username'])) {
         return false;
     }
     if (!isset($_REQUEST['password'])) {
         return false;
     }
     //check log in
     if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
         if (\Backend\Db::incorrectLoginCount($_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')') > 2) {
             \Backend\Db::log('system', 'backend login suspended (menu management)', $_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')', 2);
             return false;
         } else {
             $id = \Backend\Db::userId($_REQUEST['username'], $_REQUEST['password']);
             if ($id !== false) {
                 $module = \Db::getModule(null, $groupName = 'standard', $moduleName = 'menu_management');
                 if (\Backend\Db::allowedModule($moduleId = $module['id'], $userId = $id)) {
                     \Backend\Db::log('system', 'backend login (menu management)', $_REQUEST['username'] . ' (' . $_SERVER['REMOTE_ADDR'] . ')', 0);
                     return true;
                 } else {
                     \Backend\Db::log('system', 'this user is not allowed to access menu management module', $_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')', 1);
                     return false;
                 }
             } else {
                 \Backend\Db::log('system', 'backend login incorrect (menu management)', $_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')', 1);
                 return false;
             }
         }
     }
     //check log in
     return false;
 }
Esempio n. 10
0
 /**
  * Some modules need to make some actions before any output.
  * 
  * This function detects such requirements and executes specified module.
  * 
  * If you need to use this feature, simply POST (or GET) two variables:
  * 
  * $_REQUEST['module_group']
  * 
  * $_REQUEST['module_name']
  * 
  * This function will include file actions.php on specified module directory and execute method "make_actions()" on class actions_REQUEST['module_group']_REQUEST['module_name']
  * 
  */
 public function makeActions()
 {
     if (sizeof($_REQUEST) > 0) {
         if (isset($_REQUEST['module_group']) && isset($_REQUEST['module_name'])) {
             //old deprecated way
             //actions may be set by post or get. The prime way is trouht post. But in some cases it is not possible
             $newModule = \Db::getModule(null, $_REQUEST['module_group'], $_REQUEST['module_name']);
             if ($newModule) {
                 if ($newModule['core']) {
                     require_once BASE_DIR . MODULE_DIR . $newModule['g_name'] . '/' . $newModule['m_name'] . '/actions.php';
                 } else {
                     require_once BASE_DIR . PLUGIN_DIR . $newModule['g_name'] . '/' . $newModule['m_name'] . '/actions.php';
                 }
                 eval('$tmpModule = new \\Modules\\' . $newModule['g_name'] . '\\' . $newModule['m_name'] . '\\Actions();');
                 $tmpModule->makeActions();
             } else {
                 $backtrace = debug_backtrace();
                 if (isset($backtrace[0]['file']) && isset($backtrace[0]['line'])) {
                     trigger_error("Requested module (" . $_REQUEST['module_group'] . ">" . $_REQUEST['module_name'] . ") does not exitst. (Error source: '.{$backtrace['0']}['file'].' line: '.{$backtrace['0']}['line'].' ) ");
                 } else {
                     trigger_error("Requested module (" . $_REQUEST['module_group'] . ">" . $_REQUEST['module_name'] . ") does not exitst.");
                 }
             }
         }
     }
     $this->getZone($this->currentZone)->makeActions();
 }
Esempio n. 11
0
 public function findNewModules()
 {
     global $cms;
     global $parametersMod;
     $answer = '';
     $newModules = array();
     $newModuleGroups = $this->getFolders(PLUGIN_DIR);
     foreach ($newModuleGroups as $key => $newModuleGroup) {
         $newModuleGroups[$key] = self::getFolders(PLUGIN_DIR . $key . "/");
     }
     foreach ($newModuleGroups as $newModuleGroupKey => $newModuleGroup) {
         foreach ($newModuleGroup as $newModuleKey => $newModule) {
             $currentModule = \Db::getModule(null, $newModuleGroupKey, $newModuleKey);
             if (file_exists(BASE_DIR . PLUGIN_DIR . $newModuleGroupKey . '/' . $newModuleKey . '/install/plugin.ini')) {
                 $configuration = new ConfigurationFile(BASE_DIR . PLUGIN_DIR . $newModuleGroupKey . '/' . $newModuleKey . '/install/plugin.ini');
                 if (!$currentModule) {
                     $newModules[] = array('action' => 'insert', 'configuration' => $configuration, 'dependend' => false);
                 } else {
                     if ((double) $currentModule['version'] < (double) $configuration->getModuleVersion()) {
                         $newModules[] = array('action' => 'update', 'configuration' => $configuration, 'dependend' => false);
                     }
                 }
             } else {
                 $answer .= $parametersMod->getValue('developer', 'modules', 'admin_translations_install', 'error_ini_file_doesnt_exist') . '<b>' . $newModuleGroupKey . '/' . $newModuleKey . '/install/plugin.ini</b>';
             }
         }
     }
     if (sizeof($newModules) > 0) {
         $answer .= '<link media="screen" rel="stylesheet" type="text/css" href="' . BASE_URL . MODULE_DIR . 'developer/modules/style.css"/>';
     }
     foreach ($newModules as $key2 => &$newModule2) {
         //fill alreadyUsed array;
         $this->setDepend($newModules, $newModule2, 1);
     }
     foreach ($newModules as $key => $newModule) {
         if (!$newModule['dependend']) {
             $answer .= $this->printInstallBlock($newModules, $newModule, $alreadyUsed2, 1);
         }
     }
     return $answer;
 }
Esempio n. 12
0
 function set_main_fields()
 {
     global $parametersMod;
     global $site;
     $url = $_REQUEST['url'];
     $url = str_replace('/', '-', $url);
     if ($url == '') {
         $url = 'page';
     }
     //report about changed URL
     $elementZone = $site->getZone($_REQUEST['zone_name']);
     $element = $elementZone->getElement($_REQUEST['id']);
     $oldUrl = $element->getLink(true);
     //report about changed URL
     $url = $this->makeUrl($url, $_REQUEST['id']);
     if ($_REQUEST['rss'] == 1) {
         $rss = ' 1 ';
     } else {
         $rss = ' 0 ';
     }
     if ($_REQUEST['visible'] == 1) {
         $visible = ' 1 ';
     } else {
         $visible = ' 0 ';
     }
     $sql = "update `" . DB_PREF . "content_element`\n    set \n    \n    page_title = '" . mysql_real_escape_string($_REQUEST['page_page_title']) . "', \n    button_title = '" . mysql_real_escape_string($_REQUEST['page_button_title']) . "', \n    keywords = '" . mysql_real_escape_string($_REQUEST['keywords']) . "', \n    description = '" . mysql_real_escape_string($_REQUEST['description']) . "', \n    url = '" . mysql_real_escape_string($url) . "', \n    redirect_url = '" . mysql_real_escape_string($_REQUEST['redirect_url']) . "', \n    type = '" . mysql_real_escape_string($_REQUEST['type']) . "', \n    rss = " . $rss . ", \n    visible = " . $visible . ",\n    created_on = '" . date("Y-m-d", strtotime($_REQUEST['created_on'])) . "'\n    where id = '" . mysql_real_escape_string($_REQUEST['id']) . "'";
     $rs = mysql_query($sql);
     if (!$rs) {
         $this->set_error("Can't update page title " . $sql);
     }
     //report about changed URL
     $elementZone = $site->getZone($_REQUEST['zone_name']);
     $element = $elementZone->getElement($_REQUEST['id']);
     $newUrl = $element->getLink(true);
     if ($newUrl != $oldUrl) {
         $site->dispatchEvent('administrator', 'system', 'url_change', array('old_url' => $oldUrl, 'new_url' => $newUrl));
     }
     //report about changed URL
     if (isset($_POST['f_main_parameter'])) {
         foreach ($_POST['f_main_parameter'] as $key => $parId) {
             $parameter = \Db::getParameterById($parId);
             $parameter_group = \Db::getParameterGroupById($parameter['group_id']);
             $module = \Db::getModule($parameter_group['module_id']);
             if (isset($_POST['f_main_parameter_language'][$key]) && $_POST['f_main_parameter_language'][$key] != '') {
                 $parametersMod->setValue($module['g_name'], $module['m_name'], $parameter_group['name'], $parameter['name'], $_POST['f_main_parameter_value'][$key], $_POST['f_main_parameter_language'][$key]);
             } else {
                 $parametersMod->setValue($module['g_name'], $module['m_name'], $parameter_group['name'], $parameter['name'], $_POST['f_main_parameter_value'][$key]);
             }
         }
     }
 }
Esempio n. 13
0
    private function generateAdministratorInterfaceLanguageFile()
    {
        global $parametersMod;
        require_once __DIR__ . "/administrator_interface_config.php";
        $answer = '';
        //language code
        $answer .= '<?php
$parameterValue ["standard"]["configuration"]["advanced_options"]["administrator_interface_language"] = "' . str_replace('"', '\\"', $parametersMod->getValue('standard', 'configuration', 'advanced_options', 'administrator_interface_language')) . '"; //insert RFC 4646 code of language into whish you are translating now

';
        //module groups
        foreach ($moduleGroupTitle as $key => $groupTitle) {
            $group = Db::getModuleGroup($key);
            $answer .= '
$moduleGroupTitle["' . $key . '"] = "' . str_replace('"', '\\"', $group['translation']) . '";';
        }
        $answer .= '
';
        //modules
        foreach ($moduleTitle as $groupName => $group) {
            foreach ($group as $moduleName => $group) {
                $module = Db::getModule($groupName, $moduleName);
                $answer .= '
$moduleTitle["' . $groupName . '"]["' . $moduleName . '"] = "' . str_replace('"', '\\"', $module['translation']) . '";';
            }
        }
        $answer .= '
';
        //parameter groups
        foreach ($parameterGroupTitle as $moduleGroupName => $group) {
            foreach ($group as $moduleName => $module) {
                foreach ($module as $parameterGroupName => $parameterGroup) {
                    $module = Db::getModule($moduleGroupName, $moduleName);
                    $moduleGroup = Db::getParameterGroup($module['id'], $parameterGroupName);
                    $answer .= '
$parameterGroupTitle["' . $moduleGroupName . '"]["' . $moduleName . '"]["' . $parameterGroupName . '"] = "' . str_replace('"', '\\"', $moduleGroup['translation']) . '";';
                }
            }
        }
        //parameters
        $lastParameter = '';
        foreach ($parameter as $key => $par) {
            $keys = explode("/", $key);
            if ($lastParameter != $keys[1] . '/' . $keys[2] . '/' . $keys[3] . '/' . $keys[4]) {
                $answer .= '
';
            }
            $lastParameter = $keys[1] . '/' . $keys[2] . '/' . $keys[3] . '/' . $keys[4];
            if ($keys[0] == 'parameterTitle') {
                $dbParameter = Db::getParameter($keys[1], $keys[2], $keys[3], $keys[4]);
                $answer .= '
$parameterTitle["' . $keys[1] . '"]["' . $keys[2] . '"]["' . $keys[3] . '"]["' . $keys[4] . '"] = "' . str_replace('"', '\\"', $dbParameter['translation']) . '";';
            } else {
                $answer .= '
$parameterValue["' . $keys[1] . '"]["' . $keys[2] . '"]["' . $keys[3] . '"]["' . $keys[4] . '"] = "' . str_replace('"', '\\"', $parametersMod->getValue($keys[1], $keys[2], $keys[3], $keys[4])) . '";';
            }
        }
        return $answer;
    }