Ejemplo n.º 1
0
function json($file)
{
    global $fs, $word, $around;
    $j = new Services_JSON();
    $a = explode("T", $word);
    $date = preg_replace("/-/", "/", $a[0]);
    $time = $a[1];
    echo "{$time} ---  {$date}<BR>";
    $lines = explode("\n", $fs->getContent("{$file}-data.log"));
    $a = array();
    $around = $around / 10;
    $found = false;
    foreach ($lines as $line) {
        $e = $j->decode($line);
        if ($e) {
            $a[] = toHTML($e);
            //echo $e["date"]." ".$e["time"]. "<BR>";
            if ($found) {
                if (count($a) > $around * 2) {
                    break;
                }
            } else {
                if (count($a) > $around) {
                    array_shift($a);
                }
                if ($e["date"] == $date && $e["time"] == $time) {
                    array_push($a, "<a name='center'/><font color=red>-----------------------------------</font><BR>");
                    $found = TRUE;
                }
            }
        }
    }
    print join("<BR>", $a);
}
Ejemplo n.º 2
0
/**
 * Returns only theme names with their htmlised representation
 * { name=>html, ...}
 */
function getThemeNames() {
    $themes = getThemeList();
    $names = array();
    foreach($themes as $name=>$style) {
        $names[$name] = toHTML($name);
    }
    return $names;
}
Ejemplo n.º 3
0
function check_for_errors() {
	function toHTML($type, $e) {
		$left = '<div class="box rounded error">';

		$out = '<div class="light rounded">!</div>
				<div class="message">'.$type.': '.$e['message'].'</div>
				<div class="line">'.$e['line'].'</div>
				<div class="file">'.$e['file'].'</div>';
		$right = '</div>';



		return $left.$out.$right;
	}

	$results_so_far = '';
	if(stristr(@ob_get_contents(),"<body>")) { //this is already HTML
		//do nothing for now.  In the future we may change behaviour
	} elseif (@ob_get_contents()) { //this is json output, process it.
		$results_so_far = @ob_get_contents();
		@ob_clean();

		echo PHPUnit::toHTML($results_so_far);
	}


	 if( false === is_null($aError = error_get_last()) ) {

		  switch($aError['type']) {
				case E_NOTICE:
				echo toHTML("Notice", $aError);
				break;
			case E_WARNING:
				echo toHTML("Warning", $aError);
				break;
				case E_ERROR:
				echo toHTML("Error", $aError);
				break;
				case E_PARSE:
				echo toHTML("Parse", $aError);
					 break;
			default:
				echo toHTML("Unknown", $aError);
				echo "<br/>";
				break;
		  }


	 }

	if($results_so_far) {
		include('Main/footer.php');
	}

	exit(1);
}
Ejemplo n.º 4
0
function check_for_errors()
{
    function toHTML($type, $e)
    {
        $left = '<div class="box rounded error">';
        $out = '<div class="light rounded">!</div>
				<div class="message">' . $type . ': ' . $e['message'] . '</div>
				<div class="line">' . $e['line'] . '</div>
				<div class="file">' . $e['file'] . '</div>';
        $right = '</div>';
        return $left . $out . $right;
    }
    $results_so_far = '';
    if (@ob_get_contents()) {
        $results_so_far = @ob_get_contents();
        @ob_clean();
        echo PHPUnit::toHTML($results_so_far);
    }
    if (false === is_null($aError = error_get_last())) {
        switch ($aError['type']) {
            case E_NOTICE:
                echo toHTML("Notice", $aError);
                break;
            case E_WARNING:
                echo toHTML("Warning", $aError);
                break;
            case E_ERROR:
                echo toHTML("Error", $aError);
                break;
            case E_PARSE:
                echo toHTML("Parse", $aError);
                break;
            default:
                echo toHTML("Unknown", $aError);
                echo "<br/>";
                break;
        }
    }
    if ($results_so_far) {
        include 'Main/footer.php';
    }
    exit(1);
}
Ejemplo n.º 5
0
include_once 'htmlDefault.php';
include_once 'scoreFunctions.php';
$action = $_GET["action"];
if (!isset($action)) {
    print $html_string;
    exit;
}
define("ACTION_FAILED", -1);
define("UNKNOWN_ACTION", -2);
$connection = mysql_connect("localhost", "cookbook", "cookbook") or die(mysql_error());
mysql_select_db('cookbook_highscores');
switch ($action) {
    case 'get':
        getPlayer();
        break;
    case 'set':
        setPlayer();
        break;
    case 'xml':
        toXML();
        break;
    case 'html':
        toHTML();
        break;
    case 'reset':
        resetDatabase();
        break;
    default:
        print UNKNOWN_ACTION;
}
mysql_close($connection);
Ejemplo n.º 6
0
<body>
	<div class="content">
		<div class="create">
			<i class="fa fa-user"></i><a href="users.php">Users</a>
			<i class="fa fa-plus"></i><a href="create.php">Create Page</a>
			<i class="fa fa-sign-out"></i><a href="logout.php">Log out</a>
		</div>
		<table class="table table-striped">
			<thead>
				<tr>
					<th>ID</th>
					<th>Page</th>
					<th>Page Title</th>
					<th>Content</th>
					<th>Menu Name</th>
					<th>Menu Order</th>
					<th>Template</th>
					<th>Edit</th>
					<th>Remove</th>
				</tr>
			</thead>
			<tbody>
				<?php 
echo toHTML();
?>
			</tbody>
		</table>
	</div>
</body>
</html>
Ejemplo n.º 7
0
                                                    if ($file[0] == ".") {
                                                        continue;
                                                    }
                                                    $text = file_get_contents(PAGES_PATH . "/{$file}");
                                                    if (eregi($q, $text)) {
                                                        ++$matches;
                                                        $file = preg_replace("/(.*?)\\.txt/", "<a href=\"" . SELF . VIEW . "/\\1\">\\1</a>", $file);
                                                        $html .= "<li>{$file}</li>\n";
                                                    }
                                                }
                                                closedir($dir);
                                            }
                                            $html .= "</ul>\n";
                                            $html .= "<p>{$matches} matched</p>\n";
                                        } else {
                                            $html = toHTML($text);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
$datetime = '';
if ($action == "all" || $action == "all_name" || $action == "all_date") {
    $title = "All Pages";
} else {
Ejemplo n.º 8
0
     $doc = new DOMDocument();
     $doc->preserveWhiteSpace = false;
     if (!@$doc->loadHTML($html)) {
         printf("Error: Could not parse response as HTML.");
         sleep(10);
         continue;
     }
     // find all tables that look like they contain a sequence
     $xpath = new DOMXPath($doc);
     $tables = $xpath->query('//table[tr[3]//table/tr/td[1]/a]');
     foreach ($tables as $table) {
         $idLinks = $xpath->query('tr[3]//table/tr/td[1]/a', $table);
         if ($idLinks->length > 0) {
             $id = $idLinks[0]->textContent;
             $id = (int) substr($id, 1);
             $result[$id] = base64_encode(bzcompress(toHTML($table)));
         }
     }
     sleep(10);
 }
 /////////////////////////////////////////////////////////////////////////////
 // report results back to the mothership
 $payload = json_encode($result, JSON_UNESCAPED_SLASHES);
 $context = stream_context_create(['http' => ['method' => 'POST', 'header' => "Content-Type: application/json; charset=utf-8\r\nContent-Length: " . strlen($payload), 'content' => $payload]]);
 printf("Uploading results to the mothership...");
 $result = @file_get_contents("{$mothership}?task=finish&worker={$workerID}", null, $context);
 if (!$result) {
     printf(" failed.\n");
     sleep(5);
     continue;
 }
Ejemplo n.º 9
0
table#dd td {padding: 6px;width: 120px;}
table#dd tbody.tb1 td {background-color: #FFFFFF;}
table#dd tbody.tb2 td {background-color: #F7F7F7;}
table#dd tbody td:hover {background-color: #BFEDF9;}
table#dd tbody td ul {list-style-type:none;margin:0px;padding:0px;}
center {font-size: 24px;margin:50px}
</style>
<body>
<center>{$title}</center>
HTML;
    $arr = $rl->getContentFromFile($files);
    ksort($arr);
    $html .= $rl->arrayToTable($arr);
    $html . '</body></html>';
    header("Content-Type: text/html; charset=utf-8");
    echo $html;
}
function toJSON($strfilename)
{
    $rl = new LogAnalysis();
    $fileName = iconv('UTF-8', 'GBK', $strfilename);
    $files = array($fileName);
    $arr = $rl->getContentFromFile($files);
    ksort($arr);
    header("Content-Type: application/json; charset=utf-8");
    echo json_encode($arr);
}
$strfilename = 'C:\\Users\\N010D90001\\Downloads\\moapi.log';
set_time_limit(0);
toHTML($strfilename);
Ejemplo n.º 10
0
<?php

require_once 'XML/RSS.php';
$rssfile = 'sdphp_talks.rss';
$r =& new XML_RSS($rssfile);
$r->parse();
$channel = $r->getChannelInfo();
echo "<h1 align='center'><a href=\"{$channel['link']}\">";
echo "{$channel['title']}</a></h1>\n";
echo "<h2>{$channel['description']}</h2>\n";
echo "<table width='100%' cellspacing='1', border='0'>\n";
foreach ($r->getItems() as $item) {
    echo "<tr><td bgcolor='#000000'>\n";
    echo toHTML($item);
    echo "</td><tr>\n";
}
echo "</table>\n";
function toHTML($item)
{
    return "<table width='100%' border=0 cellspacing=0>\n" . "<tr><th bgcolor='#ffffaa'>{$item['title']}</th></tr>\n" . "<tr><td bgcolor='#ffffff' align='center'>URL: " . "<a href=\"{$item['link']}\"" . "target='_blank'>{$item['link']}</a></td></tr>\n" . "<tr><td align='right' bgcolor='ffaaff'>" . "{$item['description']}</td></tr>\n" . "</table>\n";
}
Ejemplo n.º 11
0
                                        if ($file[0] == ".") {
                                            continue;
                                        }
                                        $text = file_get_contents(PAGES_PATH . "/{$file}");
                                        if (eregi($q, $text) || eregi($q, $file)) {
                                            ++$matches;
                                            $file = preg_replace("/(.*?)\\.txt/", "<a href=\"" . SELF . VIEW . "/\\1\">\\1</a>", $file);
                                            $html .= "<li>{$file}</li>\n";
                                        }
                                    }
                                    closedir($dir);
                                }
                                $html .= "</ul>\n";
                                $html .= "<p>{$matches} matched</p>\n";
                            } else {
                                $html = empty($text) ? '' : toHTML($text);
                            }
                        }
                    }
                }
            }
        }
    }
}
$datetime = '';
if ($action == "all_name" || $action == "all_date") {
    $title = "All Pages";
} else {
    if ($action == "upload") {
        $title = "Upload Image";
    } else {