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 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); }
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); }
function showItem($uid, $gid, &$access, $pop, $option = 'com_content', $now) { global $database, $mainframe, $Itemid; global $mosConfig_MetaTitle, $mosConfig_MetaAuthor; $now = _CURRENT_SERVER_TIME; $nullDate = $database->getNullDate(); if ($access->canEdit) { $xwhere = ''; } else { $xwhere = " AND ( a.state = 1 OR a.state = -1 )" . "\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) . " )"; } // main query $query = "SELECT a.*, u.name AS author, u.usertype, cc.name AS category, s.name AS section, g.name AS groups," . "\n s.published AS sec_pub, cc.published AS cat_pub, s.access AS sec_access, cc.access AS cat_access," . "\n 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 LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . "\n WHERE a.id = " . (int) $uid . $xwhere . "\n AND a.access <= " . (int) $gid; $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; } $params = new mosParameters($row->attribs); $params->set('intro_only', 0); $params->def('back_button', $mainframe->getCfg('back_button')); if ($row->sectionid == 0) { $params->set('item_navigation', 0); } else { $params->set('item_navigation', $mainframe->getCfg('item_navigation')); } // loads the links for Next & Previous Button if ($params->get('item_navigation')) { // Paramters for menu item as determined by controlling Itemid $menu = $mainframe->get('menu'); $mparams = new mosParameters($menu->params); // the following is needed as different menu items types utilise a different param to control ordering // for Blogs the `orderby_sec` param is the order controlling param // for Table and List views it is the `orderby` param $mparams_list = $mparams->toArray(); if (array_key_exists('orderby_sec', $mparams_list)) { $order_method = $mparams->get('orderby_sec', ''); } else { $order_method = $mparams->get('orderby', ''); } // additional check for invalid sort ordering if ($order_method == 'front') { $order_method = ''; } $orderby = _orderby_sec($order_method); // array of content items in same category correctly ordered $query = "SELECT a.id" . "\n FROM #__content AS a" . "\n WHERE a.catid = " . (int) $row->catid . "\n AND a.state = " . (int) $row->state . ($access->canEdit ? '' : "\n AND a.access <= " . (int) $gid) . $xwhere . "\n ORDER BY {$orderby}"; $database->setQuery($query); $list = $database->loadResultArray(); // this check needed if incorrect Itemid is given resulting in an incorrect result if (!is_array($list)) { $list = array(); } // location of current content item in array list $location = array_search($uid, $list); $row->prev = ''; $row->next = ''; if ($location - 1 >= 0) { // the previous content item cannot be in the array position -1 $row->prev = $list[$location - 1]; } if ($location + 1 < count($list)) { // the next content item cannot be in an array position greater than the number of array postions $row->next = $list[$location + 1]; } } // page title $mainframe->setPageTitle($row->title); if ($mosConfig_MetaTitle == '1') { $mainframe->addMetaTag('title', $row->title); } if ($mosConfig_MetaAuthor == '1') { $mainframe->addMetaTag('author', $row->author); } show($row, $params, $gid, $access, $pop); } else { mosNotAuth(); return; } }
<?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 contactpage($contact_id) { global $mainframe, $database, $my, $Itemid; $query = "SELECT a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text, a.catid, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND cc.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC"; $database->setQuery($query); $checks = $database->loadObjectList(); $count = count($checks); if ($count) { if ($contact_id < 1) { $contact_id = $checks[0]->value; } $query = "SELECT a.*, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND a.id = " . (int) $contact_id . "\n AND a.access <= " . (int) $my->gid; $database->SetQuery($query); $contacts = $database->LoadObjectList(); if (!$contacts) { echo _NOT_AUTH; return; } $contact = $contacts[0]; /* * check whether category access level allows access */ if ($contact->cat_access > $my->gid) { mosNotAuth(); return; } $list = array(); foreach ($checks as $check) { if ($check->catid == $contact->catid) { $list[] = $check; } } // creates dropdown select list $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $contact_id); // Adds parameter handling $params = new mosParameters($contact->params); $params->set('page_title', 0); $params->def('pageclass_sfx', ''); $params->def('back_button', $mainframe->getCfg('back_button')); $params->def('print', !$mainframe->getCfg('hidePrint')); $params->def('name', 1); $params->def('email', 0); $params->def('street_address', 1); $params->def('suburb', 1); $params->def('state', 1); $params->def('country', 1); $params->def('postcode', 1); $params->def('telephone', 1); $params->def('fax', 1); $params->def('misc', 1); $params->def('image', 1); $params->def('email_description', 1); $params->def('email_description_text', _EMAIL_DESCRIPTION); $params->def('email_form', 1); $params->def('email_copy', 0); // global pront|pdf|email $params->def('icons', $mainframe->getCfg('icons')); // contact only icons $params->def('contact_icons', 0); $params->def('icon_address', ''); $params->def('icon_email', ''); $params->def('icon_telephone', ''); $params->def('icon_fax', ''); $params->def('icon_misc', ''); $params->def('drop_down', 0); $params->def('vcard', 0); if ($contact->email_to && $params->get('email')) { // email cloacking $contact->email = mosHTML::emailCloaking($contact->email_to); } // loads current template for the pop-up window $pop = intval(mosGetParam($_REQUEST, 'pop', 0)); if ($pop) { $params->set('popup', 1); $params->set('back_button', 0); } if ($params->get('email_description')) { $params->set('email_description', $params->get('email_description_text')); } else { $params->set('email_description', ''); } // needed to control the display of the Address marker $temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode'); $params->set('address_check', $temp); // determines whether to use Text, Images or nothing to highlight the different info groups switch ($params->get('contact_icons')) { case 1: // text $params->set('marker_address', _CONTACT_ADDRESS); $params->set('marker_email', _CONTACT_EMAIL); $params->set('marker_telephone', _CONTACT_TELEPHONE); $params->set('marker_fax', _CONTACT_FAX); $params->set('marker_misc', _CONTACT_MISC); $params->set('column_width', '100'); break; case 2: // none $params->set('marker_address', ''); $params->set('marker_email', ''); $params->set('marker_telephone', ''); $params->set('marker_fax', ''); $params->set('marker_misc', ''); $params->set('column_width', '0'); break; default: // icons $image1 = mosAdminMenus::ImageCheck('con_address.png', '/images/M_images/', $params->get('icon_address'), '/images/M_images/', _CONTACT_ADDRESS, _CONTACT_ADDRESS); $image2 = mosAdminMenus::ImageCheck('emailButton.png', '/images/M_images/', $params->get('icon_email'), '/images/M_images/', _CONTACT_EMAIL, _CONTACT_EMAIL); $image3 = mosAdminMenus::ImageCheck('con_tel.png', '/images/M_images/', $params->get('icon_telephone'), '/images/M_images/', _CONTACT_TELEPHONE, _CONTACT_TELEPHONE); $image4 = mosAdminMenus::ImageCheck('con_fax.png', '/images/M_images/', $params->get('icon_fax'), '/images/M_images/', _CONTACT_FAX, _CONTACT_FAX); $image5 = mosAdminMenus::ImageCheck('con_info.png', '/images/M_images/', $params->get('icon_misc'), '/images/M_images/', _CONTACT_MISC, _CONTACT_MISC); $params->set('marker_address', $image1); $params->set('marker_email', $image2); $params->set('marker_telephone', $image3); $params->set('marker_fax', $image4); $params->set('marker_misc', $image5); $params->set('column_width', '40'); break; } // params from menu item $menu = $mainframe->get('menu'); $menu_params = new mosParameters($menu->params); $menu_params->def('page_title', 1); $menu_params->def('header', $menu->name); $menu_params->def('pageclass_sfx', ''); HTML_contact::viewcontact($contact, $params, $count, $list, $menu_params); } else { $params = new mosParameters(''); $params->def('back_button', $mainframe->getCfg('back_button')); HTML_contact::nocontact($params); } }
/** * 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; }
$params = new mosParameters($my->params, $file, 'component'); $now = time(); // expired page functionality handling $expired = $params->def('expired', ''); $expired_time = $params->def('expired_time', ''); // if now expired link set or expired time is more than half the admin session life set, simply load normal admin homepage $checktime = ($mosConfig_session_life_admin ? $mosConfig_session_life_admin : 1800) / 2; if (!$expired || $now - $expired_time > $checktime) { $expired = 'index2.php'; } // link must also be a Joomla link to stop malicious redirection if (strpos($expired, 'index2.php?option=com_') !== 0) { $expired = 'index2.php'; } // clear any existing expired page data $params->set('expired', ''); $params->set('expired_time', ''); // param handling if (is_array($params->toArray())) { $txt = array(); foreach ($params->toArray() as $k => $v) { $txt[] = "{$k}={$v}"; } $saveparams = implode("\n", $txt); } // save cleared expired page info to user data $query = "UPDATE #__users" . "\n SET params = " . $database->Quote($saveparams) . "\n WHERE id = " . (int) $my->id . "\n AND username = "******"\n AND usertype = " . $database->Quote($my->usertype); $database->setQuery($query); $database->query(); } // check if auto_purge value set
<?php /* ja_transmenu.php @copyright (C) 2005 Joomlart.com (formerly MamboTheme.com)*/ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); global $ja_template_name; $japarams = new mosParameters(''); $japarams->set('template', $ja_template_name); // Change this value to correct template $japarams->set('absPath', $mosConfig_absolute_path . '/templates/' . $japarams->get('template') . '/ja_transmenu'); $japarams->set('LSPath', $mosConfig_live_site . '/templates/' . $japarams->get('template') . '/ja_transmenu'); $japarams->set('menutype', 'mainmenu'); // Source of menu //Set style for menu $japarams->set('menu_style', 'horizontal'); // Value: horizontal, vertical $japarams->set('menu_direction', 'down'); // Value: down, right $japarams->set('menu_position', 'bottomLeft'); // Value: bottomLeft, bottomRight, topLeft, topRight $japarams->set('p_t', '0'); $japarams->set('p_l', '0'); $japarams->set('class_sfx', '-trans'); $japarams->set('subpad_x', '0'); $japarams->set('subpad_y', '0'); $japarams->set('menu_images', '0'); $japarams->set('menu_images_align', '0'); include_once $japarams->get('absPath') . '/ja-menulib.php'; global $my; $jamenu = new JAMenu($database, $japarams); $jamenu->genMenu(); ?>
function initSessionAdmin($option, $task) { global $_VERSION, $mosConfig_admin_expired; // logout check if ($option == 'logout') { require $GLOBALS['mosConfig_absolute_path'] . '/administrator/logout.php'; exit; } $site = $GLOBALS['mosConfig_live_site']; // check if session name corresponds to correct format if (session_name() != md5($site)) { echo "<script>document.location.href='index.php'</script>\n"; exit; } // restore some session variables $my = new mosUser($this->_db); $my->id = intval(mosGetParam($_SESSION, 'session_user_id', '')); $my->username = strval(mosGetParam($_SESSION, 'session_username', '')); $my->usertype = strval(mosGetParam($_SESSION, 'session_usertype', '')); $my->gid = intval(mosGetParam($_SESSION, 'session_gid', '')); $my->params = mosGetParam($_SESSION, 'session_user_params', ''); $session_id = mosGetParam($_SESSION, 'session_id', ''); $logintime = mosGetParam($_SESSION, 'session_logintime', ''); if ($session_id != session_id()) { // session id does not correspond to required session format echo "<script>document.location.href='index.php?mosmsg=Invalid Session'</script>\n"; exit; } // check to see if session id corresponds with correct format if ($session_id == md5($my->id . $my->username . $my->usertype . $logintime)) { // if task action is to `save` or `apply` complete action before doing session checks. if ($task != 'save' && $task != 'apply') { // test for session_life_admin if (@$GLOBALS['mosConfig_session_life_admin']) { $session_life_admin = $GLOBALS['mosConfig_session_life_admin']; } else { $session_life_admin = 1800; } // purge expired admin sessions only $past = time() - $session_life_admin; $query = "DELETE FROM #__session" . "\n WHERE time < '" . (int) $past . "'" . "\n AND guest = 1" . "\n AND gid = 0" . "\n AND userid <> 0"; $this->_db->setQuery($query); $this->_db->query(); $current_time = time(); // update session timestamp $query = "UPDATE #__session" . "\n SET time = " . $this->_db->Quote($current_time) . "\n WHERE session_id = " . $this->_db->Quote($session_id); $this->_db->setQuery($query); $this->_db->query(); // set garbage cleaning timeout $this->setSessionGarbageClean(); // check against db record of session $query = "SELECT COUNT( session_id )" . "\n FROM #__session" . "\n WHERE session_id = " . $this->_db->Quote($session_id) . "\n AND username = "******"\n AND userid = " . intval($my->id); $this->_db->setQuery($query); $count = $this->_db->loadResult(); // if no entry in session table that corresponds boot from admin area if ($count == 0) { $link = NULL; if ($_SERVER['QUERY_STRING']) { $link = 'index2.php?' . $_SERVER['QUERY_STRING']; } // check if site designated as a production site // for a demo site disallow expired page functionality // link must also be a Joomla link to stop malicious redirection if ($link && strpos($link, 'index2.php?option=com_') === 0 && $_VERSION->SITE == 1 && @$mosConfig_admin_expired === '1') { $now = time(); $file = $this->getPath('com_xml', 'com_users'); if (version_compare(PHP_VERSION, '5.2.0') >= 0) { $params = new mosParameters($my->params, $file, 'component'); } else { $errorlevel = error_reporting(); error_reporting(0); $params = new mosParameters($my->params, $file, 'component'); error_reporting($errorlevel); } // return to expired page functionality $params->set('expired', $link); $params->set('expired_time', $now); // param handling if (is_array($params->toArray())) { $txt = array(); foreach ($params->toArray() as $k => $v) { $txt[] = "{$k}={$v}"; } $saveparams = implode("\n", $txt); } // save expired page info to user data $query = "UPDATE #__users" . "\n SET params = " . $this->_db->Quote($saveparams) . "\n WHERE id = " . (int) $my->id . "\n AND username = "******"\n AND usertype = " . $this->_db->Quote($my->usertype); $this->_db->setQuery($query); $this->_db->query(); } echo "<script>document.location.href='index.php?mosmsg=Admin Session Expired'</script>\n"; exit; } else { // load variables into session, used to help secure /popups/ functionality $_SESSION['option'] = $option; $_SESSION['task'] = $task; } } } else { if ($session_id == '') { // no session_id as user has not attempted to login, or session.auto_start is switched on if (ini_get('session.auto_start') || !ini_get('session.use_cookies')) { echo "<script>document.location.href='index.php?mosmsg=You need to login. If PHP\\'s session.auto_start setting is on or session.use_cookies setting is off, you may need to correct this before you will be able to login.'</script>\n"; } else { echo "<script>document.location.href='index.php?mosmsg=You need to login'</script>\n"; } exit; } else { // session id does not correspond to required session format echo "<script>document.location.href='index.php?mosmsg=Invalid Session'</script>\n"; exit; } } return $my; }