function scan($url)
{
    global $scans;
    global $documentsToScan;
    $document = getPageContents($url);
    if (!DBdocumentExists($url)) {
        $keywords = EXTRACTkeywords($document);
        DBinsertKeywords($url, $keywords);
        $scans--;
    }
    if ($scans <= 0) {
        DBclose();
        exit;
    }
    $links = getLinks($document);
    $documentsToScan = array_merge($documentsToScan, $links);
    $nextScan = array_shift($documentsToScan);
    if ($nextScan != null) {
        scan($nextScan);
    }
}
Example #2
0
<div id="container-already"><?php 
            } else {
                ?>
<div id="container"><?php 
            }
            include "includes/private/bin/modules/native/featureslider.php";
            ?>

<!-- PLUGIN: WHATIDO START CODE -->
<?php 
            include "includes/private/bin/plugins/whatido/plugin.php";
            ?>
<!-- PLUGIN: WHATIDO END CODE -->

<?php 
            getPageContents($launchpadID, $page, $subpage, $WEBSITE_URL, $launchpadPN, $properties, $THEME_NAME);
            ?>
<!-- end of PAGE CONTENTS --> 

</div>


<!-- end of #container -->

<?php 
            include "includes/private/art/lower_left.php";
            include "includes/private/art/lower_right.php";
            if ($properties->TURN_ON_BOTTOM_NAV == "yes" && $launchpad == $properties->PAD3) {
                ?>
<div id="bottomnavigation">
<div class="wrap-bottom">
$playerinfoBase = getPageContents($playerinfoURL1);
if (!stristr(implode("\n", $playerinfoBase), "O\nH\tasof\n")) {
    die("Player with PID {$pid} doesn't exist on the stat server !");
}
$playerinfoData1 = parsePlayerInfo($playerinfoBase);
// Get Player Info: Extra (getplayerinfo.aspx query)
$playerinfoURL2 = $gsURL . "/ASP/getplayerinfo.aspx?pid={$pid}&info=mtm-,mwn-,mls-";
$playerinfoExtra = getPageContents($playerinfoURL2);
$playerinfoData2 = parsePlayerInfo($playerinfoExtra);
// Get Player Info: Unlocks (getunlocksinfo.aspx query)
$unlocksinfoURL = $gsURL . "/ASP/getunlocksinfo.aspx?pid={$pid}";
$playerinfoUnlocks = getPageContents($unlocksinfoURL);
$playerinfoData3 = parseUnlocks($playerinfoUnlocks);
// Get Player Info: Awards (getawardsinfo.aspx query)
$awardsinfoURL = $gsURL . "/ASP/getawardsinfo.aspx?pid={$pid}";
$playerinfoAwards = getPageContents($awardsinfoURL);
$playerinfoData4 = parseAwards($playerinfoAwards);
print_r($playerinfoData1);
print_r($playerinfoData2);
print_r($playerinfoData3);
print_r($playerinfoData4);
// Check if Player Already Exists
$query = "SELECT * FROM player WHERE id = {$pid}";
$result = mysql_query($query);
checkSQLResult($result, $query);
if (!mysql_num_rows($result)) {
    $country = 'xx';
    // Insert information
    $query = "INSERT INTO player SET\n\t\t\tid = {$pid},\n\t\t\tname = '" . $playerinfoData1["nick"] . "',\n\t\t\tcountry = 'xx',\n\t\t\ttime = " . $playerinfoData1["time"] . ",\n\t\t\trounds = " . $playerinfoData1["mode0"] + $playerinfoData1["mode1"] + $playerinfoData1["mode2"] . ",\n\t\t\tip = '0.0.0.0',\n\t\t\tscore = " . $playerinfoData1["scor"] . ",\n\t\t\tcmdscore = " . $playerinfoData1["cdsc"] . ",\n\t\t\tskillscore = " . $playerinfoData1["cmsc"] . ",\n\t\t\tteamscore = " . $playerinfoData1["twsc"] . ",\n\t\t\tkills = " . $playerinfoData1["kill"] . ",\n\t\t\tdeaths = " . $playerinfoData1["deth"] . ",\n\t\t\tcaptures = " . $playerinfoData1["cpcp"] . ",\n\t\t\tneutralizes = 0,\n\t\t\tcaptureassists = " . $playerinfoData1["cacp"] . ",\n\t\t\tneutralizeassists = 0,\n\t\t\tdefends = " . $playerinfoData1["dfcp"] . ",\n\t\t\tdamageassists = " . $playerinfoData1["kila"] . ",\n\t\t\theals = " . $playerinfoData1["heal"] . ",\n\t\t\trevives = " . $playerinfoData1["rviv"] . ",\n\t\t\tammos = " . $playerinfoData1["rsup"] . ",\n\t\t\trepairs = " . $playerinfoData1["rpar"] . ",\n\t\t\ttargetassists = " . $playerinfoData1["tgte"] . ",\n\t\t\tdriverspecials = " . $playerinfoData1["dsab"] . ",\n\t\t\tdriverassists = " . $playerinfoData1["dkas"] . ",\n\t\t\tpassengerassists = 0,\n\t\t\tteamkills = 0,\n\t\t\tteamdamage = 0,\n\t\t\tteamvehicledamage = 0,\n\t\t\tsuicides = " . $playerinfoData1["suic"] . ",\n\t\t\tkillstreak = " . $playerinfoData1["bksk"] . ",\n\t\t\tdeathstreak = " . $playerinfoData1["wdsk"] . ",\n\t\t\trank = " . $playerinfoData1["rank"] . ",\n\t\t\tbanned = " . $playerinfoData1["ban"] . ",\n\t\t\tkicked = " . $playerinfoData1["kick"] . ",\n\t\t\tcmdtime = " . $playerinfoData1["tcdr"] . ",\n\t\t\tsqltime = " . $playerinfoData1["tsql"] . ",\n\t\t\tsqmtime = " . $playerinfoData1["tsqm"] . ",\n\t\t\tlwtime = " . $playerinfoData1["tlwf"] . ",\n\t\t\twins = " . $playerinfoData1["wins"] . ",\n\t\t\tlosses = " . $playerinfoData1["loss"] . ",\n\t\t\tavailunlocks = 0,\n\t\t\tusedunlocks = 0,\n\t\t\tjoined = " . $playerinfoData1["jond"] . ",\n\t\t\trndscore = " . $playerinfoData1["bbrs"] . ",\n\t\t\tlastonline = " . $playerinfoData1["lbtl"] . ",\n\t\t\tmode0 = " . $playerinfoData1["mode0"] . ",\n\t\t\tmode1 = " . $playerinfoData1["mode1"] . ",\n\t\t\tmode2 = " . $playerinfoData1["mode2"] . "\n\t\t";
    $result = mysql_query($query);
    checkSQLResult($result, $query);
Example #4
0
    $test['5g'] = 'getplayerprogress.aspx?mode=flag&scale=game&auth=' . $auth;
    $test['5h'] = 'getplayerprogress.aspx?mode=waccu&scale=game&auth=' . $auth;
    $test['5i'] = 'getplayerprogress.aspx?mode=wl&scale=game&auth=' . $auth;
    $test['5j'] = 'getplayerprogress.aspx?mode=twsc&scale=game&auth=' . $auth;
    $test['5k'] = 'getplayerprogress.aspx?mode=sup&scale=game&auth=' . $auth;
    $test['6'] = 'getunlocksinfo.aspx?auth=' . $auth;
    $test['7'] = 'playersearch.aspx?auth=' . $auth;
    $array_url = array();
    $array_url['stella.prod.gamespy.com'] = $test;
    $array_url['86.111.224.14'] = $test;
    echo '
<table>';
    foreach ($array_url[$server_type] as $req) {
        echo '
	<tr><td><a href="http://' . $server_type . '/' . $req . '" target="_blank">http://' . $server_type . '/' . $req . '</a></td></tr>
	<tr><td><pre>' . getPageContents("http://" . $server_type . "/" . $req) . '</pre></td></tr>';
    }
    echo '
</table>
';
}
function getPageContents($url)
{
    // Try file() first
    /*
    if( function_exists('file') && function_exists('fopen') && ini_get('allow_url_fopen') ) {
    	//ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");
    	ini_set("user_agent","GameSpyHTTP/1.0");
    	ini_set("auto_detect_line_endings", true);
    	$results = @file($url);
    }
Example #5
0
 public function update()
 {
     // Make sure user is super admin for ajax
     if ($this->user['is_super_admin'] != 1) {
         $this->show_403();
         return;
     }
     // Build our page title / desc, then load the view
     $data = array('page_title' => "Remote Updater", 'page_desc' => "This script allows you to update your CMS with just a click of a button.");
     //Try cURL first.
     if (!extension_loaded("curl")) {
         $ssl = true;
         $fopen = true;
         //Fall back on OpenSSL and allow_url_fopen before failing.
         if (!extension_loaded("openssl") || !in_array("https", stream_get_wrappers())) {
             $ssl = false;
         }
         if (ini_get("allow_url_fopen") != 1) {
             $fopen = false;
         }
         if (!$ssl || !$fopen) {
             $Message = "The Plexis remote updater requires either cURL or OpenSSL and allow_url_fopen, please enable cURL or OpenSSL and allow_url_fopen.<br /><br />cURL: Disabled";
             $Message .= "<br />OpenSSL: " . $ssl ? "Enabled" : "Disabled";
             $Message .= "<br />allow_url_fopen" . $fopen ? "Enabled" : "Disabled";
             output_message("warning", $Message);
             $this->load->view("blank", $data);
             return;
         }
     }
     // Include the URL helper
     $this->load->helper('Url');
     // Get the file changes from github
     $start = microtime(1);
     \Debug::silent_mode(true);
     $page = getPageContents('https://api.github.com/repos/Plexis/Plexis/commits?per_page=30');
     \Debug::silent_mode(false);
     $stop = microtime(1);
     // Granted we have page contents
     if ($page) {
         // Decode the results
         $commits = json_decode($page, TRUE);
         // Defaults
         $count = 0;
         $latest = 0;
         // Get the latest build
         $message = $commits[0]['commit']['message'];
         if (preg_match('/([0-9]+)/', $message, $latest)) {
             $latest = $latest[0];
             if (CMS_BUILD < $latest) {
                 $count = $latest - CMS_BUILD;
                 if ($count > 29) {
                     output_message('warning', 'Your cms is out of date by more than 30 updates. You will need to manually update.');
                     $this->load->view('blank', $data);
                     return;
                 }
             }
         } else {
             output_message('warning', 'Unable to determine latest build');
             $this->load->view('blank', $data);
             return;
         }
         // Simple
         $count == 0 ? $next = $commits[0] : ($next = $commits[$count - 1]);
         $d = new DateTime($next['commit']['author']['date']);
         $date = $d->format("M j, Y - g:i a");
         // Set JS vars
         $this->Template->setjs('update_sha', $next['sha']);
         $this->Template->setjs('update_url', $next['url']);
         // Build our page data
         $data['time'] = round($stop - $start, 5);
         $data['count'] = $count;
         $data['latest'] = $latest;
         $data['message'] = preg_replace('/([\\[0-9\\]]+)/', '', htmlspecialchars($next['commit']['message']), 1);
         $data['date'] = $date;
         $data['author'] = '<a href="https://github.com/' . $next['author']['login'] . '" target="_blank">' . ucfirst($next['author']['login']) . '</a>';
         $data['more_info'] = "https://github.com/Plexis/Plexis/commit/" . $next['sha'];
         $data['CMS_BUILD'] = CMS_BUILD;
         unset($commits);
         // No updates has a different view
         if ($count == 0) {
             $this->load->view('no_updates', $data);
         } else {
             // Add the progress bar
             $this->Template->add_script('progressbar_mini.js');
             $this->Template->add_css('progressbar.css');
             $this->load->view('updates', $data);
         }
     } else {
         output_message('warning', 'Unable to fetch updates from Github.');
         $this->load->view('blank', $data);
         return;
     }
 }
<?php

require "settings.php";
require "mysql-connector.php";
require LIB_DIR . "/core/template.php";
$content = json_decode($_POST["order"]);
$content->{"standalone"} = true;
$headers = "Content-Type: text/html; charset=utf-8\n";
$mailContent = renderTemplateToString("purchase-order", $content);
$name = $content->{"name"};
$time = $content->{"orderDate"};
$subject = "Bestellung von {$name} um {$time}";
mail(ORDER_MAIL_TO, $subject, $mailContent, $headers);
mail($content->{"mail"}, "Kopie ihrer {$subject}", $mailContent, $headers);
$article = getPageContents(10);
$article["siteBase"] = SITE_BASE;
renderTemplate("page-base", $article);
    if (!empty($amount)) {
        $product = $allItems[$id];
        if (!$product) {
            continue;
        }
        $product["amount"] = $amount;
        $totalPrice = $amount * $product["price"];
        $toPay += $totalPrice;
        $product["totalPrice"] = formatPrice($totalPrice);
        $product["price"] = formatPrice($product["price"]);
        $order[] = $product;
    }
}
date_default_timezone_set("Europe/Berlin");
$_POST["orderDate"] = date("d.m.Y H:i:s");
$_POST["itemsOrdered"] = $order;
$_POST["toPay"] = formatPrice($toPay);
$purchaseOrder = renderTemplateToString("purchase-order", $_POST);
$article = getPageContents(9);
$article["siteBase"] = SITE_BASE;
renderTemplate("page-base", array("title" => $article["title"], "content" => $article["content"], "siteBase" => SITE_BASE, "orderData" => json_encode($_POST), "orderDetails" => $purchaseOrder, "onConfirmOrderPage" => true));
function loadProducts()
{
    global $mysqli;
    $p = array();
    $res = $mysqli->query("select id, title, description, category, price from jube_items order by id");
    while ($row = $res->fetch_assoc()) {
        $p[$row["id"]] = array("id" => $row["id"], "title" => $row["title"], "description" => $row["description"], "price" => $row["price"], "category" => $row["category"]);
    }
    return $p;
}
Example #8
0
function testConfig()
{
    include 'class.validator.php';
    DEFINE('__PASS', '<b><font color="green">Pass</font></b>');
    DEFINE('__WARN', '<b><font color="orange">Warn</font></b>');
    DEFINE('__FAIL', '<b><font color="red">Fail</font></b>');
    // Define Test Snapshot String (PID: 111)
    $tst_prefix = 'TST' . uniqid(rand());
    $tst_snapshot = $tst_prefix . '\\test_map\\queryport\\29900\\mapstart\\1157264950.7\\mapend\\1157266995.57\\win\\1\\gm\\0\\m\\999\\v\\bf2\\pc\\1\\rwa\\2\\ra1\\0\\rs1\\25\\ra2\\2\\rs2\\0\\pID_0\\999\\name_0\\Test Player\\t_0\\2\\a_0\\0\\ctime_0\\1559\\c_0\\1\\ip_0\\0\\rs_0\\24\\cs_0\\0\\ss_0\\18\\ts_0\\6\\kills_0\\9\\deaths_0\\17\\cpc_0\\0\\cpn_0\\1\\cpa_0\\0\\cpna_0\\0\\cpd_0\\0\\ka_0\\0\\he_0\\0\\rev_0\\0\\rsp_0\\0\\rep_0\\0\\tre_0\\0\\drs_0\\0\\dra_0\\4\\pa_0\\0\\tmkl_0\\0\\tmdg_0\\0\\tmvd_0\\0\\su_0\\0\\ks_0\\6\\ds_0\\6\\rank_0\\3\\ban_0\\0\\kck_0\\0\\tco_0\\0\\tsl_0\\1559\\tsm_0\\0\\tlw_0\\0\\ta0_0\\1559\\ta1_0\\0\\ta2_0\\0\\ta3_0\\0\\ta4_0\\0\\ta5_0\\0\\ta6_0\\0\\ta7_0\\0\\ta8_0\\0\\ta9_0\\0\\mvns_0\\29000037\\mvks_0\\1\\mvns_0\\29000113\\mvks_0\\1\\mvns_0\\29000069\\mvks_0\\1\\mvns_0\\29000081\\mvks_0\\2\\mvns_0\\29000108\\mvks_0\\1\\mvns_0\\29000080\\mvks_0\\1\\mvns_0\\29000089\\mvks_0\\1\\mvns_0\\29000041\\mvks_0\\1\\tv0_0\\278\\tv1_0\\0\\tv2_0\\0\\tv3_0\\532\\tv4_0\\227\\tv5_0\\0\\tv6_0\\0\\tvp_0\\17\\kv0_0\\5\\kv1_0\\0\\kv2_0\\0\\kv3_0\\0\\kv4_0\\0\\kv5_0\\0\\kv6_0\\0\\bv0_0\\3\\bv1_0\\0\\bv2_0\\0\\bv3_0\\0\\bv4_0\\0\\bv5_0\\0\\bv6_0\\0\\kvr0_0\\1\\kvr1_0\\0\\kvr2_0\\0\\kvr3_0\\0\\kvr4_0\\0\\kvr5_0\\0\\kvr6_0\\0\\tk0_0\\736\\tk1_0\\20\\tk2_0\\311\\tk3_0\\0\\tk4_0\\320\\tk5_0\\84\\tk6_0\\29\\kk0_0\\8\\kk1_0\\0\\kk2_0\\0\\kk3_0\\0\\kk4_0\\1\\kk5_0\\0\\kk6_0\\0\\dk0_0\\10\\dk1_0\\1\\dk2_0\\2\\dk3_0\\0\\dk4_0\\2\\dk5_0\\1\\dk6_0\\1\\tw0_0\\11\\tw1_0\\0\\tw2_0\\49\\tw3_0\\28\\tw4_0\\10\\tw5_0\\5\\tw6_0\\54\\tw7_0\\382\\tw8_0\\47\\te0_0\\2\\te1_0\\0\\te3_0\\48\\te2_0\\0\\te4_0\\0\\te5_0\\0\\te6_0\\0\\te7_0\\0\\te8_0\\0\\kw0_0\\0\\kw1_0\\0\\kw2_0\\0\\kw3_0\\0\\kw4_0\\0\\kw5_0\\1\\kw6_0\\0\\kw7_0\\1\\kw8_0\\0\\ke0_0\\1\\ke1_0\\0\\ke3_0\\0\\ke2_0\\0\\ke4_0\\0\\ke5_0\\0\\bw0_0\\1\\bw1_0\\0\\bw2_0\\2\\bw3_0\\1\\bw4_0\\0\\bw5_0\\0\\bw6_0\\3\\bw7_0\\5\\bw8_0\\1\\be0_0\\0\\be1_0\\0\\be3_0\\1\\be2_0\\0\\be4_0\\0\\be5_0\\0\\be8_0\\0\\be9_0\\0\\de6_0\\0\\de7_0\\0\\de8_0\\0\\sw0_0\\0\\sw1_0\\0\\sw2_0\\26\\sw3_0\\0\\sw4_0\\0\\sw5_0\\15\\sw6_0\\4\\sw7_0\\53\\sw8_0\\0\\se0_0\\2\\se1_0\\0\\se2_0\\0\\se3_0\\6\\se4_0\\0\\se5_0\\0\\hw0_0\\0\\hw1_0\\0\\hw2_0\\3\\hw3_0\\0\\hw4_0\\0\\hw5_0\\5\\hw6_0\\1\\hw7_0\\8\\hw8_0\\0\\he0_0\\1\\he1_0\\0\\he2_0\\0\\he3_0\\3\\he4_0\\0\\he5_0\\0\\EOF\\1';
    $tst_pid = 999;
    $tst_mapid = 999;
    $cfg = new Config();
    $chk = new Validator();
    showLog("Testing Config...");
    // Check Config File Write Access
    showLog(" > Checking Config File...");
    if (!$chk->is_sane('_config.php')) {
        showLog("\t - Config File Writable: " . __FAIL);
    } else {
        showLog("\t - Config File Writable: " . __PASS);
    }
    // Check Log File Write Access
    showLog(" > Checking Log Files...");
    if (!$chk->is_sane($cfg->get('debug_log'))) {
        showLog("\t - Error Log File Writable: " . __WARN);
    } else {
        showLog("\t - Error Log File Writable: " . __PASS);
    }
    if (!$chk->is_sane($cfg->get('admin_log'))) {
        showLog("\t - Admin Log File Writable: " . __WARN);
    } else {
        showLog("\t - Admin Log File Writable: " . __PASS);
    }
    // DB Host Access
    showLog(" > Checking Database Host...");
    if ($chk->is_ipaddress($cfg->get('db_host'))) {
        showLog("\t - Database host (" . $cfg->get('db_host') . ") IP Address valid: " . __PASS);
    } elseif ($chk->is_hostname($cfg->get('db_host'))) {
        showLog("\t - Database host (" . $cfg->get('db_host') . ") appears valid: " . __PASS);
        if (PHP_OS == 'WINNT') {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") resolves: " . __WARN);
        } elseif (!checkdnsrr($cfg->get('db_host'), "ANY")) {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") resolves: " . __PASS);
        } else {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") resolves: " . __FAIL);
        }
    } else {
        if ($cfg->get('db_host') == 'localhost') {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") valid: " . __PASS);
        } elseif (PHP_OS == 'WINNT') {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") resolves: " . __WARN);
        } elseif (!checkdnsrr($cfg->get('db_host'), "ANY")) {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") valid: " . __PASS);
        } else {
            showLog("\t - Database host (" . $cfg->get('db_host') . ") valid: " . __FAIL);
        }
    }
    // DB MySQL Access
    showLog(" > Checking Database Config...");
    $connection = @mysql_connect($cfg->get('db_host'), $cfg->get('db_user'), $cfg->get('db_pass'));
    if (!$connection) {
        showLog("\t - Database host (" . $cfg->get('db_host') . ") access: " . __FAIL);
    } else {
        showLog("\t - Database host (" . $cfg->get('db_host') . ") access: " . __PASS);
        // DB Access
        $db_selected = @mysql_select_db($cfg->get('db_name'), $connection);
        if (!$db_selected) {
            showLog("\t - Database (" . $cfg->get('db_name') . ") access: " . __FAIL);
        } else {
            showLog("\t - Database (" . $cfg->get('db_name') . ") access: " . __PASS);
            // DB Version
            if (getDbVer() != $cfg->get('db_expected_ver')) {
                showLog("\t - Database version (" . $cfg->get('db_expected_ver') . "): " . __FAIL);
            } else {
                showLog("\t - Database version (" . $cfg->get('db_expected_ver') . "): " . __PASS);
            }
        }
    }
    // Check SNAPSHOT Storage Write Access
    showLog(" > Checking SNAPSHOT Storage Path...");
    if (!$chk->is_sane_dir($cfg->get('stats_logs'))) {
        showLog("\t - SNAPSHOT Path Writable: " . __FAIL);
    } else {
        showLog("\t - SNAPSHOT Path Writable: " . __PASS);
    }
    // Check SNAPSHOT Archive Write Access
    showLog(" > Checking SNAPSHOT Archive Storage Path...");
    if (!$chk->is_sane_dir($cfg->get('stats_logs_store'))) {
        showLog("\t - SNAPSHOT Archive Path Writable: " . __FAIL);
    } else {
        showLog("\t - SNAPSHOT Archive Path Writable: " . __PASS);
    }
    // Check Admin Backup Write Access
    showLog(" > Checking Backup Storage Path...");
    if (!$chk->is_sane_dir($cfg->get('admin_backup_path'))) {
        showLog("\t - Backup Path Writable: " . __FAIL);
    } else {
        showLog("\t - Backup Path Writable: " . __PASS);
    }
    // Check For Required Functions
    showLog(" > Checking Remote URL Functions...");
    if (function_exists('file') && function_exists('fopen') && ini_get('allow_url_fopen')) {
        showLog("\t - Remote URL Function Exist ('FOPEN'): " . __PASS);
        $doURLChecks = true;
    } elseif (function_exists('curl_exec')) {
        showLog("\t - Remote URL Function Exist ('CURL'): " . __PASS);
        $doURLChecks = true;
    } else {
        showLog("\t - Remote URL Function Exist: " . __WARN);
        $doURLChecks = false;
    }
    // Close database connection
    @mysql_close($connection);
    if ($doURLChecks) {
        // Check bf2statistics.php Processing
        showLog(" > Checking BF2Statistics Processing...");
        $fh = @fsockopen($_SERVER['HTTP_HOST'], 80);
        if ($fh) {
            fwrite($fh, "POST /ASP/bf2statistics.php HTTP/1.1\r\n");
            fwrite($fh, "HOST: " . $_SERVER['HTTP_HOST'] . "\r\n");
            fwrite($fh, "User-Agent: GameSpyHTTP/1.0\r\n");
            fwrite($fh, "Content-Type: application/x-www-form-urlencoded\r\n");
            fwrite($fh, "Content-Length: " . strlen($tst_snapshot) . "\r\n\r\n");
            fwrite($fh, $tst_snapshot . "\r\n");
            $buffer = "";
            while (!feof($fh)) {
                $buffer .= fgets($fh, 4096);
            }
            fclose($fh);
            // Check Response Buffer
            if (preg_match("%^HTTP/1.[01]\\s*(\\d+) *([^\n\r]*)(.*?)\$%is", $buffer, $matches)) {
                $responsecode = $matches[1];
            }
            if ($responsecode != '200') {
                showLog("\t - BF2Statistics Processing Check: " . __FAIL);
            } else {
                showLog("\t - BF2Statistics Processing Check: " . __PASS);
            }
        } else {
            showLog("\t - BF2Statistics Processing Check: " . __FAIL);
        }
        // Check .aspx Page Responses
        showLog(" > Checking Gamespy (.aspx) File Basic Response...");
        $url = "http://" . $_SERVER['HTTP_HOST'] . "/ASP/getbackendinfo.aspx";
        $response = getPageContents($url);
        if (trim($response[0]) != 'O') {
            showLog("\t - Gamespy (.aspx) Basic Response: " . __FAIL);
        } else {
            showLog("\t - Gamespy (.aspx) Basic Response: " . __PASS);
        }
        showLog(" > Checking Gamespy (.aspx) File Advanced Responses...");
        $url = "http://" . $_SERVER['HTTP_HOST'] . "/ASP/getawardsinfo.aspx?pid={$tst_pid}";
        $response = getPageContents($url);
        if (trim($response[0]) != 'O') {
            showLog("\t - Gamespy (.aspx) Advanced (1) Response: " . __FAIL);
        } else {
            showLog("\t - Gamespy (.aspx) Advanced (1) Response: " . __PASS);
        }
        $url = "http://" . $_SERVER['HTTP_HOST'] . "/ASP/getrankinfo.aspx?pid={$tst_pid}";
        $response = getPageContents($url);
        if (trim($response[0]) != 'O') {
            showLog("\t - Gamespy (.aspx) Advanced (2) Response: " . __FAIL);
        } else {
            showLog("\t - Gamespy (.aspx) Advanced (2) Response: " . __PASS);
        }
        $url = "http://" . $_SERVER['HTTP_HOST'] . "/ASP/getunlocksinfo.aspx?pid={$tst_pid}";
        $response = getPageContents($url);
        if (trim($response[0]) != 'O') {
            showLog("\t - Gamespy (.aspx) Advanced (3) Response: " . __FAIL);
        } else {
            showLog("\t - Gamespy (.aspx) Advanced (3) Response: " . __PASS);
        }
    }
    // Re-Connect to DB (The above scripts sometimes removes it)
    $connection = @mysql_connect($cfg->get('db_host'), $cfg->get('db_user'), $cfg->get('db_pass'));
    @mysql_select_db($cfg->get('db_name'), $connection) or die("Database Error: " . mysql_error());
    // Remove Test Server Data
    $query = "DELETE FROM `servers` WHERE prefix = '{$tst_prefix}';";
    $result = mysql_query($query);
    if ($result) {
        showLog(" -> Server Info ({$tst_prefix}) removed from Table (servers).");
    } else {
        showLog(" -> <font color='red'>ERROR:</font> Server Info ({$tst_prefix}) removed from Table (servers)!\n" . mysql_error());
    }
    // Remove Test Map Data
    $query = "DELETE FROM `mapinfo` WHERE id = {$tst_mapid};";
    $result = mysql_query($query);
    if ($result) {
        showLog(" -> Map Info ({$tst_mapid}) removed from Table (mapinfo).");
    } else {
        showLog(" -> <font color='red'>ERROR:</font> Map Info ({$tst_mapid}) removed from Table (mapinfo)!\n" . mysql_error());
    }
    $query = "DELETE FROM `round_history` WHERE mapid = {$tst_mapid};";
    $result = mysql_query($query);
    if ($result) {
        showLog(" -> Map Info ({$tst_mapid}) removed from Table (round_history).");
    } else {
        showLog(" -> <font color='red'>ERROR:</font> Map Info ({$tst_mapid}) removed from Table (round_history)!\n" . mysql_error());
    }
    showLog("Done! :)");
    showLog("");
    // Close database connection
    @mysql_close($connection);
    // Remove Test Player Data
    $_POST['selitems'] = array($tst_pid);
    processDeletePlayers();
}
Example #9
0
         $postContent = preg_replace('/<b>|<\\/b>/s', "", $postContent);
         $postContent = preg_replace('/<i>|<\\/i>/s', "", $postContent);
         $postContent = preg_replace('/<font.*?>|<\\/font>/s', "", $postContent);
         $postContent = preg_replace('/&quot;/s', '"', $postContent);
         $postContent = preg_replace('/&#39;/s', "'", $postContent);
         echo $userName . ": " . $postContent . $ratingString;
     }
 } else {
     if ($requestType == "gettweetcontents") {
         $url = $_POST["url"];
         preg_match("/(https:\\/\\/|)/", $url, $urlMatches);
         if ($urlMatches[0] == "") {
             $url = preg_replace("/http:\\/\\//", "", $url);
             $url = "https://" . $url;
         }
         $str = getPageContents($url);
         $str = trim(preg_replace('/\\s+/', ' ', $str));
         preg_match('/<div class="tweet permalink-tweet.*?">(.*)<\\/div>/s', $str, $containerMatches);
         if ($containerMatches[0] != "") {
             preg_match('/<p class="TweetTextSize TweetTextSize--28px js-tweet-text tweet-text" lang="en" data-aria-label-part="0">(.*?)<\\/p>/s', $containerMatches[0], $tweetMatches);
             preg_match('/<strong.*?>(.*?)<\\/strong>/s', $containerMatches[0], $authorMatches);
             $author = "Unknown";
             if ($authorMatches[0] != "") {
                 $cleanedAuthor = $authorMatches[0];
                 $cleanedAuthor = preg_replace('/(<strong.*?>|<\\/strong>)/s', "", $cleanedAuthor);
                 $cleanedAuthor = preg_replace('/<span.*?>(.*)<\\/span>/s', "", $cleanedAuthor);
                 $author = $cleanedAuthor;
             }
             if ($tweetMatches[0] != "") {
                 $cleanedText = $tweetMatches[0];
                 $cleanedText = preg_replace('/(<p class="TweetTextSize TweetTextSize--28px js-tweet-text tweet-text" lang="en" data-aria-label-part="0">|<\\/p>)/s', "", $cleanedText);
Example #10
0
function get_ext_ip()
{
    $url = 'http://this-ip.com/';
    $get = implode("\n", getPageContents($url));
    preg_match('/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $get, $ip);
    $var_ipaddr = $ip[0];
    return $var_ipaddr;
}
Example #11
0
<?php

require "settings.php";
require "mysql-connector.php";
require LIB_DIR . "/core/template.php";
require "admin/moddate.php";
$requestMapping = array("home" => 1, "produkte" => 2, "bestellung" => 3, "projekte" => 4, "links" => 5, "kontakt" => 6, "impressum" => 7, "agb" => 8);
$base = isset($base) ? $base : "home";
$id = $requestMapping[$base];
$res = getPageContents($id);
$viewModel = array("siteBase" => SITE_BASE, "title" => $res["title"], "content" => $res["content"], "lastModification" => getLastModificationDate());
if ($base == "produkte") {
    $viewModel["onProductPage"] = true;
    $viewModel["items"] = loadProducts();
} else {
    if ($base == "bestellung") {
        $viewModel["onOrderPage"] = true;
        $viewModel["items"] = loadProducts();
    }
}
renderTemplate("page-base", $viewModel);
function loadProducts()
{
    global $mysqli;
    $p = array();
    $res = $mysqli->query("select id, title, description, category, price, image from jube_items order by id");
    while ($row = $res->fetch_assoc()) {
        if (!$p[$row["category"]]) {
            $p[$row["category"]] = array();
        }
        $item = array("id" => $row["id"], "title" => $row["title"], "description" => $row["description"], "price" => formatPrice($row["price"]), "category" => $row["category"]);
Example #12
0
 public function update()
 {
     // Make sure we arent directly accessed and the user has perms
     $this->check_access('sa');
     // Process action
     if (isset($_POST['action'])) {
         $action = trim($this->Input->post('action'));
         switch ($action) {
             case "get_latest":
                 // cURL exist? If not we need to verify the user has openssl installed and https support
                 $curl = function_exists('curl_exec');
                 if (!$curl) {
                     // Make sure the Openssl extension is loaded
                     if (!extension_loaded('openssl')) {
                         echo json_encode(array('success' => false, 'message' => 'Openssl extension not found. Please enable the openssl extension in your php.ini file'));
                         return;
                     }
                     // Check for https support
                     if (!in_array('https', stream_get_wrappers())) {
                         echo json_encode(array('success' => false, 'message' => 'Unable to find the stream wrapper "https" - did you forget to enable it when you configured PHP?'));
                         return;
                     }
                 }
                 // Make sure the client server allows fopen of urls
                 if (ini_get('allow_url_fopen') == 1 || $curl == true) {
                     // Get the file changes from github
                     $start = microtime(1);
                     \Debug::silent_mode(true);
                     $page = getPageContents('https://api.github.com/repos/Plexis/Plexis/commits?per_page=1', false);
                     \Debug::silent_mode(false);
                     $stop = microtime(1);
                     if ($page == FALSE || empty($page)) {
                         echo json_encode(array('success' => false, 'message' => 'Unable to connect to the update server'));
                         return;
                     }
                     // Decode the results
                     $commits = json_decode($page, TRUE);
                     // Defaults
                     $count = 0;
                     $latest = 0;
                     echo json_encode(array('success' => true, 'message' => $commits));
                     return;
                 } else {
                     echo json_encode(array('success' => false, 'message' => 'allow_url_fopen not enabled in php.ini'));
                     return;
                 }
                 break;
             case "init":
                 config_set('site_updating', 1);
                 config_save('app');
                 break;
             case "finish":
                 // Enable the site again
                 config_set('site_updating', 0);
                 config_save('app');
                 break;
             case "next":
                 // Load the commit.info file
                 $sha = $type = trim($this->Input->post('sha'));
                 $url = 'https://raw.github.com/Plexis/Plexis/' . $sha . '/commit.info';
                 // Get the file changes from github
                 $start = microtime(1);
                 \Debug::silent_mode(true);
                 $page = trim(getPageContents($url, false));
                 \Debug::silent_mode(false);
                 $stop = microtime(1);
                 if ($page == FALSE || empty($page)) {
                     echo json_encode(array('success' => false, 'data' => 'Error fetching updates'));
                     return;
                 }
                 echo json_encode(array('success' => true, 'data' => json_decode($page)));
                 break;
             case "update":
                 // Grab POSTS
                 $type = trim($this->Input->post('status'));
                 $sha = trim($this->Input->post('sha'));
                 $file = trim(str_replace(array('/', '\\'), '/', $this->Input->post('filename')));
                 $url = 'https://raw.github.com/Plexis/Plexis/' . $sha . '/' . $file;
                 $filename = ROOT . DS . str_replace('/', DS, $file);
                 $dirname = dirname($filename);
                 // Load our Filesystem Class
                 $Fs = $this->load->library('Filesystem');
                 // Build our default Json return
                 $return = array();
                 $success = TRUE;
                 $removed = FALSE;
                 // Hush errors
                 \Debug::silent_mode(true);
                 // Get file contents
                 $contents = trim(getPageContents($url, false));
                 $mod = substr($type, 0, 1);
                 switch ($mod) {
                     case "A":
                     case "M":
                         // Make sure the Directory exists!
                         if (!is_dir($dirname)) {
                             // Ignore install files if the install directory doesnt exist
                             if (strpos($dirname, ROOT . DS . 'install') !== false) {
                                 $this->output(true, '');
                                 return;
                             }
                             // Create the directory for the new file if it doesnt exist
                             if (!$Fs->create_dir($dirname)) {
                                 $this->output(false, 'Error creating directory "' . $dirname . '"');
                                 return;
                             }
                         }
                         // Create cache file of modified files to prevent update errors
                         if ($mod == 'M') {
                             if (!$this->addfileids($sha, 'M', $filename)) {
                                 \Debug::write_debuglog('updater.xml');
                                 $this->output(false, 'Error creating/writting to the updater.cache file. A Detailed trace log has been generated "system/logs/debug/updater.xml"');
                                 return;
                             }
                             // Set cache filename
                             $filename = $filename . '.tmp';
                         }
                         // Now attempt to write to the file, create it if it doesnt exist
                         if (!$Fs->create_file($filename, $contents)) {
                             $this->output(false, 'Error creating/opening file "' . $filename . '"');
                             return;
                         }
                         // Add file to modify list
                         break;
                     case "D":
                         if (!$this->addfileids($sha, 'D', $filename)) {
                             \Debug::write_debuglog('updater.xml');
                             $this->output(false, 'Error creating/writting to the updater.cache file. A Detailed trace log has been generated "system/logs/debug/updater.xml"');
                             return;
                         }
                         break;
                 }
                 // Output success
                 $this->output(true, '');
                 break;
             case 'finalize':
                 // Load our Filesystem Class
                 $Fs = $this->load->library('Filesystem');
                 // Add trace for debugging
                 \Debug::trace('Finalizing updates...', __FILE__, __LINE__);
                 // We need to rename all modified files from thier cache version, and remove deleted files
                 $cfile = path(SYSTEM_PATH, 'cache', 'updater.cache');
                 if (file_exists($cfile)) {
                     $data = unserialize(file_get_contents($cfile));
                     unset($data['sha']);
                     foreach ($data['files'] as $file) {
                         // If we are missing a file name or mode, then continue to the next loop
                         if (!isset($file['mode']) || !isset($file['filename'])) {
                             continue;
                         }
                         // Modified file
                         if ($file['mode'] == 'M') {
                             $tmp = $file['filename'] . '.tmp';
                             if (!$Fs->copy($tmp, $file['filename'])) {
                                 // Add trace for debugging
                                 \Debug::trace('Failed to copy {' . $tmp . '} to {' . $file['filename'] . '}', __FILE__, __LINE__);
                                 \Debug::write_debuglog('updater.xml');
                                 $this->output(false, 'Error copying cache contents of file ' . $file['filename'] . '. Update failed.');
                                 die;
                             }
                             $Fs->delete_file($tmp);
                         } else {
                             // Deleted file / dir
                             $Fs->delete($data['filename']);
                             // Re-read the directory
                             clearstatcache();
                             $files = $Fs->read_dir($dirname);
                             // If empty, delete .DS / .htaccess files and remove dir!
                             if (empty($files) || sizeof($files) == 1 && $files[0] == '.htaccess') {
                                 $Fs->remove_dir($dirname);
                             }
                         }
                     }
                     // Remove the updater cache file
                     $Fs->delete_file($cfile);
                     // Output success
                     $this->output(true, '');
                 } else {
                     // Add trace for debugging
                     \Debug::trace('updater.cache file doesnt exist. Update failed.', __FILE__, __LINE__);
                     \Debug::write_debuglog('updater.xml');
                     $this->output(false, 'Unable to open the updater.cache file. Update failed.');
                 }
                 break;
         }
         // End Swicth $action
     } else {
         $this->output(false, 'Invalid Post Action');
     }
 }