Example #1
0
 public static function start_session()
 {
     $session_name = md5(sprintf('%s.neechy', NeechyConfig::get('title', 'neechy')));
     session_name($session_name);
     session_start();
     return null;
 }
 public function testShouldLoadTestConfigFile()
 {
     NeechyConfig::init();
     $this->assertNull(NeechyConfig::get('unset-value'));
     $this->assertTrue(NeechyConfig::get('is-testing'));
     $this->assertEquals('NeechyTest', NeechyConfig::get('title'));
 }
 private function query($sql, $params = array())
 {
     $dsn = sprintf('mysql:host=%s;dbname=%s', NeechyConfig::get('mysql_host'), $this->test_db_name);
     $pdo = new PDO($dsn, NeechyConfig::get('mysql_user'), NeechyConfig::get('mysql_password'));
     $query = $pdo->prepare($sql);
     $query->execute($params);
     return $query;
 }
Example #4
0
 private function setup_dev_environment()
 {
     $handler_path = NeechyPath::join(NEECHY_HANDLER_CORE_PATH, 'install', 'handler.php');
     require_once $handler_path;
     if (NeechyDatabase::database_exists(NeechyConfig::get('mysql_database'))) {
         error_log('Test database found.');
     } else {
         error_log('Setting up dev environment using test configuration file.');
         # Buffer console output.
         ob_start();
         $handler = new InstallHandler($this->request);
         $handler->setup_dev();
         ob_end_clean();
     }
 }
Example #5
0
<?php

require_once '../core/neechy/config.php';
require_once '../core/neechy/database.php';
require_once '../core/neechy/response.php';
# Parse params
$params = explode('/', $_SERVER["REQUEST_URI"]);
$action = count($params) > 2 ? $params[2] : null;
# Must init config for NeechyDatabase
NeechyConfig::init();
# Response
$json = array('params' => $params, 'action' => $action);
# Router
if ($action == 'database') {
    NeechyDatabase::reset();
    $json['result'] = 'ok';
} else {
    $json['warning'] = 'Invalid action.';
}
$response = new NeechyResponse(json_encode($json), 200);
$response->send_headers();
$response->render();
Example #6
0
<?php

/**
 * index.php
 *
 * This is the main Neechy script. This file is called each time a request is
 * made from the browser.
 *
 */
require_once '../core/services/web.php';
$config = NeechyConfig::init();
$web_service = new NeechyWebService($config);
$web_service->serve();
<?php

#
# Default New User Page
# This gets saved as user's page upon successfuly registration
#
$t = $this;
# templater object
?>
## Welcome to the <?php 
echo NeechyConfig::get('title');
?>
 Wiki

### This is your wiki page!

To deter spammers, this page will **not** be visible to search engines. When you registered, an email was sent to you. As soon as you click the link in that email, you will be able to edit this page.

It will be the only page you can edit until an administrator upgrades you. In the meantime, feel free look around, learn more about [markdown](/?page=NeechyFormatting) (the formatting syntax this wiki uses), and rewrite this page to your heart's content.

Welcome aboard!
Example #8
0
 private function validate_config_settings()
 {
     $db_name = NeechyConfig::get('mysql_database');
     if (!$db_name || $db_name == 'NULL') {
         throw new NeechyError(sprintf('please update database settings in your config file: %s', NeechyConfig::path()));
     } else {
         return true;
     }
 }
 /**
  * Tests
  */
 public function testInstantiates()
 {
     $config = NeechyConfig::init();
     $service = new NeechyService($config);
     $this->assertInstanceOf('NeechyService', $service);
 }
Example #10
0
 protected static function verify_host_is_configured()
 {
     $host = NeechyConfig::get('mysql_host');
     if (is_null($host) || $host == 'NULL') {
         throw new NeechyDatabaseError('mysql_host set to null');
     } else {
         return true;
     }
 }
          <th>Database</th>
          <th>Host</th>
          <th>User</th>
          <th>Connection Status</th>
        </tr>
        <tr>
          <td><?php 
echo NeechyConfig::get('mysql_database');
?>
</td>
          <td><?php 
echo NeechyConfig::get('mysql_host');
?>
</td>
          <td><?php 
echo NeechyConfig::get('mysql_user');
?>
</td>
          <td><?php 
echo NeechyDatabase::connection_status();
?>
</td>
        </tr>
      </table>

      <div class="form-group database-actions">
        <?php 
echo $t->open_form('', 'post', array('class' => 'form-inline'));
?>
          <?php 
if ($t->data('database_installed')) {
Example #12
0
 public static function init_database()
 {
     NeechyDatabase::destroy_database();
     $pdo = NeechyDatabase::create_database();
     $pdo->query(sprintf('USE %s', NeechyConfig::get('mysql_database')));
 }
Example #13
0
 public function reload()
 {
     NeechyDatabase::disconnect_from_db();
     NeechyConfig::init();
 }
<?php

$t = $this;
# templater object
$auth = new AppAuthService();
?>
    <?php 
if (NeechyConfig::stage() == 'dev') {
    ?>
      <div class="dev-footer">
        <h4>App Engine Dev Server</h4>
        <p>Using <?php 
    echo NeechyConfig::environment();
    ?>
 config settings.</p>
        <?php 
    if ($auth->user) {
        ?>
        <p>Logged in as <?php 
        echo $auth->user_is_admin() ? 'admin' : 'user';
        ?>
.</p>
        <?php 
    } else {
        ?>
        <p>Not logged in.</p>
        <?php 
    }
    ?>
      </div>
    <?php 
Example #15
0
$t = $this;
?>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title><?php 
echo NeechyConfig::get('title');
?>
</title>
    <meta name="keywords" content="<?php 
echo NeechyConfig::get('keywords');
?>
" />
    <meta name="description" content="<?php 
echo NeechyConfig::get('description');
?>
" />
    <link rel="icon" type="image/x-icon"
		  href="themes/bootstrap/images/favicon.ico"  />
    <link rel="shortcut icon" type="image/x-icon"
		  href="themes/bootstrap/images/favicon.ico"  />

    <!-- Stylesheets -->
    <link rel="stylesheet"
      href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
    <link rel="stylesheet" href="themes/bootstrap/css/bootstrap-override.css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
Example #16
0
<?php

#
# Phpunit Bootstrap File
#
# Want to see STRICT errors
error_reporting(E_ALL);
# App expects to execute from subdirectory (pubic for web, test for tests)
$test_dir = dirname(__FILE__);
chdir($test_dir);
# Need to load Google SDK
$app_engine_sdk_path = '../../../google-cloud-sdk/platform/google_appengine/php/sdk';
set_include_path(get_include_path() . PATH_SEPARATOR . $app_engine_sdk_path);
require_once 'google/appengine/runtime/autoloader.php';
require_once 'google/appengine/runtime/ApiProxyTest.php';
use google\appengine\runtime\ApiProxyTest\make_call;
# Set NEECHY_ENV var for config class
$_ENV['NEECHY_ENV'] = 'test';
# Load config class
require_once '../core/neechy/config.php';
# Require test config file
if (!file_exists(NeechyConfig::test_config_path())) {
    throw new Exception(sprintf('Test config file [%s] missing.', NeechyConfig::test_config_path()));
}