Changeset 4 for branches

Show
Ignore:
Timestamp:
02/07/09 07:44:07 (3 years ago)
Author:
daris
Message:

portal: removing position field from pages db

Location:
branches/portal_by_daris
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/portal_by_daris/admin/pages.php

    r2 r4  
    3636{ 
    3737        $page_title = forum_trim($_POST['page_title']); 
    38         $position = intval($_POST['position']); 
    3938 
    4039        ($hook = get_hook('afo_add_forum_form_submitted')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 
     
    4443 
    4544        $query = array( 
    46                 'INSERT'        => 'title, position', 
     45                'INSERT'        => 'title', 
    4746                'INTO'          => 'pages', 
    48                 'VALUES'        => '\''.$forum_db->escape($page_title).'\', '.$position 
     47                'VALUES'        => '\''.$forum_db->escape($page_title).'\'' 
    4948        ); 
    5049 
     
    152151                require FORUM_ROOT.'footer.php'; 
    153152        } 
    154 } 
    155  
    156  
    157 // Update forum positions 
    158 else if (isset($_POST['update_positions'])) 
    159 { 
    160         $positions = array_map('intval', $_POST['position']); 
    161  
    162         ($hook = get_hook('afo_update_positions_form_submitted')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 
    163  
    164         $query = array( 
    165                 'SELECT'        => 'f.id, f.disp_position', 
    166                 'FROM'          => 'categories AS c', 
    167                 'JOINS'         => array( 
    168                         array( 
    169                                 'INNER JOIN'    => 'forums AS f', 
    170                                 'ON'                    => 'c.id=f.cat_id' 
    171                         ) 
    172                 ), 
    173                 'ORDER BY'      => 'c.disp_position, c.id, f.disp_position' 
    174         ); 
    175  
    176         ($hook = get_hook('afo_update_positions_qr_get_forums')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 
    177         $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); 
    178         while ($cur_page = $forum_db->fetch_assoc($result)) 
    179         { 
    180                 // If these aren't set, we're looking at a forum that was added after 
    181                 // the admin started editing: we don't want to mess with it 
    182                 if (isset($positions[$cur_page['id']])) 
    183                 { 
    184                         $new_disp_position = $positions[$cur_page['id']]; 
    185  
    186                         if ($new_disp_position < 0) 
    187                                 message($lang_admin_pages['Must be integer']); 
    188  
    189                         // We only want to update if we changed the position 
    190                         if ($cur_page['disp_position'] != $new_disp_position) 
    191                         { 
    192                                 $query = array( 
    193                                         'UPDATE'        => 'forums', 
    194                                         'SET'           => 'disp_position='.$new_disp_position, 
    195                                         'WHERE'         => 'id='.$cur_page['id'] 
    196                                 ); 
    197  
    198                                 ($hook = get_hook('afo_update_positions_qr_update_forum_position')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 
    199                                 $forum_db->query_build($query) or error(__FILE__, __LINE__); 
    200                         } 
    201                 } 
    202         } 
    203  
    204         // Regenerate the quickjump cache 
    205         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 
    206                 require FORUM_ROOT.'include/cache.php'; 
    207  
    208         generate_quickjump_cache(); 
    209  
    210         ($hook = get_hook('afo_update_positions_pre_redirect')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 
    211  
    212         redirect(forum_link($forum_url['admin_pages']), $lang_admin_pages['Forums updated'].' '.$lang_admin_common['Redirect']); 
    213153} 
    214154 
     
    382322                                        </div> 
    383323                                </div> 
    384 <?php ($hook = get_hook('afo_pre_new_forum_position')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 
    385                                 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 
    386                                         <div class="sf-box text"> 
    387                                                 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_pages['Position label'] ?></span></label><br /> 
    388                                                 <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="position" size="3" maxlength="3" /></span> 
    389                                         </div> 
    390                                 </div> 
    391324<?php ($hook = get_hook('afo_pre_add_forum_fieldset_end')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 
    392325                        </fieldset> 
     
    402335// Display all the categories and forums 
    403336$query = array( 
    404         'SELECT'        => 'pg.id, pg.title, pg.position', 
    405         'FROM'          => 'pages AS pg', 
    406         'ORDER BY'      => 'pg.position' 
     337        'SELECT'        => 'pg.id, pg.title', 
     338        'FROM'          => 'pages AS pg' 
    407339); 
    408340 
     
    446378<?php ($hook = get_hook('afo_pre_edit_cur_page_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 
    447379                                                <div class="mf-field mf-field1 forum-field"> 
    448                                                         <span class="aslabel">Forum name:</span> 
     380                                                        <span class="aslabel"><?php echo $lang_admin_pages['Page name'] ?></span> 
    449381                                                        <span class="fld-input"><?php echo forum_htmlencode($cur_page['title']) ?></span> 
    450                                                 </div> 
    451 <?php ($hook = get_hook('afo_pre_edit_cur_page_position')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 
    452                                                 <div class="mf-field"> 
    453                                                         <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_pages['Position label'] ?></span></label><br /> 
    454                                                         <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="position[<?php echo $cur_page['id'] ?>]" size="3" maxlength="3" value="<?php echo $cur_page['position'] ?>" /></span> 
    455382                                                </div> 
    456383                                        </div> 
     
    466393?> 
    467394                        </div> 
    468                         <div class="frm-buttons"> 
    469                                 <span class="submit"><input type="submit" class="button" name="update_positions" value="<?php echo $lang_admin_pages['Update positions'] ?>" /></span> 
    470                         </div> 
    471395                </form> 
    472396        </div> 
  • branches/portal_by_daris/install.php

    r2 r4  
    3434                                        'allow_null'    => false 
    3535                                ), 
    36                                 'position'              => array( 
    37                                         'datatype'              => 'INT(10) UNSIGNED', 
    38                                         'allow_null'    => true, 
    39                                         'default'       => 0 
    40                                 ), 
    4136                                'title'                 => array( 
    4237                                        'datatype'              => 'VARCHAR(255)', 
     
    5348                $forum_db->create_table('pages', $schema); 
    5449         
    55                 $forum_db->query('INSERT INTO '.$forum_db->prefix.'pages VALUES (0, 1, \'Example page\', \'Example content\')') or error(__FILE__, __LINE__); 
     50                $forum_db->query('INSERT INTO '.$forum_db->prefix.'pages (title, content) VALUES (\'Example page\', \'Example content\')') or error(__FILE__, __LINE__); 
    5651 
    5752 
  • branches/portal_by_daris/lang/English/admin_pages.php

    r2 r4  
    99'Delete'                                                =>      'Delete', 
    1010'Page name'                                     =>      'Page name:', 
    11 'Position label'                                =>      'Position', 
    1211'Delete page'                                   =>      'Delete page', 
    1312'Delete page warning'                   =>      '<strong>WARNING!</strong> Deleting a page will delete all posts (if any) in that page!', 
     
    2120'Page content'                                  =>      'Page content:', 
    2221'Page content help'                             =>      'You may use HTML in your content.', 
    23 'Edit pages head'                               =>      'Edit, delete or change the position of pages', 
     22'Edit pages head'                               =>      'Edit or delete page', 
    2423'Edit page details head'                =>      'Edit page details', 
    2524'Confirm delete page'                   =>      'You are deleting the page "%s"', 
    2625'Add page'                                              =>      'Add page', 
    27 'Add page head'                         =>      'Add a new page to the selected category at the specified position', 
     26'Add page head'                         =>      'Add a new page', 
    2827'Add page legend'                               =>      'Add page:', 
    29 'Update positions'                              =>      'Update positions', 
    3028'Page added'                                    =>      'Page added.', 
    3129'Page deleted'                                  =>      'Page deleted.',