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