]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-list_surfbar_urls.php
Fixes for ext-surfbar (the usual asset)
[mailer.git] / inc / modules / admin / what-list_surfbar_urls.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/31/2008 *
4  * ===================                          Last change: 08/31/2008 *
5  *                                                                      *
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  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
23  *                                                                      *
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.                                  *
28  *                                                                      *
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.                         *
33  *                                                                      *
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,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
42         die();
43 } // END - if
44
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
47
48 // By default show the list...
49 $show = true;
50
51 // Check for 'id' element
52 if ((countRequestPost() > 0) && ((!isPostRequestParameterSet('id')) || (!is_array(postRequestParameter('id'))) || (count(postRequestParameter('id')) == 0))) {
53         // Not found so output message
54         loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
55
56         // Abort here
57         return;
58 } // END - if
59
60 // Edit or delete button hit?
61 if (isFormSent('edit')) {
62         // Show entries for editing
63         adminEditEntriesConfirm(
64                 postRequestParameter('id'),
65                 'surfbar_urls',
66                 array('url_id', 'url_userid', 'url'),
67                 array('bigintval', 'addMemberSelectionBox', ''),
68                 array('', array(false, true, true, 'userid[]'), '')
69         );
70         $show = false;
71 } elseif (isPostRequestParameterSet('do_edit')) {
72         // Change data of entries
73         adminEditEntriesConfirm(
74                 postRequestParameter('url_id'),
75                 'surfbar_urls',
76                 array(),
77                 array(),
78                 array(),
79                 true,
80                 'url_id'
81         );
82 } elseif (isPostRequestParameterSet('delete')) {
83         // Show entries for deletion
84         adminDeleteEntriesConfirm(
85         postRequestParameter('url_id'),
86                 'surfbar_urls',
87                 array('url_id', 'url_userid', 'url', 'url_registered'),
88                 array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', ''),
89                 array('', '', '', ''),
90                 false,
91                 'url_id',
92                 'userid',
93                 'url_userid'
94         );
95         $show = false;
96 } elseif (isPostRequestParameterSet('do_delete')) {
97         // Remove entries from database
98         adminDeleteEntriesConfirm(postRequestParameter('url_id'), 'surfbar_urls', array(), array(), array(), true, 'url_id');
99 } elseif (isFormSent('lock')) {
100         // Un-/lock selected URLs. This does not work for pending URLs
101         adminLockEntriesConfirm(
102                 postRequestParameter('url_id'),
103                 'surfbar_urls',
104                 array('url_id', 'url_userid', 'url', 'url_registered', 'status'),
105                 array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
106                 array('', '', '', '', ''),
107                 false,
108                 'url_id'
109         );
110         $show = false;
111 } elseif (isPostRequestParameterSet('do_lock')) {
112         // Un-/lock selected URLs. This does not work for pending URLs
113         adminLockEntriesConfirm(
114                 postRequestParameter('url_id'),
115                 'surfbar_urls',
116                 array(),
117                 array(),
118                 array(),
119                 array('status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
120                 true,
121                 'url_id'
122         );
123 } elseif (isPostRequestParameterSet('undelete')) {
124         // Undelete selected URLs. This does only work for deleted URLs... ;-)
125         adminUndeleteEntriesConfirm(
126                 postRequestParameter('url_id'),
127                 'surfbar_urls',
128                 array('url_id', 'url_userid', 'url', 'url_registered', 'status'),
129                 array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
130                 array('', '', '', '', ''),
131                 false,
132                 'url_id'
133         );
134         $show = false;
135 } elseif (isPostRequestParameterSet('do_undelete')) {
136         // Undelete selected URLs. This does only work for deleted URLs... ;-)
137         adminUndeleteEntriesConfirm(
138                 postRequestParameter('url_id'),
139                 'surfbar_urls',
140                 array(),
141                 array(),
142                 array(),
143                 array('status' => array('DELETED' => 'ACTIVE')),
144                 true,
145                 'url_id'
146         );
147 }
148
149 // Show entries?
150 if ($show === false) return false;
151
152 // List all URLs
153 $result = SQL_QUERY("SELECT
154         `url_id`, `url_userid`, `url`, `url_views_total`, `url_status`,
155         UNIX_TIMESTAMP(`url_registered`) AS `url_registered`,
156         UNIX_TIMESTAMP(`url_last_locked`) AS `url_last_locked`,
157         `url_lock_reason`
158 FROM
159         `{?_MYSQL_PREFIX?}_surfbar_urls`
160 ORDER BY
161         `url_id` ASC", __FILE__, __LINE__);
162
163 // Do we have some URLs left?
164 if (SQL_NUMROWS($result) > 0) {
165         // List all URLs
166         $OUT = ''; $SW = 2;
167         while ($content = SQL_FETCHARRAY($result)) {
168                 // "Translate"/add content
169                 $content['sw']              = $SW;
170                 $content['url_registered']  = generateDateTime($content['url_registered'], 2);
171                 $content['url_last_locked'] = generateDateTime($content['url_last_locked'], 2);
172                 if (empty($content['url_lock_reason'])) $content['url_lock_reason'] = '---';
173
174                 // Load row template
175                 $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content);
176
177                 // Switch color
178                 $SW = 3 - $SW;
179         } // END - while
180
181         // Load main template
182         loadTemplate('admin_list_surfbar_urls', false, $OUT);
183 } else {
184         // No URLs in surfbar
185         loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
186 }
187
188 // Free result
189 SQL_FREERESULT($result);
190
191 // [EOF]
192 ?>