Exemple #1
0
                    $changed = true;
                } else {
                    echo $out->primary("Skipped: " . $file[$index]);
                }
                break;
            default:
                $index--;
                echo $out->error('Invalid hook placeholder!!');
                break;
        }
    } else {
        if (preg_match('#^PROJECT=(?P<path>.*)$#', $file[$index], $match)) {
            if ($match['path'] != NN_ROOT) {
                $file[$index] = 'PROJECT=' . NN_ROOT;
                $changed = true;
            }
        } else {
            if (VERBOSE) {
                echo $out->primary("Skipped: " . $file[$index]);
            }
        }
    }
    $index++;
}
if ($changed === false) {
    echo $out->warning('Unable to find any hooks needing updates!');
} else {
    if (file_put_contents($target, implode("\n", $file)) === false) {
        echo $out->error("Error writing file to disc!!");
    }
}
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once dirname(__FILE__) . '/../../../www/config.php';
use newznab\db\Settings;
$colorCLI = new ColorCLI();
$warning = <<<WARNING
This script will (re)set the password hashes for older hashes,
before the change of hashing mchanism, with the user's email
..as the new password.
  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) {
Exemple #3
0
 /**
  * @param string $message
  *
  * @return void
  */
 public function warning($message)
 {
     if (PEAR_LOG_DEBUG) {
         echo $this->color->warning($message);
     }
 }