/** * @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); }
/** * Compiles information to add or edit * @param integer The unique id of the record to edit (0 if new) */ function editWeblink($option, $id) { global $database, $my, $mosConfig_absolute_path; $lists = array(); $row = new mosWeblink($database); // load the row from the db table $row->load((int) $id); // fail if checked out not by 'me' if ($row->isCheckedOut($my->id)) { mosRedirect('index2.php?option=' . $option, 'The module $row->title is currently being edited by another administrator.'); } if ($id) { $row->checkout($my->id); } else { // initialise new record $row->published = 1; $row->approved = 1; $row->order = 0; $row->catid = intval(mosGetParam($_POST, 'catid', 0)); } // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" . "\n FROM #__weblinks" . "\n WHERE catid = " . (int) $row->catid . "\n ORDER BY ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1); // build list of categories $lists['catid'] = mosAdminMenus::ComponentCategory('catid', $option, intval($row->catid)); // build the html select list $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published); $file = $mosConfig_absolute_path . '/administrator/components/com_weblinks/weblinks_item.xml'; $params = new mosParameters($row->params, $file, 'component'); HTML_weblinks::editWeblink($row, $lists, $params, $option); }
function editWebLink($id, $option) { global $database, $my; if ($my->gid < 1) { mosNotAuth(); return; } // security check to see if link exists in a menu $link = 'index.php?option=com_weblinks&task=new'; $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE link LIKE '%{$link}%'" . "\n AND published = 1"; $database->setQuery($query); $exists = $database->loadResult(); if (!$exists) { mosNotAuth(); return; } $row = new mosWeblink($database); // load the row from the db table $row->load((int) $id); // fail if checked out not by 'me' if ($row->isCheckedOut($my->id)) { mosRedirect("index2.php?option={$option}", 'The module $row->title is currently being edited by another administrator.'); } if ($id) { $row->checkout($my->id); } else { // initialise new record $row->published = 0; $row->approved = 1; $row->ordering = 0; } // build list of categories $lists['catid'] = mosAdminMenus::ComponentCategory('catid', $option, intval($row->catid)); HTML_weblinks::editWeblink($option, $row, $lists); }
/** * 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); }
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&task=view&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); }
/** * Creates a new or edits and existing user record * @param int The id of the user, 0 if a new entry * @param string The current GET/POST option */ function editNewsFeed($id, $option) { global $database, $my; $catid = intval(mosGetParam($_REQUEST, 'catid', 0)); $row = new mosNewsFeed($database); // load the row from the db table $row->load((int) $id); if ($id) { // do stuff for existing records $row->checkout($my->id); } else { // do stuff for new records $row->ordering = 0; $row->numarticles = 5; $row->cache_time = 3600; $row->published = 1; } // build the html select list for ordering $query = "SELECT a.ordering AS value, a.name AS text" . "\n FROM #__newsfeeds AS a" . "\n ORDER BY a.ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1); // build list of categories $lists['category'] = mosAdminMenus::ComponentCategory('catid', $option, intval($row->catid)); // build the html select list $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published); HTML_newsfeeds::editNewsFeed($row, $lists, $option); }
function editItem($uid, $gid, &$access, $sectionid = 0, $task, $Itemid) { global $database, $my, $mainframe; global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset; $nullDate = $database->getNullDate(); $row = new mosContent($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 person."); } 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 ($Itemid == 0 || $Itemid == 99999999) { // security check to see if link exists in a menu $link = 'index.php?option=com_content&task=new§ionid=' . (int) $sectionid; $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE (link LIKE '%{$link}' OR link LIKE '%{$link}&%')" . "\n AND published = 1"; $database->setQuery($query); $exists = $database->loadResult(); if (!$exists) { mosNotAuth(); return; } } } if ($uid) { $sectionid = $row->sectionid; } $lists = array(); // get the type name - which is a special category $query = "SELECT name FROM #__sections" . "\n WHERE id = " . (int) $sectionid; $database->setQuery($query); $section = $database->loadResult(); if ($uid == 0) { $row->catid = 0; } if ($uid) { $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(); } $query = "SELECT content_id" . "\n FROM #__content_frontpage" . "\n WHERE content_id = " . (int) $row->id; $database->setQuery($query); $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 H:i:s', time() + $mosConfig_offset * 60 * 60); $row->publish_down = 'Never'; $row->creator = 0; $row->modifier = 0; $row->frontpage = 0; } // pull param column from category info $query = "SELECT params" . "\n FROM #__categories" . "\n WHERE id = " . (int) $row->catid; $database->setQuery($query); $categoryParam = $database->loadResult(); $paramsCat = new mosParameters($categoryParam, $mainframe->getPath('com_xml', 'com_categories'), 'component'); $selected_folders = $paramsCat->get('imagefolders', ''); if (!$selected_folders) { $selected_folders = '*2*'; } // check if images utilizes settings from section if (strpos($selected_folders, '*2*') !== false) { unset($selected_folders); // load param column from section info $query = "SELECT params" . "\n FROM #__sections" . "\n WHERE id = " . (int) $row->sectionid; $database->setQuery($query); $sectionParam = $database->loadResult(); $paramsSec = new mosParameters($sectionParam, $mainframe->getPath('com_xml', 'com_sections'), 'component'); $selected_folders = $paramsSec->get('imagefolders', ''); } if (trim($selected_folders)) { $temps = explode(',', $selected_folders); foreach ($temps as $temp) { $folders[] = mosHTML::makeOption($temp, $temp); } } else { $folders[] = mosHTML::makeOption('*1*'); } // calls function to read image from directory $pathA = $mosConfig_absolute_path . '/images/stories'; $pathL = $mosConfig_live_site . '/images/stories'; $images = array(); if ($folders[0]->value == '*1*') { $folders = array(); $folders[] = mosHTML::makeOption('/'); mosAdminMenus::ReadImages($pathA, '/', $folders, $images); } else { mosAdminMenus::ReadImagesX($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, $folders); // 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 = " . (int) $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); // build the select list for the image caption alignment $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align'); // build the html select list for the group access // 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'); HTML_content::editContent($row, $section, $lists, $images, $access, $my->id, $sectionid, $task, $Itemid); }
function editWebLink($id, $option) { global $database, $my; global $mosConfig_absolute_path, $mosConfig_live_site; if ($my->gid < 1) { mosNotAuth(); return; } $row = new mosWeblink($database); // load the row from the db table $row->load($id); // fail if checked out not by 'me' if ($row->checked_out && $row->checked_out != $my->id) { mosRedirect("index2.php?option={$option}", 'The module $row->title is currently being edited by another administrator.'); } if ($id) { $row->checkout($my->id); } else { // initialise new record $row->published = 0; $row->approved = 0; $row->ordering = 0; } /* // make the select list for the image positions $yesno[] = mosHTML::makeOption( '0', 'No' ); $yesno[] = mosHTML::makeOption( '1', 'Yes' ); // build the html select list $applist = mosHTML::selectList( $yesno, 'approved', 'class="inputbox" size="2"', 'value', 'text', $row->approved ); // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" . "\n FROM #__weblinks" . "\n WHERE catid='$row->catid'" . "\n ORDER BY ordering" ; $lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $id, $query, 1 ); */ // build list of categories $lists['catid'] = mosAdminMenus::ComponentCategory('catid', $option, intval($row->catid)); HTML_weblinks::editWeblink($option, $row, $lists); }
/** * Compiles information to add or edit * @param integer The unique id of the record to edit (0 if new) */ function editWeblink($option, $id) { global $database, $my, $mosConfig_absolute_path, $mosConfig_live_site; global $adminLanguage; $lists = array(); $row = new mosWeblink($database); // load the row from the db table $row->load($id); // fail if checked out not by 'me' if ($row->checked_out && $row->checked_out != $my->id) { mosRedirect("index2.php?option=" . $option, $adminLanguage->A_COMP_CONTENT_MODULE . " " . $row->title . " " . $adminLanguage->A_COMP_ANOTHER_ADMIN); } if ($id) { $row->checkout($my->id); } else { // initialise new record $row->published = 1; $row->approved = 1; $row->order = 0; } // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" . "\n FROM #__weblinks" . "\n WHERE catid='{$row->catid}'" . "\n ORDER BY ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1); // build list of categories $lists['catid'] = mosAdminMenus::ComponentCategory('catid', $option, intval($row->catid)); // build the html select list $lists['approved'] = mosHTML::yesnoRadioList('approved', 'class="inputbox"', $row->approved); // build the html select list $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published); HTML_weblinks::editWeblink($row, $lists, $option); }