Beispiel #1
0
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database/config_mysql.php');
         $db->connect();
         return $db;
     });
     $this->setShared('auth', function () {
         $auth = new \Anax\Auth\Auth();
         return $auth;
     });
     $this->setShared('form', function () {
         $form = new \Mos\HTMLForm\CForm();
         return $form;
     });
     $this->setShared('gravatar', function () {
         $gravatar = new \Anax\User\Gravatar();
         return $gravatar;
     });
     $this->setShared('user', function () {
         $form = new \Anax\User\User();
         return $form;
     });
     $this->setShared('tags', function () {
         $tags = new \Anax\Tag\Tag();
         return $tags;
     });
 }
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     // Add CDatabase to framework
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         // LOCALp
         $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
         // BTH
         // $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_bth.php');
         $db->connect();
         return $db;
     });
     // Add CForm to framework
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Create extra navbar for top menu
     $this->setShared('topnav', function () {
         $navbar = new \Anax\Navigation\CNavbar();
         $navbar->setDI($this);
         $navbar->configure(ANAX_APP_PATH . 'config/topnav.php');
         return $navbar;
     });
     // Add UserController to framework
     $this->set('UserController', function () {
         $controller = new \Anax\User\UserController();
         $controller->setDI($this);
         return $controller;
     });
     // Add QuestionsController to framework
     $this->set('QuestionsController', function () {
         $controller = new \Anax\Questions\QuestionsController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
     // Add AnswersController to framework
     $this->set('AnswersController', function () {
         $controller = new \Anax\Answers\AnswersController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
     // Add CommentsController to framework
     $this->set('CommentsController', function () {
         $controller = new \Anax\Comments\CommentsController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
     // Add TagsController to framework
     $this->set('TagsController', function () {
         $controller = new \Anax\Tags\TagsController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database_sqlite.php');
         $db->connect();
         return $db;
     });
 }
Beispiel #4
0
 /**
  * Test
  *
  * @return void
  *
  */
 public static function setUpBeforeClass()
 {
     $di = new \Anax\DI\CDIFactoryDefault();
     $di->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(['dsn' => "sqlite:memory::", 'debug_connect' => true]);
         $db->connect();
         return $db;
     });
     self::$movie = new \Jovis\DatabaseModel\Movie();
     self::$movie->setDI($di);
     self::$movie->init();
 }
 public function testNoneExistingMethod()
 {
     $survey = new \Idun\Survey\SurveyController();
     $di = new \Anax\DI\CDIFactoryDefault();
     $survey->setDI($di);
     // Inject the database service
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'some_database_file');
         $db->connect();
         return $db;
     });
 }
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     // Add forms service
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Add databas service as a singleton
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database_mysql.php');
         $db->connect();
         return $db;
     });
 }
Beispiel #7
0
 public function __construct()
 {
     parent::__construct();
     // Creating a controller service for comments
     $this->set('CommentController', function () {
         $controller = new \Phpmvc\Comment\CommentController();
         $controller->setDI($this);
         return $controller;
     });
     // Creating a model service for comments
     $this->set('comments', function () {
         //            $comments = new \Phpmvc\Comment\CommentsInSession();
         $comments = new \Phpmvc\Comment\Comment();
         $comments->setDI($this);
         return $comments;
     });
     // Database service (from mos vendor)
     $this->set('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database_sqlite.php');
         $db->connect();
         return $db;
     });
     // Form service (from mos vendor)
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Controller for forms
     $this->set('FormController', function () {
         $controller = new \Anax\HTMLForm\FormController();
         $controller->setDI($this);
         return $controller;
     });
     // Controller for User-actions
     $this->set('UsersController', function () {
         $controller = new \Anax\Users\UsersController();
         $controller->setDI($this);
         return $controller;
     });
     // Request-recorder service
     $this->set('recorder', function () {
         $dbh = new \Kajja\Recorder\RequestDatabase();
         $dbh->setOptions(['dsn' => 'sqlite:' . ANAX_APP_PATH . '.htphpmvc.sqlite', 'fetch_mode' => \PDO::FETCH_ASSOC]);
         $dbh->connect();
         $formatter = new \Kajja\Recorder\HTMLFormatter();
         $recorder = new \Kajja\Recorder\RequestRecordAnax($dbh, $formatter, $this);
         return $recorder;
     });
 }
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         if (isset($_SERVER['HTTP-HOST'])) {
             if ($_SERVER['HTTP-HOST'] == 'localhost') {
                 $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
             }
         } else {
             $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_bth.php');
         }
         $db->connect();
         return $db;
     });
     $this->setShared('form', function () {
         $form = new \Mos\HTMLForm\CForm();
         $this->session;
         //$form->saveInSession = true;
         return $form;
     });
     // Set controllers
     $this->set('CommentController', function () {
         $controller = new \Phpmvc\Comment\CommentController();
         $controller->setDI($this);
         return $controller;
     });
     $this->set('UsersController', function () {
         $controller = new \Anax\Users\UsersController();
         $controller->setDI($this);
         return $controller;
     });
     $this->set('FormController', function () {
         $controller = new \Anax\HTMLForm\FormController();
         $controller->setDI($this);
         return $controller;
     });
     $this->set('logger', function () {
         $logger = new \Eden\Log\Clog();
         //$controller->setDI($logger);
         return $logger;
     });
 }
 public function __construct()
 {
     parent::__construct();
     // Inject the comment service into the app
     $this->set('CommentController', function () {
         $controller = new \Idun\Comment\CommentController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the form service into the app
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Inject the form controller into the app
     $this->set('FormController', function () {
         $controller = new \Anax\HTMLForm\FormController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the database service into the app
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database_mysql.php');
         $db->connect();
         return $db;
     });
     // Inject the user and admin controller into the app
     $this->set('UsersController', function () {
         $controller = new \Idun\Users\UsersController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the forum controller into the app
     $this->set('ForumController', function () {
         $controller = new \Idun\Forum\ForumController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the forum controller into the app
     $this->set('sessionmodel', function () {
         $sessionmodel = new \Idun\Session\CSessionModel();
         $sessionmodel->setDI($this);
         return $sessionmodel;
     });
 }
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('theme', function () {
         $themeEngine = new \Anax\ThemeEngine\CThemeExtended();
         $themeEngine->setDI($this);
         $themeEngine->configure(ANAX_APP_PATH . 'config/theme.php');
         return $themeEngine;
     });
     // Forms service
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Database service for Anax
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/config_sqlite.php');
         $db->connect();
         return $db;
     });
     // Flash messages
     $this->setShared('flashmessage', function () {
         $flashmessages = new \helikopterspark\FlashMsg\FlashMsg();
         $flashmessages->setDI($this);
         return $flashmessages;
     });
     // Comments
     $this->set('CommentsController', function () {
         $commentscontroller = new \CR\Comment\CommentsController();
         $commentscontroller->setDI($this);
         return $commentscontroller;
     });
     // Users
     $this->set('UsersController', function () {
         $userscontroller = new \Anax\Users\UsersController();
         $userscontroller->setDI($this);
         return $userscontroller;
     });
     $this->setShared('logger', function () {
         $logger = new \Toeswade\Log\Clog();
         return $logger;
     });
 }
Beispiel #11
0
 /**
  * Basic setup of the mock database to perform tests against.
  *
  */
 public static function setUpBeforeClass()
 {
     self::$di = new \Anax\DI\CDIFactoryDefault();
     self::$app = new \Anax\MVC\CApplicationBasic(self::$di);
     self::$di->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(['dsn' => "sqlite:memory::", "verbose" => false]);
         $db->connect();
         $db->dropTableIfExists('content')->execute();
         $db->createTable('content', ['id' => ['integer', 'primary key', 'not null', 'auto_increment'], 'slug' => ['varchar(80)', 'unique'], 'url' => ['varchar(80)', 'unique'], 'type' => ['varchar(80)'], 'title' => ['varchar(80)'], 'data' => ['text'], 'filter' => ['char(80)'], 'created' => ['datetime'], 'published' => ['datetime'], 'updated' => ['datetime'], 'deleted' => ['datetime'], 'owner' => ['varchar(80)'], 'updated_by' => ['varchar(80)']])->execute();
         $now = gmdate('Y-m-h H:i:s');
         $db->insert('content', ['slug', 'type', 'title', 'data', 'created', 'published', 'owner']);
         $db->execute(['a-first-article', 'article', 'A first article', 'This is the text of the first article.', $now, $now, 'admin']);
         return $db;
     });
 }
Beispiel #12
0
<?php

require __DIR__ . '/config_with_app.php';
$di->setShared('db', function () {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/database_sqlite.php');
    $db->connect();
    return $db;
});
$di->set('UsersController', function () use($di) {
    $controller = new \Anax\Users\UsersController();
    $controller->setDI($di);
    return $controller;
});
// $app->router->add('setup', function () use ($app) {
//
//     $app->db->setVerbose();
//
//     $app->db->dropTableIfExists('user')->execute();
//
//     $app->db->createTable(
//         'user',
//         [
//             'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
//             'acronym' => ['varchar(20)', 'unique', 'not null'],
//             'email' => ['varchar(80)'],
//             'name' => ['varchar(80)'],
//             'password' => ['varchar(255)'],
//             'created' => ['datetime'],
//             'updated' => ['datetime'],
//             'deleted' => ['datetime'],
<?php

require "../src/Database/TSQLQueryBuilderBasic.php";
require "../src/Database/CDatabaseBasic.php";
$db = new \Mos\Database\CDatabaseBasic();
//
// Create a table
//
$db->setTablePrefix('mos_');
$db->createTable('test', ['id' => ['integer', 'primary key', 'not null'], 'age' => ['integer'], 'text' => ['varchar(20)'], 'text2' => ['varchar(20)']]);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Insert a single row into table using key => value
//
$db->insert('test', ['id' => 2, 'text' => "Mumintrollet", 'text2' => "Mumindalen"]);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Insert a single row into table using two arrays
//
$db->insert('test', ['id', 'text', 'text2'], [2, "Mumintrollet", "Mumindalen"]);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Insert a single row into table using one array (rest will be sent as parameters)
//
$db->insert('test', ['id', 'text', 'text2']);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Update a single row using key => value
//
$db->update('test', ['age' => 22, 'text' => "Mumintrollet", 'text2' => "Mumindalen"], "id = 2");
echo "<pre>" . $db->getSQL() . "</pre>";
/*
 *
 * 	Include config
 */
require __DIR__ . '/config.php';
/*
 *
 * 	Initialize Di object
 */
$di = new \Anax\DI\CDIFactoryDefault();
/*
 *
 *  Set Shared objects
 */
$db = function () {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/database_mysql.php');
    $db->connect();
    return $db;
};
$commentForm = function () {
    return new CommentForm();
};
$commentController = function () use($di) {
    $controller = new \Anax\Comment\CommentController();
    $controller->setDI($di);
    return $controller;
};
$di->setShared('db', $db);
$di->setShared('commentForm', $commentForm);
$di->set('CommentController', $commentController);
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('theme', function () {
         $themeEngine = new \CR\ThemeEngine\CThemeExtended();
         $themeEngine->setDI($this);
         $themeEngine->configure(ANAX_APP_PATH . 'config/theme.php');
         return $themeEngine;
     });
     // Forms service
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Database service for Anax
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_wgtotw.php');
         $db->connect();
         return $db;
     });
     // Flash messages
     $this->setShared('flashmessage', function () {
         $flashmessages = new \helikopterspark\FlashMsg\FlashMsg();
         $flashmessages->setDI($this);
         return $flashmessages;
     });
     // Questions
     $this->setShared('QuestionController', function () {
         $questions = new \CR\Question\QuestionController();
         $questions->setDI($this);
         return $questions;
     });
     // Answers
     $this->setShared('AnswerController', function () {
         $answers = new \CR\Answer\AnswerController();
         $answers->setDI($this);
         return $answers;
     });
     // Tags
     $this->setShared('TagController', function () {
         $tags = new \CR\Tag\TagController();
         $tags->setDI($this);
         return $tags;
     });
     // Comments
     $this->set('CommentsController', function () {
         $commentscontroller = new \CR\Comment\CommentsController();
         $commentscontroller->setDI($this);
         return $commentscontroller;
     });
     // Users
     $this->set('UsersController', function () {
         $userscontroller = new \CR\Users\UsersController();
         $userscontroller->setDI($this);
         return $userscontroller;
     });
     // User login
     $this->set('UserloginController', function () {
         $userlogincontroller = new \CR\Users\UserloginController();
         $userlogincontroller->setDI($this);
         return $userlogincontroller;
     });
     // Paginator
     $this->setShared('paginator', function () {
         $paginate = new \CR\Paginator\CPaginator();
         $paginate->setDI($this);
         return $paginate;
     });
     // Vote service
     $this->setShared('vote', function () {
         $votes = new \CR\Vote\Vote();
         $votes->setDI($this);
         return $votes;
     });
     // Topbar
     $this->setShared('topbar', function () {
         $topbar = new \CR\Topbar\CTopbar();
         $topbar->setDI($this);
         //$topbar->configure(ANAX_APP_PATH . 'config/navbar.php');
         return $topbar;
     });
 }
Beispiel #16
0
<?php

require __DIR__ . '/config_with_app.php';
$app->theme->configure(ANAX_APP_PATH . 'config/theme_me.php');
$app->url->setUrlType(\Anax\Url\CUrl::URL_APPEND);
$app->navbar->configure(ANAX_APP_PATH . 'config/navbar_users.php');
// CONTROLLERS
$di->set('form', '\\Mos\\HTMLForm\\CForm');
$di->set('CommentController', function () use($di) {
    $controller = new Phpmvc\Comment\CommentController();
    $controller->setDI($di);
    return $controller;
});
$di->setShared('db', function () {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
    $db->connect();
    return $db;
});
$di->set('UsersController', function () use($di) {
    $controller = new \Anax\Users\UsersController();
    $controller->setDI($di);
    return $controller;
});
$di->set('FormController', function () use($di) {
    $controller = new \Anax\HTMLForm\FormController();
    $controller->setDI($di);
    return $controller;
});
// END CONTROLLERS
// ROUTES
Beispiel #17
0
<?php

/**
 * Config file for pagecontrollers, creating an instance of $app.
 *
 */
// Get environment & autoloader.
require __DIR__ . '/config.php';
// Create services and inject into the app.
$di = new \Anax\DI\CDIMyFactoryDefault();
$app = new \Anax\Kernel\CAnax($di);
//Add database
$di->setShared('db', function () {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/database/config_mysql_bth.php');
    $db->connect();
    return $db;
});
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('theme', function () {
         $themeEngine = new \CR\ThemeEngine\CThemeExtended();
         $themeEngine->setDI($this);
         $themeEngine->configure(ANAX_APP_PATH . 'config/theme-grid.php');
         return $themeEngine;
     });
     // Forms service
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Database service for Anax
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_wgtotw.php');
         $db->connect();
         return $db;
     });
     // Flash messages
     $this->setShared('flashmessage', function () {
         $flashmessages = new \helikopterspark\FlashMsg\FlashMsg();
         $flashmessages->setDI($this);
         return $flashmessages;
     });
     // Paginator
     $this->setShared('paginator', function () {
         $paginate = new \CR\Paginator\CPaginator();
         $paginate->setDI($this);
         return $paginate;
     });
     // Topbar
     $this->setShared('topbar', function () {
         $topbar = new \CR\Topbar\CTopbar();
         $topbar->setDI($this);
         //$topbar->configure(ANAX_APP_PATH . 'config/navbar.php');
         return $topbar;
     });
     // Shop
     $this->setShared('ShopController', function () {
         $shop = new \CR\JSShop\ShopController();
         $shop->setDI($this);
         return $shop;
     });
     // Checkout
     $this->setShared('CheckoutController', function () {
         $checkout = new \CR\JSShop\CheckoutController();
         $checkout->setDI($this);
         return $checkout;
     });
     // Playgrounds
     $this->setShared('CkmomController', function () {
         $kmom = new \CR\CKmom\CkmomController();
         $kmom->setDI($this);
         return $kmom;
     });
     // Websockets
     $this->setShared('WebsocketsController', function () {
         $ws = new \CR\Websockets\WebsocketsController();
         $ws->setDI($this);
         return $ws;
     });
 }
Beispiel #19
0
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     require ANAX_APP_PATH . 'config/error_reporting.php';
     $this->setShared('response', '\\Anax\\Response\\CResponseBasic');
     $this->setShared('validate', '\\Anax\\Validate\\CValidate');
     $this->setShared('flash', '\\Anax\\Flash\\CFlashBasic');
     $this->set('route', '\\Anax\\Route\\CRouteBasic');
     $this->set('view', '\\Anax\\View\\CViewBasic');
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     $this->set('ErrorController', function () {
         $controller = new \Anax\MVC\ErrorController();
         $controller->setDI($this);
         return $controller;
     });
     $this->setShared('log', function () {
         $log = new \Anax\Log\CLogger();
         $log->setContext('development');
         return $log;
     });
     $this->setShared('request', function () {
         $request = new \Anax\Request\CRequestBasic();
         $request->init();
         return $request;
     });
     $this->setShared('url', function () {
         $url = new \Anax\Url\CUrl();
         $url->setSiteUrl($this->request->getSiteUrl());
         $url->setBaseUrl($this->request->getBaseUrl());
         $url->setStaticSiteUrl($this->request->getSiteUrl());
         $url->setStaticBaseUrl($this->request->getBaseUrl());
         $url->setScriptName($this->request->getScriptName());
         $url->setUrlType($url::URL_APPEND);
         return $url;
     });
     $this->setShared('views', function () {
         $views = new \Anax\View\CViewContainerBasic();
         $views->setBasePath(ANAX_APP_PATH . 'view');
         $views->setFileSuffix('.tpl.php');
         $views->setDI($this);
         return $views;
     });
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
         $db->connect();
         return $db;
     });
     $this->setShared('router', function () {
         $router = new \Anax\Route\CRouterBasic();
         $router->setDI($this);
         $router->addInternal('403', function () {
             $this->dispatcher->forward(['controller' => 'error', 'action' => 'statusCode', 'params' => ['code' => 403, 'message' => "HTTP Status Code 403: This is a forbidden route."]]);
         })->setName('403');
         $router->addInternal('404', function () {
             $this->dispatcher->forward(['controller' => 'error', 'action' => 'statusCode', 'params' => ['code' => 404, 'message' => "HTTP Status Code 404: This route is not found."]]);
             $this->dispatcher->forward(['controller' => 'error', 'action' => 'displayValidRoutes']);
         })->setName('404');
         $router->addInternal('500', function () {
             $this->dispatcher->forward(['controller' => 'error', 'action' => 'statusCode', 'params' => ['code' => 500, 'message' => "HTTP Status Code 500: There was an internal server or processing error."]]);
         })->setName('500');
         return $router;
     });
     $this->setShared('dispatcher', function () {
         $dispatcher = new \Anax\MVC\CDispatcherBasic();
         $dispatcher->setDI($this);
         return $dispatcher;
     });
     $this->setShared('session', function () {
         $session = new \Anax\Session\CSession();
         $session->configure(ANAX_APP_PATH . 'config/session.php');
         $session->name();
         $session->start();
         return $session;
     });
     $this->setShared('theme', function () {
         $themeEngine = new \Anax\ThemeEngine\CThemeBasic();
         $themeEngine->setDI($this);
         $themeEngine->configure(ANAX_APP_PATH . 'config/theme.php');
         return $themeEngine;
     });
     $this->setShared('navbar', function () {
         $navbar = new \Anax\Navigation\CNavbar();
         $navbar->setDI($this);
         $navbar->configure(ANAX_APP_PATH . 'config/navbar.php');
         return $navbar;
     });
     $this->setShared('user', function () {
         $user = new \Anax\Users\User();
         $user->setDI($this);
         return $user;
     });
     $this->set('fileContent', function () {
         $fc = new \Anax\Content\CFileContent();
         $fc->setBasePath(ANAX_APP_PATH . 'content/');
         return $fc;
     });
     $this->setShared('textFilter', function () {
         $filter = new \Anax\Content\CTextFilter();
         $filter->setDI($this);
         $filter->configure(ANAX_APP_PATH . 'config/text_filter.php');
         return $filter;
     });
 }
Beispiel #20
0
<?php

//
// Set the error reporting.
//
error_reporting(-1);
// Report all type of errors
ini_set('output_buffering', 0);
// Do not buffer outputs, write directly
//
// Get required files
//
require "../../src/Database/TSQLQueryBuilderBasic.php";
require "../../src/Database/CDatabaseBasic.php";
$db = new \Mos\Database\CDatabaseBasic();
//
// Read config file
//
$options = (require "../config_mysql.php");
//
// Carry out som tests, db must exist
//
$db->setOptions($options);
$db->setTablePrefix($options['table_prefix']);
$db->connect();
//
// Drop a table if it exists
//
$tableName = 'test';
$db->dropTableIfExists($tableName)->execute();
//
<?php

// Get environment & autoloader.
require __DIR__ . '/config.php';
$db = new \Mos\Database\CDatabaseBasic();
$options = (require "config_mysql.php");
$db->setOptions($options);
$db->connect();
$db->setVerbose();
// Set verbose mode to on
$db->select()->from('test')->orderBy("id ASC");
$db->execute();