svn: /web/doc-editor/trunk/ index.php
[email protected] (Chan Ka Shing)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
mrkschan Tue, 01 Dec 2009 06:55:50 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291537
Log:
prelimiary fix for direct access in doc-editor
Changed paths:
U web/doc-editor/trunk/index.php
Modified: web/doc-editor/trunk/index.php
===================================================================
--- web/doc-editor/trunk/index.php 2009-12-01 06:43:31 UTC (rev 291536)
+++ web/doc-editor/trunk/index.php 2009-12-01 06:55:50 UTC (rev 291537)
@@ -53,13 +53,20 @@
echo jsLoadTemplate('js/main_min.js');
if (isset($_REQUEST['perm'])) {
+ require_once dirname(__FILE__) . '/php/RepositoryFetcher.php';
- $_f = explode('/', $_REQUEST['perm']);
- $_lang = array_shift($_f);
- $_file = array_pop($_f);
- $_path = (count($_f) > 0)? '/'.implode('/', $_f).'/' : '/';
- $directAccess = 'var directAccess = {"lang":"'.$_lang.'", "path":"'.$_path.'", "name":"'.$_file.'"};';
+ $_p = explode('/', trim($_REQUEST['perm'], '/'));
+ $_lang = array_shift($_p);
+ $_file = array_pop($_p);
+ $_id = explode('.', $_file);
+ array_pop($_id);
+ $xmlid = implode('.', $_id);
+
+ $r = RepositoryFetcher::getInstance()->getFileByXmlID($_lang, $xmlid);
+
+ $directAccess = 'var directAccess = {"lang":"'.$r->lang.'", "path":"'.$r->path.'", "name":"'.$r->name.'"};';
+
} else {
$directAccess = 'var directAccess = false;';
}