예제 #1
0
include dirname(__FILE__) . '/config.php';
$lang = fRequest::get('lang', "string?");
if ($lang != NULL) {
    fCookie::set('safecast_lang', $lang, '+1 year', '/', '.safecast.org');
}
if ($lang == NULL) {
    $lang = fCookie::get('safecast_lang', 'en');
}
// get language file
$lang_file = DOC_ROOT . '/lang/' . $lang . '.json';
if (!file_exists($lang_file)) {
    $lang_file = DOC_ROOT . '/lang/en.json';
}
$file = new fFile($lang_file);
$lang_file_content = $file->read();
//print_r("file content: ".$lang_file_content);
$translations = json_decode($lang_file_content);
//print_r('file: '.$lang_file);
//print_r('************'.$translations.'^^^^^^^^^^^^^^^');
//die;
$tmpl = new fTemplating(DOC_ROOT . '/views/');
$tmpl->set('header', 'header.php');
$tmpl->set('header_headless', 'header_headless.php');
$tmpl->set('info_header', 'info_header.php');
$tmpl->set('footer', 'footer.php');
$tmpl->set('lang', $lang);
require_once DOC_ROOT . '/Browser.php';
$mobile = mobile_device_detect(true, false, true, true, true, true, true, false, false);
if ($mobile) {
    $tmpl->add('css', 'style/mobile.css');
예제 #2
0
 /**
  * Loads the plaintext version of the email body from a file and applies replacements
  * 
  * The should contain either ASCII or UTF-8 encoded text. Please see
  * http://flourishlib.com/docs/UTF-8 for more information.
  * 
  * @throws fValidationException  When no file was specified, the file does not exist or the path specified is not a file
  * 
  * @param  string|fFile $file          The plaintext version of the email body
  * @param  array        $replacements  The method will search the contents of the file for each key and replace it with the corresponding value
  * @return void
  */
 public function loadHTMLBody($file, $replacements = array())
 {
     if (!$file instanceof fFile) {
         $file = new fFile($file);
     }
     $html = $file->read();
     if ($replacements) {
         $html = strtr($html, $replacements);
     }
     $this->html_body = $html;
 }
예제 #3
0
/**
 * Prepares classes and database for tests.
 */
// Some basics
date_default_timezone_set('Europe/Copenhagen');
define("FIXTURES_ROOT", dirname(__FILE__) . '/fixtures/');
include dirname(__FILE__) . '/flourish/fLoader.php';
fLoader::best();
// Include fFixture
include dirname(__FILE__) . '/../fFixture.php';
include dirname(__FILE__) . '/../fFixtureSeed.php';
// Emtpy database
$db = new fDatabase('sqlite', dirname(__FILE__) . '/test.db');
$db_setup_file = new fFile(dirname(__FILE__) . '/bootstrap.sql');
define("RESET_DATABASE_SQL", $db_setup_file->read());
$db->execute(RESET_DATABASE_SQL);
// Setup ORM
fORMDatabase::attach($db);
// Pretend implementations of fActiveRecord
class Category extends fActiveRecord
{
}
class Product extends fActiveRecord
{
}
class Shop extends fActiveRecord
{
}
class User extends fActiveRecord
{