X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_surfbar_urls.php;h=ba8a6daa2fdf8ae59646e55cbd4b4671ae99f7c5;hb=5c4d360166de238420eec3e5f4e694befb09ab5d;hp=9c3c176e4ff0e016ba5b11dd17ee5e66a0d8d7e0;hpb=6cf3cd12edf6371fc29d016c30ccd53836536211;p=mailer.git diff --git a/inc/modules/admin/what-list_surfbar_urls.php b/inc/modules/admin/what-list_surfbar_urls.php index 9c3c176e4f..ba8a6daa2f 100644 --- a/inc/modules/admin/what-list_surfbar_urls.php +++ b/inc/modules/admin/what-list_surfbar_urls.php @@ -1,7 +1,7 @@ 0) && ((!isPostRequestParameterSet('url_id')) || (!is_array(postRequestParameter('url_id'))) || (count(postRequestParameter('url_id')) == 0))) { + // Not found so output message + displayMessage('{--ADMIN_SURFBAR_NO_SELECTIONS--}'); + + // Abort here + return; +} // END - if + +// Edit or delete button hit? +if (isFormSent('edit')) { + // Show entries for editing + 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 + showEntriesByXmlCallback('admin_edit_do_surfbar_urls'); +} elseif (isFormSent('delete')) { + // Show entries for deletion + showEntriesByXmlCallback('admin_del_show_surfbar_urls'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_delete')) { + // Remove entries from database + showEntriesByXmlCallback('admin_del_do_surfbar_urls'); +} 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' + ); + + // 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('url_id'), + 'surfbar_urls', + array(), + array(), + array(), + array( + 'url_status' => array( + 'ACTIVE' => 'LOCKED', + 'LOCKED' => 'ACTIVE' + ) + ), + true, + 'url_id', + 'url_userid', + 'url_userid' + ); +} elseif (isFormSent('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 (isFormSent('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) { + // No, a form has already been show + return false; +} // END - if // List all URLs -$result = SQL_QUERY("SELECT id, userid, url, reward, 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__); +$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_NUMROWS($result) > 0) { +if (!SQL_HASZERONUMS($result)) { // List all URLs - $OUT = ""; $SW = 2; + $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { // "Translate"/add content - $content['sw'] = $SW; - $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']); - $content['url'] = FRAMETESTER($content['url']); - $content['reward'] = TRANSLATE_COMMA($content['reward']); - $content['views_total'] = TRANSLATE_COMMA($content['views_total']); - $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']); - $content['registered'] = MAKE_DATETIME($content['registered'], 2); - $content['last_locked'] = MAKE_DATETIME($content['last_locked'], 2); - if (empty($content['lock_reason'])) $content['lock_reason'] = "---"; + $content['url_registered'] = generateDateTime($content['url_registered'], 2); + $content['url_last_locked'] = generateDateTime($content['url_last_locked'], 2); // Load row template - $OUT .= LOAD_TEMPLATE("admin_list_surfbar_urls_row", true, $content); - - // Switch color - $SW = 3 - $SW; + $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content); } // END - while // Load main template - LOAD_TEMPLATE("admin_list_surfbar_urls", false, $OUT); + loadTemplate('admin_list_surfbar_urls', false, $OUT); } else { // No URLs in surfbar - LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_URLS_FOUND); + displayMessage('{--ADMIN_SURFBAR_NO_URLS_FOUND--}'); } // Free result SQL_FREERESULT($result); -// +// [EOF] ?>