/**
  * **************************************************************************\
  * function page_list() - This Creates a list of pages that you can edit 	*
  * \**************************************************************************
  */
 function page_list()
 {
     $security = login::loginCheck('editpages', true);
     $display = '';
     if ($security === true) {
         // include global variables
         global $conn, $lang, $config;
         // Include the Form Generation Class
         include $config['basepath'] . '/include/class/form_generation.inc.php';
         $formGen = new formGeneration();
         // Include the misc Class
         require_once $config['basepath'] . '/include/misc.inc.php';
         $misc = new misc();
         // Grab a list of pages in the Database to Edit
         $default_value = '';
         if (isset($_POST['PageID'])) {
             $default_value = '';
             if ($_POST['PageID'] != '') {
                 $sql = "SELECT pagesmain_title FROM " . $config['table_prefix'] . "pagesmain WHERE pagesmain_id = {$_POST['PageID']}";
                 $recordSet = $conn->Execute($sql);
                 if (!$recordSet) {
                     $misc->log_error($sql);
                 }
                 $default_value = $misc->make_db_unsafe($recordSet->fields['pagesmain_title']);
             }
         }
         $sql = "SELECT pagesmain_title, pagesmain_id FROM " . $config['table_prefix'] . "pagesmain";
         $recordSet = $conn->Execute($sql);
         if (!$recordSet) {
             $misc->log_error($sql);
         }
         // Start the Form
         $display .= '<span class="section_header">' . $lang['admin_page_editor'] . '</span><br /><br />';
         $display .= $formGen->startform('index.php?action=edit_page', 'POST', 'multipart/form-data', 'PickPage');
         while (!$recordSet->EOF) {
             $options[$recordSet->fields['pagesmain_id']] = $recordSet->fields['pagesmain_title'];
             $recordSet->Movenext();
         }
         $display .= $formGen->create_select('PageID', '', false, 5, 0, false, 0, 0, $options, $default_value);
         // $display .= $recordSet->GetMenu('PageID',"$default_value",true);}
         $display .= $formGen->createformitem('submit', '', $lang['edit_page']);
         $display .= '<span style="margin-left:10px;"><a href="index.php?action=add_page">' . $lang['create_new_page'] . '</a></span>';
         $display .= $formGen->endform() . '<br />';
     }
     return $display;
 }