From 76dbaa342b0e2210ca8be6e50613c882e546caed Mon Sep 17 00:00:00 2001 From: azett Date: Thu, 10 Oct 2019 12:29:41 +0200 Subject: [PATCH] BBCode toolbar: Selectboxes of attachments and images are being sorted by name; fixed redirects after login --- fp-plugins/bbcode/plugin.bbcode.php | 4 + login.php | 204 +++++++++++++--------------- 2 files changed, 98 insertions(+), 110 deletions(-) diff --git a/fp-plugins/bbcode/plugin.bbcode.php b/fp-plugins/bbcode/plugin.bbcode.php index 1e3a63d..54c5124 100644 --- a/fp-plugins/bbcode/plugin.bbcode.php +++ b/fp-plugins/bbcode/plugin.bbcode.php @@ -669,11 +669,15 @@ function plugin_bbcode_toolbar() { // get all available images $indexer = new fs_filelister(IMAGES_DIR); $imageslist = $indexer->getList(); + // sort by name + sort($imageslist); array_unshift($imageslist, '--'); $_FP_SMARTY->assign('images_list', $imageslist); // get all available attachements $indexer = new fs_filelister(ATTACHS_DIR); $attachslist = $indexer->getList(); + // sort by name + sort($attachslist); array_unshift($attachslist, '--'); $_FP_SMARTY->assign('attachs_list', $attachslist); // DMKE: does not work diff --git a/login.php b/login.php index 80b4de6..65e403b 100755 --- a/login.php +++ b/login.php @@ -1,130 +1,114 @@ assign('error', $error); - return 0; - } - - return 1; + $error = array(); + $lerr = & $lang ['login'] ['error']; + if (!$user) { + $error ['user'] = $lerr ['user']; } - - function main() { - global $lang, $smarty; - - if (user_loggedin()) { - - if(isset($_GET['do']) && ($_GET['do']=='logout')) { - user_logout(); - - function myredirect() { - login_redirect('index.php'); - } - - add_filter('wp_head', 'myredirect'); - - $content = (SHARED_TPLS . 'login.tpl'); - - } elseif (user_loggedin()) { - - function myredirect() { - login_redirect('index.php'); - } - - add_filter('wp_head', 'myredirect'); - - $content = (SHARED_TPLS . 'login_success.tpl'); - - } else { - utils_redirect(); - + if (!$pass) { + $error ['pass'] = $lerr ['pass']; + } + + if (!$error && !user_login($user, $pass)) { + $error ['match'] = $lerr ['match']; + } + + if ($error) { + $smarty->assign('error', $error); + return 0; + } + + return 1; +} + +function main() { + global $lang, $smarty; + + if (user_loggedin()) { + + if (isset($_GET ['do']) && ($_GET ['do'] == 'logout')) { + user_logout(); + + function myredirect() { + // login_redirect('.'); } - - } elseif (sess_remove('logout_done')) { - - function myredirect() { - login_redirect('index.php'); - } - - add_filter('wp_head', 'myredirect'); - - $content = (SHARED_TPLS . 'login_success.tpl'); - - - } elseif(empty($_POST)) { - $content = (SHARED_TPLS . 'login.tpl'); - } else { - // validate after a POST - if(login_validate()) { - utils_redirect('login.php'); - } else { - $smarty->assign($_POST); - $content = (SHARED_TPLS . 'login.tpl'); + add_filter('wp_head', 'myredirect'); + + $content = (SHARED_TPLS . 'login.tpl'); + } elseif (user_loggedin()) { + + function myredirect() { + login_redirect('admin.php'); } + + add_filter('wp_head', 'myredirect'); + + $content = (SHARED_TPLS . 'login_success.tpl'); + } else { + + utils_redirect(); } - - // Set page title and content - // first parameter is Title, second is content. - // Content can be both a shared tpl or raw html content; in this last case - // you have to set the third optional parameter to true - - $smarty->assign('subject', $lang['login']['head']); - $smarty->assign('content', $content); + } elseif (sess_remove('logout_done')) { + function myredirect() { + // login_redirect('.'); + } + + add_filter('wp_head', 'myredirect'); + + $content = (SHARED_TPLS . 'login_success.tpl'); + } elseif (empty($_POST)) { + $content = (SHARED_TPLS . 'login.tpl'); + } else { + // validate after a POST + if (login_validate()) { + utils_redirect('login.php'); + } else { + $smarty->assign($_POST); + $content = (SHARED_TPLS . 'login.tpl'); + } } + // Set page title and content + // first parameter is Title, second is content. + // Content can be both a shared tpl or raw html content; in this last case + // you have to set the third optional parameter to true - - - function login_redirect($url, $secs=5){ - echo ''; - } - - function login_title($title, $sep) { - global $lang; - return $title = "$title $sep {$lang['login']['head']}"; - } - - add_filter('wp_title', 'login_title', 10, 2); - - + $smarty->assign('subject', $lang ['login'] ['head']); + $smarty->assign('content', $content); +} + +function login_redirect($url, $secs = 0) { + echo ''; +} + +function login_title($title, $sep) { + global $lang; + return $title = "$title $sep {$lang['login']['head']}"; +} + +add_filter('wp_title', 'login_title', 10, 2); + +system_init(); +main(); +theme_init($smarty); +$smarty->display('default.tpl'); - system_init(); - main(); - theme_init($smarty); - $smarty->display('default.tpl'); - - ?>