public function disableUserAccount() { wfProfileIn(__METHOD__); if (!$this->checkRequest()) { wfProfileOut(__METHOD__); return; } $user = $this->request->getVal('user'); if (empty($user)) { $this->response->setVal('success', false); $this->response->setVal('errorMsg', wfMessage('coppatool-invalid-user')->plain()); wfProfileOut(__METHOD__); return; } $userObj = User::newFromName($user); if (!$userObj instanceof User || $userObj->getId() === 0) { $this->response->setVal('success', false); $this->response->setVal('errorMsg', wfMessage('coppatool-invalid-user')->plain()); wfProfileOut(__METHOD__); return; } $errorMessage = null; $errorMessage2 = null; $res = EditAccount::closeAccount($userObj, wfMessage('coppatool-reason')->plain(), $errorMessage, $errorMessage2, false); if ($res === false) { $this->response->setVal('success', false); $this->response->setVal('errorMsg', $errorMessage); } else { $this->response->setVal('success', true); if (!is_null($errorMessage2)) { $this->response->setVal('errorMsg', $errorMessage2); } } wfProfileOut(__METHOD__); }
public function execute() { global $wgUser, $wgExternalSharedDB; // Currently, inverted searches (using a column other than up_user) may not // be supported for preferences in the future. However this feature may be // supported for user "flags" if we need to do reverse lookups like these. // See https://wikia-inc.atlassian.net/browse/SERVICES-469. // --drsnyder echo "*******************************************************"; echo "Warning, inverted searches on 'user_properties' may be deprecated soon. Contact the services team."; echo "*******************************************************"; $closeAccountHelper = new CloseMyAccountHelper(); $dbr = wfGetDB(DB_SLAVE, [], $wgExternalSharedDB); // Only get users who self-requested account closure $subQuery = $dbr->selectSQLText('user_properties', ['up_user'], ['up_property' => 'requested-closure-date'], __METHOD__); $res = $dbr->select('user_properties', ['up_user'], ['up_property' => 'requested-closure', 'up_value' => 1, 'up_user IN (' . $subQuery . ')'], __METHOD__); $usersClosed = []; $closeReason = 'User requested account closure more than 30 days ago'; $wgUser = User::newFromName('Wikia'); foreach ($res as $row) { $userObj = User::newFromId($row->up_user); $daysRemaining = $closeAccountHelper->getDaysUntilClosure($userObj); if ($daysRemaining === 0) { $this->output("Closing account {$userObj->getName()}...\n"); $statusMsg1 = ''; $statusMsg2 = ''; $result = EditAccount::closeAccount($userObj, $closeReason, $statusMsg1, $statusMsg2, true); // Set an option that signifies this user was closed automatically $userObj->setGlobalFlag('disabled-by-user-request', true); // Cleanup $userObj->setGlobalFlag('requested-closure', null); $userObj->setGlobalAttribute('requested-closure-date', null); $userObj->saveSettings(); $closeAccountHelper->track($userObj, 'account-closed'); $usersClosed[] = $userObj->getName(); } } $this->output(count($usersClosed) . " user accounts closed.\n"); }
<h1>Edición del perfil</h1> <?php $login = new ModelLogin(); ?> Tipo de cuenta: <?php echo $login->getTypeOfUser(); echo HTML::br(1); echo $error; $EditAccount = new EditAccount(); if ($login->isUserLoggedIn() == "true" && ($login->getTypeOfUser() == "musico" || $login->getTypeOfUser() == "fan" || $login->getTypeOfUser() == "local")) { $EditAccount->usuarioEdit($login->getUserId(), $login->getTypeOfUser()); } else { if ($login->getTypeOfUser() == "administrador") { $EditAccount->usuarioEdit($_SESSION['usuario_id_edit'], $_SESSION['usuario_tipo_edit']); } else { echo "No tienes permisos para estar aquí"; } }
public static function editUser() { $EditAccount = new EditAccount(); $EditAccount->usuarioEdit($_GET['usuario_id'], $_GET['usuario_tipo']); }
<?php /** * @author Kenneth Kouot <kenneth@wikia-inc.com * @description Job that accepts a user id as an argument and disables that user account * @usage cat spamAccountIds.txt | while read line; do SERVER_ID=177 php maintenance/wikia/disableUserAccount.php --conf /usr/wikia/docroot/wiki.factory/LocalSettings.php "$line"; done */ ini_set('include_path', dirname(__FILE__) . '/../'); require 'commandLine.inc'; // username from command line argument if (!$argv[2]) { die('Error: Please specify a user id'); } $userId = $argv[2]; $stdOut = fopen('php://stdout', 'w'); fwrite($stdOut, "\n"); fwrite($stdOut, "Attempting to disable user account: " . $userId . "\n"); $user = User::newFromId($userId); $statusMessage = NULL; $result = EditAccount::closeAccount($user, 'Spamming', $statusMessage); fwrite($stdOut, "Status: " . ($result ? 'SUCCESS' : 'FAIL') . "\nMessage: " . $statusMessage . "\n"); fwrite($stdOut, "__________________________________________________________\n"); fclose($stdOut);