[9261] | 1 | <?php |
---|
| 2 | |
---|
| 3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 4 | |
---|
| 5 | if (isset($_GET['page_saved'])) |
---|
| 6 | { |
---|
| 7 | array_push($page['infos'], l10n('ap_saved_page')); |
---|
| 8 | } |
---|
| 9 | if (isset($_GET['page_deleted'])) |
---|
| 10 | { |
---|
| 11 | array_push($page['infos'], l10n('ap_deleted_page')); |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | if (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 = ' |
---|
| 22 | UPDATE ' . ADD_PAGES_TABLE . ' |
---|
| 23 | SET pos = '.$num*abs($pos++).' |
---|
| 24 | WHERE id = '.$id.' |
---|
| 25 | LIMIT 1 |
---|
| 26 | ;'; |
---|
| 27 | pwg_query($query); |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | $languages = get_languages(); |
---|
| 32 | |
---|
[9313] | 33 | $query = 'SELECT id, pos, lang, title, standalone |
---|
[9261] | 34 | FROM '.ADD_PAGES_TABLE.' |
---|
| 35 | ORDER BY ABS(pos) ASC, id ASC |
---|
| 36 | ;'; |
---|
| 37 | $result = pwg_query($query); |
---|
| 38 | |
---|
| 39 | while ($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&section='.AP_DIR.'%2Fadmin%2Fadmin.php&tab=edit_page&edit='.$row['id']; |
---|
| 43 | $row['U_DELETE'] = PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.AP_DIR.'%2Fadmin%2Fadmin.php&tab=edit_page&edit='.$row['id'].'&delete='; |
---|
| 44 | |
---|
| 45 | $row['language'] = @$languages[$row['lang']]; |
---|
| 46 | |
---|
| 47 | $template->append('pages', $row); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | $template->assign(array( |
---|
[9263] | 51 | 'F_ACTION' => $my_base_url.'&tab=manage', |
---|
[9261] | 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 | ?> |
---|