forked from science-ation/science-ation
Fix theme and paths
This commit is contained in:
parent
027966a76f
commit
268dba658a
@ -26,16 +26,23 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once ('common.inc.php');
|
require_once ('./data/config.inc.php');
|
||||||
|
|
||||||
function hash_passwords() {
|
$dsn = "mysql:host=db;dbname=$DBNAME;charset=utf8mb4";
|
||||||
|
$pdo = new PDO($dsn, $DBUSER, $DBPASS);
|
||||||
|
|
||||||
|
function use_hash_passwords() {
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
|
$q = $pdo->prepare("ALTER TABLE `users` MODIFY COLUMN `password` varchar(60)");
|
||||||
|
$q->execute();
|
||||||
|
$q = $pdo->prepare("ALTER TABLE `users` MODIFY COLUMN `oldpassword` varchar(60)");
|
||||||
|
$q->execute();
|
||||||
|
|
||||||
$q = $pdo->prepare("SELECT `id`, `password`, `oldpassword` FROM `users`");
|
$q = $pdo->prepare("SELECT `id`, `password`, `oldpassword` FROM `users`");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
|
|
||||||
while ($r = $q->fetch(PDO::FETCH_ASSOC)) {
|
while ($r = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
print_r($r);
|
|
||||||
$id = $r['id'];
|
$id = $r['id'];
|
||||||
|
|
||||||
$password=$r['password'];
|
$password=$r['password'];
|
||||||
@ -51,6 +58,8 @@ function hash_passwords() {
|
|||||||
|
|
||||||
$stmt = $pdo->prepare("UPDATE `users` SET `password`=?, `oldpassword`=? WHERE `id`=?");
|
$stmt = $pdo->prepare("UPDATE `users` SET `password`=?, `oldpassword`=? WHERE `id`=?");
|
||||||
$stmt->execute([$password, $oldpassword, $id]);
|
$stmt->execute([$password, $oldpassword, $id]);
|
||||||
|
|
||||||
|
printf("Done: %d\n", $id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +67,26 @@ function _password_not_hashed($password) {
|
|||||||
return (password_get_info($password)['algo'] == 0);
|
return (password_get_info($password)['algo'] == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_passwords();
|
|
||||||
|
function theme_config() {
|
||||||
|
global $pdo;
|
||||||
|
|
||||||
|
$q = $pdo->prepare("UPDATE `config` SET `val`='science_ation' WHERE `var`='theme'");
|
||||||
|
$q->execute();
|
||||||
|
|
||||||
|
$q = $pdo->prepare("UPDATE `config` SET `val`='icons_science_ation' WHERE `var`='theme_icons'");
|
||||||
|
$q->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function path_config() {
|
||||||
|
global $pdo;
|
||||||
|
|
||||||
|
$q = $pdo->prepare("UPDATE `config` SET `val`='/' WHERE `var`='SFIABDIRECTORY'");
|
||||||
|
$q->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
use_hash_passwords();
|
||||||
|
theme_config();
|
||||||
|
path_config();
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user