Exemple #1
0
function fetchSearchForm($gid, $itemid)
{
    global $search_mode, $ordering, $invert_search, $reverse_order, $search_where, $search_phrase, $search_catid;
    // category select list
    $options = array(mosHTML::makeOption('0', _DML_ALLCATS));
    $lists['catid'] = dmHTML::categoryList($search_catid, "", $options);
    $mode = array();
    $mode[] = mosHTML::makeOption('any', _DML_SEARCH_ANYWORDS);
    $mode[] = mosHTML::makeOption('all', _DML_SEARCH_ALLWORDS);
    $mode[] = mosHTML::makeOption('exact', _DML_SEARCH_PHRASE);
    $mode[] = mosHTML::makeOption('regex', _DML_SEARCH_REGEX);
    $lists['search_mode'] = mosHTML::selectList($mode, 'search_mode', 'id="search_mode" class="inputbox"', 'value', 'text', $search_mode);
    $orders = array();
    $orders[] = mosHTML::makeOption('newest', _DML_SEARCH_NEWEST);
    $orders[] = mosHTML::makeOption('oldest', _DML_SEARCH_OLDEST);
    $orders[] = mosHTML::makeOption('popular', _DML_SEARCH_POPULAR);
    $orders[] = mosHTML::makeOption('alpha', _DML_SEARCH_ALPHABETICAL);
    $orders[] = mosHTML::makeOption('category', _DML_SEARCH_CATEGORY);
    $lists['ordering'] = mosHTML::selectList($orders, 'ordering', 'id="ordering" class="inputbox"', 'value', 'text', $ordering);
    $lists['invert_search'] = '<input type="checkbox" class="inputbox" name="invert_search" ' . ($invert_search ? ' checked ' : '') . '/>';
    $lists['reverse_order'] = '<input type="checkbox" class="inputbox" name="reverse_order" ' . ($reverse_order ? ' checked ' : '') . '/>';
    $matches = array();
    if ($search_where && count($search_where) > 0) {
        foreach ($search_where as $val) {
            $matches[] = mosHTML::makeOption($val, $val);
        }
    } else {
        $matches[] = mosHTML::makeOption('search_description', 'search_description');
    }
    $where = array();
    $where[] = mosHTML::makeOption('search_name', _DML_NAME);
    $where[] = mosHTML::makeOption('search_description', _DML_DESCRIPTION);
    $lists['search_where'] = mosHTML::selectList($where, 'search_where[]', 'id="search_where" class="inputbox" multiple="multiple" size="2"', 'value', 'text', $where);
    return HTML_DMSearch::searchForm($lists, $search_phrase);
}
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     global $mosConfig_absolute_path;
     $menu = new mosMenu($database);
     $menu->load($uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n";
         exit(0);
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         // load values for new entry
         $menu->type = 'content_typed';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if ($uid) {
         $temp = explode('id=', $menu->link);
         $query = "SELECT a.title, a.title_alias, a.id" . "\n FROM #__content AS a" . "\n WHERE a.id = '" . $temp[1] . "'";
         $database->setQuery($query);
         $content = $database->loadObjectlist();
         // outputs item name, category & section instead of the select list
         if ($content[0]->title_alias) {
             $alias = '  (<i>' . $content[0]->title_alias . '</i>)';
         } else {
             $alias = '';
         }
         $contents = '';
         $link = 'javascript:submitbutton( \'redirect\' );';
         $lists['content'] = '<input type="hidden" name="content_typed" value="' . $temp[1] . '" />';
         $lists['content'] .= '<a href="' . $link . '" title="Edit Static Content Item">' . $content[0]->title . $alias . '</a>';
     } else {
         $query = "SELECT a.id AS value, CONCAT( a.title, '(', a.title_alias, ')' ) AS text" . "\n FROM #__content AS a" . "\n WHERE a.state = '1'" . "\n AND a.sectionid = '0'" . "\n AND a.catid = '0'" . "\n ORDER BY a.id, a.title";
         $database->setQuery($query);
         $contents = $database->loadObjectList();
         //	Create a list of links
         $lists['content'] = mosHTML::selectList($contents, 'content_typed', 'class="inputbox" size="10"', 'value', 'text', '');
     }
     // build html select list for target window
     $lists['target'] = mosAdminMenus::Target($menu);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_menu_html::edit($menu, $lists, $params, $option, $contents);
 }
Exemple #3
0
/**
* @param string The URL option
*/
function showInstalledModules($_option)
{
    global $database, $mosConfig_absolute_path, $adminLanguage;
    $filter = mosGetParam($_POST, 'filter', '');
    $select[] = mosHTML::makeOption('', $adminLanguage->A_COMP_MOD_ALL);
    $select[] = mosHTML::makeOption('0', $adminLanguage->A_MENU_SITE_MOD);
    $select[] = mosHTML::makeOption('1', $adminLanguage->A_INSTALL_MOD_ADMIN_MOD);
    $lists['filter'] = mosHTML::selectList($select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter);
    if ($filter == NULL) {
        $and = '';
    } else {
        if (!$filter) {
            $and = "\n AND client_id = '0'";
        } else {
            if ($filter) {
                $and = "\n AND client_id = '1'";
            }
        }
    }
    $database->setQuery("SELECT id, module, client_id" . "\n FROM #__modules" . "\n WHERE module LIKE 'mod_%' AND iscore='0'" . $and . "\n GROUP BY module, client_id" . "\n ORDER BY client_id, module");
    $rows = $database->loadObjectList();
    $id = 0;
    foreach ($rows as $row) {
        // path to module directory
        if ($row->client_id == "1") {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "administrator/modules");
        } else {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "modules");
        }
        // xml file for module
        $xmlfile = $moduleBaseDir . "/" . $row->module . ".xml";
        $xmlDoc =& new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if (!$xmlDoc->loadXML($xmlfile, false, true)) {
            continue;
        }
        $element =& $xmlDoc->documentElement;
        if ($element->getTagName() != 'mosinstall') {
            continue;
        }
        if ($element->getAttribute("type") != "module") {
            continue;
        }
        $element =& $xmlDoc->getElementsByPath('creationDate', 1);
        $row->creationdate = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('author', 1);
        $row->author = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('copyright', 1);
        $row->copyright = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('authorEmail', 1);
        $row->authorEmail = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('authorUrl', 1);
        $row->authorUrl = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('version', 1);
        $row->version = $element ? $element->getText() : '';
        $rows[$id] = $row;
        $id++;
    }
    HTML_module::showInstalledModules($rows, $_option, $id, $xmlfile, $lists);
}
Exemple #4
0
 public static function selectList(&$arr, $tag_name, $tag_attribs, $key, $text, $selected = NULL, $idtag = false, $flag = false)
 {
     if (JCOMMENTS_JVERSION == '1.0') {
         return mosHTML::selectList($arr, $tag_name, $tag_attribs, $key, $text, $selected);
     }
     return JHTML::_('select.genericlist', $arr, $tag_name, $tag_attribs, $key, $text, $selected, $idtag, $flag);
 }
Exemple #5
0
function editGroup($option, $uid)
{
    global $database;
    // disable the main menu to force user to use buttons
    $_REQUEST['hidemainmenu'] = 1;
    $row = new mosDMGroups($database);
    $row->load($uid);
    $musers = array();
    $toAddUsers = array();
    // get selected members
    if ($row->groups_members) {
        $database->setQuery("SELECT id,name,username, block " . "\n FROM #__users " . "\n WHERE id IN (" . $row->groups_members . ")" . "\n ORDER BY block ASC, name ASC");
        $usersInGroup = $database->loadObjectList();
        foreach ($usersInGroup as $user) {
            $musers[] = mosHTML::makeOption($user->id, $user->id . "-" . $user->name . " (" . $user->username . ")" . ($user->block ? ' - [' . _DML_USER_BLOCKED . ']' : ''));
        }
    }
    // get non selected members
    $query = "SELECT id,name,username, block FROM #__users ";
    if ($row->groups_members) {
        $query .= "\n WHERE id NOT IN (" . $row->groups_members . ")";
    }
    $query .= "\n ORDER BY block ASC, name ASC";
    $database->setQuery($query);
    $usersToAdd = $database->loadObjectList();
    foreach ($usersToAdd as $user) {
        $toAddUsers[] = mosHTML::makeOption($user->id, $user->id . "-" . $user->name . " (" . $user->username . ")" . ($user->block ? ' - [' . _DML_USER_BLOCKED . ']' : ''));
    }
    $usersList = mosHTML::selectList($musers, 'users_selected[]', 'class="inputbox" size="20" onDblClick="moveOptions(document.adminForm[\'users_selected[]\'], document.adminForm.users_not_selected)" multiple="multiple"', 'value', 'text', null);
    $toAddUsersList = mosHTML::selectList($toAddUsers, 'users_not_selected', 'class="inputbox" size="20" onDblClick="moveOptions(document.adminForm.users_not_selected, document.adminForm[\'users_selected[]\'])" multiple="multiple"', 'value', 'text', null);
    HTML_DMGroups::editGroup($option, $row, $usersList, $toAddUsersList);
}
function messageForm($option)
{
    global $acl;
    $gtree = array(mosHTML::makeOption(0, '- All User Groups -'));
    // get list of groups
    $lists = array();
    $gtree = array_merge($gtree, $acl->get_group_children_tree(null, 'USERS', false));
    $lists['gid'] = mosHTML::selectList($gtree, 'mm_group', 'size="10"', 'value', 'text', 0);
    HTML_massmail::messageForm($lists, $option);
}
Exemple #7
0
function messageForm($option)
{
    global $database, $acl;
    $gtree = array(mosHTML::makeOption(0, $adminLanguage->A_COMP_MASS_ALL));
    // get list of groups
    $lists = array();
    $gtree = array_merge($gtree, $acl->get_group_children_tree(null, 'USERS', false));
    $lists['gid'] = mosHTML::selectList($gtree, 'mm_group', 'size="10"', 'value', 'text', 0);
    HTML_massmail::messageForm($lists, $option);
}
 /**
  * @param string The name of the form element
  * @param string The value of the element
  * @param object The xml element for the parameter
  * @param string The control name
  * @return string The html for the element
  */
 function _form_editor_list($name, $value, &$node, $control_name)
 {
     global $database;
     // compile list of the editors
     $query = "SELECT element AS value, name AS text" . "\n FROM #__mambots" . "\n WHERE folder = 'editors'" . "\n AND published = 1" . "\n ORDER BY ordering, name";
     $database->setQuery($query);
     $editors = $database->loadObjectList();
     array_unshift($editors, mosHTML::makeOption('', '- Selecionar Editor -'));
     return mosHTML::selectList($editors, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value);
 }
Exemple #9
0
 /**
  * Returns the html limit # input box
  * @param string The basic link to include in the href
  * @return string
  */
 function getLimitBox($link)
 {
     $limits = array();
     for ($i = 5; $i <= 30; $i += 5) {
         $limits[] = mosHTML::makeOption("{$i}");
     }
     $limits[] = mosHTML::makeOption("50");
     // build the html select list
     $link = sefRelToAbs($link . '&amp;limit=\' + this.options[selectedIndex].value + \'&amp;limitstart=' . $this->limitstart);
     return mosHTML::selectList($limits, 'limit', 'class="inputbox" size="1" onchange="document.location.href=\'' . $link . '\';"', 'value', 'text', $this->limit);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator");
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params = new mosParameters($menu->params);
         $catids = $params->def('categoryid', '');
         if ($catids) {
             $catidsArray = explode(',', $catids);
             mosArrayToInts($catidsArray);
             $catids = 'c.id=' . implode(' OR c.id=', $catidsArray);
             $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n AND ( {$catids} )" . "\n ORDER BY s.name,c.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_category';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for category
     $rows[] = mosHTML::makeOption('', 'All Categories');
     $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name,c.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $category = mosHTML::selectList($rows, 'catid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['categoryid'] = $category;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */
     content_blog_category_html::edit($menu, $lists, $params, $option);
 }
Exemple #11
0
 /**
  * @return string The html for the limit # input box
  */
 function getLimitBox()
 {
     $limits = array();
     for ($i = 5; $i <= 30; $i += 5) {
         $limits[] = mosHTML::makeOption("{$i}");
     }
     $limits[] = mosHTML::makeOption("50");
     // build the html select list
     $html = mosHTML::selectList($limits, 'limit', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $this->limit);
     $html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"{$this->limitstart}\" />";
     return $html;
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the section to edit (0 if new)
  */
 function edit($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params = new mosParameters($menu->params);
         $secids = $params->def('sectionid', '');
         if ($secids) {
             $secidsArray = explode(',', $secids);
             mosArrayToInts($secidsArray);
             $secids = 's.id=' . implode(' OR s.id=', $secidsArray);
             $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND ( {$secids} )" . "\n ORDER BY s.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for section
     $rows[] = mosHTML::makeOption('', 'Todas as Seções');
     $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['sectionid'] = $section;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_blog_section_html::edit($menu, $lists, $params, $option);
 }
function dbBackup($p_option)
{
    global $database;
    $database->setQuery("SHOW tables");
    $tables = $database->loadResultArray();
    $tables2 = array(mosHTML::makeOption('all', T_('All Mambo Tables')));
    foreach ($tables as $table) {
        $tables2[] = mosHTML::makeOption($table);
    }
    $tablelist = mosHTML::selectList($tables2, 'tables[]', 'class="inputbox" size="5" multiple="multiple"', 'value', 'text', 'all');
    HTML_dbadmin::backupIntro($tablelist, $p_option);
}
 /**
  * @param database A database connector object
  * @param integer The unique id of the section to edit (0 if new)
  */
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     global $mosConfig_absolute_path;
     $menu = new mosMenu($database);
     $menu->load($uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n";
         exit(0);
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params =& new mosParameters($menu->params);
         $secids = $params->def('sectionid', '');
         if ($secids) {
             $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND s.id IN ( " . $secids . ")" . "\n ORDER BY s.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for section
     $rows[] = mosHTML::makeOption('', 'All Sections');
     $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['sectionid'] = $section;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component');
     /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */
     content_blog_section_html::edit($menu, $lists, $params, $option);
 }
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load($uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         echo "<script>alert('" . sprintf(T_('The module %s is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n";
         exit(0);
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         // load values for new entry
         $menu->type = 'component_item_link';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if ($uid) {
         $temp = explode('&Itemid=', $menu->link);
         $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = '" . $temp[0] . "'";
         $database->setQuery($query);
         $components = $database->loadResult();
         $lists['components'] = $components;
         $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />';
     } else {
         $query = "SELECT CONCAT( a.link, '&amp;Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = '1'" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name";
         $database->setQuery($query);
         $components = $database->loadObjectList();
         //	Create a list of links
         $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', '');
     }
     // build html select list for target window
     $lists['target'] = mosAdminMenus::Target($menu);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid, 1);
     // get params definitions
     $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     component_item_link_menu_html::edit($menu, $lists, $params, $option);
 }
Exemple #16
0
function newMessage($option, $user, $subject)
{
    global $database, $mainframe, $my, $acl;
    // get available backend user groups
    $gid = $acl->get_group_id('Public Backend', 'ARO');
    $gids = $acl->get_group_children($gid, 'ARO', 'RECURSE');
    $gids = implode(',', $gids);
    // get list of usernames
    $recipients = array(mosHTML::makeOption('0', '- Select User -'));
    $database->setQuery("SELECT id AS value, username AS text FROM #__users" . "\n WHERE gid IN ({$gids})" . "\n ORDER BY name");
    $recipients = array_merge($recipients, $database->loadObjectList());
    $recipientslist = mosHTML::selectList($recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $user);
    HTML_messages::newMessage($option, $recipientslist, $subject);
}
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
     } else {
         // load values for new entry
         $menu->type = 'component_item_link';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if ($uid) {
         $temp = explode('&Itemid=', $menu->link);
         $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = " . $database->Quote($temp[0]);
         $database->setQuery($query);
         $components = $database->loadResult();
         $lists['components'] = $components;
         $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />';
     } else {
         $query = "SELECT CONCAT( a.link, '&amp;Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = 1" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name";
         $database->setQuery($query);
         $components = $database->loadObjectList();
         //	Create a list of links
         $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', '');
     }
     // build html select list for target window
     $lists['target'] = mosAdminMenus::Target($menu);
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid, 1);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     component_item_link_menu_html::edit($menu, $lists, $params, $option);
 }
 function edit($id)
 {
     global $my, $mainframe, $database, $option, $priTask, $subTask;
     global $WBG_CONFIG, $wbGalleryDB_cat;
     $row = new wbGalleryDB_cat($database);
     $row->load($id);
     if (!$row->id) {
         $row->published = 1;
     }
     $lists = array();
     $catTree = $wbGalleryDB_cat->getCategoryTree();
     $tList = array(mosHTML::makeOption('0', 'No Parent...', 'id', 'name'));
     $tList = array_merge($tList, $catTree);
     $lists['parent_id'] = mosHTML::selectList($tList, 'parent_id', '', 'id', 'name', (int) $row->parent_id);
     $lists['published'] = mosHTML::yesnoRadioList('published', '', (int) $row->published);
     $lists['access'] = mosAdminMenus::Access($row);
     wbGallery_cat_html::edit($row, $lists);
 }
Exemple #19
0
function showFiles()
{
    global $database, $mainframe, $option, $section, $mosConfig_list_limit;
    global $_DOCMAN;
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}{$section}limitstart", 'limitstart', 0);
    $levellimit = $mainframe->getUserStateFromRequest("view{$option}{$section}limit", 'levellimit', 10);
    $filter = $mainframe->getUserStateFromRequest("filterarc{$option}{$section}", 'filter', 0);
    $search = $mainframe->getUserStateFromRequest("search{$option}{$section}", 'search', '');
    // read directory content
    $folder = new DOCMAN_Folder($_DOCMAN->getCfg('dmpath'));
    $files = $folder->getFiles($search);
    for ($i = 0, $n = count($files); $i < $n; $i++) {
        $file =& $files[$i];
        $database->setQuery("SELECT COUNT(dmfilename) FROM #__docman WHERE dmfilename='" . $database->getEscaped($file->name) . "'");
        $result = $database->loadResult();
        if ($database->getErrorNum()) {
            echo $database->stderr();
            return false;
        }
        $file->links = $result;
    }
    if ($filter == 2) {
        $files = array_filter($files, 'filterOrphans');
    }
    if ($filter == 3) {
        $files = array_filter($files, 'filterDocuments');
    }
    $total = count($files);
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    // slice out elements based on limits
    $rows = array_slice($files, $pageNav->limitstart, $pageNav->limit);
    $filters[] = mosHTML::makeOption('0', _DML_SELECT_FILE);
    $filters[] = mosHTML::makeOption('1', _DML_ALLFILES);
    $filters[] = mosHTML::makeOption('2', _DML_ORPHANS);
    $filters[] = mosHTML::makeOption('3', _DML_DOCFILES);
    $lists['filter'] = mosHTML::selectList($filters, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter);
    //$search = '';
    HTML_DMFiles::showFiles($rows, $lists, $search, $pageNav);
}
Exemple #20
0
function FLMS_params_lesson($id, $type_lesson)
{
    global $JLMS_DB;
    $course_id = $id;
    $row = new mos_FLMS_Course_load($JLMS_DB);
    $row->load($id);
    if (!$id) {
        $row->f_id = 0;
        $row->type_lesson = $type_lesson;
        $row->operation = isset($_REQUEST['flms_operation']) && $_REQUEST['flms_operation'] ? $_REQUEST['flms_operation'] : 0;
    } else {
        $row->type_lesson = isset($row->type_lesson) && $row->type_lesson == $type_lesson ? $row->type_lesson : $type_lesson;
    }
    $like_theory = mosGetParam($_REQUEST, 'flms_like_theory', $id ? $row->like_theory : 0);
    $disabled_like_theory = 0;
    if (isset($row->f_id) && $row->f_id) {
        $query = "SELECT count(*) FROM #__lmsb_booking WHERE lesson_id = '" . $row->course_id . "'";
        $JLMS_DB->setQuery($query);
        $disabled_like_theory = $JLMS_DB->loadResult();
    }
    $lists = array();
    $lists['like_theory'] = $like_theory;
    $lists['disabled_like_theory'] = $disabled_like_theory;
    $query = "SELECT id as value, name as text FROM #__lmsf_operations";
    $JLMS_DB->setQuery($query);
    $course_operations = $JLMS_DB->loadObjectList();
    $operation_mass = array();
    $operation_mass[] = mosHTML::makeOption(0, 'Select operation');
    $operation_mass = array_merge($operation_mass, $course_operations);
    $disabled = $row->type_lesson == 1 || $row->type_lesson == 3 ? 'disabled="disabled"' : ($row->type_lesson == 2 && $like_theory ? 'disabled="disabled"' : ($row->type_lesson == 0 ? 'disabled="disabled"' : ''));
    $lists['operation'] = mosHTML::selectList($operation_mass, 'flms_operation', 'class="inputbox" size="1" ' . $disabled, 'value', 'text', $id ? isset($_REQUEST['flms_operation']) ? $_REQUEST['flms_operation'] : $row->operation : $row->operation);
    $query = "SELECT cat_name FROM #__lms_course_cats_config WHERE id = '1'";
    $JLMS_DB->setQuery($query);
    $lists['title_main_category'] = $JLMS_DB->loadResult();
    FLMS_course_html::viewFParametrs($row, $lists);
}
Exemple #21
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editMambot($option, $uid, $client)
{
    global $database, $my, $mainframe, $adminLanguage;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosMambot($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        echo "<script>alert(\"" . $adminLanguage->A_COMP_CONTENT_MODULE . " " . $row->title . " " . $adminLanguage->A_COMP_MAMB_EDIT . "\"); document.location.href='index2.php?option={$option}'</script>\n";
        exit(0);
    }
    if ($uid) {
        $row->checkout($my->id);
    }
    if ($client == 'admin') {
        $where = "client_id='1'";
    } else {
        $where = "client_id='0'";
    }
    if (!$uid) {
        $row->folder = '';
        $row->ordering = 999;
        $row->published = 1;
    }
    // get list of groups
    if ($row->access == 99 || $row->client_id == 1) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
    } else {
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($row);
    }
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    if ($uid) {
        if ($row->ordering > -10000 && $row->ordering < 10000) {
            // build the html select list for ordering
            $query = "SELECT ordering AS value, name AS text" . "\n FROM #__mambots" . "\n WHERE folder='{$row->folder}'" . "\n AND published > 0" . "\n AND {$where}" . "\n AND ordering > -10000" . "\n AND ordering < 10000" . "\n ORDER BY ordering";
            $order = mosGetOrderingList($query);
            $lists['ordering'] = mosHTML::selectList($order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
        } else {
            $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />This mambot cannot be reordered';
        }
        $lists['folder'] = '<input type="hidden" name="folder" value="' . $row->folder . '" />' . $row->folder;
    } else {
        $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />New items default to the last place';
        $folders = mosReadDirectory($mosConfig_absolute_path . '/mambots/');
        $folders2 = array();
        foreach ($folders as $folder) {
            if (is_dir($mosConfig_absolute_path . '/mambots/' . $folder)) {
                $folders2[] = mosHTML::makeOption($folder);
            }
        }
        $lists['folder'] = mosHTML::selectList($folders2, 'folder', 'class="inputbox" size="1"', 'value', 'text', null);
    }
    $row->description = '';
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mosConfig_absolute_path . '/mambots/' . $row->folder . '/' . $row->element . '.xml';
    $xmlDoc =& new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $element =& $xmlDoc->documentElement;
        if ($element->getTagName() == 'mosinstall' && $element->getAttribute('type') == 'mambot') {
            $element =& $xmlDoc->getElementsByPath('description', 1);
            $row->description = $element ? trim($element->getText()) : '';
        }
    }
    // get params definitions
    $params =& new mosParameters($row->params, $mainframe->getPath('bot_xml', $row->folder . '/' . $row->element), 'mambot');
    HTML_modules::editMambot($row, $lists, $params, $option);
}
Exemple #22
0
 /**
  * Legacy function, deprecated
  *
  * @deprecated	As of version 1.5
  */
 function yesnoSelectList($tag_name, $tag_attribs, $selected, $yes = 'yes', $no = 'no')
 {
     $arr = array(mosHTML::makeOption(0, JText::_($no)), mosHTML::makeOption(1, JText::_($yes)));
     return mosHTML::selectList($arr, $tag_name, $tag_attribs, 'value', 'text', (int) $selected);
 }
/**
* Compiles a list of trash items
*/
function viewTrash($option)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $catid = $mainframe->getUserStateFromRequest("catid{$option}", 'catid', 'content');
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0));
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    if ($catid == "content") {
        // get the total number of content
        $query = "SELECT count(*)" . "\n FROM #__content AS c" . "\n LEFT JOIN #__categories AS cc ON cc.id = c.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE c.state = -2";
        $database->setQuery($query);
        $total = $database->loadResult();
        $pageNav = new mosPageNav($total, $limitstart, $limit);
        // Query content items
        $query = "SELECT c.*, g.name AS groupname, cc.name AS catname, s.name AS sectname" . "\n FROM #__content AS c" . "\n LEFT JOIN #__categories AS cc ON cc.id = c.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\n INNER JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n WHERE c.state = -2" . "\n ORDER BY s.name, cc.name, c.title";
        $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
        $content = $database->loadObjectList();
        $num = $total;
        if ($limit < $total) {
            $num = $limit;
        }
        for ($i = 0; $i < $num - 1; $i++) {
            if ($content[$i]->sectionid == 0 && $content[$i]->catid == 0) {
                $content[$i]->sectname = 'Static Content';
            }
        }
    } else {
        // get the total number of menu
        $query = "SELECT count(*)" . "\n FROM #__menu AS m" . "\n LEFT JOIN #__users AS u ON u.id = m.checked_out" . "\n WHERE m.published = -2";
        $database->setQuery($query);
        $total = $database->loadResult();
        $pageNav = new mosPageNav($total, $limitstart, $limit);
        // Query menu items
        $query = "SELECT m.name AS title, m.menutype AS sectname, m.type AS catname, m.id AS id" . "\n FROM #__menu AS m" . "\n LEFT JOIN #__users AS u ON u.id = m.checked_out" . "\n WHERE m.published = -2" . "\n ORDER BY m.menutype, m.ordering, m.ordering, m.name";
        $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
        $content = $database->loadObjectList();
    }
    // Build the select list
    $listselect = array();
    $listselect[] = mosHTML::makeOption('content', 'Content Items');
    $listselect[] = mosHTML::makeOption('menu', 'Menu Items');
    $selected = "all";
    $list = mosHTML::selectList($listselect, 'catid', 'class="inputbox" size="1" ' . 'onchange="document.adminForm.submit();"', 'value', 'text', $catid);
    HTML_trash::showList($option, $content, $pageNav, $list, $catid);
}
/**
* Compiles information to add or edit content
* @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)
*/
function edit($uid, $option)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset;
    $row = new mosContent($database);
    $row->load((int) $uid);
    $lists = array();
    $nullDate = $database->getNullDate();
    if ($uid) {
        // fail if checked out not by 'me'
        if ($row->isCheckedOut($my->id)) {
            mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
        }
        $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();
        }
        // get list of links to this item
        $and = "\n AND componentid = " . (int) $row->id;
        $menus = mosAdminMenus::Links2Menu('content_typed', $and);
    } else {
        // initialise values for a new item
        $row->version = 0;
        $row->state = 1;
        $row->images = array();
        $row->publish_up = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
        $row->publish_down = 'Never';
        $row->sectionid = 0;
        $row->catid = 0;
        $row->creator = '';
        $row->modified = $nullDate;
        $row->modifier = '';
        $row->ordering = 0;
        $menus = array();
    }
    // calls function to read image from directory
    $pathA = $mosConfig_absolute_path . '/images/stories';
    $pathL = $mosConfig_live_site . '/images/stories';
    $images = array();
    $folders = array();
    $folders[] = mosHTML::makeOption('/');
    mosAdminMenus::ReadImages($pathA, '/', $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);
    // 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 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 positions
    $lists['_align'] = mosAdminMenus::Positions('_align');
    // build the select list for the image caption alignment
    $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
    // 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_typedcontent'), 'component');
    HTML_typedcontent::edit($row, $images, $lists, $params, $option, $menus);
}
 function showMailings($task, $action, $listId, $listType, $message, $showHeader, $title)
 {
     $start = mosGetParam($_REQUEST, 'start', 0);
     //ADRIEN
     //$limit = mosGetParam($_REQUEST, 'limit', $GLOBALS['mosConfig_list_limit']);
     $limit = -1;
     $emailsearch = mosGetParam($_REQUEST, 'emailsearch', '');
     $dropList = mosGetParam($_REQUEST, 'droplist', 'ZZZZ');
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     if ($listId > 0) {
         $listTypeM = 0;
     } else {
         $listTypeM = $listType;
     }
     $orddef = 'idD';
     if ($listType == 2) {
         $orddef = 'idA';
     }
     $order = mosGetParam($_REQUEST, 'order', $orddef);
     if ($listId == 0) {
         $lists['title'] = lisType::chooseType($task, $action, $listType, 'titles', '', $title);
     } else {
         $listing = lists::getLists($listId, 0, 1, '', false, false, true);
         $lists['title'] = $title . "<span style='color: rgb(51, 51, 51);'>" . $listing[0]->list_name . "</span>";
     }
     $dropDownList = lisType::getMailingDropList($listId, $listType, $order);
     $lists['droplist'] = mosHTML::selectList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'name', $dropList);
     $mailings = xmailing::getMailings($listId, $listTypeM, $start, $limit, $emailsearch, $total, $order, false, false);
     $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
     $forms['select'] = " <form action='index2.php' method='post' name='AcajoomFilterForm'> \n\r";
     $show = lisType::showType($listType, 'showMailings');
     if ($showHeader) {
         xmailing::_header($task, $action, $listType, $message, '');
     }
     backHTML::formStart('show_mailing', 0, '');
     mailingsHTML::showMailingList($mailings, $lists, $start, $limit, $total, $emailsearch, $listId, $listType, $forms, $show, $action);
     backHTML::formEnd();
 }
Exemple #26
0
/**
* Form for copying item(s) to a specific menu
*/
function copyMenu($option, $cid, $menutype)
{
    global $database, $adminLanguage;
    if (!is_array($cid) || count($cid) < 1) {
        echo "<script> alert('" . $adminLanguage->A_COMP_CATEG_ITEM_MOVE . "'); window.history.go(-1);</script>\n";
        exit;
    }
    ## query to list selected menu items
    $cids = implode(',', $cid);
    $query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( " . $cids . " )";
    $database->setQuery($query);
    $items = $database->loadObjectList();
    ## query to choose menu
    $query = "SELECT a.params  FROM #__modules AS a WHERE a.module = 'mod_mainmenu' ORDER BY a.title";
    $database->setQuery($query);
    $modules = $database->loadObjectList();
    foreach ($modules as $module) {
        $params = mosParseParams($module->params);
        // adds menutype to array
        $type = trim(@$params->menutype);
        $menu[] = mosHTML::makeOption($type, $type);
    }
    // build the html select list
    $MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null);
    HTML_menusections::copyMenu($option, $cid, $MenuList, $items, $menutype);
}
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editModule($option, $uid, $client)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosModule($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
    }
    $row->content = htmlspecialchars($row->content);
    if ($uid) {
        $row->checkout($my->id);
    }
    // if a new record we must still prime the mosModule object with a default
    // position and the order; also add an extra item to the order list to
    // place the 'new' record in last position if desired
    if ($uid == 0) {
        $row->position = 'left';
        $row->showtitle = true;
        //$row->ordering = $l;
        $row->published = 1;
    }
    if ($client == 'admin') {
        $where = "client_id = 1";
        $lists['client_id'] = 1;
        $path = 'mod1_xml';
    } else {
        $where = "client_id = 0";
        $lists['client_id'] = 0;
        $path = 'mod0_xml';
    }
    $query = "SELECT position, ordering, showtitle, title" . "\n FROM #__modules" . "\n WHERE {$where}" . "\n ORDER BY ordering";
    $database->setQuery($query);
    if (!($orders = $database->loadObjectList())) {
        echo $database->stderr();
        return false;
    }
    $query = "SELECT position, description" . "\n FROM #__template_positions" . "\n WHERE position != ''" . "\n ORDER BY position";
    $database->setQuery($query);
    // hard code options for now
    $positions = $database->loadObjectList();
    $orders2 = array();
    $pos = array();
    foreach ($positions as $position) {
        $orders2[$position->position] = array();
        $pos[] = mosHTML::makeOption($position->position, $position->description);
    }
    $l = 0;
    $r = 0;
    for ($i = 0, $n = count($orders); $i < $n; $i++) {
        $ord = 0;
        if (array_key_exists($orders[$i]->position, $orders2)) {
            $ord = count(array_keys($orders2[$orders[$i]->position])) + 1;
        }
        $orders2[$orders[$i]->position][] = mosHTML::makeOption($ord, $ord . '::' . addslashes($orders[$i]->title));
    }
    // build the html select list
    $pos_select = 'onchange="changeDynaList(\'ordering\',orders,document.adminForm.position.options[document.adminForm.position.selectedIndex].value, originalPos, originalOrder)"';
    $active = $row->position ? $row->position : 'left';
    $lists['position'] = mosHTML::selectList($pos, 'position', 'class="inputbox" size="1" ' . $pos_select, 'value', 'text', $active);
    // get selected pages for $lists['selections']
    if ($uid) {
        $query = "SELECT menuid AS value" . "\n FROM #__modules_menu" . "\n WHERE moduleid = " . (int) $row->id;
        $database->setQuery($query);
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
        $lists['showtitle'] = 'N/A <input type="hidden" name="showtitle" value="1" />';
        $lists['selections'] = 'N/A';
    } else {
        if ($client == 'admin') {
            $lists['access'] = 'N/A';
            $lists['selections'] = 'N/A';
        } else {
            $lists['access'] = mosAdminMenus::Access($row);
            $lists['selections'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
        }
        $lists['showtitle'] = mosHTML::yesnoRadioList('showtitle', 'class="inputbox"', $row->showtitle);
    }
    // build the html select list for published
    $lists['published'] = mosAdminMenus::Published($row);
    $row->description = '';
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mainframe->getPath($path, $row->module);
    $xmlDoc = new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() == 'mosinstall' && $root->getAttribute('type') == 'module') {
            $element =& $root->getElementsByPath('description', 1);
            $row->description = $element ? trim($element->getText()) : '';
        }
    }
    // get params definitions
    $params = new mosParameters($row->params, $xmlfile, 'module');
    HTML_modules::editModule($row, $orders2, $lists, $params, $option);
}
    function editMailing($mailingEdit, $new, $listId, $forms, $show)
    {
        $lists = array();
        $folders = array();
        if (ACA_CMSTYPE) {
            $my =& JFactory::getUser();
            $folders[] = JHTML::_('select.option', '/');
            $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $mailingEdit->published);
            $lists['visible'] = JHTML::_('select.booleanlist', 'visible', 'class="inputbox"', $mailingEdit->visible);
        } else {
            global $my;
            $folders[] = mosHTML::makeOption('/');
            $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $mailingEdit->published);
            $lists['visible'] = mosHTML::yesnoRadioList('visible', 'class="inputbox"', $mailingEdit->visible);
        }
        //endif
        $images = $mailingEdit->images;
        if (!isset($mailingEdit->list_id)) {
            $mailingEdit->list_id = $listId;
        }
        $pathA = ACA_JPATH_ROOT_NO_ADMIN . '/images/stories';
        $pathL = ACA_JPATH_LIVE . '/images/stories';
        $images = array();
        if (ACA_CMSTYPE) {
            mailingsHTML::ReadImages($pathA, '/', $folders, $images);
            if (!isset($images['/'])) {
                $images['/'][] = JHTML::_('select.option', '');
            }
            $javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' )\"";
            $lists['imagefiles'] = JHTML::_('select.genericlist', $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" ' . $javascript, 'value', 'text', null);
            $javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' );\"";
            $lists['folders'] = JHTML::_('select.genericlist', $folders, 'folders', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', '/');
            $images2 = array();
            foreach ($mailingEdit->images as $file) {
                $temp = explode('|', $file);
                if (strrchr($temp[0], '/')) {
                    $filename = substr(strrchr($temp[0], '/'), 1);
                } else {
                    $filename = $temp[0];
                }
                $images2[] = JHTML::_('select.option', $file, $filename);
            }
            //$javascript	= "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
            $javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '{$pathL}/' ); showImageProps( '{$pathL}/' ); \"";
            $lists['imagelist'] = JHTML::_('select.genericlist', $images2, 'imagelist', 'class="inputbox" size="10" ' . $javascript, 'value', 'text');
            $lists['_align'] = JHTML::_('list.positions', '_align');
            $lists['_caption_align'] = JHTML::_('list.positions', '_caption_align');
        } else {
            mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
            $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
            $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL);
            $lists['imagelist'] = mosAdminMenus::GetSavedImages($mailingEdit, $pathL);
            $lists['_align'] = mosAdminMenus::Positions('_align');
            $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
        }
        //endif
        if (ACA_CMSTYPE) {
            // joomla 15
            $pos[] = JHTML::_('select.option', 'bottom', _CMN_BOTTOM);
            $pos[] = JHTML::_('select.option', 'top', _CMN_TOP);
            $lists['_caption_position'] = JHTML::_('select.genericlist', $pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        } else {
            //joomla 1x
            $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');
        }
        //endif
        backHTML::formStart('edit_mailing', $mailingEdit->html, $images);
        echo $forms['main'];
        if ($new and $mailingEdit->list_type == 7) {
            $mailingEdit->issue_nb = 0;
        }
        mailingsHTML::layout($mailingEdit, $lists, $show);
        ?>
		<input type="hidden" name="images" value="" />
		<input type="hidden" name="html" value="<?php 
        echo $mailingEdit->html;
        ?>
" />
		<input type="hidden" name="new_list" value="<?php 
        echo $new;
        ?>
" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="listype" value="<?php 
        echo $mailingEdit->list_type;
        ?>
" />
		<input type="hidden" name="mailingid" value="<?php 
        echo $mailingEdit->id;
        ?>
" />
		<input type="hidden" name="issue_nb" value="<?php 
        echo $mailingEdit->issue_nb;
        ?>
" />
	    <input type="hidden" name="userid" value="<?php 
        echo $my->id;
        ?>
" />
		<?php 
    }
function jlms_booking_users($course_id, $option)
{
    global $JLMS_DB, $JLMS_CONFIG;
    $pid = intval(mosgetparam($_GET, "pid", 0));
    $user_array = array();
    $lists = array();
    if ($pid) {
        $query = "SELECT user_id FROM #__lms_conference_usr WHERE p_id = '" . $pid . "'";
        $JLMS_DB->setQuery($query);
        $ids = $JLMS_DB->LoadResultArray();
        if (count($ids)) {
            $ids_users = implode(',', $ids);
        } else {
            $ids_users = '';
        }
        $query = "SELECT a.user_id, b.name, b.username FROM #__lms_conference_usr as a, #__users as b WHERE a.p_id = '" . $pid . "' AND b.id = a.user_id";
        $JLMS_DB->setQuery($query);
        $rows = $JLMS_DB->LoadObjectList();
        $query = "SELECT a.*" . "\n FROM #__users as a, " . "\n #__lms_users_in_groups as b, #__lms_usertypes as c " . "\n WHERE a.id = b.user_id AND b.role_id = c.id AND b.course_id = '" . $course_id . "'" . ($ids_users ? "\n AND a.id NOT IN (" . $ids_users . ")" : '') . "\n group by a.id ORDER BY a.username, a.name";
        $JLMS_DB->setQuery($query);
        $users = $JLMS_DB->LoadObjectList();
        $i = 0;
        while ($i < count($users)) {
            if ($JLMS_CONFIG->get('use_global_groups', 1)) {
                $users[$i]->username = $users[$i]->name . ' (' . $users[$i]->username . ')';
            } else {
                $users[$i]->username = ($users[$i]->ug_name ? $users[$i]->ug_name . ' - ' : '') . $users[$i]->name . ' (' . $users[$i]->username . ')';
            }
            $i++;
        }
        $lists['usrs'] = mosHTML::selectList($users, 'sel_user', 'class="inputbox" size="1" ', 'id', 'username', '');
        JLMS_conference_html::jlms_booking_users($course_id, $option, $lists, $pid, $rows);
    }
}
    function edit(&$uid, $menutype, $option)
    {
        global $database, $my, $mainframe;
        global $mosConfig_absolute_path;
        $menu = new mosMenu($database);
        $menu->load((int) $uid);
        // fail if checked out not by 'me'
        if ($menu->checked_out && $menu->checked_out != $my->id) {
            mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
        }
        if ($uid) {
            $menu->checkout($my->id);
        } else {
            // load values for new entry
            $menu->type = 'newsfeed_link';
            $menu->menutype = $menutype;
            $menu->browserNav = 0;
            $menu->ordering = 9999;
            $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
            $menu->published = 1;
        }
        if ($uid) {
            $temp = explode('feedid=', $menu->link);
            $query = "SELECT *, c.title AS category" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.id = " . (int) $temp[1];
            $database->setQuery($query);
            $newsfeed = $database->loadObjectlist();
            // outputs item name, category & section instead of the select list
            $lists['newsfeed'] = '
			<table width="100%">
			<tr>
				<td width="10%">
				Item:
				</td>
				<td>
				' . $newsfeed[0]->name . '
				</td>
			</tr>
			<tr>
				<td width="10%">
				Position:
				</td>
				<td>
				' . $newsfeed[0]->category . '
				</td>
			</tr>
			</table>';
            $lists['newsfeed'] .= '<input type="hidden" name="newsfeed_link" value="' . $temp[1] . '" />';
            $newsfeeds = '';
        } else {
            $query = "SELECT a.id AS value, CONCAT( c.title, ' - ', a.name ) AS text, a.catid " . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.published = 1" . "\n ORDER BY a.catid, a.name";
            $database->setQuery($query);
            $newsfeeds = $database->loadObjectList();
            //	Create a list of links
            $lists['newsfeed'] = mosHTML::selectList($newsfeeds, 'newsfeed_link', 'class="inputbox" size="10"', 'value', 'text', '');
        }
        // build html select list for target window
        $lists['target'] = mosAdminMenus::Target($menu);
        // build the html select list for ordering
        $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($menu);
        // build the html select list for paraent item
        $lists['parent'] = mosAdminMenus::Parent($menu);
        // build published button option
        $lists['published'] = mosAdminMenus::Published($menu);
        // build the url link output
        $lists['link'] = mosAdminMenus::Link($menu, $uid);
        // get params definitions
        $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
        newsfeed_link_menu_html::edit($menu, $lists, $params, $option, $newsfeeds);
    }