예제 #1
0
function xmapShowNavigatorLinks($config)
{
    require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapNav.php';
    require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapPlugins.php';
    require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
    # DEBUG
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    # DEBUG
    $sitemapid = JRequest::getInt('sitemap', 0);
    $link = urldecode(JRequest::getVar('link', ''));
    $name = JRequest::getCmd('e_name', '');
    $Itemid = JRequest::getInt('Itemid');
    if (!$sitemapid) {
        $sitemapid = $config->sitemap_default;
    }
    $sitemap = new XmapSitemap($database);
    if (!$sitemap->load($sitemapid)) {
        echo _XMAP_INVALID_SITEMAP;
        return false;
    }
    $menus = $sitemap->getMenus();
    $list = array();
    // Show the menu items
    if (!$link && !$Itemid) {
        foreach ($menus as $menutype => $menu) {
            $node = new stdclass();
            $menu->id = 0;
            $menu->menutype = $menutype;
            $node->uid = $menu->uid = "menu" . $menu->id;
            $node->menutype = $menutype;
            $node->ordering = $menu->ordering;
            $node->priority = $menu->priority;
            $node->changefreq = $menu->changefreq;
            $node->browserNav = 3;
            $node->type = 'separator';
            if (!($node->name = getMenuTitle($menutype, @$menu->module))) {
                $node->name = $menutype;
            }
            $node->link = '-menu-' . $menutype;
            $node->expandible = true;
            $node->selectable = false;
            //$node->name = $this->getMenuTitle($menutype,@$menu->module);	// get the mod_mainmenu title from modules table
            $list[] = $node;
        }
    } else {
        $nav = new XmapNav($config, $sitemap);
        $extensions = XmapPlugins::loadAvailablePlugins();
        $parent = new stdClass();
        if ($Itemid) {
            $items =& JSite::getMenu();
            $item =& $items->getItem($Itemid);
            if (isset($menus[$item->menutype])) {
                $parent->name = $item->name;
                $parent->id = $item->id;
                $parent->uid = 'itemid' . $item->id;
                $parent->link = $link;
                $parent->type = $item->type;
                $parent->browserNav = $item->browserNav;
                $parent->priority = $menus[$item->menutype]->priority;
                $parent->changefreq = $menus[$item->menutype]->changefreq;
                $parent->menutype = $item->menutype;
                $parent->selectable = false;
                $parent->expandible = true;
            }
        } else {
            $parent->id = 0;
            $parent->link = $link;
        }
        $list = $nav->expandLink($parent, $extensions);
    }
    XmapAdminHtml::showNavigatorLinks($sitemapid, $list, $name);
}
예제 #2
0
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapConfig.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapSitemap.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapPlugins.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapCache.php';
$user =& JFactory::getUser();
global $xSitemap, $xConfig;
$xConfig = new XmapConfig();
$xConfig->load();
// This is an AJAX request to modify a item of the sitemap
if ($task == 'editElement') {
    if ($user->get('gid') != "25") {
        die('Invalid request!');
    }
    $sitemapid = JRequest::getInt('sitemap', 0);
    if ($sitemapid) {
        $sitemap = new XmapSitemap($database);
        if ($sitemap->load($sitemapid)) {
            $action = JRequest::getCmd('action', '');
            $uid = JRequest::getCmd('uid', '');
            $itemid = JRequest::getInt('itemid', '');
            switch ($action) {
                case 'toggleElement':
                    if ($uid && $itemid) {
                        $state = $sitemap->toggleItem($uid, $itemid);
                    }
                    break;
                case 'changeProperty':
                    $uid = JRequest::getCmd('uid', '');
                    $property = JRequest::getCmd('property', '');
                    $value = JRequest::getCmd('value', '');
                    if ($uid && $itemid && $uid && $property) {
예제 #3
0
파일: xmap.php 프로젝트: allenahner/mizzou
$sitemapid = '';
// Firts lets try to get the sitemap's id from the menu's params
if ($Itemid) {
    $menu = new mosMenu($database);
    $menu->load($Itemid);
    $params = new mosParameters($menu->params);
    $sitemapid = intval($params->get('sitemap', ''));
}
if (!$sitemapid) {
    //If the is no sitemap id specificated
    $sitemapid = intval(mosGetParam($_REQUEST, 'sitemap', ''));
}
if (!$sitemapid && $xConfig->sitemap_default) {
    $sitemapid = $xConfig->sitemap_default;
}
$xSitemap = new XmapSitemap();
$xSitemap->load($sitemapid);
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);
if ($xSitemap->usecache) {
    $xmapCache->call('xmapCallShowSitemap', $view, $xSitemap->id, $mosConfig_locale, $mosConfig_sef);
    // call plugin's handler function
} else {
예제 #4
0
 /** Create the settings table for Xmap and add initial default values */
 function create()
 {
     $db =& JFactory::getDBO();
     jimport('joomla.filesystem.file');
     $fields = array();
     $fields[] = "`name` varchar(30) not null primary key";
     $fields[] = "`value` varchar(100)";
     $query = "CREATE TABLE IF NOT EXISTS #__xmap (" . implode(', ', $fields) . ")";
     $db->setQuery($query);
     if ($db->query() === FALSE) {
         echo _XMAP_ERR_NO_CREATE . "<br />\n";
         echo stripslashes($db->getErrorMsg());
         return false;
     }
     $fields = array();
     $fields[] = "`id` int not null primary key auto_increment";
     $fields[] = "`extension` varchar(100) not null";
     $fields[] = "`published` int(1) default 0";
     $fields[] = "`params` text";
     $query = "CREATE TABLE IF NOT EXISTS #__xmap_ext (" . implode(', ', $fields) . ")";
     $db->setQuery($query);
     if ($db->query() === FALSE) {
         echo _XMAP_ERR_NO_CREATE . "<br />\n";
         echo stripslashes($db->getErrorMsg());
         return false;
     }
     $extensions = array(array('com_agora', 1), array('com_content', 1), array('com_eventlist', 1), array('com_g2bridge', 1), array('com_glossary', 1), array('com_hotproperty', 1), array('com_jcalpro', 1), array('com_jdownloads', 1), array('com_jevents', 1), array('com_jomres', 1), array('com_kb', 1), array('com_kunena', 1), array('com_mtree', 1), array('com_myblog', 1), array('com_remository', 1), array('com_resource', 1), array('com_rokdownloads', 1), array('com_rsgallery2', 1), array('com_sectionex', 1), array('com_sobi2', 1), array('com_virtuemart', 1));
     foreach ($extensions as $ext) {
         $query = "SELECT COUNT(*) FROM `#__xmap_ext` WHERE extension='{$ext['0']}'";
         $db->setQuery($query);
         if ($db->loadResult() == 0) {
             $extension = new XmapPlugin($db);
             $extension->extension = $ext[0];
             $extension->published = $ext[1];
             $xmlfile = $extension->getXmlPath();
             JFile::move("{$xmlfile}.txt", $xmlfile);
             $extension->setParams($extension->loadDefaultsParams(true), '-1');
             $extension->store();
         }
     }
     $vars = get_class_vars('XmapSitemap');
     $fields = '';
     foreach ($vars as $name => $value) {
         if ($name[0] !== '_') {
             if ($name == 'id') {
                 $fields[] = 'id INT NOT NULL PRIMARY KEY AUTO_INCREMENT';
             } else {
                 switch (gettype($value)) {
                     case 'integer':
                         $fields[] = "`{$name}` INTEGER NULL";
                         break;
                     case 'string':
                         if ($name == 'menus') {
                             $fields[] = "`{$name}` TEXT NULL";
                         } else {
                             $fields[] = "`{$name}` VARCHAR(255) NULL";
                         }
                         break;
                 }
             }
         }
     }
     $query = "CREATE TABLE IF NOT EXISTS #__xmap_sitemap (" . implode(', ', $fields) . ")";
     $db->setQuery($query);
     if ($db->query() === FALSE) {
         echo _XMAP_ERR_NO_CREATE . "<br />\n";
         echo stripslashes($db->getErrorMsg());
         return false;
     }
     $query = "CREATE TABLE IF NOT EXISTS #__xmap_items ( uid varchar(100) not null, itemid int not null, view varchar(10) not null, sitemap_id int not null, properties varchar(300), primary key (uid,itemid,view,sitemap_id),index (uid,itemid),index (view));";
     $db->setQuery($query);
     if ($db->query() === FALSE) {
         echo _XMAP_ERR_NO_CREATE . "<br />\n";
         echo stripslashes($db->getErrorMsg());
         return false;
     }
     echo _XMAP_MSG_SET_DB_CREATED . "<br />\n";
     // Insert default Settings
     $query = "SELECT COUNT(*) from `#__xmap_sitemap`";
     $db->setQuery($query);
     if ($db->loadResult() == 0) {
         $sitemap = new XmapSitemap($db);
         $sitemap->save();
     }
     $query = "SELECT COUNT(*) from `#__xmap`";
     $db->setQuery($query);
     if ($db->loadResult() == 0) {
         $fields = array();
         $vars = get_class_vars('XmapConfig');
         foreach ($vars as $name => $value) {
             if ($name == 'sitemap_default') {
                 $value = $sitemap->id;
             }
             $query = "INSERT INTO #__xmap (`name`,`value`) values ('{$name}','{$value}')";
             $db->setQuery($query);
             if ($db->query() === FALSE) {
                 echo _XMAP_ERR_NO_DEFAULT_SET . "<br />\n";
                 echo stripslashes($db->getErrorMsg());
                 return false;
             }
         }
     }
     echo _XMAP_MSG_SET_DEF_INSERT . "<br />\n";
     return true;
 }
예제 #5
0
     $changefreq[] = JHTML::_('select.option', 'weekly', _XMAP_CFG_CHANGEFREQ_WEEKLY);
     $changefreq[] = JHTML::_('select.option', 'monthly', _XMAP_CFG_CHANGEFREQ_MONTHLY);
     $changefreq[] = JHTML::_('select.option', 'yearly', _XMAP_CFG_CHANGEFREQ_YEARLY);
     $changefreq[] = JHTML::_('select.option', 'never', _XMAP_CFG_CHANGEFREQ_NEVER);
     $lists['changefreq'] = JHTML::_('select.genericlist', $changefreq, 'changefreq', 'class="inputbox" size="1"', 'value', 'text', $menu->changefreq);
     $priority = array();
     for ($i = 0; $i <= 9; $i++) {
         $priority[] = JHTML::_('select.option', '0.' . $i, '0.' . $i);
     }
     $priority[] = JHTML::_('select.option', '1', '1');
     $lists['priority'] = JHTML::_('select.genericlist', $priority, 'priority', 'class="inputbox" size="1"', 'value', 'text', $menu->priority);
     XmapAdminHtml::showMenuOptions($sitemap, $menu, $lists);
     break;
 case 'save_menu_options':
     $id = intval(JRequest::getVar('sitemap', '', "REQUEST"));
     $sitemap = new XmapSitemap($database);
     if (!$sitemap->load($id)) {
         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()) {