/** * Loads admin modules via module position * @param string The position * @param int 0 = no style, 1 = tabbed */ function mosLoadAdminModules($position = 'left', $style = 0) { global $database, $acl, $my; $cache =& mosCache::getCache('com_content'); $query = "SELECT id, title, module, position, content, showtitle, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.position = " . $database->Quote($position) . "\n AND m.client_id = 1" . "\n ORDER BY m.ordering"; $database->setQuery($query); $modules = $database->loadObjectList(); if ($database->getErrorNum()) { echo "MA " . $database->stderr(true); return; } switch ($style) { case 1: // Tabs $tabs = new mosTabs(1); $tabs->startPane('modules-' . $position); foreach ($modules as $module) { $params = new mosParameters($module->params); $editAllComponents = $acl->acl_check('administration', 'edit', 'users', $my->usertype, 'components', 'all'); // special handling for components module if ($module->module != 'mod_components' || $module->module == 'mod_components' && $editAllComponents) { $tabs->startTab($module->title, 'module' . $module->id); if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } $tabs->endTab(); } } $tabs->endPane(); break; case 2: // Div'd foreach ($modules as $module) { $params = new mosParameters($module->params); echo '<div>'; if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } echo '</div>'; } break; case 0: default: foreach ($modules as $module) { $params = new mosParameters($module->params); if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } } break; } }
/** * Loads admin modules via module position * @param string The position * @param int 0 = no style, 1 = tabbed */ function mosLoadAdminModules($position = 'left', $style = 0) { global $database, $adminLanguage; $cache =& mosCache::getCache('com_content'); $query = "SELECT id, title, module, position, content, showtitle, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = '1'" . "\n AND m.position='{$position}'" . "\n AND (m.client_id = 1)" . "\n ORDER BY m.ordering"; $database->setQuery($query); $modules = $database->loadObjectList(); if ($database->getErrorNum()) { echo "MA " . $database->stderr(true); return; } switch ($style) { case 0: default: foreach ($modules as $module) { $params =& new mosParameters($module->params); if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } } break; case 1: // Tabs $tabs = new mosTabs(0); $tabs->startPane('modules-' . $position); foreach ($modules as $module) { $params =& new mosParameters($module->params); $tabs->startTab($module->title, 'module' . $module->id); if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } $tabs->endTab(); } $tabs->endPane(); break; case 2: // Div'd foreach ($modules as $module) { $params =& new mosParameters($module->params); echo '<div>'; if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } echo '</div>'; } break; } }
function orderModule($uid, $inc, $option, $client = 'admin') { global $database; $row = new mosModule($database); $row->load((int) $uid); if ($client == 'admin') { $where = "client_id = 1"; } else { $where = "client_id = 0"; } $row->move($inc, "position = " . $database->Quote($row->position) . " AND ( {$where} )"); mosCache::cleanCache('com_content'); $redirect = mosGetParam($_REQUEST, 'redirect', 'index2.php?option=' . $option . '&client=' . $client); mosRedirect($redirect); }
/** * User login into CMS framework * * @param string $username The username * @param string|boolean $password if boolean FALSE: login without password if possible * @param booleean $rememberme 1 for "remember-me" cookie method * @param int $userId used for "remember-me" login function only * @return boolean Login success */ function login( $username, $password, $rememberme = 0, $userId = null ) { header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); // needed for IE6 to accept this anti-spam cookie in higher security setting. if ( checkJversion() >= 1 ) { // Joomla 1.5 RC and above: if ( $password !== false ) { $result = $this->_baseFramework->login( array( 'username' => $username, 'password' => $password ), array( 'remember' => $rememberme ) ); } else { // login without password: jimport( 'joomla.user.authentication' ); // load user plugins: JPluginHelper::importPlugin( 'user' ); // get JAuthentication object: $authenticate =& JAuthentication::getInstance(); $dispatcher =& JDispatcher::getInstance(); $response = new JAuthenticationResponse(); // prepare our SUCCESS login response including user data: global $_CB_database; $row = new moscomprofilerUser( $_CB_database ); $row->loadByUsername( stripslashes( $username ) ); $response->status = JAUTHENTICATE_STATUS_SUCCESS; $response->username = $username; $response->fullname = $row->name; // now we attempt user login and check results: if ( checkJversion() == 2 ) { $login = $dispatcher->trigger( 'onUserLogin', array( (array) $response, array( 'action' => 'core.login.site' ) ) ); } else { $login = $dispatcher->trigger( 'onLoginUser', array( (array) $response, array() ) ); } $result = ! in_array( false, $login, true ); } if ( $result ) { $user =& JFactory::getUser(); $this->_myId = (int) $user->id; $this->_myUsername = $user->username; $this->_myUserType = $user->usertype; $this->_myCmsGid = $user->get('aid', 0); $lang =& JFactory::getLanguage(); if ( checkJversion() == 2 ) { $this->_myLanguage = strtolower( preg_replace( '/^(\w+).*$/i', '\1', $lang->getName() ) ); } else { $this->_myLanguage = $lang->getBackwardLang(); } } } else { // Mambo 4.5.x and Joomla before 1.0.13+ (in fact RC3+) do need hashed password for login() method: if ( $password !== false ) { $hashedPwdLogin = ( ( checkJversion() == 0 ) && ! function_exists( 'josHashPassword' ) ); // more reliable version-checking than the often hacked version.php file! if ( $hashedPwdLogin ) { // Joomla 1.0.12 and below: $dummyRow = new moscomprofilerUser( $_CB_database ); $this->_baseFramework->login( $username, $dummyRow->hashAndSaltPassword( $password ), $rememberme, $userId ); } else { $this->_baseFramework->login( $username, $password, $rememberme, $userId ); } // Joomla 1.0 redirects bluntly if login fails! so we need to check by ourselves below: $result = true; } else { // login without password: //TBD MAMBO 4.6 support here ! global $_CB_database, $mainframe, $_VERSION; $row = new moscomprofilerUser( $_CB_database ); $row->loadByUsername( stripslashes( $username ) ); // prepare login session with user data: $session =& $mainframe->_session; $session->guest = 0; $session->username = $row->username; $session->userid = (int) $row->id; $session->usertype = $row->usertype; $session->gid = (int) $row->gid; // attempt to login user: if ( $session->update() ) { $result = true; } // check if site is demo or production: if ( $_VERSION->SITE ) { // site is production; remove duplicate sessions: $query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__session' ) . "\n WHERE " . $_CB_database->NameQuote( 'session_id' ) . ' != ' . $_CB_database->Quote( $session->session_id ) . "\n AND " . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $row->username ) . "\n AND " . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $row->id . "\n AND " . $_CB_database->NameQuote( 'gid' ) . ' = ' . (int) $row->gid . "\n AND " . $_CB_database->NameQuote( 'guest' ) . ' = 0'; $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { trigger_error( 'loginUser 1 SQL error: ' . $_CB_database->stderr( true ), E_USER_WARNING ); } } // get current datetime: $currentDate = date( 'Y-m-d H:i:s', $this->now() ); // update user last login with current datetime: $query = 'UPDATE ' . $_CB_database->NameQuote( '#__users' ) . "\n SET " . $_CB_database->NameQuote( 'lastvisitDate' ) . " = " . $_CB_database->Quote( $currentDate ) . "\n WHERE " . $_CB_database->NameQuote( 'id' ) . " = " . (int) $session->userid; $_CB_database->setQuery( $query ); if ( ! $_CB_database->query() ) { trigger_error( 'loginUser 2 SQL error: ' . $_CB_database->stderr( true ), E_USER_WARNING ); } // clean old cache: mosCache::cleanCache(); } if ( checkJversion() == 0 ) { global $mainframe; $mymy = $mainframe->getUser(); $this->_myId = (int) $mymy->id; $this->_myUsername = $mymy->username; $this->_myUserType = $mymy->usertype; $this->_myCmsGid = $mymy->gid; if ( ! $this->_myId ) { $result = false; } } //TBD MAMBO 4.6 support here ! } return $result; }
echo T_('Clean the content items cache'); ?> '], <?php } } ?> ], <?php } ?> _cmSplit, <?php // Help Sub-Menu if (file_exists(mamboCore::get('rootPath') . '/help/mambo.whatsnew.html')) { ?> [null,'<?php echo T_('Help'); ?> ','index2.php?option=com_admin&task=help',null,null]<?php } ?> ]; cmDraw ('myMenuID', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice'); </script> <?php } } $cache =& mosCache::getCache('mos_fullmenu'); mosFullAdminMenu::show($my->usertype); //$cache->call( 'mosFullAdminMenu::show', $my->usertype );
/** * Cleans the cache */ function cleanCache($group = false) { if (mamboCore::get('mosConfig_caching')) { $cache =& mosCache::getCache($group); $cache->clean($group); } }
function clearSession($session = null) { if ($session === null) { $session =& mosSession::getCurrent(); } //mosCache::cleanCache('com_content'); mosCache::cleanCache(); $session->guest = 1; $session->username = ''; $session->userid = ''; $session->usertype = ''; $session->gid = 0; $session->update(); // this is daggy?? $lifetime = time() - 1800; setcookie("usercookie[username]", " ", $lifetime, "/"); setcookie("usercookie[password]", " ", $lifetime, "/"); setcookie("usercookie", " ", $lifetime, "/"); @session_destroy(); }
/** * Assembles head tags */ function mosShowHead() { global $database, $option, $my, $mainframe, $_VERSION, $task, $id; global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $mosConfig_live_site, $mosConfig_sef, $mosConfig_absolute_path, $mosConfig_sitename, $mosConfig_favicon; $mainframe->appendMetaTag('description', $mosConfig_MetaDesc); $mainframe->appendMetaTag('keywords', $mosConfig_MetaKeys); $mainframe->addMetaTag('Generator', $_VERSION->PRODUCT . ' - ' . $_VERSION->COPYRIGHT); $mainframe->addMetaTag('robots', 'index, follow'); // cache activation if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { $cache =& mosCache::getCache('com_content'); echo $cache->call('mainframe->getHead', @$_SERVER['QUERY_STRING'], $id); } else { echo $mainframe->getHead(); } if (isset($mosConfig_sef) && $mosConfig_sef) { echo "<base href=\"{$mosConfig_live_site}/\" />\r\n"; } if ($my->id || $mainframe->get('joomlaJavascript')) { ?> <script src="<?php echo $mosConfig_live_site; ?> /includes/js/joomla.javascript.js" type="text/javascript"></script> <?php } $row = new mosComponent($database); $query = "SELECT a.*" . "\n FROM #__components AS a" . "\n WHERE ( a.admin_menu_link = 'option=com_syndicate' OR a.admin_menu_link = 'option=com_syndicate&hidemainmenu=1' )" . "\n AND a.option = 'com_syndicate'"; $database->setQuery($query); $database->loadObject($row); // get params definitions $syndicateParams = new mosParameters($row->params, $mainframe->getPath('com_xml', $row->option), 'component'); // needed to reduce query $GLOBALS['syndicateParams'] = $syndicateParams; $live_bookmark = $syndicateParams->get('live_bookmark', 0); // and to allow disabling/enabling of selected feed types switch ($live_bookmark) { case 'RSS0.91': if (!$syndicateParams->get('rss091', 1)) { $live_bookmark = 0; } break; case 'RSS1.0': if (!$syndicateParams->get('rss10', 1)) { $live_bookmark = 0; } break; case 'RSS2.0': if (!$syndicateParams->get('rss20', 1)) { $live_bookmark = 0; } break; case 'ATOM0.3': if (!$syndicateParams->get('atom03', 1)) { $live_bookmark = 0; } break; } // support for Live Bookmarks ability for site syndication if ($live_bookmark) { $show = 1; $link_file = $mosConfig_live_site . '/index2.php?option=com_rss&feed=' . $live_bookmark . '&no_html=1'; // xhtml check $link_file = ampReplace($link_file); // security chcek $check = $syndicateParams->def('check', 1); if ($check) { // test if rssfeed module is published // if not disable access $query = "SELECT m.id" . "\n FROM #__modules AS m" . "\n WHERE m.module = 'mod_rssfeed'" . "\n AND m.published = 1"; $database->setQuery($query); $check = $database->loadResultArray(); if (empty($check)) { $show = 0; } } // outputs link tag for page if ($show) { // test if security check is enbled ?> <link rel="alternate" type="application/rss+xml" title="<?php echo $mosConfig_sitename; ?> " href="<?php echo $link_file; ?> " /> <?php } } // favourites icon if (!$mosConfig_favicon) { $mosConfig_favicon = 'favicon.ico'; } $icon = $mosConfig_absolute_path . '/images/' . $mosConfig_favicon; // checks to see if file exists if (!file_exists($icon)) { $icon = $mosConfig_live_site . '/images/favicon.ico'; } else { $icon = $mosConfig_live_site . '/images/' . $mosConfig_favicon; } // outputs link tag for page ?> <link rel="shortcut icon" href="<?php echo $icon; ?> " /> <?php }
/** * Executes a cacheable callback if not found in cache else returns cached output and result * * @param mixed $callback Callback or string shorthand for a callback * @param array $args Callback arguments * @param bool $id * @return mixed Result of the callback */ public function get($callback, $args, $id = false) { array_unshift($args, $callback); $cache = mosCache::getCache($this->_options['defaultgroup']); return call_user_func_array(array($cache, 'call'), $args); }
/** * @param string The position * @param int The style. 0=normal, 1=horiz, -1=no wrapper */ function mosLoadModules($position = 'left', $style = 0) { global $mosConfig_gzip, $mosConfig_absolute_path, $database, $my, $Itemid, $mosConfig_caching; $tp = mosGetParam($_GET, 'tp', 0); if ($tp) { echo '<div style="height:50px;background-color:#eee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">'; echo $position; echo '</div>'; return; } $style = intval($style); $cache =& mosCache::getCache('com_content'); require_once 'includes/frontend.html.php'; /* $query = "SELECT id, title, module, position, content, showtitle, params" ."\nFROM #__modules AS m, #__modules_menu AS mm" . "\nWHERE m.published='1' AND m.access <= '$my->gid' AND m.position='$position' AND m.client_id='0'" . "\nAND mm.moduleid=m.id" . "\nAND (mm.menuid = '$Itemid' OR mm.menuid = '0')" . "\nORDER BY ordering"; $database->setQuery( $query ); $modules = $database->loadObjectList(); if($database->getErrorNum()) { echo "MA ".$database->stderr(true); return; } */ $allModules =& initModules(); if (isset($GLOBALS['_MOS_MODULES'][$position])) { $modules = $GLOBALS['_MOS_MODULES'][$position]; } else { $modules = array(); } if (count($modules) < 1) { $style = 0; } if ($style == 1) { echo "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"; echo "<tr>\n"; } $prepend = $style == 1 ? "<td valign=\"top\">\n" : ''; $postpend = $style == 1 ? "</td>\n" : ''; foreach ($modules as $module) { $params =& new mosParameters($module->params); echo $prepend; if (substr("{$module->module}", 0, 4) == "mod_") { if ($params->get('cache') == 1 && $mosConfig_caching == 1) { $cache->call('modules_html::module2', $module, $params, $Itemid, $style); } else { modules_html::module2($module, $params, $Itemid, $style); } } else { if ($params->get('cache') == 1 && $mosConfig_caching == 1) { $cache->call('modules_html::module', $module, $params, $Itemid, $style); } else { modules_html::module($module, $params, $Itemid, $style); } } echo $postpend; } if ($style == 1) { echo "</tr>\n</table>\n"; } }
/** * Copies a complete menu, all its items and creates a new module, using the name speified */ function copyMenu($option, $cid, $type) { global $database; josSpoofCheck(); $menu_name = stripslashes(strval(mosGetParam($_POST, 'menu_name', 'New Menu'))); $module_name = stripslashes(strval(mosGetParam($_POST, 'module_name', 'New Module'))); // check for unique menutype for new menu copy $query = "SELECT params" . "\n FROM #__modules" . "\n WHERE module = 'mod_mainmenu'"; $database->setQuery($query); $menus = $database->loadResultArray(); foreach ($menus as $menu) { $params = mosParseParams($menu); if ($params->menutype == $menu_name) { echo "<script> alert('A menu already exists with that name - you must enter a unique Menu Name'); window.history.go(-1); </script>\n"; exit; } } // copy the menu items $mids = josGetArrayInts('mids'); $total = count($mids); $copy = new mosMenu($database); $original = new mosMenu($database); sort($mids); $a_ids = array(); foreach ($mids as $mid) { $original->load($mid); $copy = $original; $copy->id = NULL; $copy->parent = $a_ids[$original->parent]; $copy->menutype = $menu_name; if (!$copy->check()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$copy->store()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } $a_ids[$original->id] = $copy->id; } // create the module copy $row = new mosModule($database); $row->load(0); $row->title = $module_name; $row->iscore = 0; $row->published = 1; $row->position = 'left'; $row->module = 'mod_mainmenu'; $row->params = 'menutype=' . $menu_name; 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('position=' . $database->Quote($row->position)); // module assigned to show on All pages by default // ToDO: Changed to become a Joomla! db-object $query = "INSERT INTO #__modules_menu VALUES ( " . (int) $row->id . ", 0 )"; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Copy of Menu `' . $type . '` created, consisting of ' . $total . ' items'; mosRedirect('index2.php?option=' . $option, $msg); }
/** * User logout * * Reverts the current session record back to 'anonymous' parameters */ function logout() { mosCache::cleanCache(); $session =& $this->_session; $session->guest = 1; $session->username = ''; $session->userid = ''; $session->usertype = ''; $session->gid = 0; $session->update(); // kill remember me cookie $lifetime = time() - 86400; $remCookieName = mosMainFrame::remCookieName_User(); setcookie($remCookieName, ' ', $lifetime, '/'); @session_destroy(); }
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $redirect = mosGetParam($_POST, 'redirect', 0); $rettask = strval(mosGetParam($_POST, 'returntask', '')); $order = josGetArrayInts('order'); $row = new mosContent($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "catid = " . (int) $row->catid . " AND state >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; switch ($rettask) { case 'showarchive': mosRedirect('index2.php?option=com_content&task=showarchive§ionid=' . $redirect, $msg); break; default: mosRedirect('index2.php?option=com_content§ionid=' . $redirect, $msg); break; } // switch }
* Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // no direct access defined('_VALID_MOS') or die('Restricted access'); require_once $mainframe->getPath('admin_html'); switch ($task) { case 'clean_cache': mosCache::cleanCache('com_content'); mosRedirect('index2.php', 'As caches de artigos foram limpas'); break; case 'clean_all_cache': mosCache::cleanCache(); mosRedirect('index2.php', 'Todas as caches foram limpas'); break; case 'redirect': $goto = strval(strtolower(mosGetParam($_REQUEST, 'link'))); if ($goto == 'null') { $msg = 'Não existe nenhum link associado a este item'; mosRedirect('index2.php?option=com_admin&task=listcomponents', $msg); exit; } $goto = str_replace("'", '', $goto); mosRedirect($goto); break; case 'listcomponents': HTML_admin_misc::ListComponents(); break;
function saveOrder(&$cid, $menutype) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosMenu($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $condition = "menutype = " . $database->Quote($menutype) . " AND parent = " . (int) $row->parent . " AND published >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } if (!$found) { $conditions[] = array($row->id, $condition); } } } // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; mosRedirect('index2.php?option=com_menus&menutype=' . $menutype, $msg); }
/** * Loads admin modules from a specified position,a $style can be passed * to change the style of output * * @param string The position * @param int The style 0 = no style(default), 1 = tabbed, 2 = use div */ function mosLoadAdminModules($position = 'left', $style = 0) { global $my, $acl; $this->initModules(true); $cache =& mosCache::getCache('com_content'); if (isset($this->_modules[$position])) { $modules = $this->_modules[$position]; } else { $modules = array(); } switch ($style) { case 0: default: foreach ($modules as $module) { $params =& new mosParameters($module->params); if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } } break; case 1: // Tabs $tabs = new mosTabs(1); $tabs->startPane('modules-' . $position); foreach ($modules as $module) { $params =& new mosParameters($module->params); $editAllComponents = $acl->acl_check('administration', 'edit', 'users', $my->usertype, 'components', 'all'); // $authoriser = new mosAuthoriser($database); // $editAllComponents = $authoriser->checkPermission('mosUser', $my->id, 'edit', 'editAllComponents', 0); // special handling for components module if ($module->module != 'mod_components' || $module->module == 'mod_components' && $editAllComponents) { $tabs->startTab(T_($module->title), 'module' . $module->id); if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } $tabs->endTab(); } } $tabs->endPane(); break; case 2: // Div'd foreach ($modules as $module) { $params =& new mosParameters($module->params); echo '<div>'; if ($module->module == '') { mosLoadCustomModule($module, $params); } else { mosLoadAdminModule(substr($module->module, 4), $params); } echo '</div>'; } break; } }
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); for ($i = 0; $i < $total; $i++) { $query = "UPDATE #__content_frontpage" . "\n SET ordering = " . (int) $order[$i] . "\n WHERE content_id = " . (int) $cid[$i]; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // update ordering $row = new mosFrontPage($database); $row->load((int) $cid[$i]); $row->updateOrder(); } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'New ordering saved'; mosRedirect('index2.php?option=com_frontpage', $msg); }
editModule($option, $id, $client); break; case 'save': case 'apply': mosCache::cleanCache('com_content'); saveModule($option, $client, $task); break; case 'remove': removeModule($cid, $option, $client); break; case 'cancel': cancelModule($option, $client); break; case 'publish': case 'unpublish': mosCache::cleanCache('com_content'); publishModule($cid, $task == 'publish' ? 1 : 0, $option, $client); break; case 'orderup': case 'orderdown': orderModule($cid[0], $task == 'orderup' ? -1 : 1, $option, $client); break; case 'accesspublic': case 'accessregistered': case 'accessspecial': accessMenu($cid[0], $task, $option, $client); break; case 'saveorder': saveOrder($cid, $client); break; default:
function saveOrder(&$cid, $client) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosModule($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "position = " . $database->Quote($row->position) . " AND client_id = " . (int) $row->client_id; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; mosRedirect('index2.php?option=com_modules&client=' . $client, $msg); }
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosContent($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "catid=" . (int) $row->catid . " AND state >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'New ordering saved'; mosRedirect('index2.php?option=com_typedcontent', $msg); }
/** * Clean cache for a group * @static * @access public * @param string $group The cache data group */ function cleanCache($group = false) { if (JCOMMENTS_JVERSION == '1.5') { $cache =& JFactory::getCache($group); $cache->clean($group); } else { mosCache::cleanCache($group); } }