Пример #1
0
/**
* 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;
    }
}
Пример #2
0
Файл: admin.php Проект: cwcw/cms
/**
* 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;
    }
}
Пример #3
0
 /**
  * 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);
 }
Пример #4
0
 /**
  * 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;
     }
 }
Пример #5
0
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once $mainframe->getPath('front_html', 'com_content');
$sectionid = trim(mosGetParam($_REQUEST, 'sectionid', 0));
$pop = mosGetParam($_REQUEST, 'pop', 0);
$task = mosGetParam($_REQUEST, 'task', '');
$id = intval(mosGetParam($_REQUEST, 'id', 0));
$limit = intval(mosGetParam($_REQUEST, 'limit', ''));
$limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0));
$now = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
// Editor usertype check
$access = new stdClass();
$access->canEdit = $acl->acl_check('action', 'edit', 'users', $my->usertype, 'content', 'all');
$access->canEditOwn = $acl->acl_check('action', 'edit', 'users', $my->usertype, 'content', 'own');
$access->canPublish = $acl->acl_check('action', 'publish', 'users', $my->usertype, 'content', 'all');
// cache activation
$cache =& mosCache::getCache('com_content');
// loads function for frontpage component
if ($option == 'com_frontpage') {
    //frontpage( $option, $gid, $pop, $now );
    $cache->call('frontpage', $gid, $access, $pop, $now);
    return;
}
switch (strtolower($task)) {
    case 'view':
        showItem($id, $gid, $access, $pop, $option, $now);
        break;
    case 'section':
        $cache->call('showSection', $id, $gid, $access, $now);
        break;
    case 'category':
        $cache->call('showCategory', $id, $gid, $access, $sectionid, $limit, $limitstart, $now);
Пример #6
0
                    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 );
Пример #7
0
 /**
  * Cleans the cache
  */
 function cleanCache($group = false)
 {
     if (mamboCore::get('mosConfig_caching')) {
         $cache =& mosCache::getCache($group);
         $cache->clean($group);
     }
 }
Пример #8
0
/**
* @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";
    }
}
Пример #9
0
 /**
  * Cleans the cache
  */
 function cleanCache($group = false)
 {
     global $mosConfig_caching;
     if ($mosConfig_caching) {
         $cache =& mosCache::getCache($group);
         $cache->clean($group);
     }
 }
Пример #10
0
/**
* 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 
}
Пример #11
0
 /**
  * @static 
  * @param string $group
  * @return A function cache object
  */
 function getCache($group = '')
 {
     if (JCOMMENTS_JVERSION == '1.5') {
         return JFactory::getCache($group);
     }
     return mosCache::getCache($group);
 }