function run(&$filter_chain, &$request, &$response) 
  {
    debug :: add_timing_point('locale filter started');
    
    if(!$node = map_request_to_node($request))
    {
    	define('CONTENT_LOCALE_ID', DEFAULT_CONTENT_LOCALE_ID);
    	define('MANAGEMENT_LOCALE_ID', CONTENT_LOCALE_ID);
    	
    	$locale =& locale :: instance();    	
    	$locale->setlocale();
    	
      $filter_chain->next();
      return;
    }
          
    if($object_locale_id = site_object :: get_locale_by_id($node['object_id']))
    	define('CONTENT_LOCALE_ID', $object_locale_id);
    else
      define('CONTENT_LOCALE_ID', DEFAULT_CONTENT_LOCALE_ID);
    
    $user = user :: instance();
    if($user_locale_id = $user->get_locale_id())
    	define('MANAGEMENT_LOCALE_ID', $user_locale_id);
    else
      define('MANAGEMENT_LOCALE_ID', CONTENT_LOCALE_ID);
              
    debug :: add_timing_point('locale filter finished');

  	$locale =& locale :: instance();    	
  	$locale->setlocale();
    
    $filter_chain->next();
  }   
 function run(&$filter_chain, &$request, &$response)
 {
     debug::add_timing_point('authentication filter started');
     if (!($object_data = fetch_requested_object($request))) {
         if (!($node = map_request_to_node($request))) {
             if (defined('ERROR_DOCUMENT_404')) {
                 $response->redirect(ERROR_DOCUMENT_404);
             } else {
                 $response->header("HTTP/1.1 404 Not found");
             }
             return;
         }
         $response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
         return;
     }
     $object =& wrap_with_site_object($object_data);
     $site_object_controller =& $object->get_controller();
     if (($action = $site_object_controller->determine_action($request)) === false) {
         debug::write_error('"' . $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
         if (defined('ERROR_DOCUMENT_404')) {
             $response->redirect(ERROR_DOCUMENT_404);
         } else {
             $response->header("HTTP/1.1 404 Not found");
         }
         debug::add_timing_point('authentication filter finished');
         $filter_chain->next();
         return;
     }
     $actions = $object->get_attribute('actions');
     if (!isset($actions[$action])) {
         $response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
     }
     debug::add_timing_point('authentication filter finished');
     $filter_chain->next();
 }
  function run(&$filter_chain, &$request, &$response)
  {
    if(!$response->is_empty() || !$this->_is_caching_enabled())
    {
      $filter_chain->next();
      return;
    }

    $cache = new image_cache_manager();
    $cache->set_uri($request->get_uri());

    ob_start();

    $filter_chain->next();

    if(!$response->is_empty())
      return;

    debug :: add_timing_point('image cache started');

    if($content = ob_get_contents())
    {
      ob_end_clean();

      $cache->process_content($content);

      $response->write($content);
    }

    debug :: add_timing_point('image cache write finished');
  }
  function run(&$filter_chain, &$request, &$response)
  {
    if(!$response->is_empty() || !$this->_is_caching_enabled())
    {
      $filter_chain->next();
      return;
    }

    debug :: add_timing_point('full page cache started');

    $cache = new full_page_cache_manager();

    $cache->set_uri($request->get_uri());

    if($contents =& $cache->get())
    {
      debug :: add_timing_point('full page cache read finished');

      $response->write($contents);
      return;
    }

    $filter_chain->next();

    $cache->write($content =& $response->get_response_string());

    debug :: add_timing_point('full page cache write finished');
  }
 function run(&$filter_chain, &$request, &$response)
 {
     debug::add_timing_point('session startup filter started');
     require_once LIMB_DIR . '/core/lib/session/session.class.php';
     start_user_session();
     debug::add_timing_point('session startup filter finished');
     $filter_chain->next();
 }
  function run(&$filter_chain, &$request, &$response)
  {
    debug :: add_timing_point('authentication filter started');

    if(!$object_data = fetch_requested_object($request))
    {
      if(!$node = map_request_to_node($request))
      {
        if(defined('ERROR_DOCUMENT_404'))
          $response->redirect(ERROR_DOCUMENT_404);
        else
          $response->header("HTTP/1.1 404 Not found");
        return;
      }
      $response->redirect('/root/login?redirect='. urlencode($request->to_string()));
      return;
    }

    $object =& wrap_with_site_object($object_data);

    $site_object_controller =& $object->get_controller();

    if(($action = $site_object_controller->determine_action($request)) === false)
    {
      debug :: write_error('"'. $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__);

      if(defined('ERROR_DOCUMENT_404'))
        $response->redirect(ERROR_DOCUMENT_404);
      else
        $response->header("HTTP/1.1 404 Not found");

      debug :: add_timing_point('authentication filter finished');

      $filter_chain->next();
      return;
    }

    $actions = $object->get_attribute('actions');

    if(!isset($actions[$action]))
    {
      $redirect_path = $site_object_controller->get_action_property($action, 'inaccessible_redirect');

      if(!$redirect_path)
        $redirect_path = '/root/login';

      $redirect_strategy =& $this->_get_redirect_strategy($site_object_controller, $action);

      $response->set_redirect_strategy($redirect_strategy);

      $response->redirect($redirect_path . '?redirect='. urlencode($request->to_string()));
    }

    debug :: add_timing_point('authentication filter finished');

    $filter_chain->next();
  }
 function run(&$filter_chain, &$request, &$response)
 {
     $filter_chain->next();
     debug::add_timing_point('logging filter started');
     $object = wrap_with_site_object(fetch_requested_object($request));
     $controller = $object->get_controller();
     include_once LIMB_DIR . 'core/model/stats/stats_register.class.php';
     $stats_register = new stats_register();
     $stats_register->register($object->get_node_id(), $controller->get_action(), $request->get_status());
     debug::add_timing_point('logging filter finished');
 }
 function run(&$filter_chain, &$request, &$response)
 {
     debug::add_timing_point('site object controller filter started');
     $site_object =& wrap_with_site_object(fetch_requested_object($request));
     $site_object_controller =& $site_object->get_controller();
     $site_object_controller->process($request, $response);
     if ($response->is_empty()) {
         $site_object_controller->display_view();
     }
     debug::add_timing_point('site object controller filter finished');
     $filter_chain->next();
 }
Ejemplo n.º 9
0
 function run(&$filter_chain, &$request, &$response)
 {
     debug::add_timing_point('jip filter started');
     $fetcher =& fetcher::instance();
     $fetcher->set_jip_status(false);
     $user =& user::instance();
     if ($user->is_logged_in()) {
         $ini =& get_ini('jip_groups.ini');
         if ($user->is_in_groups(array_keys($ini->get_group('groups')))) {
             $fetcher->set_jip_status(true);
         }
     }
     debug::add_timing_point('jip filter done');
     $filter_chain->next();
 }
Ejemplo n.º 10
0
        ob_end_clean();
        if (debug::is_console_enabled()) {
            echo debug::parse_html_console();
        }
        header("HTTP/1.1 403 Access denied");
        exit;
    }
}
if (isset($object_data['locale_id']) && $object_data['locale_id']) {
    define('CONTENT_LOCALE_ID', $object_data['locale_id']);
} else {
    define('CONTENT_LOCALE_ID', DEFAULT_CONTENT_LOCALE_ID);
}
define('MANAGEMENT_LOCALE_ID', user::get_management_locale_id());
$site_object =& site_object_factory::instance($object_data['class_name']);
debug::add_timing_point('object fetched');
$site_object_controller =& $site_object->get_controller();
if (($action = $site_object_controller->determine_action()) === false) {
    debug::write_error('"' . $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
    ob_end_clean();
    if (debug::is_console_enabled()) {
        echo debug::parse_html_console();
    }
    header("HTTP/1.1 404 Not found");
    exit;
}
$actions = $object_data['actions'];
if (!isset($actions[$action])) {
    debug::write_error('"' . $action . '" action is not accessible', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
    ob_end_clean();
    if (debug::is_console_enabled()) {
<?php

/**********************************************************************************
* Copyright 2004 BIT, Ltd. http://www.0x00.ru, mailto: bit@0x00.ru
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/
require_once LIMB_DIR . 'core/lib/debug/debug.class.php';
debug::add_timing_point('start');
require_once LIMB_DIR . 'core/lib/system/objects_support.inc.php';
require_once LIMB_DIR . 'core/filters/filter_chain.class.php';
require_once LIMB_DIR . 'core/request/http_response.class.php';
require_once LIMB_DIR . 'core/request/request.class.php';
require_once LIMB_DIR . 'core/lib/http/control_flow.inc.php';
require_once LIMB_DIR . 'core/lib/system/message_box.class.php';
class limb_application
{
    function _inititiliaze_user_session()
    {
        require_once LIMB_DIR . 'core/lib/session/session.class.php';
        start_user_session();
    }
    function _register_filters(&$filter_chain)
    {
        $f = array();
        $filter_chain->register_filter($f[] = LIMB_DIR . 'core/filters/locale_definition_filter');
        $filter_chain->register_filter($f[] = LIMB_DIR . 'core/filters/authentication_filter');
Ejemplo n.º 12
0
    }
    exit;
}
$actions = $object_data['actions'];
if (!isset($actions[$action])) {
    debug::write_error('"' . $action . '" action is not accessible', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
    ob_end_clean();
    if (debug::is_console_enabled()) {
        echo debug::parse_html_console();
    }
    if (defined("ERROR_DOCUMENT_403")) {
        reload(ERROR_DOCUMENT_403);
    } else {
        header("HTTP/1.1 403 Access denied");
    }
    exit;
}
if (!$site_object_controller->process()) {
    debug::write_error('action failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
}
debug::add_timing_point('action processed');
if (!($view =& $site_object_controller->get_view())) {
    error('template is null', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
}
$view->display();
debug::add_timing_point('template executed');
echo message_box::parse();
if (debug::is_console_enabled()) {
    echo debug::parse_html_console();
}
ob_end_flush();
Ejemplo n.º 13
0
    }
    $object->import_attributes($params);
    if ($object->create($is_root)) {
        echo $params['parent_path'] . '/' . $params['identifier'] . ' created <br/>';
    } else {
        echo 'object was not created';
        exit;
    }
    if (!$is_root) {
        $parent_object =& site_object_factory::instance($parent_data['class_name']);
        $parent_object->import_attributes($parent_data);
        $access_policy =& access_policy::instance();
        $access_policy->save_object_access($object, $parent_object);
    }
    $db->commit();
    debug::add_timing_point('finish');
    if (debug::is_console_enabled()) {
        echo debug::parse_html_console();
    }
}
?>
<html>

<head>
	<title>Class creation</title>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
	<link href="/shared/styles/admin.css" rel="stylesheet" type="text/css">
	<script language="javascript" src="/shared/js/common.js"></script>
	<script language="javascript" src="/design/main/js/form_errors.js"></script>
	<metadata:METADATA>
	<meta name="description" content="{$description}">
  function run(&$filter_chain, &$request, &$response)
  { 
    debug :: add_timing_point('authentication filter started');
  	
    if(!$object_data = fetch_requested_object($request))
    {
      if(!$node = map_request_to_node($request))
      {
      	if(defined('ERROR_DOCUMENT_404'))
      		$response->redirect(ERROR_DOCUMENT_404);
      	else
      		$response->header("HTTP/1.1 404 Not found");
      	return;
      }
      
      
      $user =& user :: instance();
    	if (!$user->is_logged_in())
    	{
    		$tree = tree :: instance();
    		
    		$response->redirect('/root/login?redirect='. $tree->get_path_to_node($node));
    		return;
    	}	
    	else
    	{
    		debug :: write_error('content object not allowed or retrieved', __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__);
    		        	
    		if(defined('ERROR_DOCUMENT_403'))
    			$response->redirect(ERROR_DOCUMENT_403);
    		else
    			$response->header("HTTP/1.1 403 Access denied");
    		return;
    	}	
    }
    
    $object =& wrap_with_site_object($object_data); 

    $site_object_controller =& $object->get_controller();
    
    if(($action = $site_object_controller->determine_action($request)) === false)
    {
    	debug :: write_error('"'. $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__);
    
    	if(defined('ERROR_DOCUMENT_404'))
    		$response->redirect(ERROR_DOCUMENT_404);
    	else
    		$response->header("HTTP/1.1 404 Not found");

      debug :: add_timing_point('authentication filter finished');
    	
    	$filter_chain->next();
    	return;
    }
        
    $actions = $object->get_attribute('actions');
    
    if(!isset($actions[$action]))
    {
    	debug :: write_error('"'. $action . '" action is not accessible', __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__);
    	
    	if (debug :: is_console_enabled())
    		echo debug :: parse_html_console();
    		
    	if(defined("ERROR_DOCUMENT_403"))
    		$response->redirect(ERROR_DOCUMENT_403);
    	else
    		$response->header("HTTP/1.1 403 Access denied");
    	return;
    }

    debug :: add_timing_point('authentication filter finished');
          
    $filter_chain->next();        
  }
 function &get_view()
 {
     if ($this->_view) {
         return $this->_view;
     }
     if (!($template_path = $this->get_current_action_property('template_path'))) {
         return null;
     }
     $this->_view =& $this->_create_template($template_path);
     debug::add_timing_point('template created');
     return $this->_view;
 }
 function &get_view()
 {
     if ($this->_view) {
         return $this->_view;
     }
     $this->_view =& $this->_create_template();
     debug::add_timing_point('template created');
     return $this->_view;
 }
Ejemplo n.º 17
0
    $script_settings = explode(';', $script_string);
    if (sizeof($script_settings) > 1) {
        $script_run_interval = (int) $script_settings[1];
    } else {
        $script_run_interval = 3600;
    }
    $script_name = $script_settings[0];
    $script_file = $cron_scripts_dir . $script_name;
    $now = time();
    if (file_exists($script_file)) {
        $time_diff = $now - (int) $scripts_last_run[$id];
        if ($time_diff > $script_run_interval) {
            echo "running {$script_name}\n";
            debug::add_timing_point("script {$script_name} starting\n");
            include $script_file;
            debug::add_timing_point("script done\n");
            $scripts_last_run[$id] = $now;
        } else {
            echo "will run {$script_name} in " . ($script_run_interval - $time_diff) . " seconds\n";
        }
    } else {
        echo "{$script_file} not found\n";
    }
}
$fp = fopen($cron_last_run_file, 'w');
foreach ($scripts_last_run as $time) {
    fwrite($fp, "{$time}\n");
}
fclose($fp);
echo debug::parse_cli_console();
ob_end_flush();