1: <?php
2: use Define\Core\ObjectContainer;
3: use Define\Core\Framework;
4: use Define\Utilities\Session;
5: use Define\DBDrivers\DatabaseBean;
6: use Define\Utilities\Logger;
7: use Define\Core\Router;
8:
9: ob_start();
10: session_start();
11: session_regenerate_id();
12: define("DIRECT_ACCESS", TRUE);
13:
14: # set the include path #
15: # Core classes of framework - Start #
16: ###########################################################################################################################
17: set_include_path(get_include_path().PATH_SEPARATOR."lib/define/core");
18: set_include_path(get_include_path().PATH_SEPARATOR."lib/define/dbdrivers");
19: set_include_path(get_include_path().PATH_SEPARATOR."lib/define/helpers");
20: set_include_path(get_include_path().PATH_SEPARATOR."lib/define/utilities");
21: set_include_path(get_include_path().PATH_SEPARATOR."lib/define/traits");
22: set_include_path(get_include_path().PATH_SEPARATOR."lib/define/exceptions");
23: set_include_path(get_include_path().PATH_SEPARATOR."lib/vendors/phpmailer");
24: set_include_path(get_include_path().PATH_SEPARATOR."lib/vendors/tmdb");
25: ###########################################################################################################################
26: # Core classes of framework - End #
27:
28: # Classes for your application - Start #
29: ###########################################################################################################################
30: set_include_path(get_include_path().PATH_SEPARATOR."application/controller"); // Controllers for your application goes here
31: set_include_path(get_include_path().PATH_SEPARATOR."application/model/service"); // Service for your application goes here
32: set_include_path(get_include_path().PATH_SEPARATOR."application/model/service/impl"); // Service implementation
33: set_include_path(get_include_path().PATH_SEPARATOR."application/model/dao");
34: set_include_path(get_include_path().PATH_SEPARATOR."application/model/dao/impl");
35: set_include_path(get_include_path().PATH_SEPARATOR."application/bean");
36: ###########################################################################################################################
37: # Classes for your application - End #
38:
39: # Settings for framework - Start #
40: ###########################################################################################################################
41: include_once 'configuration/define.inc';
42: ###########################################################################################################################
43: # Settings for framework - End #
44:
45: # Settings for Application - Start #
46: ###########################################################################################################################
47: include_once 'configuration/application.inc';
48: ###########################################################################################################################
49: # Settings for Application - End #
50:
51: /**
52: * Autoload method for dynamically loading classes.
53: *
54: * @param object $object Name of Class
55: * @return void
56: */
57: function __autoload($object) {
58: $split = explode("\\", $object);
59: $className = end($split);
60: require_once("{$className}.php");
61: }
62:
63: $container = ObjectContainer::getInstance();
64: $container->offsetSet('FRAMEWORK', Framework::getInstance()); // Create the instance of framework and let your handlers initialized.
65: $container->offsetSet('SESSION', Session::getInstance());
66: $container->offsetSet('MYSQLI', new DatabaseBean("MYSQLI", "localhost", "root", "nitesha", "phpmyadmin", 3306));
67: //$container->offsetSet('ORACLE', new DatabaseBean("ORACLE", "localhost", "root", "nitesha", "thebookmarker", "3306"));
68: $container->offsetSet('LOGGER', Logger::getInstance());
69:
70: //$container->offsetSet('MYSQLI-2', new DatabaseBean("MYSQLI", "localhost", "root", "nitesha", "musicplus", "3306")); // another mysql database
71: //$container->offsetSet('PDO', new DatabaseBean("mysql", "localhost", "root", "nitesha", "musicplus", "3306"));
72:
73: # Do this when site is in maintenance or offline - Start #
74: ###########################################################################################################################
75:
76: /* $default = array(
77: 'controller' => 'Error',
78: 'action' => 'default',
79: 'params' => array('408')
80: ); */
81:
82: ###########################################################################################################################
83: # Do this when site is in maintenance or offline - End #
84:
85: $default = array();
86: $container->offsetGet('FRAMEWORK')->init(Router::getInstance(), $default);
87: ?>