# get a list of articles to check $dbr =& wfGetDB(DB_SLAVE); $res = $dbr->select('page', array('page_title', 'page_namespace'), array('page_is_redirect' => 0, 'page_namespace' => 0), "findInlineImages", array("ORDER BY" => "page_counter desc", "LIMIT" => "{$limit}")); $titles = array(); while ($row = $dbr->fetchObject($res)) { $title = Title::makeTitle($row->page_namespace, $row->page_title); if (isset($ignore_titles[strtolower($title->getText())])) { continue; } if ($title) { $titles[] = $title; } } $phrases = array(); for ($i = 0; $i < $wgMaxPhraseWords; $i++) { $phrases = array_merge($phrases, getPhrases($dbr, $i + 1, $wgMaxPhrases - sizeof($phrases))); if (sizeof($phrases) >= $wgMaxPhrases) { break; } } echo "got " . number_format(sizeof($titles), 0, "", ",") . " titles, and " . number_format(sizeof($phrases), 0, "", ",") . " phrases\n"; // build the search and replace arrays $fb = "[^a-zA-Z0-9_|\\[\\]]"; $search = array(); $replace = array(); foreach ($phrases as $x) { $s = strtolower($x->getText()); $s = str_replace("/", '\\/', $s); $s = str_replace("(", '\\(', $s); $s = str_replace(")", '\\)', $s); $search[] = "/({$fb})({$s})({$fb})/im";
$limit = 1000; } # get a list of articles to check $dbr =& wfGetDB(DB_SLAVE); $res = $dbr->select('page', array('page_title', 'page_namespace'), array('page_is_redirect' => 0, 'page_namespace' => 0), "findInlineImages", array("ORDER BY" => "page_counter desc", "LIMIT" => "{$limit}")); $titles = array(); while ($row = $dbr->fetchObject($res)) { $title = Title::makeTitle($row->page_namespace, $row->page_title); if (isset($ignore_titles[strtolower($title->getText())])) { continue; } if ($title) { $titles[$title->getText()] = 0; } } $phrases = getPhrases(); echo "got " . number_format(sizeof($titles), 0, "", ",") . " titles, and " . number_format(sizeof($phrases), 0, "", ",") . " phrases\n"; // build the search and replace arrays $fb = "[^a-zA-Z0-9_|\\[\\]]"; $replace = array(); $destitles = array(); $baretext = array(); foreach ($phrases as $key => $link) { $s = strtolower($key); $s = str_replace("/", '\\/', $s); $s = str_replace("(", '\\(', $s); $s = str_replace(")", '\\)', $s); $search[] = "/({$fb})({$s})({$fb})/im"; $replace[] = "\$1[[{$link}|\$2]]\$3"; $baretext[] = "{$s} - {$link}"; $desttitles[] = $links;
function getPhrase() { $phrases = getPhrases(); return $phrases[array_rand($phrases)]; }
<?php define('DS', DIRECTORY_SEPARATOR); define('APP_FOLDER', '/'); define('MANGAS_FOLDER', 'mangas'); $ADMIN_IDs = array(2807710899.0); $languageCode = getUserLanguage(); define('READER_LANGUAGE_CODE', $languageCode); $phrases = getPhrases($languageCode); $requestScheme = filter_input(INPUT_SERVER, "REQUEST_SCHEME"); $httpHost = filter_input(INPUT_SERVER, "HTTP_HOST"); $config = array("base_url" => $requestScheme . "://" . $httpHost . APP_FOLDER . "phplib/hybridauth/index.php", "providers" => array("Twitter" => array("enabled" => true, "keys" => array("key" => "uwFVJG4r4STZg8kgI13JDXZTO", "secret" => "dJvMmCwomGUbp19nwCTfVBJz3nAdCnt342mjuWwMpjg1BDdlsB"))), "debug_mode" => false, "debug_file" => "debug.log"); function getPhrases($language) { $fileName = dirname(__DIR__) . DS . "assets" . DS . "locales" . DS . "locale." . $language . ".json"; if (!file_exists($fileName)) { $fileName = dirname(__DIR__) . DS . "assets" . DS . "locales" . DS . "locale.en.json"; } return json_decode(file_get_contents($fileName), true); } function getFirstManga($dir) { foreach (new DirectoryIterator($dir . DS . MANGAS_FOLDER) as $dirInfo) { if ($dirInfo->isDot()) { continue; } if (!$dirInfo->isDir()) { continue; } return $dirInfo->getFilename(); }
$compositions = array(); for ($start = 0; $start < count($words); $start++) { for ($len = 1; $len <= $maxTerms && $len <= count($words) - $start; $len++) { $compositions[] = implode(" ", array_slice($words, $start, $len)); } } return $compositions; } function getUnderConstructionUntil($teamID) { global $prefix; $underConstruction1 = "SELECT underConstructionUntil FROM " . $prefix . "stadien WHERE team = '" . mysql_real_escape_string($teamID) . "'"; $underConstruction2 = mysql_query($underConstruction1); return intval(mysql_result($underConstruction2, 0)); } $teamNameParts = getPhrases(explode(' ', $cookie_teamname)); $stadiumAffixes = array('Arena', 'Stadium', 'Stade', 'Estadio', 'Estádio', 'Parc', 'Park', 'Stadio', 'Stadyum'); $stadionPhotos = array(0 => array(0, '/images/arena_01.jpg', 'Richard Matthews auf Flickr (Lizenz: Creative Commons BY)'), 1 => array(30000, '/images/arena_03.jpg', 'Jon Candy auf Flickr (Lizenz: Creative Commons BY-SA)'), 2 => array(45000, '/images/arena_04.jpg', 'poolie auf Flickr (Lizenz: Creative Commons BY)'), 3 => array(60000, '/images/arena_05.jpg', 'Lawrie Cate auf Flickr (Lizenz: Creative Commons BY)'), 4 => array(75000, '/images/arena_06.jpg', 'Steve Cadman auf Flickr (Lizenz: Creative Commons BY-SA)'), 5 => array(90000, '/images/arena_07.jpg', 'Ralf Peter Reimann auf Flickr (Lizenz: Creative Commons BY-SA)')); if (isset($_POST['plaetze']) && isset($_POST['art']) && $cookie_id != CONFIG_DEMO_USER) { $val1 = "SELECT plaetze FROM " . $prefix . "stadien WHERE team = '" . $cookie_team . "'"; $val2 = mysql_query($val1); $val3 = mysql_fetch_assoc($val2); $val4 = "SELECT konto FROM " . $prefix . "teams WHERE ids = '" . $cookie_team . "'"; $val5 = mysql_query($val4); $val6 = mysql_fetch_assoc($val5); if ($_POST['art'] == 'erweitert') { $plaetze_neu = intval($_POST['plaetze']); if ($plaetze_neu > 0) { $preis = 11880000 + $plaetze_neu * 1200; if ($val3['plaetze'] + $plaetze_neu <= STADIUM_MAX_SEATS) { if ($val6['konto'] - $preis >= 0) {
<?php require_once 'config.php'; require_once 'class.Phrase.php'; require_once 'class.PhrasePNGBuilder.php'; require_once 'loadPhrases.php'; $pngBuilder = new PhrasePNGBuilder($textFont, $authorFont, $textSize, $authorSize); $counter = 0; // Generate images for all phrases that have not been generated before foreach (getPhrases() as $phrase) { $text = wordwrap($phrase->phrase(), $charactersPerLine); $author = $phrase->author(); $hash = $phrase->md5(); $imageFile = $imagesFolder . '/' . $hash . '.png'; if (!file_exists($imageFile)) { $pngBuilder->phrase($phrase, $charactersPerLine); $image = $pngBuilder->build(); // Save the image imagepng($image, $imageFile); // Unload resources. imagedestroy($image); $counter++; } } echo "Generated {$counter} phrases as png files, current is: {$phrase}"; ?>
} return $ret; } function getFirstWord($t) { global $ignore_words; $words = preg_split("/\\s/", strtolower($t)); foreach ($words as $w) { $ret .= $w . " "; if (!in_array($w, $ignore_words)) { break; } } return trim($ret); } $phrases = getPhrases(isset($argv[0]) ? $argv[0] : "/var/www/html/wiki/maintenance/keywords_to_link.txt"); # iterate over the list of phrases $totallinks = 0; foreach ($phrases as $phrase => $title) { // skip ones we've already done recently if (recentlyProcessedPhrase($phrase)) { continue; } $titleObj = Title::newFromText($title); if (!$titleObj) { $errs .= "<li>Could not generate at title for '{$title}'</li>"; continue; } if ($titleObj->getArticleID() == 0) { $titleObj = Title::newFromURL($title); }