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; }
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; }
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); }
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; }
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; }
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); }
/** * 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')) { ?> <br /> <?php echo $row->description; ?> <?php } ?> </td> <?php if ($params->get('hits')) { ?> <td align="center"> <?php echo $row->hits; ?> </td> <?php } ?> </tr> <?php $k = 1 - $k; } ?> </table> <?php }
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);
<?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();
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; } }
/** * 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 { $cleanup_startup = 'false'; } if ($newlines) { $br_newlines = 'true'; $p_newlines = 'false'; } else { $br_newlines = 'false'; $p_newlines = 'true'; } // Tiny Compressed mode if ($compressed) { $load = '<script type="text/javascript" src="' . $mosConfig_live_site . '/mambots/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js"></script>'; $load_init = ' <script type="text/javascript"> tinyMCE_GZ.init({ plugins : \'style,layer,table,save,advhr,advimage,advlink,emotions,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking\', themes : \'simple,advanced\', languages : \'en\', disk_cache : true, debug : false }); </script>'; } else { $load = '<script type="text/javascript" src="' . $mosConfig_live_site . '/mambots/editors/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>'; $load_init = ''; } // preview if ($preview) { $plugins[] = 'preview'; $buttons2[] = 'preview'; } // search & replace if ($searchreplace) { $plugins[] = 'searchreplace'; $buttons2[] = 'search,replace'; } $plugins[] = 'insertdatetime'; // insert date if ($insertdate) { $buttons2[] = 'insertdate'; } // insert time if ($inserttime) { $buttons2[] = 'inserttime'; } // emotions if ($smilies) { $plugins[] = 'emotions'; $buttons2[] = 'emotions'; } // horizontal line if ($hr) { $plugins[] = 'advhr'; $elements[] = 'hr[class|width|size|noshade]'; $buttons3[] = 'advhr'; } // flash if ($flash) { $plugins[] = 'flash'; $buttons3[] = 'flash'; } // table if ($table) { $plugins[] = 'table'; $buttons3[] = 'tablecontrols'; } // fullscreen if ($fullscreen) { $plugins[] = 'fullscreen'; $buttons3[] = 'fullscreen'; } // autosave if ($autosave) { $plugins[] = 'autosave'; } // layer if ($layer) { $plugins[] = 'layer'; $buttons2[] = 'insertlayer'; $buttons2[] = 'moveforward'; $buttons2[] = 'movebackward'; $buttons2[] = 'absolute'; } // style if ($style) { $plugins[] = 'style'; $buttons3[] = 'styleprops'; } // visualchars if ($visualchars) { $plugins[] = 'visualchars'; $buttons3[] = 'visualchars'; } // media if ($media) { $plugins[] = 'media'; $buttons3[] = 'media'; } // nonbreaking if ($nonbreaking) { $plugins[] = 'nonbreaking'; $buttons3[] = 'nonbreaking'; } $buttons2 = implode(', ', $buttons2); $buttons3 = implode(', ', $buttons3); $plugins = implode(', ', $plugins); $elements = implode(', ', $elements); return <<<EOD \t{$load}\t \t{$load_init}\t \t<script type="text/javascript"> \ttinyMCE.init({ \t\ttheme : "{$theme}", \t\tlanguage : "en", \t\tmode : "specific_textareas", \t\tdocument_base_url : "{$mosConfig_live_site}/", \t\trelative_urls : {$relative_urls}, \t\tremove_script_host : false, \t\tsave_callback : "TinyMCE_Save", \t\tinvalid_elements : "{$invalid_elements}", \t\ttheme_advanced_toolbar_location : "{$toolbar}", \t\ttheme_advanced_source_editor_height : "{$html_height}", \t\ttheme_advanced_source_editor_width : "{$html_width}", \t\tdirectionality: "{$text_direction}", \t\tforce_br_newlines : "{$br_newlines}", \t\tforce_p_newlines : "{$p_newlines}", \t\t{$content_css} \t\tdebug : false, \t\tcleanup : {$cleanup}, \t\tcleanup_on_startup : {$cleanup_startup}, \t\tsafari_warning : false, \t\tplugins : "advlink, advimage, {$plugins}", \t\ttheme_advanced_buttons2_add : "{$buttons2}", \t\ttheme_advanced_buttons3_add : "{$buttons3}", \t\tplugin_insertdate_dateFormat : "{$format_date}", \t\tplugin_insertdate_timeFormat : "{$format_time}", \t\tplugin_preview_width : "{$preview_width}", \t\tplugin_preview_height : "{$preview_height}", \t\textended_valid_elements : "a[name|href|target|title|onclick], img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], {$elements}", \t\tdisk_cache : true, \t\tdebug : false,\t \t\tfullscreen_settings : { \t\t\ttheme_advanced_path_location : "top" \t\t} \t}); \tfunction TinyMCE_Save(editor_id, content, node) \t{ \t\tbase_url = tinyMCE.settings['document_base_url']; \t\tvar vHTML = content; \t\tif (true == true){ \t\t\tvHTML = tinyMCE.regexpReplace(vHTML, 'href\\s*=\\s*"?'+base_url+'', 'href="', 'gi'); \t\t\tvHTML = tinyMCE.regexpReplace(vHTML, 'src\\s*=\\s*"?'+base_url+'', 'src="', 'gi'); \t\t\tvHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_src\\s*=\\s*"?', '', 'gi'); \t\t\tvHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_href\\s*=\\s*"?', '', 'gi'); \t\t} \t\treturn vHTML; \t}\t </script> EOD; }
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; }
/** * 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 if ($row->sectionid) { if ($section->id == $row->sectionid) { $contentSection = $section->title; } } else { if ($section->id == $sectionid) { $contentSection = $section->title; } } } $sectioncategories = array(); $sectioncategories[-1] = array(); $sectioncategories[-1][] = mosHTML::makeOption('-1', 'Select Category', 'id', 'name'); mosArrayToInts($section_list); $section_list = 'section=' . implode(' OR section=', $section_list); $query = "SELECT id, name, section" . "\n FROM #__categories" . "\n WHERE ( {$section_list} )" . "\n ORDER BY ordering"; $database->setQuery($query); $cat_list = $database->loadObjectList(); foreach ($sections as $section) { $sectioncategories[$section->id] = array(); $rows2 = array(); foreach ($cat_list as $cat) { if ($cat->section == $section->id) { $rows2[] = $cat; } } foreach ($rows2 as $row2) { $sectioncategories[$section->id][] = mosHTML::makeOption($row2->id, $row2->name, 'id', 'name'); } } // get list of categories if (!$row->catid && !$row->sectionid) { $categories[] = mosHTML::makeOption('-1', 'Select Category', 'id', 'name'); $lists['catid'] = mosHTML::selectList($categories, 'catid', 'class="inputbox" size="1"', 'id', 'name'); } else { $categoriesA = array(); if ($sectionid == 0) { //$where = "\n WHERE section NOT LIKE '%com_%'"; foreach ($cat_list as $cat) { $categoriesA[] = $cat; } } else { //$where = "\n WHERE section = '$sectionid'"; foreach ($cat_list as $cat) { if ($cat->section == $sectionid) { $categoriesA[] = $cat; } } } $categories[] = mosHTML::makeOption('-1', 'Select Category', 'id', 'name'); $categories = array_merge($categories, $categoriesA); $lists['catid'] = mosHTML::selectList($categories, 'catid', 'class="inputbox" size="1"', 'id', 'name', intval($row->catid)); } // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" . "\n FROM #__content" . "\n WHERE catid = " . (int) $row->catid . "\n AND state >= 0" . "\n ORDER BY ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query, 1); // pull param column from category info $query = "SELECT params" . "\n FROM #__categories" . "\n WHERE id = " . (int) $row->catid; $database->setQuery($query); $categoryParam = $database->loadResult(); $paramsCat = new mosParameters($categoryParam, $mainframe->getPath('com_xml', 'com_categories'), 'component'); $selected_folders = $paramsCat->get('imagefolders', ''); if (!$selected_folders) { $selected_folders = '*2*'; } // check if images utilizes settings from section if (strpos($selected_folders, '*2*') !== false) { unset($selected_folders); // load param column from section info $query = "SELECT params" . "\n FROM #__sections" . "\n WHERE id = " . (int) $row->sectionid; $database->setQuery($query); $sectionParam = $database->loadResult(); $paramsSec = new mosParameters($sectionParam, $mainframe->getPath('com_xml', 'com_sections'), 'component'); $selected_folders = $paramsSec->get('imagefolders', ''); } if (trim($selected_folders)) { $temps = explode(',', $selected_folders); foreach ($temps as $temp) { $temp = ampReplace($temp); $folders[] = mosHTML::makeOption($temp, $temp); } } else { $folders[] = mosHTML::makeOption('*1*'); } // calls function to read image from directory $pathA = $mosConfig_absolute_path . '/images/stories'; $pathL = $mosConfig_live_site . '/images/stories'; $images = array(); if ($folders[0]->value == '*1*') { $folders = array(); $folders[] = mosHTML::makeOption('/'); mosAdminMenus::ReadImages($pathA, '/', $folders, $images); } else { mosAdminMenus::ReadImagesX($folders, $images); } // list of folders in images/stories/ $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL); // list of images in specfic folder in images/stories/ $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL, $folders); // list of saved images $lists['imagelist'] = mosAdminMenus::GetSavedImages($row, $pathL); // build list of users $active = intval($row->created_by) ? intval($row->created_by) : $my->id; $lists['created_by'] = mosAdminMenus::UserSelect('created_by', $active); // build the select list for the image position alignment $lists['_align'] = mosAdminMenus::Positions('_align'); // build the select list for the image caption alignment $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align'); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($row); // build the html select list for menu selection $lists['menuselect'] = mosAdminMenus::MenuSelect(); // build the select list for the image caption position $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM); $pos[] = mosHTML::makeOption('top', _CMN_TOP); $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text'); // get params definitions $params = new mosParameters($row->attribs, $mainframe->getPath('com_xml', 'com_content'), 'component'); HTML_content::editContent($row, $contentSection, $lists, $sectioncategories, $images, $params, $option, $redirect, $menus); }
/** * 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') { $selected_folders[] = mosHTML::makeOption('*2*'); } } // make order list $order = array(); $query = "SELECT COUNT(*)" . "\n FROM #__categories" . "\n WHERE section = " . $database->Quote($row->section); $database->setQuery($query); $max = intval($database->loadResult()) + 1; for ($i = 1; $i < $max; $i++) { $order[] = mosHTML::makeOption($i); } // build the html select list for sections if ($section == 'content') { $query = "SELECT s.id AS value, s.title AS text" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering"; $database->setQuery($query); $sections = $database->loadObjectList(); $lists['section'] = mosHTML::selectList($sections, 'section', 'class="inputbox" size="1"', 'value', 'text'); } else { if ($type == 'other') { $section_name = 'N/A'; } else { $temp = new mosSection($database); $temp->load($row->section); $section_name = $temp->name; } $lists['section'] = '<input type="hidden" name="section" value="' . $row->section . '" />' . $section_name; } // build the html select list for category types $types[] = mosHTML::makeOption('', 'Select Type'); if ($row->section == 'com_contact_details') { $types[] = mosHTML::makeOption('contact_category_table', 'Contact Category Table'); } else { if ($row->section == 'com_newsfeeds') { $types[] = mosHTML::makeOption('newsfeed_category_table', 'Newsfeed Category Table'); } else { if ($row->section == 'com_weblinks') { $types[] = mosHTML::makeOption('weblink_category_table', 'Weblink Category Table'); } else { $types[] = mosHTML::makeOption('content_category', 'Content Category Table'); $types[] = mosHTML::makeOption('content_blog_category', 'Content Category Blog'); $types[] = mosHTML::makeOption('content_archive_category', 'Content Category Archive Blog'); } } } // if $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text'); // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" . "\n FROM #__categories" . "\n WHERE section = " . $database->Quote($row->section) . "\n ORDER BY ordering"; $lists['ordering'] = stripslashes(mosAdminMenus::SpecificOrdering($row, $uid, $query)); // build the select list for the image positions $active = $row->image_position ? $row->image_position : 'left'; $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0, 0); // Imagelist $lists['image'] = mosAdminMenus::Images('image', $row->image); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($row); // build the html radio buttons for published $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published); // build the html select list for menu selection $lists['menuselect'] = mosAdminMenus::MenuSelect(); // handling for MOSImage directories if ($row->section > 0 || $row->section == 'content') { // list of folders in images/stories/ $imgFiles = recursive_listdir(COM_IMAGE_BASE); $len = strlen(COM_IMAGE_BASE); $folders[] = mosHTML::makeOption('*2*', 'Use Section settings'); $folders[] = mosHTML::makeOption('*#*', '---------------------'); $folders[] = mosHTML::makeOption('*1*', 'All'); $folders[] = mosHTML::makeOption('*0*', 'None'); $folders[] = mosHTML::makeOption('*#*', '---------------------'); $folders[] = mosHTML::makeOption('/'); foreach ($imgFiles as $file) { $folders[] = mosHTML::makeOption(substr($file, $len)); } $lists['folders'] = mosHTML::selectList($folders, 'folders[]', 'class="inputbox" size="17" multiple="multiple"', 'value', 'text', $selected_folders); } categories_html::edit($row, $lists, $redirect, $menus); }
/** * 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; }
$params->def('header_logout', $menu->name); $params->def('pageclass_sfx', ''); $params->def('back_button', $mainframe->getCfg('back_button')); $params->def('login', $mosConfig_live_site); $params->def('logout', $mosConfig_live_site); $params->def('login_message', 0); $params->def('logout_message', 0); $params->def('description_login', 1); $params->def('description_logout', 1); $params->def('description_login_text', _LOGIN_DESCRIPTION); $params->def('description_logout_text', _LOGOUT_DESCRIPTION); $params->def('image_login', 'key.jpg'); $params->def('image_logout', 'key.jpg'); $params->def('image_login_align', 'right'); $params->def('image_logout_align', 'right'); $params->def('registration', $mainframe->getCfg('allowUserRegistration')); $image_login = ''; $image_logout = ''; if ($params->get('image_login') != -1) { $image = $mosConfig_live_site . '/images/stories/' . $params->get('image_login'); $image_login = '******' . $image . '" align="' . $params->get('image_login_align') . '" hspace="10" alt="" />'; } if ($params->get('image_logout') != -1) { $image = $mosConfig_live_site . '/images/stories/' . $params->get('image_logout'); $image_logout = '<img src="' . $image . '" align="' . $params->get('image_logout_align') . '" hspace="10" alt="" />'; } if ($my->id) { loginHTML::logoutpage($params, $image_logout); } else { loginHTML::loginpage($params, $image_login); }
} require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapConfig.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapSitemap.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapPlugins.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapCache.php'; global $xSitemap, $xConfig; $xConfig = new XmapConfig(); $xConfig->load(); $Itemid = intval(mosGetParam($_REQUEST, 'Itemid', '')); $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') {
/** * Utility function for writing a menu link */ function mosGetMenuLink($mitem, $level = 0, &$params, $open = null) { global $Itemid, $mosConfig_live_site, $mainframe; $txt = ''; switch ($mitem->type) { case 'separator': case 'component_item_link': break; case 'url': if (preg_match('/index.php\\?/', $link) && !preg_match('/http/', $link) && !preg_match('/https/', $link)) { if (!preg_match('/Itemid=/', $link)) { $mitem->link .= '&Itemid=' . $mitem->id; } } break; case 'content_item_link': case 'content_typed': // load menu params $menuparams = new mosParameters($mitem->params, $mainframe->getPath('menu_xml', $mitem->type), 'menu'); $unique_itemid = $menuparams->get('unique_itemid', 1); if ($unique_itemid) { $mitem->link .= '&Itemid=' . $mitem->id; } else { $temp = split('&task=view&id=', $mitem->link); if ($mitem->type == 'content_typed') { $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 1, 0); } else { $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 1); } } break; default: $mitem->link .= '&Itemid=' . $mitem->id; break; } // Active Menu highlighting $current_itemid = $Itemid; if (!$current_itemid) { $id = ''; } else { if ($current_itemid == $mitem->id) { $id = 'id="active_menu' . $params->get('class_sfx') . '"'; } else { if ($params->get('activate_parent') && isset($open) && in_array($mitem->id, $open)) { $id = 'id="active_menu' . $params->get('class_sfx') . '"'; } else { $id = ''; } } } if ($params->get('full_active_id')) { // support for `active_menu` of 'Link - Component Item' if ($id == '' && $mitem->type == 'component_item_link') { parse_str($mitem->link, $url); if ($url['Itemid'] == $current_itemid) { $id = 'id="active_menu' . $params->get('class_sfx') . '"'; } } // support for `active_menu` of 'Link - Url' if link is relative if ($id == '' && $mitem->type == 'url' && strpos('http', $mitem->link) === false) { parse_str($mitem->link, $url); if (isset($url['Itemid'])) { if ($url['Itemid'] == $current_itemid) { $id = 'id="active_menu' . $params->get('class_sfx') . '"'; } } } } // replace & with amp; for xhtml compliance $mitem->link = ampReplace($mitem->link); // run through SEF convertor $mitem->link = sefRelToAbs($mitem->link); $menuclass = 'mainlevel' . $params->get('class_sfx'); if ($level > 0) { $menuclass = 'sublevel' . $params->get('class_sfx'); } // replace & with amp; for xhtml compliance // remove slashes from excaped characters $mitem->name = stripslashes(ampReplace($mitem->name)); switch ($mitem->browserNav) { // cases are slightly different case 1: // open in a new window $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>'; break; case 2: // open in a popup window $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n"; break; case 3: // don't link it $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>'; break; default: // open in parent window $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>'; break; } if ($params->get('menu_images')) { $menu_params = new stdClass(); $menu_params = new mosParameters($mitem->params); $menu_image = $menu_params->def('menu_image', -1); if ($menu_image != '-1' && $menu_image) { $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>'; if ($params->get('menu_images_align')) { $txt = $txt . ' ' . $image; } else { $txt = $image . ' ' . $txt; } } } return $txt; }
/** * Compiles information to add or edit a section * @param database A database connector object * @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 editSection($uid = 0, $scope = '', $option) { global $database, $my, $mainframe; $row = new mosSection($database); // load the row from the db table $row->load((int) $uid); // fail if checked out not by 'me' if ($row->isCheckedOut($my->id)) { $msg = 'The section ' . $row->title . ' is currently being edited by another administrator'; mosRedirect('index2.php?option=' . $option . '&scope=' . $row->scope . '&mosmsg=' . $msg); } $selected_folders = NULL; if ($uid) { $row->checkout($my->id); if ($row->id > 0) { $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . "\n AND ( type = 'content_archive_section' OR type = 'content_blog_section' OR type = 'content_section' )"; $database->setQuery($query); $menus = $database->loadObjectList(); $count = count($menus); for ($i = 0; $i < $count; $i++) { switch ($menus[$i]->type) { case 'content_section': $menus[$i]->type = 'Section Table'; break; case 'content_blog_section': $menus[$i]->type = 'Section Blog'; break; case 'content_archive_section': $menus[$i]->type = 'Section Blog Archive'; break; } } } else { $menus = array(); } // handling for MOSImage directories if (trim($row->params)) { // get params definitions $params = new mosParameters($row->params, $mainframe->getPath('com_xml', 'com_sections'), 'component'); $temps = $params->get('imagefolders', ''); $temps = explode(',', $temps); foreach ($temps as $temp) { $selected_folders[] = mosHTML::makeOption($temp, $temp); } } else { $selected_folders[] = mosHTML::makeOption('*1*'); } } else { $row->scope = $scope; $row->published = 1; $menus = array(); // handling for MOSImage directories $selected_folders[] = mosHTML::makeOption('*1*'); } // build the html select list for section types $types[] = mosHTML::makeOption('', 'Select Type'); $types[] = mosHTML::makeOption('content_section', 'Section List'); $types[] = mosHTML::makeOption('content_blog_section', 'Section Blog'); $types[] = mosHTML::makeOption('content_archive_section', 'Section Archive Blog'); $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text'); // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" . "\n FROM #__sections" . "\n WHERE scope=" . $database->Quote($row->scope) . " ORDER BY ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query); // build the select list for the image positions $active = $row->image_position ? $row->image_position : 'left'; $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0); // build the html select list for images $lists['image'] = mosAdminMenus::Images('image', $row->image); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($row); // build the html radio buttons for published $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published); // build the html select list for menu selection $lists['menuselect'] = mosAdminMenus::MenuSelect(); // list of folders in images/stories/ $imgFiles = recursive_listdir(COM_IMAGE_BASE); $len = strlen(COM_IMAGE_BASE); // handling for MOSImage directories $folders[] = mosHTML::makeOption('*1*', 'All'); $folders[] = mosHTML::makeOption('*0*', 'None'); $folders[] = mosHTML::makeOption('*#*', '---------------------'); $folders[] = mosHTML::makeOption('/'); foreach ($imgFiles as $file) { $folders[] = mosHTML::makeOption(substr($file, $len)); } $lists['folders'] = mosHTML::selectList($folders, 'folders[]', 'class="inputbox" size="17" multiple="multiple"', 'value', 'text', $selected_folders); sections_html::edit($row, $option, $lists, $menus); }
include $mainframe->getCfg('absolute_path') . '/administrator/components/com_wbgallery/load.php'; // Load menu parameters $menu = new mosMenu($database); $menu->load($Itemid); $params = new mosParameters($menu->params); // Store Menu Params global $wbGallery_menuParamsCache; $wbGallery_menuParamsCache =& $params; // Prepare Runtime global $task, $priTask, $subTask, $cid, $id; $task = mosGetParam($_REQUEST, 'task', ''); $cid = mosGetParam($_REQUEST, 'cid', 0); $id = mosGetParam($_REQUEST, 'id', 0); // Prepare wbgItemid global $wbgItemid; $wbgItemid = (int) $params->get('target_itemid'); if (!$wbgItemid) { $wbgItemid = $Itemid; } // Prepare Category ID if (!$task) { if ($id) { $task = 'image'; } elseif ($cid) { $task = 'category'; } else { $task = 'category'; } } // Prepare subTask $priTask = preg_replace('/^(\\w+)\\.(\\w+)$/', '$1', $task);
$_Itemid = (int) JCommentsInput::getVar('Itemid'); $_tmpl = JCommentsInput::getVar('tmpl'); if ($_Itemid !== 0 && $_tmpl !== 'component') { if (JCOMMENTS_JVERSION == '1.5') { $params = JComponentHelper::getParams('com_jcomments'); } elseif (JCOMMENTS_JVERSION == '1.7') { $params = $app->getParams(); } else { $menu = $app->get('menu'); if ($menu != null) { $params = new mosParameters($menu->params); } else { $params = new mosParameters(''); } } $object_group = $params->get('object_group'); $object_id = (int) $params->get('object_id', 0); if ($object_id != 0 && $object_group != '') { if ($params->get('language_suffix') != '') { JComments::loadAlternateLanguage($params->get('language_suffix')); } $keywords = $params->get('keywords'); $description = $params->get('description'); $pageTitle = $params->get('page_title'); $document = JCommentsFactory::getDocument(); if ($pageTitle != '') { $document->setTitle($pageTitle); } if ($keywords) { $document->setMetaData('keywords', $keywords); }
function genMenuItem(&$row, $level, $pos) { global $Itemid, $mosConfig_live_site, $mainframe; $txt = ''; switch ($row->type) { case 'separator': case 'component_item_link': break; case 'url': if (eregi('index.php\\?', $row->link)) { if (!eregi('Itemid=', $row->link)) { $row->link .= '&Itemid=' . $row->id; } } break; case 'content_item_link': case 'content_typed': // load menu params $menuparams = new mosParameters($row->params, $mainframe->getPath('menu_xml', $row->type), 'menu'); $unique_itemid = $menuparams->get('unique_itemid', 1); if ($unique_itemid) { $row->link .= '&Itemid=' . $row->id; } else { $temp = split('&task=view&id=', $row->link); if ($row->type == 'content_typed') { $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 1, 0); } else { $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 1); } } break; default: $row->link .= '&Itemid=' . $row->id; break; } $row->link = ampReplace($row->link); if (strcasecmp(substr($row->link, 0, 4), 'http')) { $row->link = sefRelToAbs($row->link); } $active = in_array($row->id, $this->parent->open) ? "class = \"active\"" : ""; $id = 'id="menu' . $row->id . '"'; $txt = $row->name; if ($this->getParam('menu_images')) { $menu_params = new stdClass(); $menu_params =& new mosParameters($row->params); $menu_image = $menu_params->def('menu_image', -1); if ($menu_image != '-1' && $menu_image) { $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $row->name . '"/>'; if ($this->getParam('menu_images_align')) { $txt = $txt . ' ' . $image; } else { $txt = $image . ' ' . $txt; } } } $title = " title=\"{$row->name}\""; if ($active) { $active = $row->parent == 0 && $pos == 0 ? "class=\"active-first-item\"" : "class = \"active\""; } else { $active = $row->parent == 0 && $pos == 0 ? "class=\"first-item\"" : ""; } switch ($row->browserNav) { // cases are slightly different case 1: // open in a new window $txt = '<a href="' . $row->link . '" target="_blank" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>'; break; case 2: // open in a popup window $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $row->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" " . $active . " " . $id . $title . "><span>" . $txt . "</span></a>\n"; break; case 3: // don't link it $txt = '<a href="#" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>'; break; default: // formerly case 2 // open in parent window $txt = '<a href="' . $row->link . '" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>'; break; } echo $txt; }
$t_path = $mosConfig_live_site . '/templates/' . $cur_template . '/images/'; $d_path = $mosConfig_live_site . '/images/M_images/'; // needed to reduce query if (isset($GLOBALS['syndicateParams'])) { // load value stored in GLOBALS $syndicateParams = $GLOBALS['syndicateParams']; } else { // query to oull syndication component params $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'); } // check for disabling/enabling of selected feed types if (!$syndicateParams->get('rss091', 1)) { $rss091 = 0; } if (!$syndicateParams->get('rss10', 1)) { $rss10 = 0; } if (!$syndicateParams->get('rss20', 1)) { $rss20 = 0; } if (!$syndicateParams->get('atom03', 1)) { $atom03 = 0; } if (!$syndicateParams->get('opml', 1)) { $opml = 0; } ?>
static function ownersList($option) { global $database, $my, $Itemid, $mainframe, $booklibrary_configuration, $acl, $mosConfig_list_limit, $limit, $limitstart; PHP_booklibrary::addTitleAndMetaTags(); $symbol = mosGetParam($_REQUEST, 'letindex', ''); $symbol_str = ''; if ($symbol) { $symbol_str = " AND (LOWER(u.name) LIKE '{$symbol}%' ) "; } //getting groups of user $s = getWhereUsergroupsString("c"); // $menu = new JTableMenu( $database ); // $menu->load( $Itemid ); // $params = new mosParameters( $menu->params ); if (version_compare(JVERSION, '3.0', 'ge')) { $menu = new JTableMenu($database); $menu->load($Itemid); $params = new JRegistry(); $params->loadString($menu->params); } else { $menu = new mosMenu($database); $menu->load($Itemid); $params = new mosParameters($menu->params); } $database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=com_booklibrary'"); if ($database->loadResult() != $Itemid) { $params->def('wrongitemid', '1'); } $params->def('header', _BOOKLIBRARY_LABEL_TITLE_OWNERSLIST); if (!$params->get('wrongitemid')) { $pathway = sefRelToAbs('index.php?option=' . $option . '&task=owners_list&Itemid=' . $Itemid); $pathway_name = _BOOKLIBRARY_LABEL_TITLE_OWNERSLIST; $mainframe->appendPathWay($pathway_name, $pathway); } if (checkAccessBL($booklibrary_configuration['ownerslist']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl) && $booklibrary_configuration['ownerslist']['show']) { $params->def('ownerslist_show', 1); } $db = JFactory::getDBO(); $query = "SELECT COUNT(DISTINCT u.email)\n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1\n AND ({$s}) {$symbol_str};\n "; $database->setQuery($query); $total = $database->loadResult(); $pageNav = new JPagination($total, $limitstart, $limit); // for J 1.6 $query = "SELECT u.name, COUNT(DISTINCT mc.bookid) AS books\n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1 AND bl.owneremail!=''\n AND ({$s}) {$symbol_str}\n \nGROUP BY u.name\n \nORDER BY u.name\n \nLIMIT {$pageNav->limitstart},{$pageNav->limit};"; $database->setQuery($query); $ownerslist = $database->loadObjectList(); if (!empty($ownerslist[0]->books) && !isset($ownerslist[0]->name)) { $ownerslist[0]->name = 'anonymous'; } $query = "SELECT DISTINCT UPPER(SUBSTRING(u.name, 1,1)) AS symb \n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1 AND bl.owneremail!=''\n AND ({$s})\n \nORDER BY u.name ;"; $database->setQuery($query); $symb = $database->loadObjectList(); if (count($symb) > 0) { $symb_list_str = '<div style="display:inline; margin-left:auto;margin-right:auto;">'; foreach ($symb as $symbol) { $symb_list_str .= '<span style="padding:5px; ">' . '<a href="index.php?option=' . $option . '&task=owners_list' . '&letindex=' . $symbol->symb . '&Itemid=' . $Itemid . '">' . $symbol->symb . '</a></span>'; } $symb_list_str .= "</div>"; $params->def('symb_list_str', $symb_list_str); } $params->def('ownerlist01', "{loadposition com_booklibrary_owner_list_01}"); $params->def('ownerlist02', "{loadposition com_booklibrary_owner_list_02}"); $params->def('ownerlist03', "{loadposition com_booklibrary_owner_list_03}"); //print_r($ownerslist); HTML_booklibrary::showOwnersList($params, $ownerslist, $pageNav); }
function vcard() { $contact = new mosContact(); $contact->load($this->contact_id); $params = new mosParameters($contact->params); if (!$params->get('vcard')) { echo "<script>alert (\"" . T_('There are no vCards available for download.') . "\"); window.history.go(-1);</script>"; exit(0); } $name = explode(' ', $contact->name); $firstname = $name[0]; unset($name[0]); $last = count($name); if (isset($name[$last])) { $surname = $name[$last]; unset($name[$last]); } else { $surname = ''; } $middlename = trim(implode(' ', $name)); $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(mamboCore::get('mosConfig_live_site'), 'WORK'); $v->setTitle($contact->con_position); $v->setOrg(mamboCore::get('mosConfig_sitename')); $filename = str_replace(' ', '_', $contact->name); $v->setFilename($filename); $output = $v->getVCard(mamboCore::get('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); print $output; //mosRedirect('index.php'); }
/** * Shows the email form for a given content item. * @param int The content item id */ function emailContentSend($uid, $gid) { global $database, $mainframe; global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_hideEmail; $id = intval(mosGetParam($_REQUEST, 'id', 0)); if ($id) { $query = 'SELECT attribs FROM #__content WHERE `id`=' . $id; $database->setQuery($query); $params = new mosParameters($database->loadResult()); } else { $params = new mosParameters(''); } $paramEmail = intval($params->get('email', 0)); if ($mosConfig_hideEmail && !$paramEmail) { echo _NOT_AUTH; return; } // simple spoof check security josSpoofCheck(1); // check for session cookie // Session Cookie `name` $sessionCookieName = mosMainFrame::sessionCookieName(); // Get Session Cookie `value` $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null); if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) { mosErrorAlert(_NOT_AUTH); } $itemid = intval(mosGetParam($_POST, 'itemid', 0)); $now = _CURRENT_SERVER_TIME; $nullDate = $database->getNullDate(); // query to check for state and access levels $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $uid . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )"; $database->setQuery($query); $row = NULL; if ($database->loadObject($row)) { /* * check whether category is published */ if (!$row->cat_pub && $row->catid) { mosNotAuth(); return; } /* * check whether section is published */ if (!$row->sec_pub && $row->sectionid) { mosNotAuth(); return; } /* * check whether category access level allows access */ if ($row->cat_access > $gid && $row->catid) { mosNotAuth(); return; } /* * check whether section access level allows access */ if ($row->sec_access > $gid && $row->sectionid) { mosNotAuth(); return; } $email = strval(mosGetParam($_POST, 'email', '')); $yourname = strval(mosGetParam($_POST, 'yourname', '')); $youremail = strval(mosGetParam($_POST, 'youremail', '')); $subject = strval(mosGetParam($_POST, 'subject', '')); if (empty($subject)) { $subject = _EMAIL_INFO . ' ' . $yourname; } if ($uid < 1 || !$email || !$youremail || JosIsValidEmail($email) == false || JosIsValidEmail($youremail) == false) { mosErrorAlert(_EMAIL_ERR_NOINFO); } $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0"; $database->setQuery($query); $template = $database->loadResult(); // determine Itemid for Item if ($itemid) { $_itemid = '&Itemid=' . $itemid; } else { $itemid = $mainframe->getItemid($uid, 0, 0); $_itemid = '&Itemid=' . $itemid; } // link sent in email $link = sefRelToAbs('index.php?option=com_content&task=view&id=' . $uid . $_itemid); // message text $msg = sprintf(_EMAIL_MSG, html_entity_decode($mosConfig_sitename, ENT_QUOTES), $yourname, $youremail, $link); // mail function $success = mosMail($youremail, $yourname, $email, $subject, $msg); if (!$success) { mosErrorAlert(_EMAIL_ERR_NOINFO); } HTML_content::emailSent($email, $template); } else { mosNotAuth(); return; } }
function listWeblinks($catid) { global $mainframe, $database, $my; global $mosConfig_live_site; global $Itemid; $rows = array(); $currentcat = null; if ($catid) { // url links info for category $query = "SELECT id, url, title, description, date, hits, params" . "\n FROM #__weblinks" . "\n WHERE catid = " . (int) $catid . "\n AND published = 1" . "\n AND archived = 0" . "\n ORDER BY ordering"; $database->setQuery($query); $rows = $database->loadObjectList(); // current cate info $query = "SELECT *" . "\n FROM #__categories" . "\n WHERE id = " . (int) $catid . "\n AND published = 1" . "\n AND access <= " . (int) $my->gid; $database->setQuery($query); $database->loadObject($currentcat); /* Check if the category is published or if access level allows access */ if (!$currentcat->name) { mosNotAuth(); return; } } /* Query to retrieve all categories that belong under the web links section and that are published. */ $query = "SELECT cc.*, a.catid, a.title, a.url, COUNT(a.id) AS numlinks" . "\n FROM #__categories AS cc" . "\n LEFT JOIN #__weblinks AS a ON a.catid = cc.id" . "\n WHERE a.published = 1" . "\n AND section = 'com_weblinks'" . "\n AND cc.published = 1" . "\n AND cc.access <= " . (int) $my->gid . "\n GROUP BY cc.id" . "\n ORDER BY cc.ordering"; $database->setQuery($query); $categories = $database->loadObjectList(); // Parameters $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('headings', 1); $params->def('hits', $mainframe->getCfg('hits')); $params->def('item_description', 1); $params->def('other_cat_section', 1); $params->def('other_cat', 1); $params->def('description', 1); $params->def('description_text', _WEBLINKS_DESC); $params->def('image', '-1'); $params->def('weblink_icons', ''); $params->def('image_align', 'right'); $params->def('back_button', $mainframe->getCfg('back_button')); if ($catid) { $params->set('type', 'category'); } else { $params->set('type', 'section'); } // page description $currentcat->descrip = ''; if (@$currentcat->description != '') { $currentcat->descrip = $currentcat->description; } else { if (!$catid) { // show description if ($params->get('description')) { $currentcat->descrip = $params->get('description_text'); } } } // page image $currentcat->img = ''; $path = $mosConfig_live_site . '/images/stories/'; if (@$currentcat->image != '') { $currentcat->img = $path . $currentcat->image; $currentcat->align = $currentcat->image_position; } else { if (!$catid) { if ($params->get('image') != -1) { $currentcat->img = $path . $params->get('image'); $currentcat->align = $params->get('image_align'); } } } // page header $currentcat->header = ''; if (@$currentcat->name != '') { $currentcat->header = $currentcat->name; } else { $currentcat->header = $params->get('header'); } // used to show table rows in alternating colours $tabclass = array('sectiontableentry1', 'sectiontableentry2'); HTML_weblinks::displaylist($categories, $rows, $catid, $currentcat, $params, $tabclass); }
* 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'); if (!defined('_JOS_EDITOR_INCLUDED')) { global $mosConfig_editor; global $my; if ($mosConfig_editor == '') { $mosConfig_editor = 'none'; } // Per User Editor selection $params = new mosParameters($my->params); $editor = $params->get('editor', ''); if (!$editor) { $editor = $mosConfig_editor; } $_MAMBOTS->loadBot('editors', $editor, 1); function initEditor() { global $mainframe, $_MAMBOTS; if ($mainframe->get('loadEditor')) { $results = $_MAMBOTS->trigger('onInitEditor'); foreach ($results as $result) { if (trim($result)) { echo $result; } } }
function plgContentJCommentsLinksJ10($published, &$row, &$params, $page = 0) { global $task, $option, $my; // disable comments link in 3rd party components (except Events and AlphaContent) if ($option != 'com_content' && $option != 'com_frontpage' && $option != 'com_alphacontent' && $option != 'com_events') { return; } require_once JCOMMENTS_HELPERS . '/content.php'; require_once JCOMMENTS_LIBRARIES . '/joomlatune/language.tools.php'; if (!isset($params) || $params == null) { $params = new mosParameters(''); } $pvars = array_keys(get_object_vars($params->_params)); if (!$published || $params->get('popup') || in_array('moduleclass_sfx', $pvars)) { JCommentsContentPluginHelper::processForeignTags($row, true); JCommentsContentPluginHelper::clear($row, true); return; } /* if ($option == 'com_frontpage') { $pluginParams = JCommentsPluginHelper::getParams('jcomments', 'content'); if ((int) $pluginParams->get('show_frontpage', 1) == 0) { return; } } */ require_once JCOMMENTS_BASE . '/jcomments.config.php'; require_once JCOMMENTS_BASE . '/jcomments.class.php'; if ($task != 'view') { // replace other comment systems tags to JComments equivalents like {jcomments on} JCommentsContentPluginHelper::processForeignTags($row, false); // show link to comments only if ($row->access <= $my->gid) { $readmore_link = JCommentsObjectHelper::getLink($row->id, 'com_content'); $readmore_register = 0; } else { $readmore_link = sefRelToAbs('index.php?option=com_registration&task=register'); $readmore_register = 1; } $tmpl = JCommentsFactory::getTemplate($row->id, 'com_content', false); $tmpl->load('tpl_links'); $tmpl->addVar('tpl_links', 'comments_link_style', $readmore_register ? -1 : 1); $tmpl->addVar('tpl_links', 'link-readmore', $readmore_link); $tmpl->addVar('tpl_links', 'content-item', $row); if ($params->get('readmore') == 0 || @$row->readmore == 0) { $tmpl->addVar('tpl_links', 'readmore_link_hidden', 1); } else { if (@$row->readmore > 0) { $tmpl->addVar('tpl_links', 'readmore_link_hidden', 0); } } $config = JCommentsFactory::getConfig(); $commentsDisabled = false; if (!JCommentsContentPluginHelper::checkCategory($row->catid)) { $commentsDisabled = true; } if ($config->getInt('comments_off', 0) == 1) { $commentsDisabled = true; } else { if ($config->getInt('comments_on', 0) == 1) { $commentsDisabled = false; } } $tmpl->addVar('tpl_links', 'comments_link_hidden', intval($commentsDisabled)); $count = 0; // do not query comments count if comments disabled and link hidden if (!$commentsDisabled) { require_once JCOMMENTS_MODELS . '/jcomments.php'; require_once JCOMMENTS_LIBRARIES . '/joomlatune/language.tools.php'; $acl = JCommentsFactory::getACL(); $options = array(); $options['object_id'] = (int) $row->id; $options['object_group'] = 'com_content'; $options['published'] = $acl->canPublish() || $acl->canPublishForObject($row->id, 'com_content') ? null : 1; $count = JCommentsModel::getCommentsCount($options); $anchor = $count == 0 ? '#addcomments' : '#comments'; $link_text = $count == 0 ? JText::_('LINK_ADD_COMMENT') : JText::plural('LINK_READ_COMMENTS', $count); $tmpl->addVar('tpl_links', 'link-comment', $readmore_link . $anchor); $tmpl->addVar('tpl_links', 'link-comment-text', $link_text); $tmpl->addVar('tpl_links', 'link-comments-class', 'comments-link'); $tmpl->addVar('tpl_links', 'comments-count', $count); } if ($readmore_register == 1 && $count == 0) { $tmpl->addVar('tpl_links', 'comments_link_hidden', 1); } if ($readmore_register == 1) { $readmore_text = JText::_('LINK_REGISTER_TO_READ_MORE'); } else { $readmore_text = JText::_('LINK_READ_MORE'); } $tmpl->addVar('tpl_links', 'link-readmore-text', $readmore_text); $tmpl->addVar('tpl_links', 'link-readmore-title', $row->title); $tmpl->addVar('tpl_links', 'link-readmore-class', 'readmore-link'); JCommentsContentPluginHelper::clear($row, true); $row->text .= $tmpl->renderTemplate('tpl_links'); $GLOBALS['jcomments_params_readmore'] = $params->get('readmore'); $GLOBALS['jcomments_row_readmore'] = $row->readmore; $params->set('readmore', 0); $row->readmore = 0; } else { JCommentsContentPluginHelper::processForeignTags($row, true); JCommentsContentPluginHelper::clear($row, true); } return; }
function feedFrontpage($showFeed) { global $database, $mainframe; global $mosConfig_live_site, $mosConfig_cachepath; $nullDate = $database->getNullDate(); // pull id of syndication component $query = "SELECT a.id" . "\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); $id = $database->loadResult(); // load syndication parameters $component = new mosComponent($database); $component->load((int) $id); $params = new mosParameters($component->params); // test if security check is enbled $check = $params->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)) { mosNotAuth(); return; } } $now = _CURRENT_SERVER_TIME; $iso = split('=', _ISO); // parameter intilization $info['date'] = date('r'); $info['year'] = date('Y'); $info['encoding'] = $iso[1]; $info['link'] = htmlspecialchars($mosConfig_live_site); $info['cache'] = $params->def('cache', 1); $info['cache_time'] = $params->def('cache_time', 3600); $info['count'] = $params->def('count', 5); $info['orderby'] = $params->def('orderby', ''); $info['title'] = $params->def('title', 'Joomla! powered Site'); $info['description'] = $params->def('description', 'Joomla! site syndication'); $info['image_file'] = $params->def('image_file', 'joomla_rss.png'); if ($info['image_file'] == -1) { $info['image'] = NULL; } else { $info['image'] = $mosConfig_live_site . '/images/M_images/' . $info['image_file']; } $info['image_alt'] = $params->def('image_alt', 'Powered by Joomla!'); $info['limit_text'] = $params->def('limit_text', 0); $info['text_length'] = $params->def('text_length', 20); // get feed type from url $info['feed'] = strval(mosGetParam($_GET, 'feed', 'RSS2.0')); // live bookmarks $info['live_bookmark'] = $params->def('live_bookmark', ''); $info['bookmark_file'] = $params->def('bookmark_file', ''); // set filename for live bookmarks feed if (!$showFeed & $info['live_bookmark']) { if ($info['bookmark_file']) { // custom bookmark filename $filename = $info['bookmark_file']; } else { // standard bookmark filename $filename = $info['live_bookmark']; } } else { // set filename for rss feeds $info['file'] = strtolower(str_replace('.', '', $info['feed'])); // security check to limit arbitrary file creation. // and to allow disabling/enabling of selected feed types switch ($info['file']) { case 'rss091': if (!$params->get('rss091', 1)) { echo _NOT_AUTH; return; } break; case 'rss10': if (!$params->get('rss10', 1)) { echo _NOT_AUTH; return; } break; case 'rss20': if (!$params->get('rss20', 1)) { echo _NOT_AUTH; return; } break; case 'atom03': if (!$params->get('atom03', 1)) { echo _NOT_AUTH; return; } break; case 'opml': if (!$params->get('opml', 1)) { echo _NOT_AUTH; return; } break; default: echo _NOT_AUTH; return; break; } } $filename = $info['file'] . '.xml'; // security check to stop server path disclosure if (strstr($filename, '/')) { echo _NOT_AUTH; return; } $info['file'] = $mosConfig_cachepath . '/' . $filename; // load feed creator class $rss = new UniversalFeedCreator(); // load image creator class $image = new FeedImage(); // loads cache file if ($showFeed && $info['cache']) { $rss->useCached($info['feed'], $info['file'], $info['cache_time']); } $rss->title = $info['title']; $rss->description = $info['description']; $rss->link = $info['link']; $rss->syndicationURL = $info['link']; $rss->cssStyleSheet = NULL; $rss->encoding = $info['encoding']; if ($info['image']) { $image->url = $info['image']; $image->link = $info['link']; $image->title = $info['image_alt']; $image->description = $info['description']; // loads image info into rss array $rss->image = $image; } // Determine ordering for sql switch (strtolower($info['orderby'])) { case 'date': $orderby = 'a.created'; break; case 'rdate': $orderby = 'a.created DESC'; break; case 'alpha': $orderby = 'a.title'; break; case 'ralpha': $orderby = 'a.title DESC'; break; case 'hits': $orderby = 'a.hits DESC'; break; case 'rhits': $orderby = 'a.hits ASC'; break; case 'front': $orderby = 'f.ordering'; break; default: $orderby = 'f.ordering'; break; } // query of frontpage content items $query = "SELECT a.*, u.name AS author, u.usertype, UNIX_TIMESTAMP( a.created ) AS created_ts, cat.title AS cat_title, sec.title AS section_title" . "\n FROM #__content AS a" . "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__categories AS cat ON cat.id = a.catid" . "\n LEFT JOIN #__sections AS sec ON sec.id = a.sectionid" . "\n WHERE a.state = 1" . "\n AND cat.published = 1" . "\n AND sec.published = 1" . "\n AND a.access = 0" . "\n AND cat.access = 0" . "\n AND sec.access = 0" . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )" . "\n ORDER BY {$orderby}"; $database->setQuery($query, 0, $info['count']); $rows = $database->loadObjectList(); foreach ($rows as $row) { // title for particular item $item_title = htmlspecialchars($row->title); $item_title = html_entity_decode($item_title); // url link to article // & used instead of & as this is converted by feed creator $_Itemid = ''; $itemid = $mainframe->getItemid($row->id); if ($itemid) { $_Itemid = '&Itemid=' . $itemid; } $item_link = 'index.php?option=com_content&task=view&id=' . $row->id . $_Itemid; $item_link = sefRelToAbs($item_link); // removes all formating from the intro text for the description text $item_description = $row->introtext; $item_description = mosHTML::cleanText($item_description); $item_description = html_entity_decode($item_description); if ($info['limit_text']) { if ($info['text_length']) { // limits description text to x words $item_description_array = split(' ', $item_description); $count = count($item_description_array); if ($count > $info['text_length']) { $item_description = ''; for ($a = 0; $a < $info['text_length']; $a++) { $item_description .= $item_description_array[$a] . ' '; } $item_description = trim($item_description); $item_description .= '...'; } } else { // do not include description when text_length = 0 $item_description = NULL; } } // load individual item creator class $item = new FeedItem(); // item info $item->title = $item_title; $item->link = $item_link; $item->description = $item_description; $item->source = $info['link']; $item->date = date('r', $row->created_ts); $item->category = $row->section_title . ' - ' . $row->cat_title; // loads item info into rss array $rss->addItem($item); } // save feed file $rss->saveFeed($info['feed'], $info['file'], $showFeed); }