/** * Cleans the cache */ function cleanCache(&$sitemap) { $cache =& XmapCache::getCache($sitemap); if (class_exists('JFactory')) { return $cache->clean(); } else { return $cache->clean($cache->_group); } }
die('Cannot load sitemap'); } $menutype = JRequest::getVar('menutype', '', "REQUEST"); $menus = $sitemap->getMenus(); if (!empty($menus[$menutype])) { $menu =& $menus[$menutype]; $menu->show = JRequest::getVar('show', '', "POST"); $menu->showXML = JRequest::getVar('showXML', '', "POST"); $menu->priority = JRequest::getVar('priority', '', "POST"); $menu->changefreq = JRequest::getVar('changefreq', '', "POST"); $menu->module = JRequest::getVar('module', '', "POST"); # Clean the cache of the sitemap $sitemap->setMenus($menus); if ($sitemap->save()) { if ($sitemap->usecache) { XmapCache::cleanCache($sitemap); } echo 1; } else { echo $database->getErrorMsg(); } } break; case 'uninstallplugin': $id = intval(JRequest::getVar('plugin', '', "REQUEST")); if ($id != JRequest::getVar('plugin', '', "REQUEST")) { //Security Check! die('Cannot load plugin'); } if (xmapUninstallPlugin($id)) { echo 1;
} $database =& JFactory::getDBO(); $xSitemap = new XmapSitemap($database); $xSitemap->load($sitemapid); //$database->setQuery('alter table #__xmap_sitemap add excluded_items text'); //$database->query(); if (!$xSitemap->id) { echo _XMAP_MSG_NO_SITEMAP; return; } if ($view == 'xml') { Header("Content-type: text/xml; charset=UTF-8"); Header("Content-encoding: UTF-8"); } global $xmap; $xmapCache = XmapCache::getCache($xSitemap); $excluded_items = $xSitemap->getExcludedItems(); if ($xSitemap->usecache) { $lang = JFactory::getLanguage(); $xmapCache->call('xmapCallShowSitemap', $view, $xSitemap->id, $excluded_items, $lang->getName(), $mainframe->getCfg('sef'), $user->get('id'), $news); // call plugin's handler function } else { xmapCallShowSitemap($view, $xSitemap->id, $excluded_items); } switch ($view) { case 'html': $xSitemap->views_html++; $xSitemap->lastvisit_html = time(); $xSitemap->save(); break; case 'xml':
function chageItemPropery($uid, $itemid, $view, $property, $value) { $this->loadItems($view, $itemid); $db =& JFactory::getDBO(); $isNew = false; if (empty($this->_items[$view][$itemid][$uid])) { $this->_items[$view][$itemid][$uid] = array(); $isNew = true; } $this->_items[$view][$itemid][$uid][$property] = $value; $sep = $properties = ''; foreach ($this->_items[$view][$itemid][$uid] as $k => $v) { $properties .= $sep . $k . '=' . $v; $sep = ';'; } if (!$isNew) { $query = 'UPDATE #__xmap_items SET properties=\'' . $db->getEscaped($properties) . "' where uid='" . $db->getEscaped($uid) . "' and itemid={$itemid} and view='{$view}' and sitemap_id=" . $this->id; } else { $query = 'INSERT #__xmap_items (uid,itemid,view,sitemap_id,properties) values ( \'' . $db->getEscaped($uid) . "',{$itemid},'{$view}',{$this->id},'" . $db->getEscaped($properties) . "')"; } $db->setQuery($query); if ($db->query()) { XmapCache::cleanCache($this); return true; } else { return false; } }