示例#1
0
<?php

define('APPLICATION_PATH', __DIR__ . '/../');
define('CONFIG', APPLICATION_PATH . '/configs/config.json');
require_once APPLICATION_PATH . "vendor/autoload.php";
$config = new \Noodlehaus\Config(CONFIG);
$app = new Silex\Application();
$app['debug'] = $config->get('debug');
$dbOptions = $config->get('db');
define('APP_KEY', $config->get('app_key'));
$app->register(new Silex\Provider\DoctrineServiceProvider(), ['db.options' => $dbOptions]);
\Sasik\Db\DbSingleton::setDb($app['db']);
$app->mount('/', new Sasik\Controllers\IndexControllerProvider());
$app->run();
示例#2
0
 /**
  * logging
  *
  * @param array $input_array
  * @param string $file_name
  * @param string $type
  */
 public function logging($input_array = array(), $type = "up", $file_name = 'bim.log')
 {
     $conf = new \Noodlehaus\Config(__DIR__ . "/../config/bim.json");
     $logging_path = $conf->get("logging_path");
     $return_message = " >> php bim " . $type . " \n";
     $return_message .= date('d.m.Y H:i:s') . "\n";
     $return_message .= print_r($input_array, true) . "\n";
     $return_message .= "\n----------\n\n";
     $file_name = empty($file_name) ? 'bim.log' : $file_name;
     $log_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $logging_path . '/' . date("Y") . "/" . date("m") . "/" . date("d");
     if (!file_exists($log_path)) {
         mkdir($log_path, 0777, true);
     }
     file_put_contents($log_path . '/' . $file_name, $return_message, FILE_APPEND);
     $this->writeln("Put info to log file > " . Colors::colorize($log_path . '/' . $file_name, Colors::GREEN));
 }
示例#3
0
文件: init.php 项目: buisoft/wob
<?php

session_cache_limiter(false);
session_start();
ob_start();
ini_set('display_errors', 'On');
define('INC_ROOT', dirname(__DIR__));
require INC_ROOT . '/vendor/autoload.php';
$app = new Slim\Slim(['mode' => file_get_contents(INC_ROOT . '/app/config/env/mode.php'), 'view' => new Slim\Views\Twig(), 'templates.path' => INC_ROOT . '/views/']);
$app->add(new BuiSoft\Middleware\BeforeMiddleware());
$app->configureMode($app->config('mode'), function () use($app) {
    $app->config = Noodlehaus\Config::load(INC_ROOT . "/app/config/env/{$app->mode}.php");
});
require INC_ROOT . '/app/config/database.php';
require INC_ROOT . '/app/filters/authentication.php';
require INC_ROOT . '/app/config/api.php';
require INC_ROOT . '/app/config/routes.php';
require INC_ROOT . '/app/config/queue.php';
require INC_ROOT . '/app/config/session.php';
require INC_ROOT . '/app/config/cache.php';
require INC_ROOT . '/app/config/languages.php';
require INC_ROOT . '/app/config/app.php';
$view = $app->view();
$view->parserOptions = ['debug' => $app->config->get('twig.debug')];
$view->parserExtensions = [new Slim\Views\TwigExtension()];
<?php

use Illuminate\Database\Capsule\Manager as Capsule;
// create a new capsule to hold database connection
$capsule = new Capsule();
$config = new \Noodlehaus\Config(dirname(__FILE__) . '/../config/app.php');
$capsule->addConnection(['driver' => $config->get('db.driver'), 'host' => $config->get('db.hostname'), 'database' => $config->get('db.dbname'), 'username' => $config->get('db.username'), 'password' => $config->get('db.password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
$capsule->setAsGlobal();
$capsule->bootEloquent();
示例#5
0
<?php

/**
 * User: sasik
 * Date: 7/17/15
 * Time: 8:28 PM
 */
define('APPLICATION_PATH', __DIR__ . '/../');
define('CONFIG', APPLICATION_PATH . '/configs/config.json');
require_once APPLICATION_PATH . "vendor/autoload.php";
use Sasik\Google\CloudMessaging;
$config = new \Noodlehaus\Config(CONFIG);
define('APP_KEY', $config->get('app_key'));
$token = 'APA91bGi5JhZbR5DebXc5HzpcCHHk4Ct_3RBhQwwpxEntOG_nIHNgHvVNUO-SelCsY5s8f638uukDCYC3bxuPeXky0WeHWB8pXUFLB2E7Q5eLEvBp4vwPTU3lEknni9M6mv4VUP1W9iY';
//$token = 'APA91bGgAA6lIMDfReRkB1mEuCmVajg2rcMNWYndf1If3JyTObaTr-dy7rjkHlI1CJL6no_60cV5rMeuVZr_J9OVIkA6XC3kJmEvlroKgf1q2vTVszRzqhP1RlFRwdMPQBe5lDhJp-4W';
//$token = 'APA91bG95sMzVadM-ZOk9o8akiXPG4JthPudKI_u0EgoDjigV_cZL4iKlD5rVGaT6izsztckY4W7nTfcmZpux9vGTVNvE0fBT3_CBoGEVsgce2UfX0t21URkfZT6CYMeWKYp5t_mGMIU';
//$token = 'APA91bG15iDpwV60IQy7LlSCVBBL4dzeL7qeNpfdtIy_K2zfNEhqmT2bHfAJ_NA-ktE2fASzwp-m434w61V8gbzZJILyAT0RjeEkHMIiLoC719vPmCuy4zFW0yudOd7Eojz_jKTJ59ZM';
$resp = CloudMessaging::send($token, ['message' => 'hi mother f****r', 'timestamp' => time(), 'type' => rand(0, 1)]);
dump($resp->getBody()->getContents());
dump($resp->getStatusCode());
dump($resp->getHeaders());
//dump(\Sasik\Google\Request::send('abc', ['hi message']));
//dump($resp);
示例#6
0
<?php

/**
 * для Создания тестовых сущносей в базе данных
 * User: sasik
 * Date: 7/17/15
 * Time: 3:05 PM
 */
define('APPLICATION_PATH', __DIR__ . '/../');
define('CONFIG', APPLICATION_PATH . '/configs/config.json');
require_once APPLICATION_PATH . "vendor/autoload.php";
use Sasik\Models\Children;
use Sasik\Models\Parents;
use Sasik\Models\Tokens;
$config = new \Noodlehaus\Config(CONFIG);
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\DoctrineServiceProvider(), ['db.options' => $config->get('db')]);
\Sasik\Db\DbSingleton::setDb($app['db']);
$db = \Sasik\Db\DbSingleton::getDb();
/**
 * ОСТОРОЖНО
 */
foreach (['children', 'parents', 'tokens', 'children_to_parents'] as $table) {
    $query = $db->createQueryBuilder();
    $query->delete($table)->execute();
    //    $db->fetchAll('DELETE FROM ' . $table );
}
//$db->delete('children', []);
//$db->delete('parents', []);
//$db->delete('tokens', []);
示例#7
0
 /**
  * getTableName
  * @return string
  */
 public static function getTableName()
 {
     $conf = new \Noodlehaus\Config(__DIR__ . "/../../config/bim.json");
     return $conf->get("migration_table");
 }
示例#8
0
文件: app.php 项目: buisoft/wob
<?php

$app->auth = false;
//TODO Autoset the language given IP Address, Previous Visit, User Settings
$app->lang = Noodlehaus\Config::load(INC_ROOT . "/app/languages/en/defaults.php");
$app->container->set('hash', function () use($app) {
    //return new BuiSoft\Helpers\Hash($app->config);
});
require_once INC_ROOT . "/app/WOB/Courses/Course.php";
use WOB\Courses\Course;
$app->container->set('course', function () use($app) {
    return new Course();
});
$app->container->singleton('mail', function () use($app) {
    $mailer = new PHPMailer();
    $mailer->Host = $app->config->get('mail.host');
    $mailer->SMTPAuth = $app->config->get('mail.smtp_auth');
    $mailer->SMTPSecure = $app->config->get('mail.smtp_secure');
    $mailer->Port = $app->config->get('mail.port');
    $mailer->Username = $app->config->get('mail.username');
    $mailer->Password = $app->config->get('mail.password');
    $mailer->isHTML($app->config->get('mail.html'));
    return new BuiSoft\Mail\Mailer($mailer, $app->view);
});
$app->container->singleton('randomlib', function () {
    $factory = new RandomLib\Factory();
    return $factory->getMediumStrengthGenerator();
});