BBCode toolbar: Selectboxes of attachments and images are being sorted by name;

fixed redirects after login
This commit is contained in:
azett 2019-10-10 12:29:41 +02:00
parent e949c087d5
commit 76dbaa342b
2 changed files with 98 additions and 110 deletions

View File

@ -669,11 +669,15 @@ function plugin_bbcode_toolbar() {
// get all available images // get all available images
$indexer = new fs_filelister(IMAGES_DIR); $indexer = new fs_filelister(IMAGES_DIR);
$imageslist = $indexer->getList(); $imageslist = $indexer->getList();
// sort by name
sort($imageslist);
array_unshift($imageslist, '--'); array_unshift($imageslist, '--');
$_FP_SMARTY->assign('images_list', $imageslist); $_FP_SMARTY->assign('images_list', $imageslist);
// get all available attachements // get all available attachements
$indexer = new fs_filelister(ATTACHS_DIR); $indexer = new fs_filelister(ATTACHS_DIR);
$attachslist = $indexer->getList(); $attachslist = $indexer->getList();
// sort by name
sort($attachslist);
array_unshift($attachslist, '--'); array_unshift($attachslist, '--');
$_FP_SMARTY->assign('attachs_list', $attachslist); $_FP_SMARTY->assign('attachs_list', $attachslist);
// DMKE: does not work // DMKE: does not work

172
login.php
View File

@ -1,130 +1,114 @@
<?php <?php
// Example of use // Example of use
require_once 'defaults.php'; require_once 'defaults.php';
require_once (INCLUDES_DIR.'includes.php'); require_once (INCLUDES_DIR . 'includes.php');
require(SMARTY_DIR . 'SmartyValidate.class.php'); require (SMARTY_DIR . 'SmartyValidate.class.php');
$tpl = 'default.tpl';
$tpl = 'default.tpl'; function login_validate() {
global $smarty, $lang;
function login_validate() { $user = trim(@$_POST ['user']);
global $smarty, $lang; $pass = trim(@$_POST ['pass']);
$user = trim(@$_POST['user']); $error = array();
$pass = trim(@$_POST['pass']); $lerr = & $lang ['login'] ['error'];
$error = array();
$lerr =& $lang['login']['error'];
if (!$user) {
$error['user'] = $lerr['user'];
}
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;
if (!$user) {
$error ['user'] = $lerr ['user'];
} }
function main() { if (!$pass) {
global $lang, $smarty; $error ['pass'] = $lerr ['pass'];
}
if (user_loggedin()) { if (!$error && !user_login($user, $pass)) {
$error ['match'] = $lerr ['match'];
}
if(isset($_GET['do']) && ($_GET['do']=='logout')) { if ($error) {
user_logout(); $smarty->assign('error', $error);
return 0;
}
function myredirect() { return 1;
login_redirect('index.php'); }
}
add_filter('wp_head', 'myredirect'); function main() {
global $lang, $smarty;
$content = (SHARED_TPLS . 'login.tpl'); if (user_loggedin()) {
} elseif (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_success.tpl');
} else {
utils_redirect();
function myredirect() {
// login_redirect('.');
} }
} elseif (sess_remove('logout_done')) { add_filter('wp_head', 'myredirect');
function myredirect() { $content = (SHARED_TPLS . 'login.tpl');
login_redirect('index.php'); } elseif (user_loggedin()) {
}
add_filter('wp_head', 'myredirect'); function myredirect() {
login_redirect('admin.php');
}
$content = (SHARED_TPLS . 'login_success.tpl'); add_filter('wp_head', 'myredirect');
$content = (SHARED_TPLS . 'login_success.tpl');
} elseif(empty($_POST)) {
$content = (SHARED_TPLS . 'login.tpl');
} else { } else {
// validate after a POST
if(login_validate()) { utils_redirect();
utils_redirect('login.php'); }
} else { } elseif (sess_remove('logout_done')) {
$smarty->assign($_POST);
$content = (SHARED_TPLS . 'login.tpl'); function myredirect() {
} // login_redirect('.');
} }
// Set page title and content add_filter('wp_head', 'myredirect');
// 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);
$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
$smarty->assign('subject', $lang ['login'] ['head']);
$smarty->assign('content', $content);
}
function login_redirect($url, $secs = 0) {
echo '<meta http-equiv="refresh" content="' . "$secs;url=$url" . '" />';
}
function login_redirect($url, $secs=5){ function login_title($title, $sep) {
echo '<meta http-equiv="refresh" content="'."$secs;url=$url".'" />'; global $lang;
} return $title = "$title $sep {$lang['login']['head']}";
}
function login_title($title, $sep) { add_filter('wp_title', 'login_title', 10, 2);
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');
?> ?>