示例#1
0
function smarty_modifier_textile($string, $lite = false, $restricted = false)
{
    if (!isset($string) || $string === '') {
        return $string;
    } else {
        Globe::Load('Textile/library/Vendor/Textile', 'package');
        $textile = new Textile();
        return $restricted ? $textile->TextileRestricted($string, $lite) : $textile->TextileThis($string, $lite);
    }
}
示例#2
0
 public function get_parent_obj()
 {
     if (!$this->parent_obj && $this->parent) {
         $this->parent_obj = object_get($this->root, $this->parent);
         if (!$this->parent_obj) {
             Globe::Load($this->parent, 'model');
             $this->parent_obj = $this->root->{$this->parent} = $this->root->find_parent($this->parent);
         }
     }
     return $this->parent_obj;
 }
示例#3
0
<?php

Globe::Load('AppUsers', 'controller');
class AdminsController extends AppUsersController
{
    var $name = 'users';
}
示例#4
0
<?php

Globe::Load('Setting', 'model');
class Email
{
    var $from, $to, $cc, $bcc, $subject, $message;
    var $parts = array();
    function __construct($from, $to, $include_admin = false, $options = array())
    {
        $admin = Setting::Get('admin', 'emails', true);
        if ($include_admin) {
            $to = $admin . wrap($to, ', ');
        }
        $this->from = $from ? $from : $admin;
        $this->to = $to ? $to : $admin;
        foreach ($options as $key => $value) {
            $this->{$key} = $value;
        }
    }
    function send_data($data, $subject = '[Data Send]')
    {
        return $this->send($this->build_message($data), $subject, true);
    }
    function send($message, $subject = '[Send]', $is_html = false)
    {
        $this->set_part('message', $message);
        $this->message = $this->get_part('prepends') . $this->get_part('message') . $this->get_part('appends');
        $this->subject = $subject;
        $this->build_headers(true);
        return mail($this->to, $this->subject, $this->message, $this->headers);
    }
示例#5
0
 private function _set_filter()
 {
     // filter?
     $value = Url::GetRequest('filter', null);
     // parents?
     $parents = $this->Model ? $this->Model->get_first_parent() : false;
     if (!empty($parents)) {
         $parent = $parents['key'];
         $parent_params = $parents['value'];
         AppModel::RelationNameParams($parent, $parent_params);
         $parents = add_all(AppModel::FindAllAssoc_options($parent));
     } else {
         $parents = $parent = false;
     }
     // short filter?
     if ($short = is_numeric($value)) {
         if ($parent) {
             Globe::Load($parent, 'model');
             $field = array_get($parent_params, 'foreignKey', AppInflector::tableize($parent) . '_id');
             if ($value != false) {
                 $where = "{$field}={$value}";
             } else {
                 $where = null;
             }
         } else {
             $field = $where = null;
         }
     } else {
         if (!empty($value)) {
             preg_match_all('/\\s*([^=]+)\\s*/', $value, $parts);
             // explode & trim!
             $field = array_shift($parts[0]);
             $value = implode('=', $parts[0]);
             $where = "{$field}='{$value}'";
         } else {
             $field = $where = null;
         }
     }
     $this->assign('filter', $this->filter = (object) array('short' => $short, 'where' => $where, 'field' => $field, 'value' => $value, 'parent' => $parent, 'parents' => $parents));
 }
示例#6
0
 * @author Philip Blyth
 */
require_once ENDO_ROOT . INCLUDES_DIR . 'debug.php';
require_once ENDO_ROOT . CLASSES_DIR . 'class.log.php';
require_once ENDO_ROOT . CLASSES_DIR . 'class.error.php';
require_once ENDO_ROOT . CLASSES_DIR . 'class.globe.php';
// --------------------------------------------------
// INCLUDES
// --------------------------------------------------
Globe::Load(array('endo_bootstrap', 'app_bootstrap'), 'include');
// --------------------------------------------------
// PACKAGES
// --------------------------------------------------
Globe::Load(array('MyActiveRecord/MyActiveRecord.0.4', 'Smarty/Smarty.class'), 'package');
// --------------------------------------------------
// CLASSES
// --------------------------------------------------
Globe::Load(array('log', 'endo_view', 'app_view', 'url', 'app_url'));
// --------------------------------------------------
// MODELS
// --------------------------------------------------
Globe::Load(array('endo', 'app', 'event', 'user', 'app_user', 'admin'), 'model');
// --------------------------------------------------
// CONTROLLERS
// --------------------------------------------------
Globe::Load(array('endo', 'app'), 'controller');
// --------------------------------------------------
// BEHAVIORS
// --------------------------------------------------
Globe::Load(array('endo', 'app'), STR_BEHAVIOR);
示例#7
0
 private function _detach_from_all($class)
 {
     Globe::Load($class, 'model');
     // get all objects:
     $objects = Listing::FindAll($class, true);
     // cycle listings
     foreach ($objects as $object) {
         // attach & save
         $object->detach($this);
     }
 }