2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
48 // By default show the list...
51 // Check for 'url_id' element
52 if ((countRequestPost() > 0) && ((!isPostRequestParameterSet('url_id')) || (!is_array(postRequestParameter('url_id'))) || (count(postRequestParameter('url_id')) == 0))) {
53 // Not found so output message
54 loadTemplate('admin_settings_saved', false, '{--ADMIN_SURFBAR_NO_SELECTIONS--}');
60 // Edit or delete button hit?
61 if (isFormSent('edit')) {
62 // Show entries for editing
63 adminEditEntriesConfirm(
64 postRequestParameter('url_id'),
66 array('url_id', 'url_userid', 'url'),
67 array('bigintval', 'addMemberSelectionBox', ''),
68 array('', array(false, true, true, 'url_userid[]'), ''),
75 } elseif (isPostRequestParameterSet('do_edit')) {
76 // Change data of entries
77 adminEditEntriesConfirm(
78 postRequestParameter('url_id'),
88 } elseif (isPostRequestParameterSet('delete')) {
89 // Show entries for deletion
90 adminDeleteEntriesConfirm(
91 postRequestParameter('url_id'),
93 array('url_id', 'url_userid', 'url', 'url_registered'),
94 array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', ''),
95 array('', '', '', ''),
102 } elseif (isPostRequestParameterSet('do_delete')) {
103 // Remove entries from database
104 adminDeleteEntriesConfirm(postRequestParameter('url_id'), 'surfbar_urls', array(), array(), array(), true, 'url_id');
105 } elseif (isFormSent('lock')) {
106 // Un-/lock selected URLs. This does not work for pending URLs
107 adminLockEntriesConfirm(
108 postRequestParameter('url_id'),
110 array('url_id', 'url_userid', 'url', 'url_registered', 'url_status'),
111 array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
112 array('', '', '', '', ''),
119 } elseif (isPostRequestParameterSet('do_lock')) {
120 // Un-/lock selected URLs. This does not work for pending URLs
121 adminLockEntriesConfirm(
122 postRequestParameter('url_id'),
127 array('url_status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
133 } elseif (isPostRequestParameterSet('undelete')) {
134 // Undelete selected URLs. This does only work for deleted URLs... ;-)
135 adminUndeleteEntriesConfirm(
136 postRequestParameter('url_id'),
138 array('url_id', 'url_userid', 'url', 'url_registered', 'url_status'),
139 array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
140 array('', '', '', '', ''),
147 } elseif (isPostRequestParameterSet('do_undelete')) {
148 // Undelete selected URLs. This does only work for deleted URLs... ;-)
149 adminUndeleteEntriesConfirm(
150 postRequestParameter('url_id'),
155 array('url_status' => array('DELETED' => 'ACTIVE')),
164 if ($show === false) return false;
167 $result = SQL_QUERY("SELECT
168 `url_id`, `url_userid`, `url`, `url_views_total`, `url_status`,
169 UNIX_TIMESTAMP(`url_registered`) AS `url_registered`,
170 UNIX_TIMESTAMP(`url_last_locked`) AS `url_last_locked`,
173 `{?_MYSQL_PREFIX?}_surfbar_urls`
175 `url_id` ASC", __FILE__, __LINE__);
177 // Do we have some URLs left?
178 if (SQL_NUMROWS($result) > 0) {
181 while ($content = SQL_FETCHARRAY($result)) {
182 // "Translate"/add content
183 $content['sw'] = $SW;
184 $content['url_registered'] = generateDateTime($content['url_registered'], 2);
185 $content['url_last_locked'] = generateDateTime($content['url_last_locked'], 2);
186 if (empty($content['url_lock_reason'])) $content['url_lock_reason'] = '---';
189 $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content);
195 // Load main template
196 loadTemplate('admin_list_surfbar_urls', false, $OUT);
198 // No URLs in surfbar
199 loadTemplate('admin_settings_saved', false, '{--ADMIN_SURFBAR_NO_URLS_FOUND--}');
203 SQL_FREERESULT($result);