]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_surfbar_urls.php
Code style changed, ext-user continued:
[mailer.git] / inc / modules / admin / what-list_surfbar_urls.php
index be0ad38097180370ba0ffd5be833e8f09e476d3b..02943e89dfcc1dd9e1741000d968fb91a517ee96 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -43,143 +41,67 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 // By default show the list...
-$show = true;
+$show = TRUE;
 
-// Check for 'id' element
-if ((countRequestPost() > 0) && ((!isPostRequestParameterSet('id')) || (!is_array(postRequestParameter('id'))) || (count(postRequestParameter('id')) == 0))) {
+// Check for 'url_id' element
+if ((countRequestPost() > 0) && (!ifPostContainsSelections('url_id'))) {
        // Not found so output message
-       loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
+       displayMessage('{--ADMIN_SURFBAR_NO_SELECTIONS--}');
 
        // Abort here
        return;
 } // END - if
 
 // Edit or delete button hit?
-if (isPostRequestParameterSet('edit')) {
+if (isFormSent('edit')) {
        // Show entries for editing
-       adminEditEntriesConfirm(
-               postRequestParameter('id'),
-               'surfbar_urls',
-               array('id', 'userid', 'url'),
-               array('bigintval', 'addMemberSelectionBox', ''),
-               array('', array(false, true, true), '')
-       );
-       $show = false;
-} elseif (isPostRequestParameterSet('do_edit')) {
+       showEntriesByXmlCallback('admin_edit_show_surfbar_urls');
+
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_edit')) {
        // Change data of entries
-       adminEditEntriesConfirm(
-               postRequestParameter('id'),
-               'surfbar_urls',
-               array(),
-               array(),
-               array(),
-               true
-       );
-} elseif (isPostRequestParameterSet('delete')) {
+       showEntriesByXmlCallback('admin_edit_do_surfbar_urls');
+} elseif (isFormSent('delete')) {
        // Show entries for deletion
-       adminDeleteEntriesConfirm(
-       postRequestParameter('id'),
-               'surfbar_urls',
-               array('id', 'userid', 'url', 'registered'),
-               array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''),
-               array('', '', '', '')
-       );
-       $show = false;
-} elseif (isPostRequestParameterSet('do_delete')) {
+       showEntriesByXmlCallback('admin_delete_show_surfbar_urls');
+
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_delete')) {
        // Remove entries from database
-       adminDeleteEntriesConfirm(postRequestParameter('id'), 'surfbar_urls', array(), array(), array(), true);
-} elseif (isPostRequestParameterSet('lock')) {
+       showEntriesByXmlCallback('admin_delete_do_surfbar_urls');
+} elseif (isFormSent('lock')) {
        // Un-/lock selected URLs. This does not work for pending URLs
-       adminLockEntriesConfirm(
-               postRequestParameter('id'),
-               'surfbar_urls',
-               array('id', 'userid', 'url', 'registered', 'status'),
-               array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
-               array('', '', '', '', '')
-       );
-       $show = false;
-} elseif (isPostRequestParameterSet('do_lock')) {
+       showEntriesByXmlCallback('admin_lock_show_surfbar_urls');
+
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_lock')) {
        // Un-/lock selected URLs. This does not work for pending URLs
-       adminLockEntriesConfirm(
-               postRequestParameter('id'),
-               'surfbar_urls',
-               array(),
-               array(),
-               array(),
-               array('status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
-               true
-       );
-} elseif (isPostRequestParameterSet('undelete')) {
+       showEntriesByXmlCallback('admin_lock_do_surfbar_urls');
+} elseif (isFormSent('undelete')) {
        // Undelete selected URLs. This does only work for deleted URLs... ;-)
-       adminUndeleteEntriesConfirm(
-               postRequestParameter('id'),
-               'surfbar_urls',
-               array('id', 'userid', 'url', 'registered', 'status'),
-               array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
-               array('', '', '', '', '')
-       );
-       $show = false;
-} elseif (isPostRequestParameterSet('do_undelete')) {
+       showEntriesByXmlCallback('admin_undelete_show_surfbar_urls');
+
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_undelete')) {
        // Undelete selected URLs. This does only work for deleted URLs... ;-)
-       adminUndeleteEntriesConfirm(
-               postRequestParameter('id'),
-               'surfbar_urls',
-               array(),
-               array(),
-               array(),
-               array('status' => array('DELETED' => 'ACTIVE')),
-               true
-       );
+       showEntriesByXmlCallback('admin_undelete_do_surfbar_urls');
 }
 
 // Show entries?
-if ($show === false) return false;
+if ($show === FALSE) {
+       // No, a form has already been show
+       return FALSE;
+} // END - if
 
 // List all URLs
-$result = SQL_QUERY("SELECT
-       `id`, `userid`, `url`, `views_total`, `status` AS `url_status`,
-       UNIX_TIMESTAMP(`registered`) AS url_registered,
-       UNIX_TIMESTAMP(`last_locked`) AS url_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['url_status']      = translateSurfbarUrlStatus($content['url_status']);
-               $content['url_registered']  = generateDateTime($content['url_registered'], 2);
-               $content['url_last_locked'] = generateDateTime($content['url_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'));
-}
-
-// Free result
-SQL_FREERESULT($result);
+showEntriesByXmlCallback('admin_list_surfbar_urls');
 
 // [EOF]
 ?>