Esempio n. 1
0
$runVar['panes'] = $tRun->getListOfPanes($runVar['constants']);
//totals per category in db, results by parentID
$catcntqry = "SELECT c.parentid AS parentid, COUNT(r.id) AS count FROM category c, releases r WHERE r.categoryid = c.id GROUP BY c.parentid";
//create timers and set to now
$runVar['timers']['timer1'] = $runVar['timers']['timer2'] = $runVar['timers']['timer3'] = $runVar['timers']['timer4'] = $runVar['timers']['timer5'] = time();
$runVar['timers']['query']['tmux_time'] = $runVar['timers']['query']['split_time'] = $runVar['timers']['query']['init_time'] = $runVar['timers']['query']['proc1_time'] = $runVar['timers']['query']['proc2_time'] = $runVar['timers']['query']['proc3_time'] = $runVar['timers']['query']['split1_time'] = $runVar['timers']['query']['init1_time'] = $runVar['timers']['query']['proc11_time'] = $runVar['timers']['query']['proc21_time'] = $runVar['timers']['query']['proc31_time'] = $runVar['timers']['query']['tpg_time'] = $runVar['timers']['query']['tpg1_time'] = 0;
// Analyze tables
printf($pdo->log->info("\nAnalyzing your tables to refresh your indexes."));
$pdo->optimise(false, 'analyze', false, ['releases']);
Misc::clearScreen();
$runVar['settings']['monitor'] = 0;
$runVar['counts']['iterations'] = 1;
$runVar['modsettings']['fc']['firstrun'] = true;
$runVar['modsettings']['fc']['num'] = 0;
$tblCount = "SELECT TABLE_ROWS AS count FROM information_schema.TABLES WHERE TABLE_NAME = :table AND TABLE_SCHEMA = " . $pdo->escapeString($db_name);
$psTableRowCount = $pdo->Prepare($tblCount);
while ($runVar['counts']['iterations'] > 0) {
    //check the db connection
    if ($pdo->ping(true) == false) {
        unset($pdo);
        $pdo = new Settings();
    }
    $timer01 = time();
    // These queries are very fast, run every loop -- tmux and site settings
    $runVar['settings'] = $pdo->queryOneRow($tRun->getMonitorSettings(), false);
    $runVar['timers']['query']['tmux_time'] = time() - $timer01;
    $runVar['settings']['book_reqids'] = !empty($runVar['settings']['book_reqids']) ? $runVar['settings']['book_reqids'] : Category::CAT_PARENT_BOOKS;
    //get usenet connection info
    $runVar['connections'] = $tOut->getConnectionsInfo($runVar['constants']);
    $runVar['modsettings']['clean'] = $runVar['settings']['post_non'] == 2 ? ' clean ' : ' ';
    $runVar['constants']['pre_lim'] = $runVar['counts']['iterations'] > 1 ? '7' : '';
  It is intended for use ONLY if you have a *lot* of users, as this is not
secure (a user's email addresses may be known to other users). If you only have
a few users then run setUsersPasswordHash.php for each of them instead.
WARNING;
$usage = "\nUsage: php {$argv[0]} <IUnderStandTheRisks>";
echo $colorCLI->warning($warning);
if ($argc != 2) {
    exit($colorCLI->error("\nWrong number of parameters{$usage}"));
} else {
    if ($argv[1] !== 1 && $argv[1] != '<IUnderStandTheRisks>' && $argv[1] != 'IUnderStandTheRisks' && $argv[1] != 'true') {
        exit($colorCLI->error("\nInvalid parameter(s){$usage}"));
    }
}
$pdo = new Settings();
$users = $pdo->query("SELECT id, username, email, password FROM users");
$update = $pdo->Prepare('UPDATE users SET password = :password WHERE id = :id');
$Users = new Users(['Settings' => $pdo]);
foreach ($users as $user) {
    if (needUpdate($user)) {
        $hash = $Users->hashPassword($user['email']);
        if ($hash !== false) {
            $update->execute([':password' => $hash, ':id' => $user['id']]);
            echo $colorCLI->primary('Updating hash for user:'******'username'];
        } else {
            echo $colorCLI->error('Error updating hash for user:'******'username'];
        }
    }
}
function needUpdate($user)
{
    global $colorCLI;