Esempio n. 1
0
function olivxml_load_file($file)
{
    return simplexml_load_file(system::OLIV_CORE_PATH() . $file);
    //	$xml = @simplexml_load_file(system::OLIV_CORE_PATH() . $file);
    //	if ($xml) return $xml;
    //		die ("olivxml_load_file in file.php - fatal error: xml parse error in $file");
}
Esempio n. 2
0
    public function __construct($menuName, $name, $value = "")
    {
        if ($menuName and $name) {
            // load javascripts
            OLIVCore::loadScript("jquery-1.7.1.js", system::OLIV_JAVASCRIPT_PATH());
            OLIVCore::loadScript("jquery.contextMenu.js", system::OLIV_JAVASCRIPT_PATH());
            // load css
            OLIVTemplate::link_css(system::OLIV_TEMPLATE_PATH() . system::OLIV_TEMPLATE() . "/", "jquery.contextMenu.css");
            // load menu item definition
            $this->context = olivxml_load_file(system::OLIV_CONTEXT_PATH() . "{$menuName}.xml", system::OLIV_CORE_PATH());
            //------------------------------------------------------------------------------
            // load context menu plugin script
            OLIVCore::loadScript("{$menuName}.contextMenu.js", system::OLIV_JAVASCRIPT_PATH());
            // set javascript action for context display
            ?>
	<script language='javascript'>
// get function name and parameters
			menuFunc="<?php 
            echo $menuName;
            ?>
_contextMenu";
			menuParam = "<?php 
            echo $name;
            ?>
";

// call contextMenu script
			window[menuFunc](menuParam);
	</script>

<?php 
            //------------------------------------------------------------------------------
            // set context menu name
            $this->context->addAttribute('name', $name);
            if ($value) {
                $this->context->addAttribute('value', $value);
            }
            // disable paste
            if (!OLIVClipboard::_()) {
                $this->disable("paste");
            }
        } else {
            return FALSE;
        }
    }
Esempio n. 3
0
 public static function loadScript($file, $path = "")
 {
     $path = system::OLIV_CORE_PATH() . $path;
     // redirect to core root directory
     if (file_exists($path . $file)) {
         // check for filetype
         $fileInfo = pathInfo($file);
         // debug
         // print_r("load script " . $path . $file . "<br>");
         switch ($fileInfo['extension']) {
             case 'php':
                 include_once $path . $file;
                 break;
             case 'js':
                 echo "<script type='text/javascript' src='{$path}{$file}'></script >";
                 break;
             default:
                 OLIVError::fire("core::loadScript - script {$path}{$file} unknown filetype");
                 return FALSE;
         }
         return $file;
     } else {
         OLIVError::fire("core::loadScript - script {$path}{$file} not found");
     }
     return FALSE;
 }
Esempio n. 4
0
if (system::OLIV_BASE() == "/") {
    system::set('OLIV_BASE', "");
}
system::set('OLIV_HOST', $_SERVER['HTTP_HOST'] . "/");
//------------------------------------------------------------------------------
// set http / https protocol
if (isset($_SERVER['HTTPS'])) {
    system::set('OLIV_PROTOCOL', "https://");
} else {
    system::set('OLIV_PROTOCOL', "http://");
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// load system definitions
if (file_exists(system::OLIV_CORE_PATH() . "system.xml")) {
    $coreXml = simplexml_load_file(system::OLIV_CORE_PATH() . "system.xml");
} else {
    die("init.php - system.xml not found");
}
//------------------------------------------------------------------------------
// set system constants
if ($coreXml) {
    if ($coreXml->system->children()) {
        foreach ($coreXml->system->children() as $key => $value) {
            system::set($key, (string) $value);
        }
    } else {
        die("init.php - no constant definitions found");
    }
    //------------------------------------------------------------------------------
    // system includes