Permalink
Browse files

few tweaks

  • Loading branch information...
1 parent 4164139 commit 57bb7c8626dbdaf823fc9807184c95e6eb325285 @xcaww committed Mar 23, 2011
View
11 README
@@ -1,7 +1,7 @@
OSKARR (beta)
Developed by xCore
Current Stage: in beginning of core development
-Version: none...
+Version: beta (mc lovin)
Instructions
@@ -12,11 +12,4 @@ Example: index.php?channel=rage
Current structure and functionality (including minimum security) is very unstable...
Without a connected mySQL database, this will not function.
-Details on the database structure are yet to be released...
-
-
-Current
-
-Channel and page listings (channel indexs & threads) are being moved to comply with the generic page generation structure.
-Error logger
-Database query function
+Details on the database structure are yet to be released...
View
50 engine/core.php
@@ -22,12 +22,34 @@ function generate_page($URL_page, $URL_query, $URL_i = false){
}
- function call_module($module){
+ function get_base_dir(){
- require("./engine/module/" . $module['moduleName'] . "/" . $module['moduleName'] . ".php");
- $this->module = new module($module);
- return $this->module->process_module();
+ echo dirname($_SERVER['SCRIPT_NAME']);
+
+ }
+
+ function require_file_once($fileRequest){
+
+ if(file_exists($fileRequest)){
+
+ require_once($fileRequest);
+
+ }else{
+
+ $this->send_error_log("require once: " . $fileRequest);
+
+ }
+
+ }
+ function call_module($module){//TODO, add a modules table to database
+
+ $this->require_file_once("./engine/module/" . $module['moduleName'] . "/" . $module['moduleName'] . ".php");
+
+ $this->module = new $module['moduleName']($module);
+ $moduleData = $this->module->process_module();
+
+ return $moduleData;
}
function execution_time(){
@@ -80,26 +102,6 @@ function send_error_log($errorMessage){
}
- function show_header(){
-
- echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">
-
- <head>
- <meta http-equiv=\"Content-Type\" content=\"application/xhtml+xmL; charset=iso-8859-1\" />
- <title>oskarr</title>
- <link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" />
- </head>
-
- <body>
-
- <div id=\"header\" align=\"center\">
- <img src=\"images/oskarr.png\" alt=\"oskarr\" />
- </div>
-
- ";
-
- }
-
function get_channel($channelAddress = false, $postID = false){
if($channelAddress != false){
View
2 engine/database.php
@@ -4,7 +4,7 @@ class database extends core{
function connect_database(){
- $this->connectionLink = mysql_connect("localhost", "root", "rscbU");
+ $this->connectionLink = mysql_connect("localhost", "root", "cheeseh44");
if($this->connectionLink){
View
72 engine/module/pagebits/pagebits.php
@@ -0,0 +1,72 @@
+<?php
+
+class pagebits extends core{
+
+ function __construct($module){
+
+ $this->moduleData = $module;
+
+ }
+
+ function get_pagebits($pagebit){
+
+ switch($pagebit){
+
+ case "header":
+
+ $pagebitData = "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">
+
+ <head>
+ <meta http-equiv=\"Content-Type\" content=\"application/xhtml+xmL; charset=iso-8859-1\" />
+ <title>oskarr</title>
+ <link href=\"" . dirname($_SERVER['SCRIPT_NAME']) . "/style.css\" rel=\"stylesheet\" type=\"text/css\" />
+ </head>
+
+ <body>
+
+ <div id=\"header\" align=\"center\">
+ <img src=\"" . dirname($_SERVER['SCRIPT_NAME']) . "/images/oskarr.png\" alt=\"oskarr\" />
+ </div>
+
+ ";
+
+ break;
+ case "execution":
+
+ $pageTime = round((float) parent::execution_time() - (float) $this->moduleData['execution_start'], 4);
+
+ $pagebitData = "
+
+ <br/>
+ <p class=\"page_time\" align=\"center\">Generated page in {$pageTime} seconds</p>
+
+ </body>
+
+</html>";
+
+ break;
+
+ }
+
+ return $pagebitData;
+
+ }
+
+ function process_module(){
+
+ parent::database_connect();
+ $query = explode(", ", $this->moduleData['moduleQuery']);
+
+ foreach($query as $pagebit){
+
+ $this->returnedData[$pagebit] = $this->get_pagebits($pagebit);
+
+ }
+
+ return $this->returnedData;
+
+ }
+
+}
+
+?>
View
34 engine/module/statistics/statistics.php
@@ -1,6 +1,6 @@
<?php
-class module extends core{
+class statistics extends core{
function __construct($module){
@@ -11,10 +11,21 @@ function __construct($module){
function get_statistics($statistic){
$statisticResult = false;
+
+ /*if(substr($statistic, 0, 1) == "@"){//@variable_variable_variable etc...
+
+ $splitStatisticVars = explode("_", substr($statistic, 0, 1));
+
+ }*/
- switch ($statistic){
+ switch($statistic){
case "posts":
+
+ $result = parent::database_query("
+ SELECT id
+ FROM posts
+ ");
break;
case "channels":
@@ -23,27 +34,18 @@ function get_statistics($statistic){
SELECT id
FROM channels
");
-
- if(mysql_num_rows($result)){
-
- $statisticResult = (string) mysql_num_rows($result);
-
- }
break;
- default:
- parent::send_error_log("module error: failed statistic selection");
- break;
}
- if($statisticResult != false){
-
- return $statisticResult;
-
+ if(mysql_num_rows($result)){
+
+ return (string) mysql_num_rows($result);
+
}else{
- parent::send_error_log("module error: failed statistic data");
+ parent::send_error_log("module error: Statistics -> failed statistic data");
}
View
2 engine/page/channel/constructor/page_constructor.php
@@ -4,7 +4,7 @@ class pageConstructor extends pageProducer{
function __construct($pageDetails){
- require_once("./engine/page/" . $pageDetails['address'] . "/function/page_function.php"); //core functions; other function scripts may be called later on during this class!
+ require_once("./engine/page/" . $pageDetails['address'] . "/function/page_function.php");
$this->channel = new channel($pageDetails['query'], $pageDetails['number']);
}
View
2 engine/page/channel/product/main_index.php
@@ -2,7 +2,7 @@
function build_page($pageData){
- echo "<link href=\".\engine\page\\{$pageData['pageAddress']}\product\\{$pageData['styles']}\" rel=\"stylesheet\" type=\"text/css\" />
+ echo "<link href=\"" . dirname($_SERVER['SCRIPT_NAME']) . "/engine/page/{$pageData['pageAddress']}/product/{$pageData['styles']}\" rel=\"stylesheet\" type=\"text/css\" />
";
View
5 engine/page/channels/product/main_index.php
@@ -13,9 +13,8 @@
*/
function build_page($pageData){
+ echo "<link href=\"" . dirname($_SERVER['SCRIPT_NAME']) . "/engine/page/{$pageData['pageAddress']}/product/{$pageData['styles']}\" rel=\"stylesheet\" type=\"text/css\" />
- echo "<link href=\".\engine\page\\{$pageData['pageAddress']}\product\\{$pageData['styles']}\" rel=\"stylesheet\" type=\"text/css\" />
-
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"> <!-- Post Table -->
<tr>
@@ -40,6 +39,8 @@ function build_page($pageData){
</td>
+ </tr>
+
<tr>
<td style=\"text-align: center; vertical-align: top; width: 600px;\">
View
24 index.php
@@ -19,14 +19,19 @@
*/
-//load core function library + logger
+//load core function library + database class
require("./engine/core.php");
require("./engine/database.php");
//Let's roll...
$core = new core();
-$timer_start = $core->execution_time();
-$core->show_header();
+$module['moduleName'] = "pagebits";
+$module['execution_start'] = $core->execution_time();
+$module['moduleQuery'] = "header";
+
+$header = $core->call_module($module);
+echo $header['header'];
+
$core->database_connect();
//GET i VAR
@@ -89,14 +94,7 @@
//end execution timer, close page tags
-echo "
-
- <br/>
- <p class=\"page_time\" align=\"center\">Generated page in " . round($core->execution_time() - $timer_start, 3) . " seconds</p>
-
- </body>
-
-</html>";
-
-
+$module['moduleQuery'] = "execution";
+$execution_time = $core->call_module($module);
+echo $execution_time['execution'];
?>

0 comments on commit 57bb7c8

Please sign in to comment.