Skip to content

Commit 9edf2f0

Browse files
committed
Structural Changes
1 parent d44b2aa commit 9edf2f0

File tree

318 files changed

+1959
-1575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+1959
-1575
lines changed

.buildpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<buildpath>
3+
<buildpathentry kind="src" path=""/>
4+
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
5+
</buildpath>

.project

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>rainframework github</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.wst.validation.validationbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.dltk.core.scriptbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.php.core.PHPNature</nature>
21+
</natures>
22+
</projectDescription>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#Fri Mar 04 11:45:32 CET 2011
2+
eclipse.preferences.version=1
3+
include_path=0;/rainframework github

ajax.php

100755100644
Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,20 @@
44
session_start();
55

66

7-
7+
8+
89
#--------------------------------
910
# Load the class
10-
#--------------------------------
11-
require_once "application/config/constants.php";
12-
require_once LIBRARY_DIR . "loader.class.php";
13-
14-
15-
16-
1711
#--------------------------------
18-
# Init Loader class
19-
#--------------------------------
20-
$loader = new Loader;
21-
$loader->database_connect(); // Connect the database
22-
$loader->load_settings(); // load the settings
23-
$loader->set_language('en'); // set the language
24-
$loader->login(); // do login ( you must pass login=your_login and password=your_password)
25-
$loader->set_theme(); // set theme
26-
$loader->set_page('index'); // set page layout
27-
$loader->init_route(); // init the route
28-
29-
12+
require_once "application/config/constants.php";
13+
require_once "library/Loader.php";
14+
require_once "application/Bootstrap.Loader.php";
3015

31-
#--------------------------------
32-
# Auto Load the Controller
33-
# init_route set the controller/action/params
34-
# to load the controller
35-
#--------------------------------
36-
$html = $loader->load_controller( $loader->get_selected_controller(), $loader->get_selected_action(), $loader->get_selected_params() );
3716

38-
39-
40-
#--------------------------------
41-
# Add Style and Script
42-
#--------------------------------
43-
global $script, $style, $javascript, $javascript_onload;
44-
if( $style )
45-
foreach( $style as $s )
46-
$html .= '<link rel="stylesheet" href="'.$s.'" type="text/css" />' . "\n";
4717

48-
if( $script )
49-
foreach( $script as $s )
50-
$html .= '<script src="'.$s.'" type="text/javascript"></script>' . "\n";
18+
$loader = new Bootstrap_Loader;
19+
$loader->init_ajax();
5120

52-
if( $javascript_onload ) $javascript .= "\n" . "$(function(){" . "\n" . " $javascript_onload" . "\n" . "});" . "\n";
53-
if( $javascript )
54-
$html .= "<script type=\"text/javascript\">" . "\n" .$javascript . "\n" . "</script>;";
55-
56-
echo $html;
57-
#--------------------------------
58-
59-
60-
61-
6221

6322

64-
6523
?>

application/Bootstrap.Loader.php

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
/*
3+
* Init everything
4+
*/
5+
6+
class Bootstrap_Loader extends Loader{
7+
8+
function init(){
9+
10+
$this->database_connect(); // Connect the database
11+
$this->load_settings(); // load the settings
12+
$this->set_language('en'); // set the language
13+
$this->login(); // do login ( you must pass login=your_login and password=your_password)
14+
$this->init_route(); // init the route
15+
$this->set_theme(); // set theme
16+
$this->set_page('index'); // set page layout
17+
18+
#--------------------------------
19+
# Auto Load the Controller
20+
# init_route set the controller/action/params
21+
# to load the controller
22+
#--------------------------------
23+
$this->auto_load_controller();
24+
25+
26+
27+
#--------------------------------
28+
# Load model
29+
# load the model and assign the result
30+
# @params model, action, params, assign_to
31+
#--------------------------------
32+
$model = 'menu';
33+
$action = 'load_menu';
34+
$params = array( $this->get_selected_controller() );
35+
$assign_to = 'menu'; // the result will be assigned to template layout "menu"
36+
$this->load_model( $model, $action, $params, $assign_to );
37+
38+
39+
40+
41+
#--------------------------------
42+
# Assign Layout variables
43+
#--------------------------------
44+
$this->assign( 'title', 'RainFramework' );
45+
46+
47+
48+
#--------------------------------
49+
# Print the layout
50+
#--------------------------------
51+
$this->draw();
52+
}
53+
54+
55+
56+
57+
function init_ajax(){
58+
59+
$this->database_connect(); // Connect the database
60+
$this->load_settings(); // load the settings
61+
$this->set_language('en'); // set the language
62+
$this->login(); // do login ( you must pass login=your_login and password=your_password)
63+
$this->init_route(); // init the route
64+
$this->set_theme(); // set theme
65+
66+
67+
68+
#--------------------------------
69+
# Enable the Ajax Mode and set the ajax controller
70+
#--------------------------------
71+
$this->ajax_mode();
72+
$this->set_controller_extension( AJAX_CONTROLLER_EXTENSION );
73+
$this->set_controller_class_name( AJAX_CONTROLLER_CLASS_NAME );
74+
75+
76+
#--------------------------------
77+
# Auto Load the Controller
78+
# init_route set the controller/action/params
79+
# to load the controller
80+
#--------------------------------
81+
$this->auto_load_controller();
82+
83+
84+
85+
#--------------------------------
86+
# Print the layout
87+
#--------------------------------
88+
$this->draw();
89+
90+
}
91+
92+
93+
}
94+
95+
96+
?>

application/config/constants.php

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,46 @@
77

88
//-------------------------------------------------------------
99
//
10-
// Directories
10+
// Directories
1111
//
1212
//-------------------------------------------------------------
1313

14-
define( "LIBRARY_DIR", "library/" );
15-
define( "LANGUAGE_DIR", "language/" );
16-
define( "APPLICATION_DIR", "application/" );
17-
18-
define( "CONTROLLERS_DIR", "application/controllers/" );
19-
define( "MODELS_DIR", "application/models/" );
20-
define( "VIEWS_DIR", "application/views/" );
14+
define( "BASE_DIR", dirname( $_SERVER['SCRIPT_NAME'] ) . "/" );
15+
16+
define( "APPLICATION_DIR", "application/" );
17+
define( "LIBRARY_DIR", "library/" );
18+
19+
define( "EXTENSION_DIR", "library/extension/" );
20+
define( "WEB_DIR", "library/web/" );
21+
define( "JAVASCRIPT_DIR", "library/web/js/" );
22+
define( "CSS_DIR", "library/web/css/" );
23+
24+
define( "CONTROLLERS_DIR", "application/controllers/" );
25+
define( "MODELS_DIR", "application/models/" );
26+
define( "VIEWS_DIR", "application/views/" );
27+
28+
define( "CONFIG_DIR", "application/config/" );
29+
define( "LANGUAGE_DIR", "application/language/" );
30+
define( "LOG_DIR", "application/log/" );
31+
define( "MODULES_DIR", "application/modules/" );
32+
define( "CACHE_DIR", "application/cache/" ); //temp dir
33+
define( "UPLOADS_DIR", "application/uploads/" );
34+
define( "APPLICATION_LIBRARY_DIR", "application/library/" );
35+
36+
37+
38+
39+
//-------------------------------------------------------------
40+
//
41+
// Controller
42+
//
43+
//-------------------------------------------------------------
44+
45+
define( "CONTROLLER_EXTENSION", "php" );
46+
define( "CONTROLLER_CLASS_NAME", "_Controller" );
47+
define( "AJAX_CONTROLLER_EXTENSION", "Ajax.php" );
48+
define( "AJAX_CONTROLLER_CLASS_NAME", "_Ajax_Controller" );
2149

22-
define( "CONFIG_DIR", "application/config/" );
23-
define( "LOG_DIR", "application/log/" );
24-
define( "MODULES_DIR", "application/modules/" );
25-
define( "CACHE_DIR", "application/cache/" ); //temp dir
26-
define( "UPLOADS_DIR", "application/uploads/" ); //uploads
27-
define( "APPLICATION_LIBRARY_DIR", "application/library/" );
28-
define( "JAVASCRIPT_DIR", "application/library/js/" ); //js dir
2950

3051

3152
//-------------------------------------------------------------
@@ -35,26 +56,19 @@
3556
//-------------------------------------------------------------
3657

3758
// get user IP
38-
$ip = getenv( "HTTP_X_FORWARDED_FOR" ) ? getenv( "HTTP_X_FORWARDED_FOR" ) : getenv( "REMOTE_ADDR" );
39-
if( !preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $ip ) )
40-
$ip = null;
41-
define( "IP", $ip );
42-
59+
$IP = getenv( "HTTP_X_FORWARDED_FOR" ) ? getenv( "HTTP_X_FORWARDED_FOR" ) : getenv( "REMOTE_ADDR" ); if( !preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $IP ) ) $IP = null;
4360
// browser calculation
44-
$known = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
45-
preg_match( '#(' . join('|', $known) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#', strtolower($_SERVER['HTTP_USER_AGENT']), $br );
46-
preg_match_all( '#\((.*?);#', $_SERVER['HTTP_USER_AGENT'], $os );
47-
48-
if( isset( $br[1][1] ) ) $browser = $br[1][1]; else $browser = null;
49-
if( isset( $br[2][1] ) ) $version = $br[2][1]; else $version = null;
61+
$known = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko'); preg_match( '#(' . join('|', $known) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#', strtolower($_SERVER['HTTP_USER_AGENT']), $br ); preg_match_all( '#\((.*?);#', $_SERVER['HTTP_USER_AGENT'], $os ); if( isset( $br[1][1] ) ) $browser = $br[1][1]; else $browser = null; if( isset( $br[2][1] ) ) $version = $br[2][1]; else $version = null;
5062

63+
define( "IP", $IP );
5164
define( "BROWSER_LANG_ID", substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) );
5265
define( "BROWSER", $browser );
5366
define( "BROWSER_VERSION", $version );
5467
define( "BROWSER_OS", $os[1][0] );
5568
define( "USER_ONLINE_TIME", 150 ); // user is considered online before 3 minutes of inactivity
5669

5770

71+
5872
//-------------------------------------------------------------
5973
//
6074
// User Constants
@@ -69,9 +83,27 @@
6983
define( "LOGIN_NOT_LOGGED", 0 );
7084
define( "LOGIN_DONE", 1 );
7185
define( "LOGIN_LOGGED", 2 );
72-
7386

74-
87+
//user level
88+
global $user_level;
89+
$user_level = array( -3 => "USER_CONTACT",
90+
-2 => "USER_REFUSED",
91+
-1 => "USER_BANNED",
92+
0 => "USER_UNREGISTERED",
93+
1 => "USER_REGISTERED",
94+
2 => "USER_ADMIN",
95+
3 => "USER_SUPER_ADMIN" );
96+
97+
// user status
98+
define( "USER_CONTACT", -3 );
99+
define( "USER_REFUSED", -2 );
100+
define( "USER_BANNED", -1 );
101+
define( "USER_UNREGISTERED", 0 );
102+
define( "USER_REGISTERED", 1 );
103+
define( "USER_ADMIN", 2 );
104+
define( "USER_SUPER_ADMIN", 3 );
105+
106+
75107
//-------------------------------------------------------------
76108
//
77109
// Constants
@@ -87,7 +119,7 @@
87119
define( "LOW", 0 );
88120
define( "MED", 1 );
89121
define( "HIGH", 2 );
90-
122+
91123
//msg level
92124
define( "ERROR", 0 );
93125
define( "SUCCESS", 1 );
@@ -99,7 +131,7 @@
99131
define( "SECOND" , 1 );
100132
define( "MINUTE" , 60 ); // seconds in minute
101133
define( "HOUR" , 3600 ); // seconds in hour
102-
define( "DAY" , 86400 ); // seconds in day
134+
define( "DAY" , 86400 ); // seconds in day
103135
define( "WEEK" , 604800 ); // seconds in week
104136
define( "MONTH" , 2592000 ); // seconds in month
105137
define( "YEAR" , 31536000 ); // seconds in year
@@ -108,7 +140,7 @@
108140
// google sitemaps
109141
// use for creating google sitemaps for your application
110142
global $changefreq;
111-
$changefreq = Array(
143+
$changefreq = Array(
112144
-1 => "not in sitemaps", // this content will not added to the sitemaps
113145
0 => "always",
114146
1 => "hourly",
@@ -117,7 +149,7 @@
117149
4 => "monthly",
118150
5 => "yearly",
119151
6 => "never",
120-
);
152+
);
153+
121154

122-
123155
?>

0 commit comments

Comments
 (0)