source: extensions/AdditionalPages/admin/manage.inc.php @ 9263

Last change on this file since 9263 was 9263, checked in by patdenice, 10 years ago

Bugs corrected

File size: 1.6 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5if (isset($_GET['page_saved']))
6{
7  array_push($page['infos'], l10n('ap_saved_page'));
8}
9if (isset($_GET['page_deleted']))
10{
11  array_push($page['infos'], l10n('ap_deleted_page'));
12}
13
14if (isset($_POST['submit']))
15{
16  asort($_POST['position'], SORT_NUMERIC);
17  $pos = 1;
18  foreach($_POST['position'] as $id => $old_pos)
19  {
20    $num = isset($_POST['hide_'.$id]) ? -1 : +1;
21    $query = '
22UPDATE ' . ADD_PAGES_TABLE . '
23  SET pos = '.$num*abs($pos++).'
24  WHERE id = '.$id.'
25LIMIT 1
26;';
27    pwg_query($query);
28  }
29}
30
31$languages = get_languages();
32
33$query = 'SELECT id, pos, lang, title
34FROM '.ADD_PAGES_TABLE.'
35ORDER BY ABS(pos) ASC, id ASC
36;';
37$result = pwg_query($query);
38
39while ($row = pwg_db_fetch_assoc($result))
40{
41  $row['U_PAGE'] = make_index_url().'/page/'.(isset($row['permalink']) ? $row['permalink'] : $row['id']);
42  $row['U_EDIT'] = PHPWG_ROOT_PATH.'admin.php?page=plugin&amp;section='.AP_DIR.'%2Fadmin%2Fadmin.php&amp;tab=edit_page&amp;edit='.$row['id'];
43  $row['U_DELETE'] = PHPWG_ROOT_PATH.'admin.php?page=plugin&amp;section='.AP_DIR.'%2Fadmin%2Fadmin.php&amp;tab=edit_page&amp;edit='.$row['id'].'&amp;delete=';
44
45  $row['language'] = @$languages[$row['lang']];
46
47  $template->append('pages', $row);
48}
49
50$template->assign(array(
51  'F_ACTION' => $my_base_url.'&amp;tab=manage',
52  'HOMEPAGE' => $conf['additional_pages']['homepage'],
53  )
54);
55
56$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/manage.tpl'));
57$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
58
59?>
Note: See TracBrowser for help on using the repository browser.