115 lines
3.0 KiB
PHP
115 lines
3.0 KiB
PHP
<?php
|
|
|
|
$DOCUMENT_ROOT = '/var/home/slowtwitch/slowtwitch.com/www';
|
|
$default_font = 'font face="Verdana, Arial, Helvetica, sans-serif"';
|
|
|
|
$month_names = array('January','February','March','April','May','June','July',
|
|
'August','September','October','November','December');
|
|
|
|
|
|
$static_base = "http://www.slowtwitch.com/live/";
|
|
|
|
$db = mysql_connect("192.168.1.10", "slowtwitch", "k9volqlAcpq");
|
|
mysql_select_db("ticker",$db);
|
|
umask('002');
|
|
|
|
function myaddslashes($string)
|
|
{
|
|
if (get_magic_quotes_gpc() == 1) { return ($string); }
|
|
else { return (addslashes($string)); }
|
|
}
|
|
|
|
function staticify($stageID)
|
|
{
|
|
$db = mysql_connect("192.168.1.10", "slowtwitch", "k9volqlAcpq");
|
|
mysql_select_db("ticker",$db);
|
|
$err = NULL;
|
|
$url = "http://www.slowtwitch.com";
|
|
$sourcepage = "$url/tick/viewer.php?ID=$stageID";
|
|
$query = "SELECT static_url FROM stages WHERE ID = " . $stageID;
|
|
$result = mysql_query($query, $db);
|
|
if ($result)
|
|
{
|
|
$r = mysql_fetch_array($result);
|
|
$static_URL = $r['static_url'];
|
|
}
|
|
$tempfilename = "/tmp/temp_viewer.html";
|
|
$targetfilename = "/var/home/slowtwitch/slowtwitch.com/www/live/".$static_URL.".html";
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt ($ch, CURLOPT_URL, $sourcepage);
|
|
curl_setopt ($ch, CURLOPT_HEADER, 0);
|
|
|
|
ob_start();
|
|
|
|
curl_exec ($ch);
|
|
curl_close ($ch);
|
|
$htmldata = ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
/**$dynamic_source = fopen($sourcepage, 'r');
|
|
|
|
if (!$dynamic_source) {
|
|
echo "<strong>Unable to load $sourcepage - Static page! Update Failed!</strong>";
|
|
exit();
|
|
}
|
|
|
|
$htmldata = fread($dynamic_source, 1024*1024);
|
|
fclose($dynamic_source); **/
|
|
|
|
$tempfile = fopen($tempfilename, 'w');
|
|
if (!$tempfile) {
|
|
$err = "write_error";
|
|
}
|
|
|
|
fwrite($tempfile, $htmldata);
|
|
fclose($tempfile);
|
|
|
|
copy($tempfilename, $targetfilename);
|
|
unlink($tempfilename);
|
|
}
|
|
|
|
function staticify_all($eventID)
|
|
{
|
|
$db = mysql_connect("192.168.1.10", "slowtwitch", "k9volqlAcpq");
|
|
mysql_select_db("ticker",$db);
|
|
$query = "SELECT ID FROM stages WHERE eventID = ${eventID} AND status != 'complete'";
|
|
$result = mysql_query($query, $db);
|
|
if ($result)
|
|
{
|
|
while ($r = mysql_fetch_array($result))
|
|
{
|
|
$stageID = $r['ID'];
|
|
staticify($stageID);
|
|
}
|
|
}
|
|
}
|
|
|
|
function staticify_old($stageID)
|
|
{
|
|
//$s = "/usr/bin/wget -O /var/www/html/one/tick/html/stage${stageID}.html 'http://www.onemillionrevolutions.org/tick/viewer.php?ID=${stageID}&link=static'";
|
|
//exec("$s 2>&1", $updw);
|
|
//$s = "/usr/bin/wget -O /var/www/html/one/tick/html/stage${stageID}_mobile.html 'http://www.onemillionrevolutions.org/tick/viewer_mobile.php?ID=${stageID}&link=static'";
|
|
//exec("$s 2>&1", $updw);
|
|
}
|
|
|
|
function staticify_all_old($eventID)
|
|
{
|
|
//$db = mysql_connect("localhost", "web", "jalapeno");
|
|
//mysql_select_db("ticker",$db);
|
|
//$query = "SELECT ID FROM stages WHERE eventID = ${eventID}";
|
|
//$result = mysql_query($query, $db);
|
|
//if ($result)
|
|
//{
|
|
//while ($r = mysql_fetch_array($result))
|
|
//{
|
|
//$stageID = $r['ID'];
|
|
//staticify($stageID);
|
|
//}
|
|
//}
|
|
}
|
|
|
|
?>
|