function authPlugin() { $my = mamboCore::get('currentUser'); $this->usertype = $my->usertype; $this->username = $my->username; $this->grp = $my->gid; $this->mainframe = mosMainFrame::getInstance(); }
function setMetaData() { $mainframe = mosMainFrame::getInstance(); $mainframe->prependMetaTag('description', strip_tags($this->name)); if ($this->keywords) { $mainframe->prependMetaTag('keywords', $this->keywords); } else { $mainframe->prependMetaTag('keywords', $this->name); } }
/** * Display Table of items */ function showTable(&$params, &$rows, $catid, $tabclass) { global $mosConfig_live_site; // icon in table display if ($params->get('weblink_icons') != -1) { $mainframe =& mosMainFrame::getInstance(); $img = $mainframe->ImageCheck('weblink.png', '/images/M_images/', $params->get('weblink_icons')); } 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 T_('Web Link'); ?> </td> <?php if ($params->get('hits')) { ?> <td width="30px" height="20" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> " align="right"> <?php echo T_('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); $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 . '">' . stripslashes($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}\">" . stripslashes($row->title) . "</a>\n"; break; default: // formerly case 2 // open in parent window $txt = '<a href="' . $link . '" class="' . $menuclass . '">' . stripslashes($row->title) . '</a>'; break; } ?> <tr class="<?php echo $tabclass[$k]; ?> "> <?php if ($img) { ?> <td width="100px" 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 }
/** * Writes Print icon */ function PrintIcon(&$row, &$params, $hide_js, $link, $status = NULL) { if ($params->get('print') && !$hide_js) { // use default settings if none declared if (!$status) { $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; } // checks template image directory for image, if non found default are loaded if ($params->get('icons')) { $mainframe =& mosMainFrame::getInstance(); $image = $mainframe->ImageCheck('printButton.png', '/images/M_images/', NULL, NULL, T_('Print')); } else { $image = _ICON_SEP . ' ' . T_('Print') . ' ' . _ICON_SEP; } if ($params->get('popup') && !$hide_js) { // Print Preview button - used when viewing page ?> <td align="right" class="buttonheading"> <a href="#" onclick="javascript:window.print(); return false" title="<?php echo T_('Print'); ?> "> <?php echo $image; ?> </a> </td> <?php } else { // Print Button - used in pop-up window ?> <td align="right" class="buttonheading"> <a href="javascript:void window.open('<?php echo $link; ?> ', 'win2', '<?php echo $status; ?> ');" title="<?php echo T_('Print'); ?> "> <?php echo $image; ?> </a> </td> <?php } } }
function groupMarking(&$params) { switch ($params->get('contact_icons')) { case 1: // text $params->set('marker_address', T_('Address: ')); $params->set('marker_email', T_('Email: ')); $params->set('marker_telephone', T_('Telephone: ')); $params->set('marker_fax', T_('Fax: ')); $params->set('marker_misc', T_('Information: ')); $params->set('column_width', '100px'); 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', '0px'); break; default: // icons $mainframe = mosMainFrame::getInstance(); $image1 = $mainframe->ImageCheck('con_address.png', '/images/M_images/', $params->get('icon_address')); $image2 = $mainframe->ImageCheck('emailButton.png', '/images/M_images/', $params->get('icon_email')); $image3 = $mainframe->ImageCheck('con_tel.png', '/images/M_images/', $params->get('icon_telephone')); $image4 = $mainframe->ImageCheck('con_fax.png', '/images/M_images/', $params->get('icon_fax')); $image5 = $mainframe->ImageCheck('con_info.png', '/images/M_images/', $params->get('icon_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', '40px'); break; } }
/** * mosComponentAdminManager Class contructor * * This constructor initiates all necessary members with values passed trought REQUEST * creates a new instance of the correct class and calls the task to do, finally * restore the magic quotes to it initial state. * * @param string component name * @param string component version * @access private */ function mosComponentAdminManager($component_name, $version) { mosComponentManager::mosComponentManager($component_name, $version); $this->act = mosGetParam($_REQUEST, 'act', $this->plugin_name); $this->task = mosGetParam($_REQUEST, 'task', 'list'); $mainframe = mosMainFrame::getInstance(); $default_limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', 20); $this->limit = intval(mosGetParam($_REQUEST, 'limit', $default_limit)); $this->limitstart = mosGetParam($_REQUEST, 'limitstart', 0); $this->cfid = mosGetParam($_REQUEST, 'cfid', array(0)); if (is_array($this->cfid)) { foreach ($this->cfid as $i => $id) { $this->cfid[$i] = intval($id); } } $this->order = mosGetParam($_REQUEST, 'order', array()); if (is_array($this->cfid)) { $this->currid = intval($this->cfid[0]); } else { $this->currid = intval($this->cfid); } $name = $this->getAction(); if (class_exists($name)) { $controller =& new $name($this); $task = $this->task . 'Task'; if (is_callable(array(&$controller, 'getRequestData'))) { $controller->getRequestData(); } if (is_callable(array(&$controller, $task))) { $controller->{$task}(); } else { trigger_error(sprintf(T_('MOS error in %s: method %s not found in class %s'), $this->plugin_name, $task, $name)); } } else { trigger_error(sprintf(T_('MOS error in %s: class not found %s'), $this->plugin_name, $name)); } $this->restore_magic_quotes(); }
/** * Assembles head tags */ function mosShowHead($keys = '', $exclude = '') { $mainframe =& mosMainFrame::getInstance(); $mainframe->mosShowHead($keys, $exclude); }
/** * Writes a media_manager button * @param string The sub-drectory to upload the media to */ function media_manager($directory = '') { $mainframe =& mosMainFrame::getInstance(); $image = $mainframe->ImageCheck('upload.png', '/images/', NULL, NULL, T_('Upload Image'), 'uploadPic'); $image2 = $mainframe->ImageCheck('upload_f2.png', '/images/', NULL, NULL, T_('Upload Image'), 'uploadPic', 0); ?> <td width="25" align="center"> <a href="#" onclick="popupWindow('popups/uploadimage.php?directory=<?php echo $directory; ?> ','win1',250,100,'no');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('uploadPic','','<?php echo $image2; ?> ',1);"> <?php echo $image; ?> </a> </td> <?php }
function cancel($task = 'cancel', $alt = null) { if (is_null($alt)) { $alt = T_('Cancel'); } $mainframe =& mosMainFrame::getInstance(); $image = $mainframe->ImageCheck('cancel.png', '/administrator/images/', NULL, NULL, $alt, $task); $image2 = $mainframe->ImageCheck('cancel_f2.png', '/administrator/images/', NULL, NULL, $alt, $task, 0); ?> <td width="25" align="center"> <a href="javascript:submitbutton('<?php echo $task; ?> ');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task; ?> ','','<?php echo $image2; ?> ',1);"> <?php echo $image; ?> </a> </td> <?php }
/** * Load Mambo generated head tags into an array */ function loadHeadTags() { static $obj; if (!is_object($obj)) { $obj =& mosHtmlHelper::getInstance(); } $mainframe =& mosMainFrame::getInstance(); $obj->_headTags = array(); $mainframe->appendMetaTag('description', mamboCore::get('mosConfig_MetaDesc'), true); $mainframe->appendMetaTag('keywords', mamboCore::get('mosConfig_MetaKeys'), true); $title = $mainframe->_head['title']; $obj->_headTags['title'] = $obj->tag('title', $title); $obj->_headTags['meta'] = array(); foreach ($mainframe->_head['meta'] as $name => $meta) { if ($meta[1]) { $obj->_headTags['meta'][] = $meta[1]; } $obj->_headTags['meta'][$name] = $obj->tag('meta', array($name, $meta[0])); if ($meta[2]) { $obj->_headTags['meta'][] = $meta[2]; } } $my =& mamboCore::get('currentUser'); $obj->_headTags['mambojavascript'] = $my->id ? $obj->tag('javascript', ' src="' . mamboCore::get('mosConfig_live_site') . "/includes/js/mambojavascript.js\"") : ''; $obj->_headTags['custom'] = array(); foreach ($mainframe->_head['custom'] as $html) { if (trim($html) !== '') { $obj->_headTags['custom'][] = $html; } } ob_start(); $mainframe->liveBookMark(); $obj->_headTags['livebookmark'] = trim(ob_get_contents()); ob_end_clean(); $configuration =& mamboCore::getMamboCore(); $obj->_headTags['favicon'] = $obj->tag('metalinkrel', array("shortcut icon", $configuration->getFavIcon())); }
/** * Display Table of items */ function showTable(&$params, &$rows, $catid, $tabclass) { global $mosConfig_live_site, $Itemid; // icon in table display $mainframe =& mosMainFrame::getInstance(); $img = $mainframe->ImageCheck('con_info.png', '/images/M_images/', $params->get('icon')); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> <?php if ($params->get('headings')) { ?> <tr> <?php if ($params->get('name')) { ?> <td height="20" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo T_('Feed Name'); ?> </td> <?php } ?> <?php if ($params->get('articles')) { ?> <td height="20" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> " align="center"> <?php echo T_('# Articles'); ?> </td> <?php } ?> <?php if ($params->get('link')) { ?> <td height="20" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo T_('Feed Link'); ?> </td> <?php } ?> <td width="100%" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> "></td> </tr> <?php } $k = 0; foreach ($rows as $row) { $link = 'index.php?option=com_newsfeeds&task=view&feedid=' . $row->id . '&Itemid=' . $Itemid; ?> <tr> <?php if ($params->get('name')) { ?> <td width="30%" height="20" class="<?php echo $tabclass[$k]; ?> "> <a href="<?php echo sefRelToAbs($link); ?> " class="category<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo $row->name; ?> </a> </td> <?php } ?> <?php if ($params->get('articles')) { ?> <td width="20%" class="<?php echo $tabclass[$k]; ?> " align="center"> <?php echo $row->numarticles; ?> </td> <?php } ?> <?php if ($params->get('link')) { ?> <td width="50%" class="<?php echo $tabclass[$k]; ?> "> <?php echo $row->link; ?> </td> <?php } ?> <td width="100%"></td> </tr> <?php $k = 1 - $k; } ?> </table> <?php }
/** * Class constructor * @param database A database connection object * @param string The url option * @param string The path of the mos directory */ function mosMainFrame(&$db, $option, $basePath, $isAdmin = false) { $this->_db =& $db; // load the configuration values //return( $this->loadConfig() ); $this->_setTemplate($isAdmin); if (substr($option, 0, 4) != 'com_') { $this->_option = "com_{$option}"; } else { $this->_option = $option; } if (isset($_SESSION['session_userstate'])) { $this->_userstate =& $_SESSION['session_userstate']; } else { $this->_userstate = null; } $this->_head['title'] = $GLOBALS['mosConfig_sitename']; $this->_head['meta'] = array(); $this->_head['custom'] = array(); mosMainFrame::getInstance($this); }
/** * Writes Email icon */ function EmailIcon($row, $params, $hide_js) { global $mosConfig_live_site; if ($params->get('email') && !$params->get('popup') && !$hide_js) { $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=400,height=250,directories=no,location=no'; $link = $mosConfig_live_site . '/index2.php?option=com_content&task=emailform&id=' . $row->id; if ($params->get('icons')) { $mainframe =& mosMainFrame::getInstance(); $image = $mainframe->ImageCheck('emailButton.png', '/images/M_images/', NULL, NULL, T_('E-mail')); } else { $image = ' ' . T_('E-mail'); } ?> <td align="right" class="buttonheading"> <a href="javascript:void window.open('<?php echo $link; ?> ', 'win2', '<?php echo $status; ?> ');" title="<?php echo T_('E-mail'); ?> "> <?php echo $image; ?> </a> </td> <?php } }
global $mosConfig_live_site, $mosConfig_absolute_path, $cur_template; $text = $params->get('text'); $moduleclass_sfx = $params->get('moduleclass_sfx', ''); $rss091 = $params->get('rss091', 1); $rss10 = $params->get('rss10', 1); $rss20 = $params->get('rss20', 1); $atom = $params->get('atom', 1); $opml = $params->get('opml', 1); $rss091_image = $params->get('rss091_image', ''); $rss10_image = $params->get('rss10_image', ''); $rss20_image = $params->get('rss20_image', ''); $atom_image = $params->get('atom_image', ''); $opml_image = $params->get('opml_image', ''); $t_path = $mosConfig_live_site . '/templates/' . $cur_template . '/images/'; $d_path = $mosConfig_live_site . '/images/M_images/'; $mainframe =& mosMainFrame::getInstance(); ?> <div class="syndicate<?php echo $moduleclass_sfx; ?> "> <?php // rss091 link if ($text) { ?> <div align="center" class="syndicate_text<?php echo $moduleclass_sfx; ?> "> <?php
function botVoting(&$row, &$params, $page = 0) { global $mosConfig_live_site, $mosConfig_absolute_path, $cur_template; global $Itemid; if (strtolower(get_class($row)) != strtolower('mosExtendedContent')) { return; } if (is_callable(array($row, 'getId'))) { $id = $row->getId(); } else { $id = $row->id; } $option = 'com_content'; $task = mosGetParam($_REQUEST, 'task', ''); $html = ''; if ($params->get('rating') && !$params->get('popup')) { if (is_callable(array($row, 'getRating'))) { $rating = $row->getRating(); } else { $rating = $row->rating; } if (is_callable(array($row, 'getRatingCount'))) { $rating_count = $row->getRatingCount(); } else { $rating_count = $row->rating_count; } $html .= '<form method="post" action="' . sefRelToAbs('index.php') . '">'; $img = ''; // look for images in template if available $mainframe =& mosMainFrame::getInstance(); $starImageOn = $mainframe->ImageCheck('rating_star.png', '/images/M_images/'); $starImageOff = $mainframe->ImageCheck('rating_star_blank.png', '/images/M_images/'); for ($i = 0; $i < $rating; $i++) { $img .= $starImageOn; } for ($i = $rating; $i < 5; $i++) { $img .= $starImageOff; } $html .= '<span class="content_rating">'; $html .= T_('User Rating') . ':' . $img . ' / '; $html .= intval($rating_count); $html .= "</span>\n<br />\n"; $url = @$_SERVER['REQUEST_URI']; $url = ampReplace($url); require_once mamboCore::get('mosConfig_absolute_path') . '/includes/phpInputFilter/class.inputfilter.php'; $iFilter = new InputFilter(null, null, 1, 1); $url = trim($iFilter->process($url)); if (!$params->get('intro_only') && $task != "blogsection") { $html .= '<span class="content_vote">'; $html .= T_('Poor'); $html .= '<input type="radio" alt="' . T_('vote 1 star') . '" name="user_rating" value="1" />'; $html .= '<input type="radio" alt="' . T_('vote 2 star') . '" name="user_rating" value="2" />'; $html .= '<input type="radio" alt="' . T_('vote 3 star') . '" name="user_rating" value="3" />'; $html .= '<input type="radio" alt="' . T_('vote 4 star') . '" name="user_rating" value="4" />'; $html .= '<input type="radio" alt="' . T_('vote 5 star') . '" name="user_rating" value="5" checked="checked" />'; $html .= T_('Best'); $html .= ' <input class="button" type="submit" name="submit_vote" value="' . T_('Rate') . '" />'; $html .= '<input type="hidden" name="task" value="vote" />'; $html .= '<input type="hidden" name="pop" value="0" />'; $html .= '<input type="hidden" name="option" value="com_content" />'; $html .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $html .= '<input type="hidden" name="cid" value="' . $id . '" />'; //$html .= '<input type="hidden" name="url" value="'. $url .'" />'; $html .= '</span>'; } $html .= "</form>\n"; } return $html; }
/** * Checks to see if an image exists in the current templates image directory * if it does it loads this image. Otherwise the default image is loaded. * Also can be used in conjunction with the menulist param to create the chosen image * load the default or use no image */ function ImageCheckAdmin($file, $directory = '/administrator/images/', $param = NULL, $param_directory = '/administrator/images/', $alt = NULL, $name = NULL, $type = 1, $align = 'middle') { $mosConfig_live_site = mamboCore::get('mosConfig_live_site'); $mainframe = mosMainFrame::getInstance(); $cur_template = $mainframe->getTemplate(); if ($param) { $image = $mosConfig_live_site . $param_directory . $param; } else { if (file_exists(mamboCore::get('mosConfig_absolute_path') . '/administrator/templates/' . $cur_template . '/images/' . $file)) { $image = $mosConfig_live_site . '/administrator/templates/' . $cur_template . '/images/' . $file; } else { $image = $mosConfig_live_site . $directory . $file; } } // outputs actual html <img> tag if ($type) { $image = '<img src="' . $image . '" alt="' . $alt . '" align="' . $align . '" name="' . $name . '" border="0" />'; } return $image; }