コード例 #1
0
ファイル: Alert.php プロジェクト: yslbc/twcompany
 /**
  * alert popup javascript alert with $message and redirect to $url
  *
  * @param Pix_Controller $controller
  * @param string $message
  * @param string $url
  * @access public
  * @return void
  */
 public function alert($controller, $message, $url)
 {
     $view = new Pix_Partial(__DIR__ . '/Alert/');
     echo $view->partial('alert.phtml', array('message' => $message, 'url' => $url));
     return $controller->noview();
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: ronnywang/pixframework
 /**
  * getHelperManager get Helper Manager
  *
  * @static
  * @access public
  * @return Pix_Helper_Manager
  */
 public static function getHelperManager()
 {
     if (is_null(self::$_helper_manager)) {
         self::$_helper_manager = new Pix_Helper_Manager();
     }
     return self::$_helper_manager;
 }
コード例 #3
0
<?php

include __DIR__ . '/webdata/init.inc.php';
Pix_Controller::addCommonHelpers();
if (!getenv('SESSION_SECRET')) {
    die("need SESSION_SECRET");
}
Pix_Session::setAdapter('cookie', array('secret' => getenv('SESSION_SECRET')));
Pix_Controller::dispatch(__DIR__ . '/webdata/');
コード例 #4
0
ファイル: init.php プロジェクト: ronnywang/ptthot
if (file_exists(__DIR__ . '/webdata/setting.php')) {
    include __DIR__ . '/webdata/setting.php';
}
if (!getenv('TEST') and $_SERVER['HTTP_HOST'] != 'ptthot.ronny.tw') {
    header('Location: http://ptthot.ronny.tw' . $_SERVER['REQUEST_URI'], true, 301);
    exit;
}
date_default_timezone_set('Asia/Taipei');
if (!getenv('DATABASE_URL')) {
    die('need DATABASE_URL');
}
if (preg_match('#postgres://([^:]*):([^@]*)@([^/]*)/(.*)#', strval(getenv('DATABASE_URL')), $matches)) {
    $user = $matches[1];
    $pass = $matches[2];
    $host = $matches[3];
    $dbname = $matches[4];
    Pix_Table::setDefaultDb(new Pix_Table_Db_Adapter_PgSQL(array('user' => $user, 'password' => $pass, 'host' => $host, 'dbname' => $dbname)));
} else {
    if (preg_match('#mysql://([^:]*):([^@]*)@([^/]*)/(.*)#', strval(getenv('DATABASE_URL')), $matches)) {
        $db = new StdClass();
        $db->host = $matches[3];
        $db->username = $matches[1];
        $db->password = $matches[2];
        $db->dbname = $matches[4];
        $config = new StdClass();
        $config->master = $config->slave = $db;
        Pix_Table::setDefaultDb(new Pix_Table_Db_Adapter_MysqlConf(array($config)));
    }
}
Pix_Controller::addCommonHelpers();
Pix_Table::addStaticResultSetHelper('Pix_Array_Volume');