本文整理汇总了PHP中mosParameters::get方法的典型用法代码示例。如果您正苦于以下问题:PHP mosParameters::get方法的具体用法?PHP mosParameters::get怎么用?PHP mosParameters::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mosParameters
的用法示例。
在下文中一共展示了mosParameters::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectTitle
function getObjectTitle($id)
{
$title = 'JComments';
$menu = jc_com_jcomments::getMenuItem($id);
if ($menu != '') {
if (JCOMMENTS_JVERSION == '1.5') {
$params = new JParameter($menu->params);
} else {
$params = new mosParameters($menu->params);
}
$title = $params->get('page_title');
if ($title == '') {
$title = $menu->name;
}
}
return $title;
}
示例2: virtuemart_is_installed
function virtuemart_is_installed()
{
global $database, $mosConfig_absolute_path, $mosConfig_dbprefix, $VMVERSION, $shortversion, $myVersion, $version_info;
if (is_null($database) && class_exists('jfactory')) {
$database = JFactory::getDBO();
}
//add VirtueMart admin menu image
$database->setQuery("UPDATE #__components SET admin_menu_img = '../components/com_virtuemart/shop_image/ps_image/menu_icon.png' WHERE admin_menu_link = 'option=com_virtuemart'");
$database->query();
$option = 'com_virtuemart';
$installfile = dirname(__FILE__) . "/install.php";
$database->setQuery("SHOW TABLES LIKE '" . $mosConfig_dbprefix . "vm_%'");
$vm_tables = $database->loadObjectList();
if (file_exists($mosConfig_absolute_path . '/administrator/components/' . $option . '/classes/htmlTools.class.php') && count($vm_tables) > 30) {
// VirtueMart is installed! But is it an older version that needs to be updated?
$database->setQuery('SELECT id, params FROM `#__components` WHERE name = \'virtuemart_version\'');
$database->loadObject($old_version);
if ($old_version && file_exists($mosConfig_absolute_path . '/administrator/components/com_virtuemart/classes/htmlTools.class.php')) {
$version_info = new mosParameters($old_version->params);
include_once $mosConfig_absolute_path . '/administrator/components/' . $option . '/version.php';
$VMVERSION = new vmVersion();
$result = version_compare($version_info->get('RELEASE'), '1.1.0');
if ($result == -1) {
return false;
}
}
@unlink($installfile);
if (file_exists($installfile) || !file_exists(dirname(__FILE__) . "/virtuemart.cfg.php")) {
die('<h2>Virtuemart Installation Notice</h2>
<p>You already have installed VirtueMart.</p>
<p>You MUST
<ol>
<li>DELETE the file <strong>' . $installfile . '</strong>,</li>
<li>RENAME the file <strong>virtuemart.cfg-dist.php</strong> to <strong>virtuemart.cfg.php</strong></li>
</ol>before you can use VirtueMart.
</p>');
} else {
header('Location: index2.php?option=com_virtuemart');
echo '<script type="text/javascript">document.location=\'' . $GLOBALS['mosConfig_live_site'] . '/administrator/index2.php?option=com_virtuemart\';</script>';
exit;
}
}
return false;
}
示例3: showWrap
function showWrap($option)
{
global $database, $Itemid, $mainframe;
$menu = $mainframe->get('menu');
$params = new mosParameters($menu->params);
$params->def('back_button', $mainframe->getCfg('back_button'));
$params->def('scrolling', 'auto');
$params->def('page_title', '1');
$params->def('pageclass_sfx', '');
$params->def('header', $menu->name);
$params->def('height', '500');
$params->def('height_auto', '0');
$params->def('width', '100%');
$params->def('add', '1');
$url = $params->def('url', '');
$row = new stdClass();
if ($params->get('add')) {
// adds 'http://' if none is set
if (substr($url, 0, 1) == '/') {
// relative url in component. use server http_host.
$row->url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
} elseif (!strstr($url, 'http') && !strstr($url, 'https')) {
$row->url = 'http://' . $url;
} else {
$row->url = $url;
}
} else {
$row->url = $url;
}
// auto height control
if ($params->def('height_auto')) {
$row->load = 'onload="iFrameHeight()"';
} else {
$row->load = '';
}
$mainframe->SetPageTitle($menu->name);
HTML_wrapper::displayWrap($row, $params, $menu);
}
示例4: botExtendedMenuSourceWeblinks_onLoadMenu
function botExtendedMenuSourceWeblinks_onLoadMenu(&$menuLoader, $name = '')
{
global $database;
$botName = 'bot_exmenu_source_weblinks';
// load parameters
$database->setQuery('SELECT m.params FROM #__mambots AS m WHERE element = \'' . $botName . '\' AND folder = \'exmenu\'');
$params = new mosParameters($database->loadResult());
$params->def('source_name', 'weblinks');
if ($name != $params->get('source_name')) {
return FALSE;
}
$rootMenuNode =& $menuLoader->getRootMenuNode();
$database->setQuery('SELECT * FROM #__weblinks WHERE published = 1 ORDER BY hits DESC, title LIMIT 10');
$rows = $database->loadObjectList();
foreach (array_keys($rows) as $key) {
$row =& $rows[$key];
$menuNode =& $menuLoader->getEmptyMenuNode();
$menuNode->type = 'url';
$menuNode->link = $row->url;
$menuNode->name = $row->title;
$menuLoader->addMenuNode($rootMenuNode, $menuNode);
}
return TRUE;
}
示例5: jimport
require_once $_DOCMAN->getPath('classes', 'utils');
require_once $_DOCMAN->getPath('classes', 'theme');
require_once $_DOCMAN->getPath('classes', 'compat');
require_once $_DOCMAN->getPath('classes', 'token');
// Component Menu parameters
if (defined('_DM_J15')) {
jimport('joomla.application.menu');
$menu =& JMenu::getInstance('site');
$params =& $menu->getParams($Itemid);
} else {
$menu = $mainframe->get('menu');
$params = new mosParameters($menu->params);
}
// Request vars
$task = mosGetParam($_REQUEST, "task", "");
$gid = (int) mosGetParam($_REQUEST, "gid", $params->get('cat_id', 0));
$script = mosGetParam($_REQUEST, "script", 0);
$ordering = mosGetParam($_REQUEST, "order", $_DOCMAN->getCfg('default_order'));
$direction = strtoupper(mosGetParam($_REQUEST, "dir", $_DOCMAN->getCfg('default_order2')));
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
$revision = mosGetParam($_REQUEST, "revision", 0);
$archive = mosGetParam($_REQUEST, "archive", 0);
$limitstart = (int) mosGetParam($_REQUEST, "limitstart", 0);
// $limit = (int) mosGetParam($_REQUEST, "limit", $_DOCMAN->getCfg('perpage'));
$limit = $_DOCMAN->getCfg('perpage');
$total = DOCMAN_Cats::countDocsInCatByUser($gid, $_DMUSER);
if ($total <= $limit) {
$limitstart = 0;
}
示例6: showFeed
function showFeed($feedid)
{
global $database, $mainframe, $mosConfig_absolute_path, $mosConfig_cachepath, $Itemid, $my;
// check if cache directory is writeable
$cacheDir = $mosConfig_cachepath . '/';
if (!is_writable($cacheDir)) {
echo 'Cache Directory Unwriteable';
return;
}
require_once $mainframe->getPath('class');
$newsfeed = new mosNewsFeed($database);
$newsfeed->load((int) $feedid);
/*
* Check if newsfeed is published
*/
if (!$newsfeed->published) {
mosNotAuth();
return;
}
$category = new mosCategory($database);
$category->load((int) $newsfeed->catid);
/*
* Check if newsfeed category is published
*/
if (!$category->published) {
mosNotAuth();
return;
}
/*
* check whether category access level allows access
*/
if ($category->access > $my->gid) {
mosNotAuth();
return;
}
// full RSS parser used to access image information
require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_rss.php';
$LitePath = $mosConfig_absolute_path . '/includes/Cache/Lite.php';
// Adds parameter handling
$menu = $mainframe->get('menu');
$params = new mosParameters($menu->params);
$params->def('page_title', 1);
$params->def('header', $menu->name);
$params->def('pageclass_sfx', '');
$params->def('back_button', $mainframe->getCfg('back_button'));
// Feed Display control
$params->def('feed_image', 1);
$params->def('feed_descr', 1);
$params->def('item_descr', 1);
$params->def('word_count', 0);
// Encoding
$params->def('utf8', 1);
if (!$params->get('page_title')) {
$params->set('header', '');
}
$and = '';
if ($feedid) {
$and = "\n AND id = {$feedid}";
}
$mainframe->SetPageTitle($menu->name);
HTML_newsfeed::showNewsfeeds($newsfeed, $LitePath, $cacheDir, $params);
}
示例7: showTable
/**
* Display Table of items
*/
function showTable(&$params, &$rows, $catid, $tabclass)
{
global $mosConfig_live_site;
// icon in table display
if ($params->get('weblink_icons') != -1) {
$img = mosAdminMenus::ImageCheck('weblink.png', '/images/M_images/', $params->get('weblink_icons'), '/images/M_images/', 'Link', 'Link');
} else {
$img = NULL;
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
if ($params->get('headings')) {
?>
<tr>
<?php
if ($img) {
?>
<td class="sectiontableheader<?php
echo $params->get('pageclass_sfx');
?>
">
</td>
<?php
}
?>
<td width="90%" height="20" class="sectiontableheader<?php
echo $params->get('pageclass_sfx');
?>
">
<?php
echo _HEADER_TITLE_WEBLINKS;
?>
</td>
<?php
if ($params->get('hits')) {
?>
<td width="30" height="20" class="sectiontableheader<?php
echo $params->get('pageclass_sfx');
?>
" align="right">
<?php
echo _HEADER_HITS;
?>
</td>
<?php
}
?>
</tr>
<?php
}
$k = 0;
foreach ($rows as $row) {
$iparams = new mosParameters($row->params);
$link = sefRelToAbs('index.php?option=com_weblinks&task=view&catid=' . $catid . '&id=' . $row->id);
$link = ampReplace($link);
$menuclass = 'category' . $params->get('pageclass_sfx');
switch ($iparams->get('target')) {
// cases are slightly different
case 1:
// open in a new window
$txt = '<a href="' . $link . '" target="_blank" class="' . $menuclass . '">' . $row->title . '</a>';
break;
case 2:
// open in a popup window
$txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\">" . $row->title . "</a>\n";
break;
default:
// formerly case 2
// open in parent window
$txt = '<a href="' . $link . '" class="' . $menuclass . '">' . $row->title . '</a>';
break;
}
?>
<tr class="<?php
echo $tabclass[$k];
?>
">
<?php
if ($img) {
?>
<td width="100" height="20" align="center">
<?php
echo $img;
?>
</td>
<?php
}
?>
<td height="20">
<?php
echo $txt;
?>
<?php
if ($params->get('item_description')) {
//.........这里部分代码省略.........
示例8: substr
require_once $mosConfig_absolute_path . "/administrator/components/com_virtuemart/virtuemart.cfg.php";
$GLOBALS['mosConfig_live_site'] = $mosConfig_live_site = substr(URL, 0, strlen(URL) - 1);
// the global file for VirtueMart
require_once ADMINPATH . 'global.php';
if (!vmIsAdminMode() && !is_a($mainframe, 'JAdministrator') && !isset($_REQUEST['page'])) {
// Get the menu parameters, if any
if (vmIsJoomla('1.5')) {
$menuparams = $mainframe->getParams();
} else {
$Itemid = (int) vmRequest::getInt('Itemid', '');
$query = "SELECT params FROM #__menu WHERE id='" . $Itemid . "'";
$database->setQuery($query);
$itemparams = $database->loadResult();
$menuparams = new mosParameters($itemparams);
}
$tmp_product_id = $menuparams->get('product_id');
$tmp_category_id = $menuparams->get('category_id');
$tmp_flypage = $menuparams->get('flypage');
$tmp_page = $menuparams->get('page');
if (!empty($tmp_product_id)) {
vmRequest::setVar('product_id', $tmp_product_id);
vmRequest::setVar('page', 'shop.product_details');
} elseif (!empty($tmp_category_id)) {
vmRequest::setVar('category_id', $tmp_category_id);
vmRequest::setVar('page', 'shop.browse');
}
if ((!empty($tmp_product_id) || !empty($tmp_category_id)) && !empty($tmp_flypage)) {
vmRequest::setVar('flypage', $tmp_flypage);
}
if (!empty($tmp_page)) {
vmRequest::setVar('page', $tmp_page);
示例9: die
<?php
/* ja_cssmenu.php @copyright (C) 2005 Joomlart.com (formerly MamboTheme.com)*/
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
$japarams = new mosParameters('');
global $ja_template_name;
$japarams->set('template', $ja_template_name);
// Change this value to correct template
$japarams->set('absPath', $mosConfig_absolute_path . '/templates/' . $japarams->get('template') . '/ja_cssmenu');
$japarams->set('LSPath', $mosConfig_live_site . '/templates/' . $japarams->get('template') . '/ja_cssmenu');
$japarams->set('menutype', 'mainmenu');
// Source of menu
include_once $japarams->get('absPath') . '/ja-menulib.php';
global $my;
$jamenu = new JAMenu($database, $japarams);
$jamenu->genMenu();
示例10: vCard
function vCard($id)
{
global $database;
global $mosConfig_sitename, $mosConfig_live_site;
$contact = new mosContact($database);
$contact->load((int) $id);
$params = new mosParameters($contact->params);
$show = $params->get('vcard', 0);
if ($show) {
// check to see if VCard option hsa been activated
$name = explode(' ', $contact->name);
$count = count($name);
// handles conversion of name entry into firstname, surname, middlename distinction
$surname = '';
$middlename = '';
switch ($count) {
case 1:
$firstname = $name[0];
break;
case 2:
$firstname = $name[0];
$surname = $name[1];
break;
default:
$firstname = $name[0];
$surname = $name[$count - 1];
for ($i = 1; $i < $count - 1; $i++) {
$middlename .= $name[$i] . ' ';
}
break;
}
$middlename = trim($middlename);
$v = new MambovCard();
$v->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE');
$v->setPhoneNumber($contact->fax, 'WORK;FAX');
$v->setName($surname, $firstname, $middlename, '');
$v->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL');
$v->setEmail($contact->email_to);
$v->setNote($contact->misc);
$v->setURL($mosConfig_live_site, 'WORK');
$v->setTitle($contact->con_position);
$v->setOrg($mosConfig_sitename);
$filename = str_replace(' ', '_', $contact->name);
$v->setFilename($filename);
$output = $v->getVCard($mosConfig_sitename);
$filename = $v->getFileName();
// header info for page
header('Content-Disposition: attachment; filename=' . $filename);
header('Content-Length: ' . strlen($output));
header('Connection: close');
header('Content-Type: text/x-vCard; name=' . $filename);
header('Cache-Control: store, cache');
header('Pragma: cache');
print $output;
} else {
mosNotAuth();
return;
}
}
示例11: botTinymceEditorInit
/**
* TinyMCE WYSIWYG Editor - javascript initialisation
*/
function botTinymceEditorInit()
{
global $mosConfig_live_site, $database, $mosConfig_absolute_path, $mainframe;
// load tinymce info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'tinymce'" . "\n AND folder = 'editors'";
$database->setQuery($query);
$database->loadObject($mambot);
$params = new mosParameters($mambot->params);
$theme = $params->get('theme', 'advanced');
// handling for former default option
if ($theme == 'default') {
$theme = 'advanced';
}
$toolbar = $params->def('toolbar', 'top');
$html_height = $params->def('html_height', '550');
$html_width = $params->def('html_width', '750');
$text_direction = $params->def('text_direction', 'ltr');
$content_css = $params->def('content_css', 1);
$content_css_custom = $params->def('content_css_custom', '');
$invalid_elements = $params->def('invalid_elements', 'script,applet,iframe');
$newlines = $params->def('newlines', 0);
$cleanup = $params->def('cleanup', 1);
$cleanup_startup = $params->set('cleanup_startup', 0);
// Currently disabled due to bugs in TinyMCE
$compressed = $params->def('compressed', 0);
$relative_urls = $params->def('relative_urls', 0);
// Plugins
// preview
$preview = $params->def('preview', 1);
$preview_height = $params->def('preview_height', '550');
$preview_width = $params->def('preview_width', '750');
// insert date
$insertdate = $params->def('insertdate', 1);
$format_date = $params->def('format_date', '%Y-%m-%d');
// insert time
$inserttime = $params->def('inserttime', 1);
$format_time = $params->def('format_time', '%H:%M:%S');
// search & replace
$searchreplace = $params->def('searchreplace', 1);
// emotions
$smilies = $params->def('smilies', 1);
// flash
$flash = $params->def('flash', 1);
// table
$table = $params->def('table', 1);
// horizontal line
$hr = $params->def('hr', 1);
// fullscreen
$fullscreen = $params->def('fullscreen', 1);
// autosave
$autosave = $params->def('autosave', 0);
// layer
$layer = $params->def('layer', 1);
// style
$style = $params->def('style', 1);
// visualchars
$visualchars = $params->def('visualchars', 1);
// media
$media = $params->def('media', 1);
// nonbreaking
$nonbreaking = $params->def('nonbreaking', 1);
if ($relative_urls) {
$relative_urls = 'true';
} else {
$relative_urls = 'false';
}
if ($content_css_custom) {
$content_css = 'content_css : "' . $content_css_custom . '", ';
} else {
$query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
$database->setQuery($query);
$template = $database->loadResult();
$file_path = $mosConfig_absolute_path . '/templates/' . $template . '/css/';
if ($content_css) {
$file = 'template.css';
} else {
$file = 'editor_content.css';
}
$content_css = 'content_css : "' . $mosConfig_live_site . '/templates/' . $template . '/css/';
if (file_exists($file_path . '/' . $file)) {
$content_css = $content_css . $file . '", ';
} else {
$content_css = $content_css . 'template_css.css", ';
}
}
$plugins[] = '';
$buttons2[] = '';
$buttons3[] = '';
$elements[] = '';
if ($cleanup) {
$cleanup = 'true';
} else {
$cleanup = 'false';
}
if ($cleanup_startup) {
$cleanup_startup = 'true';
} else {
//.........这里部分代码省略.........
示例12: switch
function ja_getSubmenu($menuitem, $depth, $first = false, $colors = null, $hilight = false, $color_index = false)
{
global $mainframe, $tab_index, $color, $hilightid, $menuname;
$r = "";
$id = "";
switch ($menuitem->type) {
case 'separator':
case 'component_item_link':
break;
case 'url':
if (eregi('index.php\\?', $menuitem->link)) {
if (!eregi('Itemid=', $menuitem->link)) {
$menuitem->link .= '&Itemid=' . $menuitem->id;
}
}
break;
case 'content_item_link':
case 'content_typed':
// load menu params
$menuparams = new mosParameters($menuitem->params, $mainframe->getPath('menu_xml', $menuitem->type), 'menu');
$unique_itemid = $menuparams->get('unique_itemid', 1);
if ($unique_itemid) {
$menuitem->link .= '&Itemid=' . $menuitem->id;
} else {
$temp = split('&task=view&id=', $menuitem->link);
if ($menuitem->type == 'content_typed') {
$menuitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 1, 0);
} else {
$menuitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 1);
}
}
break;
default:
$menuitem->link .= '&Itemid=' . $menuitem->id;
break;
}
if ($color_index) {
$id .= $colors[$tab_index % count($colors)];
$tab_index++;
}
$current_itemid = trim(mosGetParam($_REQUEST, 'Itemid', 0));
if (!$current_itemid && !$hilight) {
//$id = '';
} else {
if ($hilight || $current_itemid == $menuitem->id) {
if ($depth == 0) {
$color = $id;
$menuname = $menuitem->name;
$hilightid = $menuitem->id;
}
$id = JA_CURRENT_MENU;
}
}
if ($id == JA_CURRENT_MENU) {
$id = ' class="' . $id . '"';
} else {
$id = "";
}
$menuitem->link = ampReplace($menuitem->link);
if (strcasecmp(substr($menuitem->link, 0, 4), 'http')) {
$menuitem->link = sefRelToAbs($menuitem->link);
}
$id .= " id=\"menu" . $menuitem->id . "\"";
$className = $first ? "class=\"first-item\"" : "";
$title = "title=\"{$menuitem->name}\"";
switch ($menuitem->browserNav) {
case 1:
// open in a new window
$r = '<li' . $id . '><a href="' . $menuitem->link . '" ' . $className . ' target="_blank" ' . $title . '><span>' . $menuitem->name . "</span></a></li>\n";
break;
case 2:
// open in a popup window
$r = "<li" . $id . "><a href=\"#\" {$className} onclick=\"javascript: window.open('" . $menuitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" {$title}><span>" . $menuitem->name . "</span></a></li>\n";
break;
case 3:
// don't link it
$r = '<li' . $id . '><span class="seperator">' . $menuitem->name . "</span></li>\n";
break;
default:
// open in parent window
$r = '<li' . $id . '><a ' . $className . ' href="' . $menuitem->link . '" ' . $title . '><span>' . $menuitem->name . "</span></a></li>\n";
break;
}
return $r;
}
示例13: editContent
/**
* Compiles information to add or edit the record
* @param database A database connector object
* @param integer The unique id of the record to edit (0 if new)
* @param integer The id of the content section
*/
function editContent($uid = 0, $sectionid = 0, $option)
{
global $database, $my, $mainframe;
global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset;
$redirect = strval(mosGetParam($_POST, 'redirect', ''));
$nullDate = $database->getNullDate();
if (!$redirect) {
$redirect = $sectionid;
}
// load the row from the db table
$row = new mosContent($database);
$row->load((int) $uid);
if ($uid) {
$sectionid = $row->sectionid;
if ($row->state < 0) {
mosRedirect('index2.php?option=com_content§ionid=' . $row->sectionid, 'You cannot edit an archived item');
}
}
// fail if checked out not by 'me'
if ($row->checked_out && $row->checked_out != $my->id) {
mosRedirect('index2.php?option=com_content', 'The module ' . $row->title . ' is currently being edited by another administrator');
}
$selected_folders = NULL;
if ($uid) {
$row->checkout($my->id);
if (trim($row->images)) {
$row->images = explode("\n", $row->images);
} else {
$row->images = array();
}
$row->created = mosFormatDate($row->created, _CURRENT_SERVER_TIME_FORMAT);
$row->modified = $row->modified == $nullDate ? '' : mosFormatDate($row->modified, _CURRENT_SERVER_TIME_FORMAT);
$row->publish_up = mosFormatDate($row->publish_up, _CURRENT_SERVER_TIME_FORMAT);
if (trim($row->publish_down) == $nullDate || trim($row->publish_down) == '' || trim($row->publish_down) == '-') {
$row->publish_down = 'Never';
}
$row->publish_down = mosFormatDate($row->publish_down, _CURRENT_SERVER_TIME_FORMAT);
$query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->created_by;
$database->setQuery($query);
$row->creator = $database->loadResult();
// test to reduce unneeded query
if ($row->created_by == $row->modified_by) {
$row->modifier = $row->creator;
} else {
$query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->modified_by;
$database->setQuery($query);
$row->modifier = $database->loadResult();
}
$query = "SELECT content_id" . "\n FROM #__content_frontpage" . "\n WHERE content_id = " . (int) $row->id;
$database->setQuery($query);
$row->frontpage = $database->loadResult();
// get list of links to this item
$and = "\n AND componentid = " . (int) $row->id;
$menus = mosAdminMenus::Links2Menu('content_item_link', $and);
} else {
if (!$sectionid && @$_POST['filter_sectionid']) {
$sectionid = $_POST['filter_sectionid'];
}
if (@$_POST['catid']) {
$row->catid = (int) $_POST['catid'];
$category = new mosCategory($database);
$category->load((int) $_POST['catid']);
$sectionid = $category->section;
} else {
$row->catid = 0;
}
$row->sectionid = $sectionid;
$row->version = 0;
$row->state = 1;
$row->ordering = 0;
$row->images = array();
$row->publish_up = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
$row->publish_down = 'Never';
$row->creator = '';
$row->modified = $nullDate;
$row->modifier = '';
$row->frontpage = 0;
$menus = array();
}
$javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\"";
$query = "SELECT s.id, s.title" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering";
$database->setQuery($query);
if ($sectionid == 0) {
$sections[] = mosHTML::makeOption('-1', 'Select Section', 'id', 'title');
$sections = array_merge($sections, $database->loadObjectList());
$lists['sectionid'] = mosHTML::selectList($sections, 'sectionid', 'class="inputbox" size="1" ' . $javascript, 'id', 'title');
} else {
$sections = $database->loadObjectList();
$lists['sectionid'] = mosHTML::selectList($sections, 'sectionid', 'class="inputbox" size="1" ' . $javascript, 'id', 'title', intval($row->sectionid));
}
$contentSection = '';
foreach ($sections as $section) {
$section_list[] = $section->id;
// get the type name - which is a special category
//.........这里部分代码省略.........
示例14: editCategory
/**
* Compiles information to add or edit a category
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editCategory($uid = 0, $section = '')
{
global $database, $my, $mainframe;
$type = strval(mosGetParam($_REQUEST, 'type', ''));
$redirect = strval(mosGetParam($_REQUEST, 'section', 'content'));
// check for existance of any sections
$query = "SELECT COUNT( id )" . "\n FROM #__sections" . "\n WHERE scope = 'content'";
$database->setQuery($query);
$sections = $database->loadResult();
if (!$sections && $type != 'other') {
echo "<script> alert('You need to have at least one Section before you can create a Category'); window.history.go(-1); </script>\n";
exit;
}
$row = new mosCategory($database);
// load the row from the db table
$row->load((int) $uid);
// fail if checked out not by 'me'
if ($row->checked_out && $row->checked_out != $my->id) {
mosRedirect('index2.php?option=categories§ion=' . $row->section, 'The category ' . $row->title . ' is currently being edited by another administrator');
}
$lists['links'] = 0;
$menus = NULL;
$selected_folders = NULL;
if ($uid) {
// existing record
$row->checkout($my->id);
// code for Link Menu
switch ($row->section) {
case 'com_weblinks':
$and = "\n AND type = 'weblink_category_table'";
$link = 'Table - Weblink Category';
break;
case 'com_newsfeeds':
$and = "\n AND type = 'newsfeed_category_table'";
$link = 'Table - Newsfeeds Category';
break;
case 'com_contact_details':
$and = "\n AND type = 'contact_category_table'";
$link = 'Table - Contacts Category';
break;
default:
$and = '';
$link = '';
break;
}
// content
if ($row->section > 0) {
$query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . "\n AND ( type = 'content_archive_category' OR type = 'content_blog_category' OR type = 'content_category' )";
$database->setQuery($query);
$menus = $database->loadObjectList();
$count = count($menus);
for ($i = 0; $i < $count; $i++) {
switch ($menus[$i]->type) {
case 'content_category':
$menus[$i]->type = 'Table - Content Category';
break;
case 'content_blog_category':
$menus[$i]->type = 'Blog - Content Category';
break;
case 'content_archive_category':
$menus[$i]->type = 'Blog - Content Category Archive';
break;
}
}
$lists['links'] = 1;
// handling for MOSImage directories
if (trim($row->params)) {
// get params definitions
$params = new mosParameters($row->params, $mainframe->getPath('com_xml', 'com_categories'), 'component');
$temps = $params->get('imagefolders', '');
$temps = explode(',', $temps);
foreach ($temps as $temp) {
$selected_folders[] = mosHTML::makeOption($temp, $temp);
}
} else {
$selected_folders[] = mosHTML::makeOption('*2*');
}
} else {
$query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . $and;
$database->setQuery($query);
$menus = $database->loadObjectList();
$count = count($menus);
for ($i = 0; $i < $count; $i++) {
$menus[$i]->type = $link;
}
$lists['links'] = 1;
}
} else {
// new record
$row->section = $section;
$row->published = 1;
$menus = NULL;
// handling for MOSImage directories
if ($row->section == 'content') {
//.........这里部分代码省略.........
示例15: Link
/**
* build the link/url of a menu item
*/
function Link(&$row, $id, $link = NULL)
{
global $mainframe;
if ($id) {
switch ($row->type) {
case 'content_item_link':
case 'content_typed':
// load menu params
$params = new mosParameters($row->params, $mainframe->getPath('menu_xml', $row->type), 'menu');
if ($params->get('unique_itemid')) {
$row->link .= '&Itemid=' . $row->id;
} else {
$temp = split('&task=view&id=', $row->link);
$row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 0);
}
$link = $row->link;
break;
default:
if ($link) {
$link = $row->link;
} else {
$link = $row->link . '&Itemid=' . $row->id;
}
break;
}
} else {
$link = NULL;
}
return $link;
}