Example #1
0
/**
 * Register hooks addon uses
 *
 * @return boolean always true
 */
function fn_register_hooks()
{
    $hooks =& Registry::get('hooks');
    $args = func_get_args();
    $backtrace = debug_backtrace();
    $addon_path = fn_unified_path($backtrace[0]['file']);
    if (strpos($addon_path, DIR_ADDONS) !== false) {
        $path_dirs = explode('/', substr($addon_path, strlen(DIR_ADDONS)));
        $addon_name = array_shift($path_dirs);
    } else {
        die("Hooks can be only registered by addons: {$addon_path} is not addon path ");
    }
    $addon_priority = Registry::get('addons.' . $addon_name . '.priority');
    foreach ($args as &$hook) {
        $priority = $addon_priority;
        // if we get array we need to set priority manually
        if (is_array($hook)) {
            $priority = $hook[1];
            $hook = $hook[0];
        }
        $callback = 'fn_' . $addon_name . '_' . $hook;
        if (!isset($hooks[$hook])) {
            $hooks[$hook] = array();
        }
        $hooks[$hook][] = array('func' => $callback, 'addon' => $addon_name, 'priority' => $priority);
    }
    return true;
}
Example #2
0
/**
 * Register hooks addon uses
 *
 * @return boolean always true
 */
function fn_register_hooks()
{
    $args = func_get_args();
    $backtrace = debug_backtrace();
    $addon_path = fn_unified_path($backtrace[0]['file']);
    $path_dirs = explode('/', $addon_path);
    array_pop($path_dirs);
    $addon_name = array_pop($path_dirs);
    $hooks = Registry::get('hooks');
    $addon_priority = Registry::get('addons.' . $addon_name . '.priority');
    foreach ($args as &$hook) {
        $priority = $addon_priority;
        $addon = $addon_name;
        // if we get array we need to set priority manually
        if (is_array($hook)) {
            $priority = $hook[1];
            if (isset($hook[2])) {
                $addon = $hook[2];
                if (Registry::get('addons.' . $addon . '.status') != 'A') {
                    // skip hook registration if addon is not enabled
                    continue;
                }
                if ($priority === '') {
                    $priority = Registry::get('addons.' . $addon . '.priority');
                }
            }
            if (empty($priority)) {
                $priority = $addon_priority;
            }
            $hook = $hook[0];
        }
        $callback = 'fn_' . $addon . '_' . $hook;
        if (!isset($hooks[$hook])) {
            $hooks[$hook] = array();
        }
        $hooks[$hook][] = array('func' => $callback, 'addon' => $addon, 'priority' => $priority);
    }
    Registry::set('hooks', $hooks, true);
    return true;
}
Example #3
0
function fn_pathinfo($path, $encoding = 'UTF-8')
{
    $path = fn_unified_path($path);
    $basename = explode("/", $path);
    $basename = end($basename);
    if (strpos($path, '/') === false) {
        $path = './' . $path;
    }
    $dirname = rtrim(fn_substr($path, 0, fn_strlen($path, $encoding) - fn_strlen($basename, $encoding) - 1, $encoding), '/');
    $dirname .= empty($dirname) ? '/' : '';
    if (strpos($basename, '.') !== false) {
        $_name_components = explode('.', $basename);
        $extension = array_pop($_name_components);
        $filename = implode('.', $_name_components);
    } else {
        $extension = '';
        $filename = $basename;
    }
    return array('dirname' => $dirname, 'basename' => $basename, 'extension' => $extension, 'filename' => $filename);
}
Example #4
0
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
//
// $Id: prepare.php 10035 2010-07-12 06:18:07Z andyye $
//
define('TIME', time());
define('MICROTIME', microtime(true));
define('MIN_PHP_VERSION', '5.1.0');
if (stristr(PHP_OS, 'WIN')) {
    // Define operation system
    define('IS_WINDOWS', true);
}
define('DIR_ROOT', fn_unified_path(dirname(__FILE__)));
// Real path to the directory where software is installed
if (empty($_SERVER['REQUEST_METHOD'])) {
    // if we do not have $_SERVER['REQUEST_METHOD'], assume that we're in console mode
    define('CONSOLE', true);
}
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) {
    //die('PHP version <b>' . MIN_PHP_VERSION . '</b> or greater is required. Your PHP is version <b>' . PHP_VERSION . '</b>, please ask your host to upgrade it.');
}
if (!isset($_SERVER['HTTP_HOST'])) {
    $_SERVER['HTTP_HOST'] = 'localhost';
}
// Detect https
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == '1')) {
    define('HTTPS', true);
} elseif (isset($_SERVER['HTTP_X_FORWARDED_SERVER']) && ($_SERVER['HTTP_X_FORWARDED_SERVER'] == 'secure' || $_SERVER['HTTP_X_FORWARDED_SERVER'] == 'ssl')) {
Example #5
0
<?php

/***************************************************************************
*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
define('AREA', 'C');
require dirname(__FILE__) . '/../../init.php';
$backtrace = debug_backtrace();
$processor = fn_basename(fn_unified_path($backtrace[0]['file']), '.php');
if (!fn_check_prosessor_status($processor)) {
    die('Access denied');
}