/** * @brief Selects recent founders from DB * * @desc Returns false in case of DB error or array with found founders ids * * @param Integer $interval number of days we should go back; default: 1; max: 365; * * @return array|bool */ function findInvalidFounders($interval) { global $wgExternalSharedDB; $interval = intval($interval); $interval = $interval <= 0 || $interval > CNW_MAINTENANCE_MAX_DAYS_BACK ? 1 : $interval; $db = wfGetDB(DB_SLAVE, [], $wgExternalSharedDB); $table = ['l' => 'city_list', 'u' => '`user`']; $fields = ['l.city_founding_user']; $joins = ['u' => ['LEFT JOIN', 'l.city_founding_user = u.user_id']]; $where = ['l.city_founding_user <> 0', 'l.city_founding_user IS NOT NULL', 'u.user_id IS NULL', 'l.city_created > \'' . getCreationDate($interval) . '\'']; $options = ['DISTINCT']; $invalidFounders = []; try { $resultWrapper = $db->select($table, $fields, $where, __METHOD__, $options, $joins); while ($row = $resultWrapper->fetchObject()) { $invalidFounders[] = $row->city_founding_user; } return $invalidFounders; } catch (DBQueryError $e) { echo "Database error: " . $e->getMessage() . PHP_EOL; echo "SQL statement was: " . $e->getSQL() . PHP_EOL . PHP_EOL; return false; } }
} $shortID = htmlspecialchars($_GET["id"], ENT_QUOTES); $hasInfoChar = hasInfoChar($shortID); if ($hasInfoChar) { // Remove the info char ('+') from the shortID. $shortID = substr($shortID, 0, strlen($shortID) - 1); } $shortIDExists = shortIDExists($mysqli, $shortID); if (!shortIDExists($mysqli, $shortID)) { header("location: /"); $mysqli->close(); die; } // store the information for the shortID. $url = getLongURL($mysqli, $shortID); $creationDate = getCreationDate($mysqli, $shortID); ?> <!DOCTYPE html> <html lang="us"> <head> <meta charset="utf-8"> <link type="text/css" rel="stylesheet" href="css/main.css"/> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.2.8/jquery.form-validator.min.js"></script> <title>M307: ToManyChars</title> </head> <body> <div id="wrapper"> <div id="content">