Changeset 4 for branches/portal_by_daris/admin
- Timestamp:
- 02/07/09 07:44:07 (3 years ago)
- Files:
-
- 1 modified
-
branches/portal_by_daris/admin/pages.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/portal_by_daris/admin/pages.php
r2 r4 36 36 { 37 37 $page_title = forum_trim($_POST['page_title']); 38 $position = intval($_POST['position']);39 38 40 39 ($hook = get_hook('afo_add_forum_form_submitted')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; … … 44 43 45 44 $query = array( 46 'INSERT' => 'title , position',45 'INSERT' => 'title', 47 46 'INTO' => 'pages', 48 'VALUES' => '\''.$forum_db->escape($page_title).'\' , '.$position47 'VALUES' => '\''.$forum_db->escape($page_title).'\'' 49 48 ); 50 49 … … 152 151 require FORUM_ROOT.'footer.php'; 153 152 } 154 }155 156 157 // Update forum positions158 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 after181 // the admin started editing: we don't want to mess with it182 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 position190 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 cache205 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']);213 153 } 214 154 … … 382 322 </div> 383 323 </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>391 324 <?php ($hook = get_hook('afo_pre_add_forum_fieldset_end')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 392 325 </fieldset> … … 402 335 // Display all the categories and forums 403 336 $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' 407 339 ); 408 340 … … 446 378 <?php ($hook = get_hook('afo_pre_edit_cur_page_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 447 379 <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> 449 381 <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>455 382 </div> 456 383 </div> … … 466 393 ?> 467 394 </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>471 395 </form> 472 396 </div>