示例#1
0
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchNewsfeedslinks($text, $phrase = '', $ordering = '')
{
    global $database, $my;
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    $menuhandler = mosMenuHandler::getInstance();
    $Itemid = $menuhandler->getIDByTypeLink('*', 'index.php?option=com_newsfeeds');
    $wheres = array();
    switch ($phrase) {
        case 'exact':
            $wheres2 = array();
            $wheres2[] = "LOWER(a.name) LIKE '%{$text}%'";
            $wheres2[] = "LOWER(a.link) LIKE '%{$text}%'";
            $where = '(' . implode(') OR (', $wheres2) . ')';
            break;
        case 'all':
        case 'any':
        default:
            $words = explode(' ', $text);
            $wheres = array();
            foreach ($words as $word) {
                $wheres2 = array();
                $wheres2[] = "LOWER(a.name) LIKE '%{$word}%'";
                $wheres2[] = "LOWER(a.link) LIKE '%{$word}%'";
                $wheres[] = implode(' OR ', $wheres2);
            }
            $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
            break;
    }
    switch ($ordering) {
        case 'alpha':
            $order = 'a.name ASC';
            break;
        case 'category':
            $order = 'b.title ASC, a.name ASC';
            break;
        case 'oldest':
        case 'popular':
        case 'newest':
        default:
            $order = 'a.name ASC';
    }
    $query = "SELECT a.name AS title," . "\n a.link AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ','News Feeds', b.title )AS section," . "\n '1' AS browsernav," . "\n CONCAT( 'index.php?option=com_newsfeeds&task=view&Itemid={$Itemid}&feedid=', a.id ) AS href" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid AND b.access <= '{$my->gid}'" . "\n WHERE ( {$where} )" . "\n AND a.published = 1" . "\n ORDER BY {$order}";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    return $rows;
}
示例#2
0
// needed to reduce queries used by getItemid for Content Items
if ($type == 1 || $type == 3) {
    require_once mamboCore::get('mosConfig_absolute_path') . '/components/com_content/content.class.php';
    $handler =& new contentHandler();
    $bs = $handler->getBlogSectionCount();
    $bc = $handler->getBlogCategoryCount();
    $gbs = $handler->getGlobalBlogSectionCount();
}
// Output
?>
<ul class="mostread<?php 
echo $class_sfx;
?>
">
<?php 
$menuhandler =& mosMenuHandler::getInstance();
if ($rows) {
    foreach ($rows as $row) {
        // get Itemid
        switch ($type) {
            case 2:
                $Itemid = $menuhandler->getIDByTypeCid('content_typed', $row->id);
                break;
            case 3:
                if ($row->sectionid) {
                    $Itemid = $mainframe->getItemid($row->id, 0, 0, $bs, $bc, $gbs);
                } else {
                    $Itemid = $menuhandler->getIDByTypeCid('content_typed', $row->id);
                }
                break;
            case 1:
示例#3
0
 function view()
 {
     $database = mamboDatabase::getInstance();
     $query = "SELECT a.*, a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text" . "\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 <=" . $this->user->gid . "\n AND cc.access <=" . $this->user->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
     $database->setQuery($query);
     $list = $database->loadObjectList();
     $count = count($list);
     if ($count == 0) {
         $params =& new mosParameters('');
         $params->def('back_button', mamboCore::get('mosConfig_back_button'));
         HTML_contact::nocontact($params);
         return;
     }
     if ($this->contact_id == 0) {
         $this->contact_id = $list[0]->id;
     }
     foreach ($list as $cont) {
         if ($cont->id == $this->contact_id) {
             $contact =& $cont;
             break;
         }
     }
     if (!isset($contact)) {
         echo T_('You are not authorized to view this resource.');
         return;
     }
     // creates dropdown select list
     $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $this->contact_id);
     // Adds parameter handling
     $params =& $this->makeParams($contact->params);
     // load mambot params info
     $query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
     $database->setQuery($query);
     $id = $database->loadResult();
     $mambot = new mosMambot($database);
     $mambot->load($id);
     $params2 =& $this->makeParams($mambot->params);
     if ($contact->email_to and $params->get('email')) {
         // email cloacking
         $contact->email = mosHTML::emailCloaking($contact->email_to, $params2->get('mode'));
     }
     // loads current template for the pop-up window
     $pop = 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
     $this->groupMarking($params);
     // params from menu item
     $menuhandler = mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuByID($this->Itemid);
     $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);
 }
示例#4
0
 function getItemid($id, $typed = 1, $link = 1, $bs = 1, $bc = 1, $gbs = 1)
 {
     $_Itemid = null;
     $menuhandler =& mosMenuHandler::getInstance();
     if ($typed) {
         // Search for typed link
         $_Itemid = $menuhandler->getIDByTypeLink('content_typed', "index.php?option=com_content&task=view&id={$id}");
     }
     if ($_Itemid == null and $link) {
         // Search for item link
         $_Itemid = $menuhandler->getIDByTypeLink('content_item_link', "index.php?option=com_content&task=view&id={$id}");
     }
     $sectionid = $this->getSection($id);
     if ($_Itemid == null) {
         // Search in sections
         $_Itemid = $menuhandler->getIDByTypeCid('content_section', $sectionid);
     }
     if ($_Itemid == null) {
         // Search in sections
         $_Itemid = $menuhandler->getIDByTypeCid('content_blog_section', $sectionid);
     }
     if ($_Itemid == null) {
         // Search in sections
         $_Itemid = $menuhandler->getIDByTypeCid('content_blog_category', $sectionid);
     }
     if ($_Itemid == null and $gbs) {
         // Search in global blog section
         $_Itemid = $menuhandler->getIDByTypeCid('content_blog_section', 0);
     }
     /*
     if ($_Itemid == '') {
     	// Search in global blog category
     	$this->_db->setQuery( "SELECT id "
     	."\nFROM #__menu "
     	."\nWHERE type='content_blog_category' AND published='1' AND componentid=0" );
     	$_Itemid = $this->_db->loadResult();
     }
     */
     $catid = $this->getCategory($id);
     if ($_Itemid == null) {
         // Search in blog categories
         $_Itemid = $menuhandler->getIDByTypeCid('content_blog_category', $catid);
     }
     if ($_Itemid == null) {
         // Search in categories
         $_Itemid = $menuhandler->getIDByTypeCid('content_category', $catid);
     }
     if ($_Itemid == null) {
         // Search in main menu
         $menus = $menuhandler->getByParentOrder(0, 'mainmenu');
         $home = $menus[0];
         $_Itemid = $home->id;
     }
     if ($_Itemid) {
         return $_Itemid;
     } else {
         return mamboCore::get('Itemid');
     }
 }
示例#5
0
/**
* Checks whether a menu option is within the users access level
* @param int Item id number
* @param string The menu option
* @param int The users group ID number
* @param database A database connector object
* @return boolean True if the visitor's group at least equal to the menu access
*/
function mosMenuCheck($Itemid, $menu_option, $task, $gid)
{
    $menuhandler =& mosMenuHandler::getInstance();
    return $menuhandler->menuCheck($Itemid, $menu_option, $task, $gid);
}
示例#6
0
 /**
  *	binds an array/hash to this object
  *	@param int $oid optional argument, if not specifed then the value of current key is used
  *	@return any result from the database operation
  */
 function load($oid = null)
 {
     $k = $this->_tbl_key;
     if ($oid !== null) {
         $this->{$k} = $oid;
     }
     if ($this->{$k} === null) {
         return false;
     }
     $menuhandler =& mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuById($this->{$k});
     if ($menu) {
         foreach (get_object_vars($menu) as $key => $data) {
             $this->{$key} = $data;
         }
         return true;
     } else {
         return false;
     }
 }
示例#7
0
文件: sef.php 项目: jwest00724/mambo
 function default_revert($specialname)
 {
     $request = explode($specialname . '/', $_SERVER['REQUEST_URI']);
     if (isset($request[1])) {
         $parmset = explode("/", $request[1]);
     } else {
         $parmset = array();
     }
     $QUERY_STRING = '';
     $menuhandler =& mosMenuHandler::getInstance();
     foreach ($parmset as $values) {
         $parts = explode(",", $values);
         if (count($parts) > 1) {
             $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
             if ($parts[0] == 'option') {
                 $_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $menuhandler->getIDLikeLink("index.php?option={$parts['1']}");
                 mamboCore::set('Itemid', $Itemid);
                 $QUERY_STRING .= "{$parts['0']}={$parts['1']}&Itemid={$Itemid}";
             }
             $QUERY_STRING .= "&{$parts['0']}={$parts['1']}";
         }
     }
     return $QUERY_STRING;
 }
示例#8
0
 function menutypes()
 {
     $modulehandler =& mosModuleHandler::getInstance();
     $modMenus =& $modulehandler->getByName('mod_mainmenu', false, true);
     $menuhandler =& mosMenuHandler::getInstance();
     $mtypes =& $menuhandler->getMenuTypes();
     $menuTypes = array();
     foreach ($mtypes as $type => $count) {
         $menuTypes[] = $type;
     }
     foreach ($modMenus as $modMenu) {
         mosMakeHtmlSafe($modMenu);
         $modParams = mosParseParams($modMenu->params);
         $menuType = @$modParams->menutype ? $modParams->menutype : 'mainmenu';
         if (!in_array($menuType, $menuTypes)) {
             $menuTypes[] = $menuType;
         }
     }
     // sorts menutypes
     asort($menuTypes);
     return $menuTypes;
 }