2 /************************************************************************
3 * MXChange v0.2.1 Start: 08/31/2008 *
4 * ================ Last change: 08/31/2008 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_surfbar_urls.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List all URLs in surfbar and sync from mail pool *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle URLs in Surfbar auflisten und syncen *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
48 // By default show the list...
51 // Check for 'id' element
52 if ((REQUEST_POST_COUNT() > 0) && ((!REQUEST_ISSET_POST('id')) || (!is_array(REQUEST_POST('id'))) || (count(REQUEST_POST('id')) == 0))) {
53 // Not found so output message
54 LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
60 // Edit or delete button hit?
61 if (REQUEST_ISSET_POST('edit')) {
62 // Show entries for editing
63 ADMIN_EDIT_ENTRIES_CONFIRM(
66 array('id', 'userid', 'url'),
67 array('bigintval', 'ADD_MEMBER_SELECTION_BOX', ''),
68 array('', array(false, true, true), '')
71 } elseif (REQUEST_ISSET_POST(('do_edit'))) {
72 // Change data of entries
73 ADMIN_EDIT_ENTRIES_CONFIRM(
81 } elseif (REQUEST_ISSET_POST('delete')) {
82 // Show entries for deletion
83 ADMIN_DELETE_ENTRIES_CONFIRM(
86 array('id', 'userid', 'url', 'registered'),
87 array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''),
91 } elseif (REQUEST_ISSET_POST(('do_delete'))) {
92 // Remove entries from database
93 ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), 'surfbar_urls', array(), array(), array(), true);
94 } elseif (REQUEST_ISSET_POST(('lock'))) {
95 // Un-/lock selected URLs. This does not work for pending URLs
96 ADMIN_LOCK_ENTRIES_CONFIRM(
99 array('id', 'userid', 'url', 'registered', 'status'),
100 array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'surfbarTranslateUserStatus'),
101 array('', '', '', '', '')
104 } elseif (REQUEST_ISSET_POST(('do_lock'))) {
105 // Un-/lock selected URLs. This does not work for pending URLs
106 ADMIN_LOCK_ENTRIES_CONFIRM(
112 array('status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
115 } elseif (REQUEST_ISSET_POST(('undelete'))) {
116 // Undelete selected URLs. This does only work for deleted URLs... ;-)
117 ADMIN_UNDELETE_ENTRIES_CONFIRM(
120 array('id', 'userid', 'url', 'registered', 'status'),
121 array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'surfbarTranslateUserStatus'),
122 array('', '', '', '', '')
125 } elseif (REQUEST_ISSET_POST(('do_undelete'))) {
126 // Undelete selected URLs. This does only work for deleted URLs... ;-)
127 ADMIN_UNDELETE_ENTRIES_CONFIRM(
133 array('status' => array('DELETED' => 'ACTIVE')),
139 if (!$show) return false;
142 $result = SQL_QUERY("SELECT id, userid, url, views_total, status, UNIX_TIMESTAMP(registered) AS registered, UNIX_TIMESTAMP(last_locked) AS last_locked, lock_reason
143 FROM `{!_MYSQL_PREFIX!}_surfbar_urls`
144 ORDER BY `id` ASC", __FILE__, __LINE__);
146 // Do we have some URLs left?
147 if (SQL_NUMROWS($result) > 0) {
150 while ($content = SQL_FETCHARRAY($result)) {
151 // "Translate"/add content
152 $content['sw'] = $SW;
153 $content['userid'] = generateUserProfileLink($content['userid']);
154 $content['url'] = FRAMETESTER($content['url']);
155 $content['views_total'] = translateComma($content['views_total']);
156 $content['status'] = surfbarTranslateUserStatus($content['status']);
157 $content['registered'] = generateDateTime($content['registered'], 2);
158 $content['last_locked'] = generateDateTime($content['last_locked'], 2);
159 if (empty($content['lock_reason'])) $content['lock_reason'] = '---';
162 $OUT .= LOAD_TEMPLATE('admin_list_surfbar_urls_row', true, $content);
168 // Load main template
169 LOAD_TEMPLATE('admin_list_surfbar_urls', false, $OUT);
171 // No URLs in surfbar
172 LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
176 SQL_FREERESULT($result);