mirror of
https://github.com/php/web-doc-editor.git
synced 2026-04-26 02:18:04 +02:00
102 lines
3.5 KiB
PHP
Executable File
102 lines
3.5 KiB
PHP
Executable File
<?php
|
|
|
|
session_start();
|
|
|
|
$ExtJsVersion = "3.3.1";
|
|
|
|
require_once './php/html.templates.php';
|
|
|
|
// Perm link management
|
|
if (isset($_REQUEST['perm'])) {
|
|
|
|
$perm = trim($_REQUEST['perm'], '/ ');
|
|
|
|
if( substr($perm, -4) == '.php' )
|
|
{
|
|
require_once dirname(__FILE__) . '/php/ProjectManager.php';
|
|
require_once dirname(__FILE__) . '/php/RepositoryFetcher.php';
|
|
|
|
$_project = $_REQUEST['project'];
|
|
|
|
// Set the project
|
|
ProjectManager::getInstance()->setProject($_project);
|
|
|
|
$_p = explode('/', $perm);
|
|
$_lang = array_shift($_p);
|
|
$_file = array_pop($_p);
|
|
|
|
$_id = explode('.', $_file);
|
|
array_pop($_id);
|
|
$xmlid = implode('.', $_id);
|
|
|
|
$r = RepositoryFetcher::getInstance()->getFileByXmlID($_lang, $xmlid);
|
|
|
|
if ( $r ) {
|
|
$jsVar = 'var directAccess = {"link":"perm", "lang":"'.$r->lang.'", "path":"'.$r->path.'", "name":"'.$r->name.'", "project":"'.$_project.'"};';
|
|
} else {
|
|
$jsVar = 'var directAccess = false;';
|
|
}
|
|
} else {
|
|
$jsVar = 'var directAccess = false;';
|
|
}
|
|
|
|
} else if (isset($_REQUEST['patch'])) {
|
|
|
|
$patch = trim($_REQUEST['patch'], '/ ');
|
|
$_project = $_REQUEST['project'];
|
|
|
|
require_once dirname(__FILE__) . '/php/ProjectManager.php';
|
|
|
|
// Set the project
|
|
ProjectManager::getInstance()->setProject($_project);
|
|
|
|
$_patch = explode('/', $patch);
|
|
$fileName = $_patch[count($_patch)-1];
|
|
$filePath = substr($patch, 0, (strlen($patch)-strlen($fileName)));
|
|
|
|
$jsVar = 'var directAccess = {"link":"patch", "lang":"en", "path":"'.$filePath.'", "name":"'.$fileName.'", "project":"'.$_project.'"};';
|
|
|
|
} else {
|
|
$jsVar = 'var directAccess = false;';
|
|
}
|
|
|
|
$jsVar .= " var ExtJsVersion = '$ExtJsVersion';";
|
|
|
|
// Log the user in if needed
|
|
if (!isset($_SESSION['userID'])) {
|
|
echo headerTemplate();
|
|
echo cssLoadTemplate('http://extjs.cachefly.net/ext-'.$ExtJsVersion.'/resources/css/ext-all.css');
|
|
echo cssLoadTemplate('themes/login-all.css');
|
|
echo jsCallTemplate($jsVar);
|
|
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Loading Core API...";');
|
|
echo jsLoadTemplate('http://extjs.cachefly.net/ext-'.$ExtJsVersion.'/adapter/ext/ext-base.js');
|
|
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Loading UI Components...";');
|
|
echo jsLoadTemplate('http://extjs.cachefly.net/ext-'.$ExtJsVersion.'/ext-all.js');
|
|
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Initializing...";');
|
|
echo jsLoadTemplate('js/login-all.js');
|
|
echo footerTemplate();
|
|
exit;
|
|
}
|
|
|
|
echo headerTemplate();
|
|
echo cssLoadTemplate('http://extjs.cachefly.net/ext-'.$ExtJsVersion.'/resources/css/ext-all.css', 'extTheme');
|
|
echo cssLoadTemplate('themes/empty.css', 'appTheme');
|
|
echo cssLoadTemplate('themes/main-all.css');
|
|
|
|
echo jsCallTemplate($jsVar);
|
|
|
|
// ExtJs Javascript core files
|
|
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Loading Core API...";');
|
|
echo jsLoadTemplate('http://extjs.cachefly.net/ext-'.$ExtJsVersion.'/adapter/ext/ext-base.js');
|
|
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Loading UI Components...";');
|
|
echo jsLoadTemplate('http://extjs.cachefly.net/ext-'.$ExtJsVersion.'/ext-all.js');
|
|
|
|
// Ext.ux Javascript files
|
|
echo jsCallTemplate('document.getElementById("loading-msg").innerHTML = "Initializing...";');
|
|
echo jsLoadi18nTemplate();
|
|
echo jsLoadTemplate('js/ux/codemirror/js/codemirror.js');
|
|
echo jsLoadTemplate('js/main-all.js');
|
|
echo footerTemplate();
|
|
|
|
?>
|