/**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function editSection($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 % 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 {
         $menu->type = 'content_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build the html select list for section
     $lists['componentid'] = mosAdminMenus::Section($menu, $uid);
     // 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_section_menu_html::editSection($menu, $lists, $params, $option);
 }
 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);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 public static function editSection($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);
     } else {
         $menu->type = 'content_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build the html select list for section
     $lists['componentid'] = mosAdminMenus::Section($menu, $uid);
     // 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_section_menu_html::editSection($menu, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function editCategory($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 {
         $menu->type = 'content_archive_category';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build the html select list for category
     $lists['componentid'] = mosAdminMenus::Category($menu, $uid);
     // 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_archive_category_menu_html::editCategory($menu, $lists, $params, $option);
 }
 /**
  * @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);
 }
 /**
  * @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);
 }
 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);
 }
Beispiel #10
0
 /**
  * @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($uid);
     $row = new mosComponent($database);
     // load the row from the db table
     $row->load($menu->componentid);
     // 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) {
         // do stuff for existing item
         $menu->checkout($my->id);
     } else {
         // do stuff for new item
         $menu->type = 'components';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link <> ''" . "\n ORDER BY c.name";
     $database->setQuery($query);
     $components = $database->loadObjectList();
     // build the html select list for section
     $lists['componentid'] = mosAdminMenus::Component($menu, $uid);
     // componentname
     $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid);
     // 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('com_xml', $row->option), 'component');
     components_menu_html::edit($menu, $components, $lists, $params, $option);
 }
 /**
  * @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);
     $row = new mosComponent($database);
     // load the row from the db table
     $row->load((int) $menu->componentid);
     // 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) {
         // do stuff for existing item
         $menu->checkout($my->id);
     } else {
         // do stuff for new item
         $menu->type = 'components';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link != ''" . "\n ORDER BY c.name";
     $database->setQuery($query);
     $components = $database->loadObjectList();
     // build the html select list for section
     $lists['componentid'] = mosAdminMenus::Component($menu, $uid);
     // componentname
     $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid);
     // 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('com_xml', $row->option), 'component');
     components_menu_html::edit($menu, $components, $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);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function editCategory($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 {
         $menu->type = 'weblink_category_table';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build list of categories
     $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_weblinks', intval($menu->componentid), NULL, 'ordering', 5, 0);
     if ($uid) {
         $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_weblinks'" . "\n AND published = '1'" . "\n AND id = " . $menu->componentid;
         $database->setQuery($query);
         $category = $database->loadResult();
         $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $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 mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     weblink_category_table_menu_html::editCategory($menu, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function editCategory($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 {
         $menu->type = 'newsfeed_category_table';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     // build list of categories
     $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_newsfeeds', intval($menu->componentid), NULL, 'name', 10, 0);
     if ($uid) {
         $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_newsfeeds'" . "\n AND published = 1" . "\n AND id = " . (int) $menu->componentid;
         $database->setQuery($query);
         $category = $database->loadResult();
         $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $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');
     newsfeed_category_table_menu_html::editCategory($menu, $lists, $params, $option);
 }
Beispiel #15
0
 /**
  * @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($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) {
         // do stuff for existing item
         $menu->checkout($my->id);
     } else {
         // do stuff for new item
         $menu->type = 'separator';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if (empty($menu->name)) {
         $menu->name = '- - - - - - -';
     }
     // 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);
     // get params definitions
     $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component');
     separator_menu_html::edit($menu, $lists, $params, $option);
 }
 /**
  * @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("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         // do stuff for existing item
         $menu->checkout($my->id);
     } else {
         // do stuff for new item
         $menu->type = 'separator';
         $menu->menutype = $menutype;
         $menu->browserNav = 0;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
     }
     if (empty($menu->name)) {
         $menu->name = '- - - - - - -';
     }
     // 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);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     separator_menu_html::edit($menu, $lists, $params, $option);
 }
Beispiel #17
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);
}
    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 = 'contact_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('contact_id=', $menu->link);
            $query = "SELECT *" . "\n FROM #__contact_details AS a" . "\n WHERE a.id = '" . $temp[1] . "'";
            $database->setQuery($query);
            $contact = $database->loadObjectlist();
            // outputs item name, category & section instead of the select list
            $lists['contact'] = '
			<table width="100%">
			<tr>
				<td width="10%">
				' . T_('Name:') . '
				</td>
				<td>
				' . $contact[0]->name . '
				</td>
			</tr>
			<tr>
				<td width="10%">
				' . T_('Position:') . '
				</td>
				<td>
				' . $contact[0]->con_position . '
				</td>
			</tr>
			</table>';
            $lists['contact'] .= '<input type="hidden" name="contact_item_link" value="' . $temp[1] . '" />';
            $contacts = '';
        } else {
            $query = "SELECT a.id AS value, CONCAT( a.name, ' - ',a.con_position ) AS text, a.catid " . "\n FROM #__contact_details 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);
            $contacts = $database->loadObjectList();
            //	Create a list of links
            $lists['contact'] = mosHTML::selectList($contacts, 'contact_item_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 mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
        contact_item_link_menu_html::edit($menu, $lists, $params, $option, $contacts);
    }
Beispiel #19
0
/**
* Compiles information to add or edit the record
* @param database A database connector object
* @param integer The unique id of the record to edit (0 if new)
* @param integer The id of the content section
*/
function editContent($uid = 0, $sectionid = 0, $option)
{
    global $database, $my, $mainframe, $adminLanguage;
    global $mosConfig_absolute_path, $mosConfig_live_site;
    $redirect = mosGetParam($_POST, 'redirect', '');
    if (!$redirect) {
        $redirect = $sectionid;
    }
    // load the row from the db table
    $row = new mosContent($database);
    $row->load($uid);
    if ($uid) {
        $sectionid = $row->sectionid;
        if ($row->state < 0) {
            mosRedirect('index2.php?option=com_content&sectionid=' . $row->sectionid, $adminLanguage->A_COMP_CONTENT_CANNOT);
        }
    }
    if ($sectionid == 0) {
        $where = "\n WHERE section NOT LIKE '%com_%'";
    } else {
        $where = "\n WHERE section='{$sectionid}'";
    }
    // get the type name - which is a special category
    if ($row->sectionid) {
        $query = "SELECT name FROM #__sections WHERE id={$row->sectionid}";
        $database->setQuery($query);
        $section = $database->loadResult();
        $contentSection = $section;
    } else {
        $query = "SELECT name FROM #__sections WHERE id={$sectionid}";
        $database->setQuery($query);
        $section = $database->loadResult();
        $contentSection = $section;
    }
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        mosRedirect("index2.php?option=com_content", $adminLanguage->A_COMP_CONTENT_MODULE . " " . $row->title . " " . $adminLanguage->A_COMP_CONTENT_ANOTHER);
    }
    if ($uid) {
        $row->checkout($my->id);
        if (trim($row->images)) {
            $row->images = explode("\n", $row->images);
        } else {
            $row->images = array();
        }
        if (trim($row->publish_down) == '0000-00-00 00:00:00') {
            $row->publish_down = 'Never';
        }
        $query = "SELECT name from #__users" . "\n WHERE id={$row->created_by}";
        $database->setQuery($query);
        $row->creator = $database->loadResult();
        $query = "SELECT name from #__users" . "\n WHERE id={$row->modified_by}";
        $database->setQuery($query);
        $row->modifier = $database->loadResult();
        $query = "SELECT content_id from #__content_frontpage" . "\n WHERE content_id={$row->id}";
        $database->setQuery($query);
        $row->frontpage = $database->loadResult();
        // get list of links to this item
        $and = "\n AND componentid = " . $row->id;
        $menus = mosAdminMenus::Links2Menu('content_item_link', $and);
    } else {
        $row->sectionid = $sectionid;
        $row->version = 0;
        $row->state = 1;
        $row->ordering = 0;
        $row->images = array();
        $row->publish_up = date('Y-m-d', time());
        $row->publish_down = 'Never';
        $row->catid = NULL;
        $row->creator = '';
        $row->modifier = '';
        $row->frontpage = 0;
        $menus = array();
    }
    $javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\"";
    $query = "SELECT s.id AS value, s.title AS text" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering";
    $database->setQuery($query);
    if ($sectionid == 0) {
        $sections[] = mosHTML::makeOption('-1', $adminLanguage->A_COMP_CONTENT_SELECT_SEC);
        $sections = array_merge($sections, $database->loadObjectList());
        $lists['sectionid'] = mosHTML::selectList($sections, 'sectionid', 'class="inputbox" size="1" ' . $javascript, 'value', 'text');
    } else {
        $lists['sectionid'] = mosHTML::selectList($database->loadObjectList(), 'sectionid', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', intval($row->sectionid));
    }
    $sections = $database->loadObjectList();
    $sectioncategories = array();
    $sectioncategories[-1] = array();
    $sectioncategories[-1][] = mosHTML::makeOption('-1', $adminLanguage->A_COMP_CONTENT_SELECT_CAT);
    foreach ($sections as $section) {
        $sectioncategories[$section->value] = array();
        $query = "SELECT id AS value, name AS text" . "\n FROM #__categories" . "\n WHERE section='{$section->value}'" . "\n ORDER BY ordering";
        $database->setQuery($query);
        $rows2 = $database->loadObjectList();
        foreach ($rows2 as $row2) {
            $sectioncategories[$section->value][] = mosHTML::makeOption($row2->value, $row2->text);
        }
    }
    //echo "<div align=left><pre>"; print_r($sectioncategories); die;
    $query = "SELECT id AS value, name AS text" . "\n FROM #__categories" . $where . "\n ORDER BY ordering";
    $database->setQuery($query);
    if (!$row->catid && !$row->sectionid) {
        // get list of categories
        $categories[] = mosHTML::makeOption('-1', $adminLanguage->A_COMP_CONTENT_SELECT_CAT);
        /*
        $categories = array_merge( $categories, $database->loadObjectList() );
        if (count( $categories ) < 2) {
        	mosRedirect( 'index2.php?option=com_categories&section='. $sectionid, 'You must add a category for this section first.' );
        }
        */
        $lists['catid'] = mosHTML::selectList($categories, 'catid', 'class="inputbox" size="1"', 'value', 'text');
    } else {
        $lists['catid'] = mosHTML::selectList($database->loadObjectList(), 'catid', 'class="inputbox" size="1"', 'value', 'text', intval($row->catid));
    }
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__content" . "\n WHERE catid='{$row->catid}'" . "\n AND state >= 0" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query, 1);
    // 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 select list for the image positions
    $lists['_align'] = mosAdminMenus::Positions('_align');
    // 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();
    // get params definitions
    $params =& new mosParameters($row->attribs, $mainframe->getPath('com_xml', 'com_content'), 'component');
    HTML_content::editContent($row, $contentSection, $lists, $sectioncategories, $images, $my->id, $params, $option, $redirect, $menus);
}
/**
* 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);
}
Beispiel #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 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 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_item_link';
            $menu->menutype = $menutype;
            $menu->browserNav = 0;
            $menu->ordering = 9999;
            $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
            $menu->published = 1;
        }
        if ($uid) {
            $link = 'javascript:submitbutton( \'redirect\' );';
            $temp = explode('id=', $menu->link);
            $query = "SELECT a.title, c.name AS category, s.name AS section" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS c ON a.catid = c.id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.id = '" . $temp[1] . "'";
            $database->setQuery($query);
            $content = $database->loadObjectlist();
            // outputs item name, category & section instead of the select list
            $lists['content'] = '
			<table width="100%">
			<tr>
				<td width="10%">
				Item:
				</td>
				<td>
				<a href="' . $link . '" title="' . T_('Edit Content Item') . '">
				' . $content[0]->title . '
				</a>
				</td>
			</tr>
			<tr>
				<td width="10%">
				' . T_('Category:') . '
				</td>
				<td>
				' . $content[0]->category . '
				</td>
			</tr>
			<tr>
				<td width="10%">
				' . T_('Section:') . '
				</td>
				<td>
				' . $content[0]->section . '
				</td>
			</tr>
			</table>';
            $contents = '';
            $lists['content'] .= '<input type="hidden" name="content_item_link" value="' . $temp[1] . '" />';
        } else {
            $query = "SELECT a.id AS value, a.title AS text, a.sectionid, a.catid " . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n INNER JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.state = '1'" . "\n ORDER BY a.sectionid, a.catid, a.title";
            $database->setQuery($query);
            $contents = $database->loadObjectList();
            foreach ($contents as $content) {
                $database->setQuery("SELECT s.title" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND s.id = '" . $content->sectionid . "'");
                $section = $database->loadResult();
                $database->setQuery("SELECT c.title" . "\n FROM #__categories AS c" . "\n WHERE c.id = '" . $content->catid . "'");
                $category = $database->loadResult();
                $value = $content->value;
                $text = $section . " - " . $category . " / " . $content->text . "&nbsp;&nbsp;&nbsp;&nbsp;";
                $temp[] = mosHTML::makeOption($value, $text);
                $contents = $temp;
            }
            //	Create a list of links
            $lists['content'] = mosHTML::selectList($contents, 'content_item_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 mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
        content_item_link_menu_html::edit($menu, $lists, $params, $option, $contents);
    }
    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);
    }
Beispiel #24
0
function editItem($uid, $gid, &$access, $sectionid = 0, $task, $Itemid)
{
    global $database, $mainframe, $my;
    global $mosConfig_absolute_path, $mosConfig_live_site;
    $row = new mosContent($database);
    // load the row from the db table
    $row->load($uid);
    if ($uid) {
        // existing record
        if (!($access->canEdit || $access->canEditOwn && $row->created_by == $my->id)) {
            mosNotAuth();
            return;
        }
    } else {
        // new record
        if (!($access->canEdit || $access->canEditOwn)) {
            mosNotAuth();
            return;
        }
    }
    if ($uid) {
        $sectionid = $row->sectionid;
    }
    $lists = array();
    // get the type name - which is a special category
    $database->setQuery("SELECT name FROM #__sections WHERE id={$sectionid}");
    $section = $database->loadResult();
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        echo "<script>alert('The module " . $row->title . " is currently being edited by another person.')</script>";
        mosRedirect('index.php?option=com_content&amp;task=view&amp;id=' . $row->id);
    }
    if ($uid == 0) {
        $row->catid = 0;
    }
    if ($uid) {
        $row->checkout($my->id);
        if (trim($row->publish_down) == "0000-00-00 00:00:00") {
            $row->publish_down = "Never";
        }
        if (trim($row->images)) {
            $row->images = explode("\n", $row->images);
        } else {
            $row->images = array();
        }
        $database->setQuery("SELECT name from #__users" . "\n WHERE id = " . $row->created_by);
        $row->creator = $database->loadResult();
        $database->setQuery("SELECT name from #__users" . "\n WHERE id = " . $row->modified_by);
        $row->modifier = $database->loadResult();
        $database->setQuery("SELECT content_id from #__content_frontpage" . "\n WHERE content_id = " . $row->id);
        $row->frontpage = $database->loadResult();
    } else {
        $row->sectionid = $sectionid;
        $row->version = 0;
        $row->state = 0;
        $row->ordering = 0;
        $row->images = array();
        $row->publish_up = date('Y-m-d', time());
        $row->publish_down = 'Never';
        $row->creator = 0;
        $row->modifier = 0;
        $row->frontpage = 0;
    }
    // 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);
    // make the select list for the states
    $states[] = mosHTML::makeOption(0, _CMN_UNPUBLISHED);
    $states[] = mosHTML::makeOption(1, _CMN_PUBLISHED);
    $lists['state'] = mosHTML::selectList($states, 'state', 'class="inputbox" size="1"', 'value', 'text', intval($row->state));
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__content" . "\n WHERE catid = '{$row->catid}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query, 1);
    // build list of categories
    $lists['catid'] = mosAdminMenus::ComponentCategory('catid', $sectionid, intval($row->catid));
    // build the select list for the image positions
    $lists['_align'] = mosAdminMenus::Positions('_align');
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    HTML_content::editContent($row, $section, $lists, $images, $access, $my->id, $sectionid, $task, $Itemid);
}
    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("The module " . $menu->title . " is currently being edited by another administrator");
        }
        if ($uid) {
            $menu->checkout($my->id);
        } else {
            // load values for new entry
            $menu->type = 'content_item_link';
            $menu->menutype = $menutype;
            $menu->browserNav = 0;
            $menu->ordering = 9999;
            $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
            $menu->published = 1;
        }
        if ($uid) {
            $link = 'javascript:submitbutton( \'redirect\' );';
            $temp = explode('id=', $menu->link);
            $query = "SELECT a.title, c.name AS category, s.name AS section" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS c ON a.catid = c.id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.id = " . (int) $temp[1];
            $database->setQuery($query);
            $content = $database->loadObjectlist();
            // outputs item name, category & section instead of the select list
            $lists['content'] = '
			<table width="100%">
			<tr>
				<td width="10%">
				Item:
				</td>
				<td>
				<a href="' . $link . '" title="Edit Content Item">
				' . $content[0]->title . '
				</a>
				</td>
			</tr>
			<tr>
				<td width="10%">
				Category:
				</td>
				<td>
				' . $content[0]->category . '
				</td>
			</tr>
			<tr>
				<td width="10%">
				Section:
				</td>
				<td>
				' . $content[0]->section . '
				</td>
			</tr>
			</table>';
            $contents = '';
            $lists['content'] .= '<input type="hidden" name="content_item_link" value="' . $temp[1] . '" />';
        } else {
            $query = "SELECT a.id AS value," . "\n CONCAT(s.title, ' - ',c.title,' / ',a.title, '&nbsp;&nbsp;&nbsp;&nbsp;') AS text" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n INNER JOIN #__sections AS s ON a.sectionid = s.id AND s.scope = 'content'" . "\n WHERE a.state = 1" . "\n ORDER BY a.sectionid, a.catid, a.title";
            $database->setQuery($query);
            $contents = $database->loadObjectList();
            //	Create a list of links
            $lists['content'] = mosHTML::selectList($contents, 'content_item_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');
        content_item_link_menu_html::edit($menu, $lists, $params, $option, $contents);
    }
Beispiel #26
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 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($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        echo "<script>alert('" . sprintf(T_('The module %s is currently being edited by another administrator'), $row->title) . "'); document.location.href='index2.php?option={$option}'</script>\n";
        exit(0);
    }
    $row->title = htmlspecialchars(str_replace('&amp;', '&', $row->title));
    $row->content = htmlspecialchars(str_replace('&amp;', '&', $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 <> ''";
    $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 FROM #__modules_menu WHERE moduleid=' . $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'] = T_('Administrator') . '<input type="hidden" name="access" value="99" />';
        $lists['showtitle'] = T_('N/A') . ' <input type="hidden" name="showtitle" value="1" />';
        $lists['selections'] = T_('N/A');
    } else {
        if ($client == 'admin') {
            $lists['access'] = T_('N/A');
            $lists['selections'] = T_('N/A');
        } else {
            $lists['access'] = mosAdminMenus::Access($row);
            $lists['groups'] = mosAdminMenus::groupAccess($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);
    // xml file for module
    $xmlfile = $mainframe->getPath($path, $row->module);
    if ($xmlfile) {
        $xmlparser =& new mosXMLDescription($xmlfile);
        $row->description = $xmlparser->getDescription('module');
    } else {
        $row->description = '';
    }
    // get params definitions
    $params =& new mosAdminParameters($row->params, $xmlfile, 'module');
    HTML_modules::editModule($row, $orders2, $lists, $params, $option);
}
Beispiel #27
0
/**
* Creates a new or edits and existing user record
* @param int The id of the record, 0 if a new entry
* @param string The current GET/POST option
*/
function editContact($id, $option)
{
    global $database, $my;
    global $mosConfig_absolute_path;
    $row = new mosContact($database);
    // load the row from the db table
    $row->load($id);
    if ($id) {
        // do stuff for existing records
        $row->checkout($my->id);
    } else {
        // do stuff for new records
        $row->imagepos = 'top';
        $row->ordering = 0;
        $row->published = 1;
    }
    $lists = array();
    // build the html select list for ordering
    $query = "SELECT ordering AS value, name AS text" . "\n FROM #__contact_details" . "\n WHERE published >= 0" . "\n AND catid = '{$row->catid}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1);
    // build list of users
    $lists['user_id'] = mosAdminMenus::UserSelect('user_id', $row->user_id, 1);
    // build list of categories
    $lists['catid'] = mosAdminMenus::ComponentCategory('catid', 'com_contact_details', intval($row->catid));
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoradioList('published', '', $row->published);
    // build the html radio buttons for default
    $lists['default_con'] = mosHTML::yesnoradioList('default_con', '', $row->default_con);
    // get params definitions
    $file = $mosConfig_absolute_path . '/administrator/components/com_contact/contact_items.xml';
    $params =& new mosAdminParameters($row->params, $file, 'component');
    HTML_contact::editcontact($row, $lists, $option, $params);
}
Beispiel #28
0
/**
* Compiles information to add or edit a category
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editCategory($uid = 0, $section = '')
{
    global $database, $my, $adminLanguage;
    global $mosConfig_absolute_path, $mosConfig_live_site;
    $type = mosGetParam($_REQUEST, 'type', '');
    $redirect = mosGetParam($_POST, 'section', '');
    $row = new mosCategory($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) {
        mosRedirect('index2.php?option=categories&section=' . $row->section, $adminLanguage->A_COMP_CATEG_MESSAGE . " " . $row->title . " " . $adminLanguage->A_COMP_CATEG_MESSAGE2);
    }
    if ($uid) {
        // existing record
        $row->checkout($my->id);
        // code for Link Menu
        if ($row->section > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . $row->id . "\n AND ( type = 'content_archive_category' OR type = 'content_blog_category' OR type = 'content_category' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_category':
                        $menus[$i]->type = $adminLanguage->A_COMP_CATEG_TABLE;
                        break;
                    case 'content_blog_category':
                        $menus[$i]->type = $adminLanguage->A_COMP_CATEG_BLOG;
                        break;
                    case 'content_archive_category':
                        $menus[$i]->type = $adminLanguage->A_COMP_CATEG_BLOG_ARCHIVE;
                        break;
                }
            }
        } else {
            $menus = array();
        }
    } else {
        // new record
        $row->section = $section;
        $row->published = 1;
        $menus = NULL;
    }
    // make order list
    $order = array();
    $database->setQuery("SELECT COUNT(*) FROM #__categories WHERE section='{$row->section}'");
    $max = intval($database->loadResult()) + 1;
    for ($i = 1; $i < $max; $i++) {
        $order[] = mosHTML::makeOption($i);
    }
    // build the html select list for sections
    if ($section == 'content') {
        $query = "SELECT s.id AS value, s.title AS text" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering";
        $database->setQuery($query);
        $sections = $database->loadObjectList();
        $lists['section'] = mosHTML::selectList($sections, 'section', 'class="inputbox" size="1"', 'value', 'text');
    } else {
        if ($type == 'other') {
            $section_name = 'N/A';
        } else {
            $temp = new mosSection($database);
            $temp->load($row->section);
            $section_name = $temp->name;
        }
        $lists['section'] = '<input type="hidden" name="section" value="' . $row->section . '" />' . $section_name;
    }
    // build the html select list for category types
    $types[] = mosHTML::makeOption('', $adminLanguage->A_COMP_CATEG_SELECT_TYPE);
    $types[] = mosHTML::makeOption('content_category', $adminLanguage->A_COMP_CATEG_TABLE);
    $types[] = mosHTML::makeOption('content_blog_category', $adminLanguage->A_COMP_CATEG_BLOG);
    $types[] = mosHTML::makeOption('content_archive_category', $adminLanguage->A_COMP_CATEG_BLOG_ARCHIVE);
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__categories" . "\n WHERE section = '{$row->section}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0, 0);
    // Imagelist
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    categories_html::edit($row, $section, $lists, $redirect, $menus);
}
Beispiel #29
0
/**
* 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;
    $row = new mosContent($database);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $row->title) . "'); document.location.href='index2.php?option={$option}'</script>\n";
        exit(0);
    }
    $lists = array();
    if ($uid) {
        // load the row from the db table
        $row->load($uid);
        $row->checkout($my->id);
        if (trim($row->images)) {
            $row->images = explode("\n", $row->images);
        } else {
            $row->images = array();
        }
        if (trim($row->publish_down) == "0000-00-00 00:00:00") {
            $row->publish_down = "Never";
        }
        $query = "SELECT name from #__users" . "\n WHERE id={$row->created_by}";
        $database->setQuery($query);
        $row->creator = $database->loadResult();
        $query = "SELECT name from #__users" . "\n WHERE id={$row->modified_by}";
        $database->setQuery($query);
        $row->modifier = $database->loadResult();
        $query = "SELECT content_id from #__content_frontpage" . "\n WHERE content_id={$row->id}";
        $database->setQuery($query);
        $row->frontpage = $database->loadResult();
        // get list of links to this item
        $_and = "\n AND componentid = " . $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", time());
        $row->publish_down = "Never";
        $row->sectionid = 0;
        $row->catid = 0;
        $row->creator = '';
        $row->modifier = '';
        $row->ordering = 0;
        $row->frontpage = 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', T_('Bottom'));
    $pos[] = mosHTML::makeOption('top', T_('Top'));
    $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
    // get params definitions
    $params =& new mosAdminParameters($row->attribs, $mainframe->getPath('com_xml', 'com_typedcontent'), 'component');
    HTML_typedcontent::edit($row, $images, $lists, $params, $option, $menus);
}
/**
* Compiles information to add or edit a section
* @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)
* @param string The name of the current user
*/
function editSection($uid = 0, $scope = '', $option)
{
    global $database, $my, $mainframe;
    $row = new mosSection($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        $msg = 'The section ' . $row->title . ' is currently being edited by another administrator';
        mosRedirect('index2.php?option=' . $option . '&scope=' . $row->scope . '&mosmsg=' . $msg);
    }
    $selected_folders = NULL;
    if ($uid) {
        $row->checkout($my->id);
        if ($row->id > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . "\n AND ( type = 'content_archive_section' OR type = 'content_blog_section' OR type = 'content_section' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_section':
                        $menus[$i]->type = 'Section Table';
                        break;
                    case 'content_blog_section':
                        $menus[$i]->type = 'Section Blog';
                        break;
                    case 'content_archive_section':
                        $menus[$i]->type = 'Section Blog Archive';
                        break;
                }
            }
        } else {
            $menus = array();
        }
        // handling for MOSImage directories
        if (trim($row->params)) {
            // get params definitions
            $params = new mosParameters($row->params, $mainframe->getPath('com_xml', 'com_sections'), 'component');
            $temps = $params->get('imagefolders', '');
            $temps = explode(',', $temps);
            foreach ($temps as $temp) {
                $selected_folders[] = mosHTML::makeOption($temp, $temp);
            }
        } else {
            $selected_folders[] = mosHTML::makeOption('*1*');
        }
    } else {
        $row->scope = $scope;
        $row->published = 1;
        $menus = array();
        // handling for MOSImage directories
        $selected_folders[] = mosHTML::makeOption('*1*');
    }
    // build the html select list for section types
    $types[] = mosHTML::makeOption('', 'Select Type');
    $types[] = mosHTML::makeOption('content_section', 'Section List');
    $types[] = mosHTML::makeOption('content_blog_section', 'Section Blog');
    $types[] = mosHTML::makeOption('content_archive_section', 'Section Archive Blog');
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__sections" . "\n WHERE scope=" . $database->Quote($row->scope) . " ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0);
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    // list of folders in images/stories/
    $imgFiles = recursive_listdir(COM_IMAGE_BASE);
    $len = strlen(COM_IMAGE_BASE);
    // handling for MOSImage directories
    $folders[] = mosHTML::makeOption('*1*', 'All');
    $folders[] = mosHTML::makeOption('*0*', 'None');
    $folders[] = mosHTML::makeOption('*#*', '---------------------');
    $folders[] = mosHTML::makeOption('/');
    foreach ($imgFiles as $file) {
        $folders[] = mosHTML::makeOption(substr($file, $len));
    }
    $lists['folders'] = mosHTML::selectList($folders, 'folders[]', 'class="inputbox" size="17" multiple="multiple"', 'value', 'text', $selected_folders);
    sections_html::edit($row, $option, $lists, $menus);
}