Пример #1
0
 /**
 	Class constructor
 		@public
 	**/
 function __construct($user_to_impersonate = null)
 {
     // get application instance
     $this->__app =& Factory::getApplication();
     $this->id = null;
     $this->username = null;
     $this->level = 'guest';
     $this->parent = null;
     $this->blocked = null;
     $this->_loggedIn = false;
     if (!is_null($user_to_impersonate)) {
         return $this->_impersonate($user_to_impersonate);
     }
     if ($this->attemptSessionLogin()) {
         return;
     }
 }
Пример #2
0
 /**
 	Get crumb tree
 		@public
 	**/
 public static function getCrumbs()
 {
     $app =& Factory::getApplication();
     $items = $app->get('crumbs');
     $crumbs = array();
     if ($items) {
         foreach ($items as $item) {
             if (is_array($item)) {
                 $html = "<a href=\"{link}\">{text}</a>\n";
                 if (isset($item['link'])) {
                     $html = str_replace('{link}', empty($item['link']) ? '#' : $item['link'], $html);
                 }
                 if (isset($item['text'])) {
                     $html = str_replace('{text}', empty($item['text']) ? '?' : $item['text'], $html);
                 }
             } else {
                 $html = "<span>{$item}</span>\n";
             }
             $crumbs[] = $html;
         }
     }
     return $crumbs;
 }
Пример #3
0
<?php

define('DIR_BASE', '.');
define('DIR_LIB', DIR_BASE . '/lib');
define('DIR_TPL', DIR_BASE . '/tpl');
define('DIR_CONF', DIR_BASE . '/conf');
require_once DIR_LIB . '/factory.inc.php';
$app = Factory::getApplication();
$app->run();
Factory::releaseApplication($app);
Пример #4
0
    function tinymce($name, $value = '', $required = false, $rows = 10, $cols = 50, $params = null)
    {
        $app =& Factory::getApplication();
        $config =& Factory::getConfig();
        // set script source path
        $baseURL = $config->baseURL;
        $baseURL = str_replace(@$config->admin_path, '', $baseURL);
        $app->set('js', $baseURL . 'assets/editors/tinymce/tiny_mce.js');
        $show_format_1 = isset($params['buttons1_format']) && $params['buttons1_format'] ? true : false;
        $show_buttons_2 = isset($params['buttons2']) && $params['buttons2'] ? true : false;
        ob_start();
        ?>
<script>
tinyMCE.init({
	// General options
	mode : "exact",
	elements : "<?php 
        echo $name;
        ?>
",
	theme : "advanced",
	skin : "o2k7",
	skin_variant : "silver",
	relative_urls : false,
	remove_script_host : false,
	invalid_elements: "script",
	plugins : "safari,table,style,advimage,paste,advlink,inlinepopups,media,directionality",

	// Theme options
	content_css : "<?php 
        echo $baseURL;
        ?>
templates/<?php 
        echo $config->__raw->template;
        ?>
/assets/css/editor.css",
	theme_advanced_buttons1 : "<?php 
        echo $show_format_1 ? 'formatselect,' : '';
        ?>
bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|undo,redo,|,pastetext,pasteword,|,link,unlink,image,|,code",
	theme_advanced_buttons2 : "<?php 
        echo $show_buttons_2 ? 'tablecontrols,|,hr,removeformat' : '';
        ?>
",
	theme_advanced_buttons3 : "<?php 
        echo $show_buttons_2 ? 'formatselect,fontselect,fontsizeselect' : '';
        ?>
",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "none"
	<?php 
        if (isset($params['width'])) {
            ?>
	,width: <?php 
            echo $params['width'];
            ?>
	<?php 
        }
        ?>
	<?php 
        if (isset($params['height'])) {
            ?>
	,height: <?php 
            echo $params['height'];
            ?>
	<?php 
        }
        ?>
	
	// File manager (MFM)
	,file_browser_callback : _loadMFM
});
function _loadMFM(field_name, url, type, win) {
	tinyMCE.activeEditor.windowManager.open({
		<?php 
        // build params for this plugin
        $fm_params = array('base_path' => BASE_PATH, 'root_path' => $baseURL, 'editor_path' => $baseURL . 'assets/editors/tinymce', 'file_root' => 'uploads');
        $fm_params = base64_encode(serialize($fm_params));
        ?>
		file : "<?php 
        echo $baseURL;
        ?>
assets/editors/editor_plugins/mfm.php?field=" + field_name + "&url=" + url + "&params=<?php 
        echo $fm_params;
        ?>
",
		title : 'File Manager',
		width : 640,
		height : 450,
		resizable : "no",
		inline : "yes",
		close_previous : "no"
	}, 
	{
		window : win,
		input : field_name
	});
	
	return false;
}
</script>
<?php 
        $js_script = ob_get_clean();
        $app->set('js', $js_script, false, true);
        $attributes = array('mce_editable="true"');
        // attach script tag
        if (isset($params['attach_script']) && $params['attach_script']) {
            $script_tag = str_replace(array('<script>', '</script>'), array('', ''), $js_script);
            $attributes[] = '_script_tag="' . base64_encode($script_tag) . '"';
        }
        // load generic
        return HTMLHelper::_('editor.generic', $name, $value, $required, $rows, $cols, implode(' ', $attributes));
    }
Пример #5
0
 /** 
 	Create URI object from url
 		@param $url string
 		@private
 	**/
 private static function _buildURIFromURL($url)
 {
     $__app =& Factory::getApplication();
     $config = $__app->get('config');
     $root_path = parse_url($config->baseURL);
     $url_path = parse_url($url);
     $uri = new stdclass();
     $uri->_raw = $url;
     $uri->_url = $url_path['path'];
     if ($root_path['path'] == '/' && @$url[0] == '/') {
         $uri->_url = substr($uri->_url, 1);
     } else {
         $uri->_url = str_replace($root_path['path'], '', $uri->_url);
     }
     return $uri;
 }