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 - 2009 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')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 // By default show the list...
50 // Check for 'id' element
51 if ((countRequestPost() > 0) && ((!isPostRequestElementSet('id')) || (!is_array(postRequestElement('id'))) || (count(postRequestElement('id')) == '0'))) {
52 // Not found so output message
53 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
59 // Edit or delete button hit?
60 if (isPostRequestElementSet('edit')) {
61 // Show entries for editing
62 adminEditEntriesConfirm(
63 postRequestElement('id'),
65 array('id', 'userid', 'url'),
66 array('bigintval', 'addMemberSelectionBox', ''),
67 array('', array(false, true, true), '')
70 } elseif (isPostRequestElementSet('do_edit')) {
71 // Change data of entries
72 adminEditEntriesConfirm(
73 postRequestElement('id'),
80 } elseif (isPostRequestElementSet('delete')) {
81 // Show entries for deletion
82 adminDeleteEntriesConfirm(
83 postRequestElement('id'),
85 array('id', 'userid', 'url', 'registered'),
86 array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''),
90 } elseif (isPostRequestElementSet('do_delete')) {
91 // Remove entries from database
92 adminDeleteEntriesConfirm(postRequestElement('id'), 'surfbar_urls', array(), array(), array(), true);
93 } elseif (isPostRequestElementSet('lock')) {
94 // Un-/lock selected URLs. This does not work for pending URLs
95 adminLockEntriesConfirm(
96 postRequestElement('id'),
98 array('id', 'userid', 'url', 'registered', 'status'),
99 array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
100 array('', '', '', '', '')
103 } elseif (isPostRequestElementSet('do_lock')) {
104 // Un-/lock selected URLs. This does not work for pending URLs
105 adminLockEntriesConfirm(
106 postRequestElement('id'),
111 array('status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
114 } elseif (isPostRequestElementSet('undelete')) {
115 // Undelete selected URLs. This does only work for deleted URLs... ;-)
116 adminUndeleteEntriesConfirm(
117 postRequestElement('id'),
119 array('id', 'userid', 'url', 'registered', 'status'),
120 array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
121 array('', '', '', '', '')
124 } elseif (isPostRequestElementSet('do_undelete')) {
125 // Undelete selected URLs. This does only work for deleted URLs... ;-)
126 adminUndeleteEntriesConfirm(
127 postRequestElement('id'),
132 array('status' => array('DELETED' => 'ACTIVE')),
138 if ($show === false) return false;
141 $result = SQL_QUERY("SELECT
142 `id`, `userid`, `url`, `views_total`, `status`,
143 UNIX_TIMESTAMP(`registered`) AS registered,
144 UNIX_TIMESTAMP(`last_locked`) AS last_locked,
147 `{?_MYSQL_PREFIX?}_surfbar_urls`
149 `id` ASC", __FILE__, __LINE__);
151 // Do we have some URLs left?
152 if (SQL_NUMROWS($result) > 0) {
155 while ($content = SQL_FETCHARRAY($result)) {
156 // "Translate"/add content
157 $content['sw'] = $SW;
158 $content['userid'] = generateUserProfileLink($content['userid']);
159 $content['url'] = generateFrametesterUrl($content['url']);
160 $content['views_total'] = translateComma($content['views_total']);
161 $content['status'] = translateSurfbarUrlStatus($content['status']);
162 $content['registered'] = generateDateTime($content['registered'], 2);
163 $content['last_locked'] = generateDateTime($content['last_locked'], 2);
164 if (empty($content['lock_reason'])) $content['lock_reason'] = '---';
167 $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content);
173 // Load main template
174 loadTemplate('admin_list_surfbar_urls', false, $OUT);
176 // No URLs in surfbar
177 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
181 SQL_FREERESULT($result);