+addMenuDescription('admin', __FILE__);
+
+// By default show the list...
+$show = true;
+
+// Check for 'id' element
+if ((countRequestPost() > 0) && ((!isPostRequestElementSet('id')) || (!is_array(postRequestElement('id'))) || (count(postRequestElement('id')) == 0))) {
+ // Not found so output message
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
+
+ // Abort here
+ return;
+} // END - if
+
+// Edit or delete button hit?
+if (isPostRequestElementSet('edit')) {
+ // Show entries for editing
+ adminEditEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array('id', 'userid', 'url'),
+ array('bigintval', 'addMemberSelectionBox', ''),
+ array('', array(false, true, true), '')
+ );
+ $show = false;
+} elseif (isPostRequestElementSet('do_edit')) {
+ // Change data of entries
+ adminEditEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array(),
+ array(),
+ array(),
+ true
+ );
+} elseif (isPostRequestElementSet('delete')) {
+ // Show entries for deletion
+ adminDeleteEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array('id', 'userid', 'url', 'registered'),
+ array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''),
+ array('', '', '', '')
+ );
+ $show = false;
+} elseif (isPostRequestElementSet('do_delete')) {
+ // Remove entries from database
+ adminDeleteEntriesConfirm(postRequestElement('id'), 'surfbar_urls', array(), array(), array(), true);
+} elseif (isPostRequestElementSet('lock')) {
+ // Un-/lock selected URLs. This does not work for pending URLs
+ adminLockEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array('id', 'userid', 'url', 'registered', 'status'),
+ array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
+ array('', '', '', '', '')
+ );
+ $show = false;
+} elseif (isPostRequestElementSet('do_lock')) {
+ // Un-/lock selected URLs. This does not work for pending URLs
+ adminLockEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array(),
+ array(),
+ array(),
+ array('status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
+ true
+ );
+} elseif (isPostRequestElementSet('undelete')) {
+ // Undelete selected URLs. This does only work for deleted URLs... ;-)
+ adminUndeleteEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array('id', 'userid', 'url', 'registered', 'status'),
+ array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
+ array('', '', '', '', '')
+ );
+ $show = false;
+} elseif (isPostRequestElementSet('do_undelete')) {
+ // Undelete selected URLs. This does only work for deleted URLs... ;-)
+ adminUndeleteEntriesConfirm(
+ postRequestElement('id'),
+ 'surfbar_urls',
+ array(),
+ array(),
+ array(),
+ array('status' => array('DELETED' => 'ACTIVE')),
+ true
+ );
+}
+
+// Show entries?
+if ($show === false) return false;
+
+// List all URLs
+$result = SQL_QUERY("SELECT
+ `id`, `userid`, `url`, `views_total`, `status`,
+ UNIX_TIMESTAMP(`registered`) AS registered,
+ UNIX_TIMESTAMP(`last_locked`) AS last_locked,
+ `lock_reason`
+FROM
+ `{?_MYSQL_PREFIX?}_surfbar_urls`
+ORDER BY
+ `id` ASC", __FILE__, __LINE__);
+
+// Do we have some URLs left?
+if (SQL_NUMROWS($result) > 0) {
+ // List all URLs
+ $OUT = ''; $SW = 2;
+ while ($content = SQL_FETCHARRAY($result)) {
+ // "Translate"/add content
+ $content['sw'] = $SW;
+ $content['userid'] = generateUserProfileLink($content['userid']);
+ $content['url'] = generateFrametesterUrl($content['url']);
+ $content['views_total'] = translateComma($content['views_total']);
+ $content['status'] = translateSurfbarUrlStatus($content['status']);
+ $content['registered'] = generateDateTime($content['registered'], 2);
+ $content['last_locked'] = generateDateTime($content['last_locked'], 2);
+ if (empty($content['lock_reason'])) $content['lock_reason'] = '---';
+
+ // Load row template
+ $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content);
+
+ // Switch color
+ $SW = 3 - $SW;
+ } // END - while
+
+ // Load main template
+ loadTemplate('admin_list_surfbar_urls', false, $OUT);
+} else {
+ // No URLs in surfbar
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
+}