Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

few tweaks

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

0 notes on commit 57bb7c8

Please sign in to comment.
Something went wrong with that request. Please try again.