/** * Saves the record from an edit form submit * @param string The current GET/POST option */ function saveSyndicate($option) { global $database; josSpoofCheck(); $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $id = intval(mosGetParam($_POST, 'id', '17')); $row = new mosComponent($database); $row->load($id); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $msg = 'Settings successfully Saved'; mosRedirect('index2.php?option=' . $option, $msg); }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $secids = mosGetParam($_POST, 'secid', array()); $secid = implode(',', $secids); $params[sectionid] = $secid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($secids) == 1 && $secids[0] != '') { $row->link = str_replace('id=0', 'id=' . $secids[0], $row->link); $row->componentid = $secids[0]; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype='{$row->menutype}' AND parent='{$row->parent}'"); $msg = 'Menu item Saved'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $params[url] = mosGetParam($_POST, 'url', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder('menutype = ' . $database->Quote($row->menutype) . ' AND parent = ' . (int) $row->parent); $msg = 'Item de menu salvo'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }
/** * Saves the module after an edit form submit */ function saveModule($option, $client, $task) { global $database; josSpoofCheck(); $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosModule($database); if (!$row->bind($_POST, 'selections')) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); if ($client == 'admin') { $where = "client_id=1"; } else { $where = "client_id=0"; } $row->updateOrder('position=' . $database->Quote($row->position) . " AND ({$where})"); $menus = josGetArrayInts('selections'); // delete old module to menu item associations $query = "DELETE FROM #__modules_menu" . "\n WHERE moduleid = " . (int) $row->id; $database->setQuery($query); $database->query(); // check needed to stop a module being assigned to `All` // and other menu items resulting in a module being displayed twice if (in_array('0', $menus)) { // assign new module to `all` menu item associations $query = "INSERT INTO #__modules_menu" . "\n SET moduleid = " . (int) $row->id . ", menuid = 0"; $database->setQuery($query); $database->query(); } else { foreach ($menus as $menuid) { // this check for the blank spaces in the select box that have been added for cosmetic reasons if ($menuid != "-999") { // assign new module to menu item associations $query = "INSERT INTO #__modules_menu" . "\n SET moduleid = " . (int) $row->id . ", menuid = " . (int) $menuid; $database->setQuery($query); $database->query(); } } } mosCache::cleanCache('com_content'); switch ($task) { case 'apply': $msg = 'Successfully Saved changes to Module: ' . $row->title; mosRedirect('index2.php?option=' . $option . '&client=' . $client . '&task=editA&hidemainmenu=1&id=' . $row->id, $msg); break; case 'save': default: $msg = 'Successfully Saved Module: ' . $row->title; mosRedirect('index2.php?option=' . $option . '&client=' . $client, $msg); break; } }
/** * Writes the configuration file of the current theme * * @param array $d */ function writeThemeConfig(&$d) { global $page, $VM_LANG, $vmLogger; $my_config_array = array(); $config = "<?php\r\nif( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );\r\n/**\r\n* The configuration file for the " . basename(VM_THEMEPATH) . " theme\r\n*\r\n* @package VirtueMart\r\n* @subpackage themes\r\n* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php\r\n* VirtueMart is free software. This version may have been modified pursuant\r\n* to the GNU General Public License, and as distributed it includes or\r\n* is derivative of works licensed under the GNU General Public License or\r\n* other free or open source software licenses.\r\n* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.\r\n*\r\n* http://virtuemart.net\r\n*/\r\n?>\r\n"; $params = vmGet($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } if (is_callable(array('mosParameters', 'textareaHandling'))) { $_POST['params'] = mosParameters::textareaHandling($txt); } else { $total = count($txt); for ($i = 0; $i < $total; $i++) { if (strstr($txt[$i], "\n")) { $txt[$i] = str_replace("\n", '<br />', $txt[$i]); } } $_POST['params'] = implode("\n", $txt); } } $config .= $_POST['params']; if ($fp = fopen(VM_THEMEPATH . "theme.config.php", "w")) { fputs($fp, $config, strlen($config)); fclose($fp); if (!empty($_REQUEST['ajax_request'])) { $vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false)); } else { $task = vmGet($_REQUEST, 'task', ''); if ($task == 'apply') { $page = 'admin.theme_config_form'; $theme = '&theme=' . basename(VM_THEMEURL); } else { $page = 'admin.show_cfg'; $theme = ''; } if (!empty($_REQUEST['ajax_request'])) { $vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false)); } else { vmRedirect($_SERVER['PHP_SELF'] . "?page={$page}{$theme}&option=com_virtuemart", $VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS')); } } return true; } else { $vmLogger->err($VM_LANG->_('VM_CONFIGURATION_CHANGE_FAILURE', false) . ' (' . VM_THEMEPATH . "theme.config.php)"); return false; } }
/** * Saves the module after an edit form submit */ function saveModule($option, $client, $task) { global $database; $params = mosGetParam($_POST, 'params', '', _MOS_ALLOWHTML); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosModule($database); if (!$row->bind($_POST, 'selections')) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // special access groups if (is_array($row->groups)) { $row->groups = implode(',', $row->groups); } else { $row->groups = ''; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); if ($client == 'admin') { $where = "client_id='1'"; } else { $where = "client_id='0'"; } $row->updateOrder("position='{$row->position}' AND ({$where})"); $menus = mosGetParam($_POST, 'selections', array()); $database->setQuery("DELETE FROM #__modules_menu WHERE moduleid='{$row->id}'"); $database->query(); foreach ($menus as $menuid) { // this check for the blank spaces in the select box that have been added for cosmetic reasons if ($menuid != "-999" && $menuid != "-998") { $query = "INSERT INTO #__modules_menu SET moduleid='{$row->id}', menuid='{$menuid}'"; $database->setQuery($query); $database->query(); } } switch ($task) { case 'apply': $msg = sprintf(T_('Successfully Saved changes to Module: %s'), $row->title); mosRedirect('index2.php?option=' . $option . '&client=' . $client . '&task=editA&hidemainmenu=1&id=' . $row->id, $msg); break; case 'save': default: $msg = sprintf(T_('Successfully Saved Module: %s'), $row->title); mosRedirect('index2.php?option=' . $option . '&client=' . $client, $msg); break; } }
/** * Saves the module after an edit form submit */ function saveMambot($option, $client, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMambot($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); if ($client == 'admin') { $where = "client_id='1'"; } else { $where = "client_id='0'"; } $row->updateOrder("folder='{$row->folder}' AND ordering > -10000 AND ordering < 10000 AND ({$where})"); switch ($task) { case 'apply': $msg = sprintf(T_('Successfully Saved changes to Mambot: %s'), $row->name); mosRedirect('index2.php?option=' . $option . '&client=' . $client . '&task=editA&hidemainmenu=1&id=' . $row->id, $msg); case 'save': default: $msg = sprintf(T_('Successfully Saved Mambot: %s'), $row->name); mosRedirect('index2.php?option=' . $option . '&client=' . $client, $msg); break; } }
/** * Saves the module after an edit form submit */ function saveMambot($option, $client, $task) { global $database; josSpoofCheck(); $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMambot($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); if ($client == 'admin') { $where = "client_id='1'"; } else { $where = "client_id='0'"; } $row->updateOrder("folder = " . $database->Quote($row->folder) . " AND ordering > -10000 AND ordering < 10000 AND ( {$where} )"); switch ($task) { case 'apply': $msg = 'Alterações realizadas com sucesso!: ' . $row->name; mosRedirect('index2.php?option=' . $option . '&client=' . $client . '&task=editA&hidemainmenu=1&id=' . $row->id, $msg); case 'save': default: $msg = 'Plugin salvo com sucesso: ' . $row->name; mosRedirect('index2.php?option=' . $option . '&client=' . $client, $msg); break; } }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $catids = josGetArrayInts('catid'); $catid = implode(',', $catids); $params['categoryid'] = $catid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($catids) == 1 && $catids[0] != "") { $row->link = str_replace("id=0", "id=" . $catids[0], $row->link); $row->componentid = $catids[0]; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype = " . $database->Quote($row->menutype) . " AND parent = " . (int) $row->parent); $msg = 'Item de menu salvo'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }