Example #1
0
File: module.php Project: cwcw/cms
/**
* @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);
}
Example #2
0
 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);
 }
Example #3
0
 function yesnoRadioList($tag_name, $tag_attribs, $selected, $yes = 'yes', $no = 'no', $id = false)
 {
     if (JCOMMENTS_JVERSION == '1.5') {
         return JHTML::_('select.booleanlist', $tag_name, $tag_attribs, $selected, $yes, $no, $id);
     }
     return mosHTML::yesnoRadioList($tag_name, $tag_attribs, $selected, $yes, $no);
 }
Example #4
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);
}
Example #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);
}
Example #6
0
/**
* Mambot that Cloaks all emails in content from spambots via javascript
*/
function botMosEmailCloak($published, &$row, &$cparams, $page = 0, $params)
{
    global $database;
    // 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 );*/
    $mambots =& mosMambotHandler::getInstance();
    $mambot = $mambots->getBot('mosemailcloack', 'content');
    $params =& new mosParameters(isset($mambot->params) ? $mambot->params : '');
    $mode = $params->def('mode', 1);
    //$search 	= "([[:alnum:]_\.\-]+)(\@[[:alnum:]\.\-]+\.+)([[:alnum:]\.\-]+)";
    $search = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-\\?\\=\\%]+)";
    $search_text = "([[:alnum:][:space:][:punct:]][^<>]+)";
    // search for derivativs of link code <a href="mailto:email@amail.com">email@amail.com</a>
    // extra handling for inclusion of title and target attributes either side of href attribute
    $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*>)" . $search . "</a>";
    if (is_callable(array($row, 'getText'))) {
        $localtext = $row->getText();
    } else {
        $localtext = $row->text;
    }
    while (eregi($searchlink, $localtext, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5] . $regs[6] . $regs[7];
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com">anytext</a>
    // extra handling for inclusion of title and target attributes either side of href attribute
    $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*)>" . $search_text . "</a>";
    while (eregi($searchlink, $localtext, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5];
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    // search for plain text email@amail.com
    while (eregi($search, $localtext, $regs)) {
        $mail = $regs[0];
        $replacement = mosHTML::emailCloaking($mail, $mode);
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    if (is_callable(array($row, 'saveText'))) {
        $row->saveText($localtext);
    } else {
        $row->text = $localtext;
    }
}
Example #7
0
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);
}
Example #8
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);
 }
Example #10
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);
 }
 /**
  * @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);
 }
Example #13
0
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);
}
Example #14
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;
 }
Example #15
0
 /**
  * @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 editSubscriber($subscriber, $listings, $queues, $forms, $access = false, $frontEnd = false, $cb = false)
 {
     global $my, $mainframe;
     mosCommonHTML::loadOverlib();
     $lists['receive_html'] = mosHTML::yesnoRadioList('receive_html', 'class="inputbox"', $subscriber->receive_html);
     $lists['confirmed'] = mosHTML::yesnoRadioList('confirmed', 'class="inputbox"', $subscriber->confirmed);
     $lists['blacklist'] = mosHTML::yesnoRadioList('blacklist', 'class="inputbox"', $subscriber->blacklist);
     $br = "\n\r";
     $html = $forms['main'];
     $html .= '<div style="width:100%; align:left;">' . $br;
     $html .= '<fieldset class="acajoomcss" style="padding: 10px; text-align: left">' . $br;
     $html .= '<legend><strong>' . _ACA_SUB_INFO . '</strong></legend>' . $br;
     $html .= '<table cellpadding="0" cellspacing="0" align="center">' . $br;
     $text = str_replace('"', '&quot;', $subscriber->name);
     if (function_exists('htmlspecialchars_decode')) {
         $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
     } elseif (function_exists('html_entity_decode')) {
         $text = html_entity_decode($text, ENT_NOQUOTES);
     }
     if (!$cb) {
         $html .= acajoom::miseEnHTML(_ACA_INPUT_NAME, _ACA_INPUT_NAME_TIPS, '<input type="text" name="name" size="30" value="' . $text . '" class="inputbox" />');
         $html .= acajoom::miseEnHTML(_ACA_INPUT_EMAIL, _ACA_INPUT_EMAIL_TIPS, '<input type="text" name="email" size="30" class="inputbox" value="' . $subscriber->email . ' "  />');
     } else {
         $html .= '<input type="hidden" name="cb_integration" value="1"  />';
     }
     $html .= acajoom::miseEnHTML(_ACA_RECEIVE_HTML, _ACA_RECEIVE_HTML_TIPS, $lists['receive_html']);
     if ($GLOBALS[ACA . 'time_zone'] == 1) {
         $html .= acajoom::miseEnHTML(_ACA_TIME_ZONE_ASK, _ACA_TIME_ZONE_ASK_TIPS, ' <input type="text" name="timezone" size="30" class="inputbox" value="' . $subscriber->timezone . '"  />');
     } else {
         $html .= '<input type="hidden" name="timezone" value="' . $subscriber->timezone . '"  />';
     }
     if ($access) {
         if ($subscriber->user_id == 0) {
             $html .= acajoom::miseEnHTML(_ACA_CONFIRMED, '', $lists['confirmed']);
         } else {
             if (!$cb or !$mainframe->isAdmin()) {
                 $html .= '<input type="hidden" name="confirmed" value="' . $subscriber->confirmed . '" />';
             }
         }
         $html .= acajoom::miseEnHTML(_ACA_BLACK_LIST, '', $lists['blacklist']);
         $html .= acajoom::miseEnHTML(_ACA_REGISTRATION_DATE, '', $subscriber->subscribe_date);
         $html .= acajoom::miseEnHTML(_ACA_USER_ID, '', $subscriber->user_id);
     } else {
         $html .= '<input type="hidden" name="confirmed" value="' . $subscriber->confirmed . '" />';
         $html .= '<input type="hidden" name="blacklist" value="' . $subscriber->blacklist . '" />';
     }
     $html .= '</table>';
     $html .= '</fieldset></div>';
     $html .= subscribersHTML::showSubscriberLists($subscriber, $listings, $queues, $frontEnd, $access);
     return $html;
 }
 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);
 }
Example #18
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);
 }
Example #21
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);
}
Example #22
0
 public static function _($type)
 {
     $type = preg_replace('#[^A-Z0-9_\\.]#i', '', $type);
     $args = func_get_args();
     array_shift($args);
     $item = $args[0];
     $i = $args[1];
     $prefix = isset($args[2]) ? $args[2] : null;
     $result = '';
     switch ($type) {
         case 'grid.id':
             if (JCOMMENTS_JVERSION == '1.0') {
                 $result = mosHTML::idBox($i, $item->id);
             } elseif (JCOMMENTS_JVERSION == '1.7') {
                 $result = JHTML::_('grid.id', $i, $item->id);
             } else {
                 $result = JHtml::_('grid.id', $i, $item->id);
             }
             break;
         case 'grid.checkedout':
             if (JCOMMENTS_JVERSION == '1.0') {
                 $result = mosCommonHTML::CheckedOutProcessing($item, $i);
             } elseif (JCOMMENTS_JVERSION == '1.7') {
                 $result = JHTML::_('grid.checkedout', $item, $i);
             } else {
                 $result = JHtml::_('grid.checkedout', $item, $i);
             }
             break;
         case 'grid.published':
             if (JCOMMENTS_JVERSION == '1.0') {
                 $result = mosCommonHTML::PublishedProcessing($item, $i);
             } elseif (JCOMMENTS_JVERSION == '1.7') {
                 $result = JHTML::_('grid.published', $item, $i, 'tick.png', 'publish_x.png', $prefix);
             } else {
                 $result = JHtml::_('grid.published', $item, $i, 'tick.png', 'publish_x.png', $prefix);
             }
             break;
     }
     return $result;
 }
Example #23
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);
}
Example #24
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);
}
Example #25
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);
 }
Example #26
0
    function displaylist(&$categories, &$rows, $catid, $currentcat = NULL, &$params, $tabclass)
    {
        global $Itemid, $mosConfig_live_site, $hide_js;
        if ($params->get('page_title')) {
            ?>
			<div class="componentheading<?php 
            echo $params->get('pageclass_sfx');
            ?>
">
			<?php 
            echo $currentcat->header;
            ?>
			</div>
			<?php 
        }
        ?>
		<form action="index.php" method="post" name="adminForm">

		<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane<?php 
        echo $params->get('pageclass_sfx');
        ?>
">
		<tr>
			<td width="60%" valign="top" class="contentdescription<?php 
        echo $params->get('pageclass_sfx');
        ?>
" colspan="2">
			<?php 
        // show image
        if ($currentcat->img) {
            ?>
				<img src="<?php 
            echo $currentcat->img;
            ?>
" align="<?php 
            echo $currentcat->align;
            ?>
" hspace="6" alt="<?php 
            echo T_('Web Links');
            ?>
" />
				<?php 
        }
        echo $currentcat->descrip;
        ?>
			</td>
		</tr>
		<tr>
			<td>
			<?php 
        if (count($rows)) {
            HTML_weblinks::showTable($params, $rows, $catid, $tabclass);
        }
        ?>
			</td>
		</tr>
		<tr>
			<td>&nbsp;

			</td>
		</tr>
		<tr>
			<td>
			<?php 
        // Displays listing of Categories
        if ($params->get('type') == 'category' && $params->get('other_cat')) {
            HTML_weblinks::showCategories($params, $categories, $catid);
        } else {
            if ($params->get('type') == 'section' && $params->get('other_cat_section')) {
                HTML_weblinks::showCategories($params, $categories, $catid);
            }
        }
        ?>
			</td>
		</tr>
		</table>
		</form>
		<?php 
        // displays back button
        mosHTML::BackButton($params, $hide_js);
    }
Example #27
0
/**
* 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);
}
    function show_all_notices($option, $lists, $total, $pageNav, $limitstart, $limit)
    {
        global $JLMS_CONFIG, $Itemid;
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        $link_pages = "index.php?option={$option}&task=view_all_notices";
        ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
        echo count($lists['levels']);
        ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
        echo count($lists['levels']);
        ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if ((pressbutton == 'delete_notice_no_ajax' || pressbutton == 'edit_notice_no_ajax') && form.boxchecked.value == '0') {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else {
				form.task.value = pressbutton;
				form.submit();
			}
		}
		//--><!]]>
		</script>
		<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
			<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('doc', 'View notices', $params);
        $controls = array();
        $controls[] = array('href' => $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_notice_no_ajax", 'title' => 'New Notice', 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('edit_notice_no_ajax');", 'title' => 'Edit Notice', 'img' => 'edit');
        $controls[] = array('href' => "javascript:submitbutton('delete_notice_no_ajax');", 'title' => 'Delete Notice(s)', 'img' => 'delete');
        //			$controls[] = array('href' => 'spacer');
        JLMS_TMPL::ShowControlsFooter($controls, '', false);
        JLMS_TMPL::CloseMT();
        ?>
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td colspan="5">
						<table border="0" cellpadding="0" cellspacing="0" align="right">
							<tr>
								<td align="right">
									<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo (isset($lists['levels'][0]->cat_name) && $lists['levels'][0]->cat_name != '' ? $lists['levels'][0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'];
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'];
        }
        ?>
								</td>
							</tr>
							<?php 
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    ?>
										<tr>
											<td align="right">
											<?php 
                    echo (isset($lists['levels'][$i]->cat_name) && $lists['levels'][$i]->cat_name != '' ? $lists['levels'][$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i];
                    ?>
	
											</td>
										</tr>	
										<?php 
                }
            }
        }
        if (isset($lists['levels'][0]) || count($multicat)) {
            ?>
								<tr>
									<td align="right">
										<?php 
            echo $lists['f_course'];
            ?>
	
									</td>
								</tr>	
								<?php 
        }
        ?>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="5" align="center">
						<?php 
        echo $pageNav->writePagesCounter() . ' ' . $pageNav->getLimitBox($link_pages);
        ?>
					</td>
				</tr>
				<tr>
					<td class="sectiontableheader" width="1%">
						#
					</td>
					<td class="sectiontableheader" width="1%">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($lists['my_notices']);
        ?>
);" />
					</td>
					<td class="sectiontableheader">
						Notice
					</td>
					<td class="sectiontableheader" width="20%">
						Course name
					</td>
					<td class="sectiontableheader" width="10%">
						Date
					</td>
				</tr>
				<?php 
        $link_base = 'index.php?option=com_joomla_lms';
        $z = $limitstart;
        $end = $limit + $z;
        if ($end > $total) {
            $end = $total + 1;
        }
        $k = 1;
        for ($i = $z; $i < $end; $i++) {
            if (isset($lists['my_notices'][$i])) {
                $m_n = $lists['my_notices'][$i];
                $link = $link_base;
                if ($m_n->doc_id) {
                    $link .= '&task=' . $m_n->task . '&course_id=' . $m_n->course_id . '&id=' . $m_n->doc_id . '';
                } else {
                    $link .= '&task=' . $m_n->task . '&id=' . $m_n->course_id . '';
                }
                $checked = mosHTML::idBox($i, $m_n->id);
                ?>
						<tr class="<?php 
                echo "sectiontableentry{$k}";
                ?>
">
							<td align="center" width="1%"><?php 
                echo $pageNav->limitstart + $i + 1;
                ?>
</td>
							<td align="center" width="1%"><?php 
                echo $checked;
                ?>
</td>
							<td style="text-align: justify;">
								<?php 
                if (!$m_n->course_id && !$m_n->doc_id) {
                    /*
                    if(strlen($m_n->notice) > 100){
                    	echo substr($m_n->notice, 0, 100).' ...';	
                    } else {
                    	echo substr($m_n->notice, 0, 100);	
                    }
                    */
                    echo $m_n->notice;
                } else {
                    ?>
								<a href="<?php 
                    echo sefRelToAbs($link);
                    ?>
" title="<?php 
                    echo str_replace('"', '&quot;', strip_tags(substr($m_n->notice, 0, 30)));
                    ?>
">
									<?php 
                    /*
                    if(strlen($m_n->notice) > 100){
                    	echo substr($m_n->notice, 0, 100).' ...';	
                    } else {
                    	echo substr($m_n->notice, 0, 100);	
                    }
                    */
                    echo $m_n->notice;
                    ?>
								</a>
								<?php 
                }
                ?>
							</td>
							<td>
								<?php 
                echo $m_n->course_name;
                ?>
							</td>
							<td width="10%" nowrap="nowrap">
							on 
							<?php 
                echo JLMS_dateToDisplay($m_n->data, false, 0, " H:m:s");
                ?>
							</td>
						</tr>
						<?php 
                $k = 3 - $k;
            }
        }
        ?>
				<tr>
					<td colspan="5" align="center">
					<br />
						<?php 
        echo $pageNav->writePagesLinks($link_pages);
        ?>
					</td>
				</tr>
			</table>
			
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="boxchecked" value="0" />
		
		</form>
		<?php 
    }
    /**
     * Writes a list of the content items
     * @param array An array of content objects
     */
    function showArchive(&$rows, $section, &$lists, $search, $pageNav, $option, $all = NULL, $redirect)
    {
        global $my, $acl;
        ?>
		<script language="javascript" type="text/javascript">
		function submitbutton(pressbutton) {
			if (pressbutton == 'remove') {
				if (document.adminForm.boxchecked.value == 0) {
					alert('Por favor, selecione um item na lista para enviar a lixeira');
				} else if ( confirm('Você tem certeza que deseja enviar esse item para lixeira? \nIsto não apagará os artigos permanentemente.')) {
					submitform('remove');
				}
			} else {
				submitform(pressbutton);
			}
		}
		</script>
		<form action="index2.php" method="post" name="adminForm">

		<table class="adminheading">
		<tr>
			<th class="edit" rowspan="2">
			<?php 
        if ($all) {
            ?>
				Administrar Arquivo <small><small>[ Seção: Todas ]</small></small>
				<?php 
        } else {
            ?>
				Administrar Arquivo <small><small>[ Seção: <?php 
            echo $section->title;
            ?>
 ]</small></small>
				<?php 
        }
        ?>
			</th>
			<?php 
        if ($all) {
            ?>
				<td align="right" rowspan="2" valign="top">
				<?php 
            echo $lists['sectionid'];
            ?>
				</td>
				<?php 
        }
        ?>
			<td align="right" valign="top">
			<?php 
        echo $lists['catid'];
        ?>
			</td>
			<td valign="top">
			<?php 
        echo $lists['authorid'];
        ?>
			</td>
		</tr>
		<tr>
			<td align="right">
			Filtro:
			</td>
			<td>
			<input type="text" name="search" value="<?php 
        echo htmlspecialchars($search);
        ?>
" class="text_area" onChange="document.adminForm.submit();" />
			</td>
		</tr>
		</table>

		<table class="adminlist">
		<tr>
			<th width="5">
			nº
			</th>
			<th width="20">
			<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" />
			</th>
			<th class="title">
			Título 
			</th>
			<th width="2%">
			Ordem
			</th>
			<th width="1%">
			<a href="javascript: saveorder( <?php 
        echo count($rows) - 1;
        ?>
 )"><img src="images/filesave.png" border="0" width="16" height="16" alt="Salvar Ordem" /></a>
			</th>
			<th width="15%" align="left">
			Categoria
			</th>
			<th width="15%" align="left">
			Autor
			</th>
			<th align="center" width="10">
			Data
			</th>
		</tr>
		<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $row->cat_link = 'index2.php?option=com_categories&task=editA&hidemainmenu=1&id=' . $row->catid;
            if ($acl->acl_check('administration', 'manage', 'users', $my->usertype, 'components', 'com_users')) {
                if ($row->created_by_alias) {
                    $author = $row->created_by_alias;
                } else {
                    $linkA = 'index2.php?option=com_users&task=editA&hidemainmenu=1&id=' . $row->created_by;
                    $author = '<a href="' . $linkA . '" title="Editar Usuário">' . $row->author . '</a>';
                }
            } else {
                if ($row->created_by_alias) {
                    $author = $row->created_by_alias;
                } else {
                    $author = $row->author;
                }
            }
            $date = mosFormatDate($row->created, '%x');
            ?>
			<tr class="<?php 
            echo "row{$k}";
            ?>
">
				<td>
				<?php 
            echo $pageNav->rowNumber($i);
            ?>
				</td>
				<td width="20">
				<?php 
            echo mosHTML::idBox($i, $row->id);
            ?>
				</td>
				<td>
				<?php 
            echo $row->title;
            ?>
				</td>
				<td align="center" colspan="2">
				<input type="text" name="order[]" size="5" value="<?php 
            echo $row->ordering;
            ?>
" class="text_area" style="text-align: center" />
				</td>
				<td>
				<a href="<?php 
            echo $row->cat_link;
            ?>
" title="Editar Categoria">
				<?php 
            echo $row->name;
            ?>
				</a>
				</td>
				<td>
				<?php 
            echo $author;
            ?>
				</td>
				<td>
				<?php 
            echo $date;
            ?>
				</td>
			</tr>
			<?php 
            $k = 1 - $k;
        }
        ?>
		</table>

		<?php 
        echo $pageNav->getListFooter();
        ?>

		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="sectionid" value="<?php 
        echo $section->id;
        ?>
" />
		<input type="hidden" name="task" value="showarchive" />
		<input type="hidden" name="returntask" value="showarchive" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="hidemainmenu" value="0" />
		<input type="hidden" name="redirect" value="<?php 
        echo $redirect;
        ?>
" />
		<input type="hidden" name="<?php 
        echo josSpoofValue();
        ?>
" value="1" />
		</form>
		<?php 
    }
/**
* 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);
}