1: | <?php |
2: | /** |
3: | * SphpPermission class for manage permissions system |
4: | */ |
5: | class SphpPermission { |
6: | /** |
7: | * Set Permissions List as Associate Array |
8: | * @param array $arrP <p> |
9: | * $arrp = array("perm1" => true,"perm2" => true); |
10: | * perm1 can be like index-view or allview or any word you want to use as |
11: | * permission identification. This permissions can be manage content in temp file or |
12: | * enable disable application features or menus. |
13: | * </p> |
14: | */ |
15: | public function setPermissions($arrP) {} |
16: | /** |
17: | * Check is permission ID exists |
18: | * @param string $permission |
19: | * @return boolean |
20: | */ |
21: | public function hasPermission($permission) {} |
22: | /** |
23: | * Check Single or multi permissions |
24: | * @param string $permissions <p> |
25: | * single or coma separated permissions list as string |
26: | * </p> |
27: | * @return boolean |
28: | */ |
29: | public function isPermission($permissions) {} |
30: | /** |
31: | * Authorise user if permission is available otherwise application will be exit |
32: | * and redirected by according to getWelcome function in comp.php file in project folder |
33: | * @param string $perm <p> |
34: | * string or comma separated string list |
35: | * </p> |
36: | * @return boolean |
37: | */ |
38: | public function getAuthenticate($perm = "") {} |
39: | } |
40: | class SphpBase { |
41: | public static $dynData = null; |
42: | public static $stmycache = null; |
43: | public static $cacheFileList = null; |
44: | /** |
45: | * Get Engine |
46: | * @static |
47: | * @return \Sphp\Engine |
48: | */ |
49: | public static function engine() { |
50: | return self::$engine; |
51: | } |
52: | /** |
53: | * Get Router |
54: | * @static |
55: | * @return \Sphp\core\Router |
56: | */ |
57: | public static function sphp_router() { |
58: | return self::$sphp_router; |
59: | } |
60: | /** |
61: | * Get SphpAPI |
62: | * @static |
63: | * @return \Sphp\core\SphpAPI |
64: | */ |
65: | public static function sphp_api() { |
66: | return self::$sphp_api; |
67: | } |
68: | /** |
69: | * Get Request |
70: | * @static |
71: | * @return \Sphp\core\Request |
72: | */ |
73: | public static function sphp_request() { |
74: | return self::$sphp_request; |
75: | } |
76: | /** |
77: | * Get Response |
78: | * @static |
79: | * @return \Sphp\core\Response |
80: | */ |
81: | public static function sphp_response() { |
82: | return self::$sphp_response; |
83: | } |
84: | /** |
85: | * Get Session |
86: | * @static |
87: | * @return \Sphp\core\Session |
88: | */ |
89: | public static function sphp_session() { |
90: | return self::$sphp_session; |
91: | } |
92: | /** |
93: | * Get Settings |
94: | * @static |
95: | * @return \Sphp\core\Settings |
96: | */ |
97: | public static function sphp_settings() { |
98: | return self::$sphp_settings; |
99: | } |
100: | /** |
101: | * Get SphpPermission |
102: | * @static |
103: | * @return \SphpPermission |
104: | */ |
105: | public static function sphp_permissions() { |
106: | return self::$sphp_permissions; |
107: | } |
108: | /** |
109: | * Get JSServer |
110: | * @static |
111: | * @return \Sphp\kit\JSServer |
112: | */ |
113: | public static function JSServer() { |
114: | return self::$JSServer; |
115: | } |
116: | /** |
117: | * Get JQuery |
118: | * @static |
119: | * @return \Sphp\kit\JQuery |
120: | */ |
121: | public static function JQuery() { |
122: | return self::$JQuery; |
123: | } |
124: | /** |
125: | * Get Page Object |
126: | * @static |
127: | * @return \Sphp\kit\Page |
128: | */ |
129: | public static function page() { |
130: | return self::$page; |
131: | } |
132: | /** |
133: | * Set Page Object |
134: | * @static |
135: | * @param \Sphp\kit\Page $p |
136: | */ |
137: | public static function set_page($p) { |
138: | //in future controll here for assignment more then one |
139: | self::$page = $p; |
140: | } |
141: | /** |
142: | * Get DebugProfiler |
143: | * @static |
144: | * @return \Sphp\core\DebugProfiler |
145: | */ |
146: | public static function debug() { |
147: | return self::$debug; |
148: | } |
149: | /** |
150: | * Get DB Engine |
151: | * @static |
152: | * @return \MySQL |
153: | */ |
154: | public static function dbEngine() { |
155: | return self::$dbEngine; |
156: | } |
157: | /** |
158: | * set DB Engine |
159: | * @static |
160: | * @param \MySQL $d |
161: | */ |
162: | public static function set_dbEngine($d) { |
163: | self::$dbEngine = $d; |
164: | } |
165: | /** |
166: | * Get JS Manager |
167: | * @static |
168: | * @return \SphpJsM |
169: | */ |
170: | public static function sphpJsM() { |
171: | return self::$sphpJsM; |
172: | } |
173: | /** |
174: | * Advance Function, No Use |
175: | * @static |
176: | * @ignore |
177: | */ |
178: | public static function _startme() { |
179: | // set up settings |
180: | self::$sphp_settings = new \Sphp\Settings(); |
181: | } |
182: | /** |
183: | * Advance Function, No Use |
184: | * @static |
185: | * @ignore |
186: | */ |
187: | public static function init() { |
188: | global $stmycache, $cacheFileList; |
189: | self::$stmycache = $stmycache; |
190: | self::$cacheFileList = $cacheFileList; |
191: | self::$sphp_request = new \Sphp\core\Request(); |
192: | } |
193: | /** |
194: | * Advance Function, No Use |
195: | * @static |
196: | * @ignore |
197: | */ |
198: | public static function setReady($engine) { |
199: | self::$engine = $engine; |
200: | self::$sphp_router = $engine->getRouter(); |
201: | self::$sphp_api = $engine->getSphpAPI(); |
202: | self::$sphp_response = $engine->getResponse(); |
203: | self::$sphp_session = $engine->getSession(); |
204: | self::$JSServer = $engine->getJSServer(); |
205: | self::$JQuery = $engine->getJQuery(); |
206: | self::$debug = $engine->getDebug(); |
207: | self::$dbEngine = $engine->getDBEngine(); |
208: | self::$sphp_permissions = new SphpPermission(); |
209: | self::$sphpJsM = new \SphpJsM(); |
210: | } |
211: | /** |
212: | * Advance Function, No Use |
213: | * @static |
214: | * @ignore |
215: | */ |
216: | public static function refreshCacheEngine() { |
217: | global $ytetimestart1; |
218: | $ytetimestart1 = microtime(true); |
219: | self::$stmycache = new stmycache(); |
220: | self::$sphp_response->init(); |
221: | return self::$stmycache; |
222: | } |
223: | /** |
224: | * Advance Function, No Use |
225: | * @static |
226: | * @ignore |
227: | */ |
228: | public static function addNewRequest() { |
229: | self::$sphp_api->init(); |
230: | self::$JSServer->init(); |
231: | self::$sphpJsM->init(); |
232: | self::$sphp_request->parseRequest(); |
233: | self::$sphp_router->route(); |
234: | self::$page()->init(); |
235: | self::$engine->engine_start_time = microtime(true); |
236: | } |
237: | } |
238: | if (!$blnPreLibCache) { |
239: | if ($blnPreLibLoad) { |
240: | include_once("{$libpath}/libsphp1.php"); |
241: | } else { |
242: | include_once("{$libpath}/global/libloader.php"); |
243: | } |
244: | } |
245: | include_once("{$slibpath}/comp/SphpJsM.php"); |
246: | if ($debugmode > 0) { |
247: | ini_set("display_errors", 1); |
248: | ini_set('display_startup_errors', 1); |
249: | error_reporting(E_ALL); |
250: | } |
251: | /** |
252: | * Extra autoload registered function |
253: | * @param string $name |
254: | */ |
255: | function loadSphpLibClass($name) {} |
256: | spl_autoload_register("loadSphpLibClass"); |
257: | function runSartajPHPEngine(){} |
258: |