Example #1
0
 /**
  * check canshow duoshuo
  *
  * @param string $data  wikitest
  * @return bool 
  */
 private function _canShowDuoshuo($data)
 {
     $flag = 0;
     $no_duoshuo = preg_match('/[^<nowiki>]' . syntax_plugin_duoshuo::NODUOSHUO_SYNTAX . '/', $data, $matches);
     if ($no_duoshuo >= 1 || self::$DUOSHUO == 1) {
         $flag = 3;
         self::$DUOSHUO = 1;
     } else {
         self::$DUOSHUO = 0;
         $auto = $this->getConf('auto');
         $no_admin = isset($_REQUEST['do']) ? false : true;
         $info = pageinfo();
         $exists = $info['exists'];
         if ($auto) {
             if ($auto && $exists && $no_admin) {
                 $flag = 1;
             }
         } else {
             $count = preg_match('/[^<nowiki>]' . syntax_plugin_duoshuo::DUOSHUO_SYNTAX . '/', $data, $matches);
             if ($count >= 1 && $exists && $no_admin) {
                 $flag = 2;
             }
         }
     }
     return $flag;
 }
 function debug(&$event, $param)
 {
     global $ID;
     ptln('<h1>Publish plug-in debug</h1>');
     ptln('<h1>Metadata</h1>');
     ptln('<pre>');
     ptln(print_r(p_get_metadata($ID), true));
     ptln('</pre>');
     ptln('<h1>pageinfo</h1>');
     ptln('<pre>');
     ptln(print_r(pageinfo(), true));
     ptln('</pre>');
 }
Example #3
0
 function settings_plugin_siteexport_settings($functions)
 {
     global $ID;
     $functions->debug->setDebugLevel($this->getConf('debugLevel'));
     $functions->debug->setDebugFile($this->getConf('debugFile'));
     if (empty($_REQUEST['pattern'])) {
         $params = $_REQUEST;
         $this->pattern = $functions->requestParametersToCacheHash($params);
     } else {
         // Set the pattern
         $this->pattern = $_REQUEST['pattern'];
     }
     $this->isCLI = !$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name();
     $this->cachetime = $this->getConf('cachetime');
     if (!empty($_REQUEST['disableCache'])) {
         $this->cachetime = intval($_REQUEST['disableCache']) == 1 ? 0 : $this->cachetime;
     }
     // Load Variables
     $this->origZipFile = $this->getConf('zipfilename');
     $this->ignoreNon200 = $this->getConf('ignoreNon200');
     // ID
     $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
     //        $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
     $this->zipFile = mediaFN($this->downloadZipFile);
     $this->tmpDir = mediaFN(getNS($this->origZipFile));
     $this->exportLinkedPages = intval($_REQUEST['exportLinkedPages']) == 1 ? true : false;
     $this->namespace = $functions->getNamespaceFromID($_REQUEST['ns'], $PAGE);
     $this->addParams = !empty($_REQUEST['addParams']);
     $this->useTOCFile = !empty($_REQUEST['useTocFile']);
     // set export Namespace - which is a virtual Root
     $pg = noNS($ID);
     if (empty($this->namespace)) {
         $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg);
     }
     $this->exportNamespace = !empty($_REQUEST['ens']) && preg_match("%^" . $functions->getNamespaceFromID($_REQUEST['ens'], $pg) . "%", $this->namespace) ? $functions->getNamespaceFromID($_REQUEST['ens'], $pg) : $this->namespace;
     $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
     // Strip params that should be forwarded
     $this->additionalParameters = $_REQUEST;
     $functions->removeWikiVariables($this->additionalParameters, true);
     $tmpID = $ID;
     $ID = $this->origZipFile;
     $INFO = pageinfo();
     if (!$this->isCLI) {
         // Workaround for the cron which cannot authenticate but has access to everything.
         if ($INFO['perm'] < AUTH_DELETE) {
             list($USER, $PASS) = $functions->basic_authentication();
             auth_login($USER, $PASS);
         }
     }
     $ID = $tmpID;
 }
Example #4
0
/**
 * returns lastmod of given page id
 */
function template_getLastModOfGivenPageId($pageid)
{
    global $ID;
    global $INFO;
    // Backup id of current page
    $id_save = $ID;
    // Set global page id
    $ID = $pageid;
    // get page infos
    $tmp_info = pageinfo();
    // save lastmod
    $lastmod = $tmp_info['lastmod'];
    // restore global page id
    $ID = $id_save;
    return $lastmod;
}
 /**
  * Blackbox integration test of action_plugin_publish_mail::getLastApproved
  *
  * @coversNothing
  */
 public function test_getLastApproved()
 {
     global $ID;
     $ID = 'foo';
     saveWikiText('foo', 'bar old', 'foobar');
     saveWikiText('foo', 'bar approved', 'foobar');
     $data = pageinfo();
     $expected_revision = $data['currentrev'];
     //Make sure we have the rights to actully approve a revision
     $this->assertSame(255, auth_quickaclcheck('foo'));
     $request = new TestRequest();
     $request->get(array(), '/doku.php?id=foo&publish_approve');
     saveWikiText('foo', 'bar new', 'foobar');
     /** @var helper_plugin_publish $helper */
     $helper = plugin_load('helper', 'publish');
     $actual_lastapproved_helper = $helper->getLatestApprovedRevision($ID);
     $this->assertSame($expected_revision, $actual_lastapproved_helper);
 }
Example #6
0
 function start(&$event, $param)
 {
     global $USERINFO;
     global $auth;
     global $INFO;
     if (!$_SERVER['REMOTE_USER']) {
         return;
     }
     $this->_load();
     if (!isset($this->users[$_SERVER['REMOTE_USER']])) {
         return;
     }
     if (!isset($USERINFO['grps'])) {
         $USERINFO['grps'] = array();
     }
     $grps = array_unique(array_merge($USERINFO['grps'], $this->users[$_SERVER['REMOTE_USER']]));
     $USERINFO['grps'] = $grps;
     $_SESSION[DOKU_COOKIE]['auth']['info']['grps'] = $grps;
     $INFO = pageinfo();
 }
Example #7
0
 public function handle_action_act_preprocess(Doku_Event &$event, $param)
 {
     global $ID, $INFO, $REV, $RANGE, $TEXT, $PRE, $SUF;
     // check if the action was given as array key
     if (is_array($event->data)) {
         list($act) = array_keys($event->data);
     } else {
         $act = $event->data;
     }
     if ($act == 'save' && $_REQUEST['saveandedit'] && actionOK($act)) {
         if (act_permcheck($act) == 'save' && checkSecurityToken()) {
             $event->data = act_save($act);
             if ($event->data == 'show') {
                 $event->data = 'edit';
                 $REV = '';
                 // now we are working on the current revision
                 // Handle section edits
                 if ($PRE || $SUF) {
                     // $from and $to are 1-based indexes of the actually edited content
                     $from = strlen($PRE) + 1;
                     $to = $from + strlen($TEXT);
                     $RANGE = $from . '-' . $to;
                 }
                 // Ensure the current text is loaded again from the file
                 unset($GLOBALS['TEXT'], $GLOBALS['PRE'], $GLOBALS['SUF']);
                 // Reset the date of the last modification to avoid conflict messages
                 unset($GLOBALS['DATE']);
                 // Reset the change check
                 unset($_REQUEST['changecheck']);
                 // Force rendering of the metadata in order to ensure metadata is correct
                 p_set_metadata($ID, array(), true);
                 $INFO = pageinfo();
                 // reset pageinfo to new data (e.g. if the page exists)
             } elseif ($event->data == 'conflict') {
                 // DokuWiki won't accept 'conflict' as action here.
                 // Just execute save again, the conflict will be detected again
                 $event->data = 'save';
             }
         }
     }
 }
Example #8
0
 /**
  *  check ismobile
  */
 function test_ismobile()
 {
     global $ID, $conf;
     $ID = 'wiki:start';
     $info = $this->_get_expected_pageinfo();
     $info['id'] = 'wiki:start';
     $info['namespace'] = 'wiki';
     $info['filepath'] = $conf['datadir'] . '/wiki/start.txt';
     // overkill, ripped from clientismobile() as we aren't testing detection - but forcing it
     $_SERVER['HTTP_X_WAP_PROFILE'] = 'a fake url';
     $_SERVER['HTTP_ACCEPT'] .= ';wap';
     $_SERVER['HTTP_USER_AGENT'] = 'blackberry,symbian,hand,mobi,phone';
     $info['ismobile'] = clientismobile();
     $this->assertTrue(clientismobile());
     // ensure THIS test fails if clientismobile() returns false
     $this->assertEquals($info, pageinfo());
     // it would be a test failure not a pageinfo failure.
 }
Example #9
0
/**
 * Handle 'login', 'logout'
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function act_auth($act)
{
    global $ID;
    global $INFO;
    //already logged in?
    if (isset($_SERVER['REMOTE_USER']) && $act == 'login') {
        return 'show';
    }
    //handle logout
    if ($act == 'logout') {
        $lockedby = checklock($ID);
        //page still locked?
        if ($lockedby == $_SERVER['REMOTE_USER']) {
            unlock($ID);
        }
        //try to unlock
        // do the logout stuff
        auth_logoff();
        // rebuild info array
        $INFO = pageinfo();
        act_redirect($ID, 'login');
    }
    return $act;
}
    /**
     * @covers action_plugin_publish_mail::create_mail_body
     */
    function test_approve_mail_body()
    {
        global $ID;
        $ID = 'start';
        global $USERINFO;
        /** @var DokuWiki_Auth_Plugin $auth */
        global $auth;
        $auth->createUser('john', 'x', 'John Smith', '*****@*****.**');
        $_SERVER['REMOTE_USER'] = '******';
        $USERINFO['name'] = 'John Smith';
        saveWikiText('start', 'start first', 'foobar');
        $_SERVER['REMOTE_USER'] = '******';
        $USERINFO['name'] = 'Mike Doe';
        $revision = pageinfo();
        $revision = $revision['lastmod'];
        $expected_mail_body = 'Hi John Smith!
Your suggestion for My Test Wiki at http://wiki.example.com/./

URL: http://wiki.example.com/./doku.php?id=start&rev=' . $revision . '

is approved.

-- ' . '
This mail was generated by DokuWiki at
http://wiki.example.com/./
';
        $mail = new action_plugin_publish_mail();
        $actual_mail_body = $mail->create_mail_body('approve');
        $this->assertSame($expected_mail_body, $actual_mail_body);
    }
Example #11
0
 /**
  * Send approve-mail to editor of the now approved revision
  *
  * @return bool false if there was an error passing the mail to the MTA
  */
 public function send_approve_mail()
 {
     global $ID;
     global $REV;
     /** @var DokuWiki_Auth_Plugin $auth */
     global $auth;
     $data = pageinfo();
     // get mail receiver
     if (!$REV) {
         $rev = $data['lastmod'];
     } else {
         $rev = $REV;
     }
     $changelog = new PageChangelog($ID);
     $revinfo = $changelog->getRevisionInfo($rev);
     $userinfo = $auth->getUserData($revinfo['user']);
     $receiver = $userinfo['mail'];
     // get mail sender
     $ReplyTo = $data['userinfo']['mail'];
     if ($ReplyTo == $receiver) {
         return true;
     }
     // get mail subject
     $subject = $this->getLang('apr_mail_app_subject');
     // get mail text
     $body = $this->create_mail_body('approve');
     $mail = new Mailer();
     $mail->to($receiver);
     $mail->subject($subject);
     $mail->setBody($body);
     $mail->setHeader("Reply-To", $ReplyTo);
     $returnStatus = $mail->send();
     return $returnStatus;
 }
Example #12
0
 /**
  * remove an old zip file
  **/
 function __removeOldZip($FILENAMEID = null, $checkForMore = true)
 {
     global $INFO;
     global $conf;
     $returnValue = true;
     if (empty($FILENAMEID)) {
         $FILENAMEID = $this->functions->settings->origZipFile;
     }
     if (!$this->functions->settings->isCLI) {
         $INFO = pageinfo();
         if ($INFO['perm'] < AUTH_DELETE && !$this->functions->settings->isAuthed) {
             list($USER, $PASS) = $this->functions->basic_authentication();
             $this->functions->settings->isAuthed = auth_login($USER, $PASS);
             $this->functions->debug->message("Login With:", array('User' => $USER, 'Password' => '*****', 'isAuthed' => $this->functions->settings->isAuthed));
             $INFO = pageinfo();
         }
     }
     if (!file_exists(mediaFN($FILENAMEID))) {
         $returnValue = true;
     } else {
         require_once DOKU_INC . 'inc/media.php';
         if (!media_delete($FILENAMEID, $INFO['perm'])) {
             $returnValue = false;
         }
     }
     if ($checkForMore) {
         // Try to remove more files.
         $ns = getNS($FILENAMEID);
         $fn = $this->functions->getSpecialExportFileName(noNS($FILENAMEID), '.+');
         $data = array();
         search($data, $conf['mediadir'], 'search_media', array('pattern' => "/{$fn}\$/i"), $ns);
         if (count($data > 0)) {
             // 30 Minuten Cache Zeit
             $cache = $this->functions->settings->cachetime;
             foreach ($data as $media) {
                 //decide if has to be deleted needed:
                 if ($media['mtime'] < time() - $cache) {
                     $this->__removeOldZip($media['id'], false);
                 }
             }
         }
     }
     return $returnValue;
 }
Example #13
0
 /**
  * Creates a new entry page
  */
 function _handle_newEntry()
 {
     global $ID, $INFO;
     $ns = cleanID($_REQUEST['ns']);
     $title = str_replace(':', '', $_REQUEST['title']);
     $ID = $this->_newEntryID($ns, $title);
     $INFO = pageinfo();
     // check if we are allowed to create this file
     if ($INFO['perm'] >= AUTH_CREATE) {
         //check if locked by anyone - if not lock for my self
         if ($INFO['locked']) {
             return 'locked';
         } else {
             lock($ID);
         }
         // prepare the new thread file with default stuff
         if (!@file_exists($INFO['filepath'])) {
             global $TEXT;
             $TEXT = pageTemplate(array(($ns ? $ns . ':' : '') . $title));
             if (!$TEXT) {
                 $data = array('id' => $ID, 'ns' => $ns, 'title' => $title);
                 $TEXT = $this->_pageTemplate($data);
             }
             return 'preview';
         } else {
             return 'edit';
         }
     } else {
         return 'show';
     }
 }
Example #14
0
 function _apply_result()
 {
     ### _apply_result : store the content in dokuwiki page and the attache file (img) in dokuwiki media
     # OUTPUT :
     #   * true -> process successfully
     #   * false -> something wrong; using _msg to display what's wrong
     global $INFO;
     // Save the content in data/page
     saveWikiText($this->pageName, $this->result, $this->getLang('parserSummary') . $this->odtFileName);
     if (!page_exists($this->pageName)) {
         return $this->_msg('er_apply_content');
     }
     // Check if the user could upload file (ACL : permission lvl 8)
     if (auth_quickaclcheck($ID) >= AUTH_UPLOAD) {
         // Import the image file in the mediaManager (data/media)
         $destDir = mediaFN($this->nsName);
         if (!(file_exists($destDir) || mkdir($destDir))) {
             return $this->_msg(array('er_apply_dirCreate'));
         }
         if ($this->file_import) {
             foreach ($this->file_import as $pict) {
                 $destFile = mediaFN($this->nsName . ':' . $pict);
                 list($ext, $mime) = mimetype($this->uploadDir . '/Pictures/' . $pict);
                 if (media_upload_finish($this->uploadDir . '/Pictures/' . $pict, $destFile, $this->nsName, $mime, @file_exists($destFile), 'rename') != $this->nsName) {
                     return $this->_msg(array('er_apply_img', $this->uploadDir . '/Pictures/' . $pict));
                 }
             }
         }
         // Keep the original file (import the upload file in the mediaManager)
         $destFile = mediaFN($this->nsName . ':' . $this->odtFileName);
         list($ext, $mime) = mimetype($this->uploadDir . '/' . $this->odtFileName);
         if (media_upload_finish($this->uploadDir . '/' . $this->odtFileName, $destFile, $this->nsName, $mime, @file_exists($destFile), 'rename') != $this->nsName) {
             return $this->_msg(array('er_apply_odtFile'));
         }
     } else {
         // If not allowed to upload, display a message.
         $this->_msg('inf_acl_upload', 0, true);
     }
     # Refresh info about the current page (see doku.php where $INFO is initiate) - Needed for edit or preview "parserPostDisplay" option
     $INFO = pageinfo();
     return true;
 }
Example #15
0
/**
 * Handle 'login', 'logout'
 *
 * @author Andreas Gohr <*****@*****.**>
 *
 * @param string $act action command
 * @return string action command
 */
function act_auth($act)
{
    global $ID;
    global $INFO;
    /* @var Input $INPUT */
    global $INPUT;
    //already logged in?
    if ($INPUT->server->has('REMOTE_USER') && $act == 'login') {
        return 'show';
    }
    //handle logout
    if ($act == 'logout') {
        $lockedby = checklock($ID);
        //page still locked?
        if ($lockedby == $INPUT->server->str('REMOTE_USER')) {
            unlock($ID);
            //try to unlock
        }
        // do the logout stuff
        auth_logoff();
        // rebuild info array
        $INFO = pageinfo();
        act_redirect($ID, 'login');
    }
    return $act;
}
Example #16
0
/**
 * Refresh a page lock and save draft
 *
 * Andreas Gohr <*****@*****.**>
 */
function ajax_lock()
{
    global $conf;
    global $lang;
    global $ID;
    global $INFO;
    global $INPUT;
    $ID = cleanID($INPUT->post->str('id'));
    if (empty($ID)) {
        return;
    }
    $INFO = pageinfo();
    if (!$INFO['writable']) {
        echo 'Permission denied';
        return;
    }
    if (!checklock($ID)) {
        lock($ID);
        echo 1;
    }
    if ($conf['usedraft'] && $INPUT->post->str('wikitext')) {
        $client = $_SERVER['REMOTE_USER'];
        if (!$client) {
            $client = clientIP(true);
        }
        $draft = array('id' => $ID, 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), 'text' => $INPUT->post->str('wikitext'), 'suffix' => $INPUT->post->str('suffix'), 'date' => $INPUT->post->int('date'), 'client' => $client);
        $cname = getCacheName($draft['client'] . $ID, '.draft');
        if (io_saveFile($cname, serialize($draft))) {
            echo $lang['draftdate'] . ' ' . dformat();
        }
    }
}
Example #17
0
<?php

if (!defined('DOKU_INC')) {
    define('DOKU_INC', dirname(__FILE__) . '/../../');
}
define('DOKU_MEDIADETAIL', 1);
require_once DOKU_INC . 'inc/init.php';
$IMG = getID('media');
$ID = cleanID($INPUT->str('id'));
$REV = $INPUT->int('rev');
// this makes some general info available as well as the info about the
// "parent" page
$INFO = array_merge(pageinfo(), mediainfo());
$tmp = array();
trigger_event('DETAIL_STARTED', $tmp);
//close session
session_write_close();
if ($conf['allowdebug'] && $INPUT->has('debug')) {
    print '<pre>';
    foreach (explode(' ', 'basedir userewrite baseurl useslash') as $x) {
        print '$' . "conf['{$x}'] = '" . $conf[$x] . "';\n";
    }
    foreach (explode(' ', 'DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF ' . 'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x) {
        print '$' . "_SERVER['{$x}'] = '" . $_SERVER[$x] . "';\n";
    }
    print "getID('media'): " . getID('media') . "\n";
    print "getID('media',false): " . getID('media', false) . "\n";
    print '</pre>';
}
$ERROR = false;
// check image permissions
    function setUp()
    {
        parent::setUpBeforeClass();
        $this->pluginsEnabled[] = 'move';
        global $ID;
        global $INFO;
        global $conf;
        $ID = $this->movedId;
        $text = <<<EOT
[[start|start]]
[[parallel_page|parallel_page]]
[[.:|.:]]
[[..current_ns:|..current_ns:]]
[[..:current_ns:|..:current_ns:]]
[[..parallel_ns:|..parallel_ns:]]
[[..:parallel_ns:|..:parallel_ns:]]
[[..:..:|..:..:]]
[[..:..:parent_ns:|..:..:parent_ns:]]
[[parent_ns:new_page|parent_ns:new_page]]
[[parent_ns/new_page|parent_ns/new_page]]
[[/start|/start]]
EOT;
        $summary = 'Test';
        saveWikiText($this->movedId, $text, $summary);
        $INFO = pageinfo();
        $references = array_keys(p_get_metadata($this->movedId, 'relation references', METADATA_RENDER_UNLIMITED));
        idx_get_indexer()->addMetaKeys($this->movedId, 'relation_references', $references);
        $text = <<<EOT
[[{$this->movedId}|{$this->movedId}]]
[[:{$this->movedId}|:{$this->movedId}]]
[[.current_ns:test_page|.current_ns:test_page]]
[[.:current_ns:test_page|.:current_ns:test_page]]
[[..parent_ns:current_ns:test_page|..parent_ns:current_ns:test_page]]
[[test_page|test_page]]
[[new_page|new_page]]
[[ftp://somewhere.com|ftp://somewhere.com]]
[[http://somewhere.com|http://somewhere.com]]

[[start|start]]
[[parallel_page|parallel_page]]
[[.:|.:]]
[[..current_ns:|..current_ns:]]
[[..:current_ns:|..:current_ns:]]
[[..parallel_ns:|..parallel_ns:]]
[[..:parallel_ns:|..:parallel_ns:]]
[[..:..:|..:..:]]
[[..:..:parent_ns:|..:..:parent_ns:]]
[[parent_ns:new_page|parent_ns:new_page]]
[[parent_ns/new_page|parent_ns/new_page]]
[[/start|/start]]
EOT;
        saveWikiText($this->parentBacklinkingId, $text, $summary);
        $references = array_keys(p_get_metadata($this->parentBacklinkingId, 'relation references', METADATA_RENDER_UNLIMITED));
        idx_get_indexer()->addMetaKeys($this->parentBacklinkingId, 'relation_references', $references);
        $text = <<<EOT
[[{$this->movedId}|{$this->movedId}]]
[[:{$this->movedId}|:{$this->movedId}]]
[[..current_ns:test_page|..current_ns:test_page]]
[[..:current_ns:test_page|..:current_ns:test_page]]
[[test_page|test_page]]
[[.test_page|.test_page]]
[[.:test_page|.:test_page]]
[[..test_page|..test_page]]
[[..:test_page|..:test_page]]
[[.:..:test_page|.:..:test_page]]
[[new_page|new_page]]
[[ftp://somewhere.com|ftp://somewhere.com]]
[[http://somewhere.com|http://somewhere.com]]

[[start|start]]
[[parallel_page|parallel_page]]
[[.:|.:]]
[[..current_ns:|..current_ns:]]
[[..:current_ns:|..:current_ns:]]
[[..parallel_ns:|..parallel_ns:]]
[[..:parallel_ns:|..:parallel_ns:]]
[[..:..:|..:..:]]
[[..:..:parent_ns:|..:..:parent_ns:]]
[[parent_ns:new_page|parent_ns:new_page]]
[[parent_ns/new_page|parent_ns/new_page]]
[[/start|/start]]
EOT;
        saveWikiText($this->currentNsBacklinkingId, $text, $summary);
        $references = array_keys(p_get_metadata($this->currentNsBacklinkingId, 'relation references', METADATA_RENDER_UNLIMITED));
        idx_get_indexer()->addMetaKeys($this->currentNsBacklinkingId, 'relation_references', $references);
        $text = <<<EOT
[[{$this->movedId}|{$this->movedId}]]
[[:{$this->movedId}|:{$this->movedId}]]
[[.current_ns:test_page|.current_ns:test_page]]
[[.:current_ns:test_page|.:current_ns:test_page]]
[[test_page|test_page]]
[[new_page|new_page]]
[[ftp://somewhere.com|ftp://somewhere.com]]
[[http://somewhere.com|http://somewhere.com]]

[[start|start]]
[[parallel_page|parallel_page]]
[[.:|.:]]
[[..current_ns:|..current_ns:]]
[[..:current_ns:|..:current_ns:]]
[[..parallel_ns:|..parallel_ns:]]
[[..:parallel_ns:|..:parallel_ns:]]
[[..:..:|..:..:]]
[[..:..:parent_ns:|..:..:parent_ns:]]
[[parent_ns:new_page|parent_ns:new_page]]
[[parent_ns/new_page|parent_ns/new_page]]
[[/start|/start]]
EOT;
        saveWikiText($this->otherBacklinkingId, $text, $summary);
        $references = array_keys(p_get_metadata($this->otherBacklinkingId, 'relation references', METADATA_RENDER_UNLIMITED));
        idx_get_indexer()->addMetaKeys($this->otherBacklinkingId, 'relation_references', $references);
        $text = <<<EOT
[[{$this->movedId}|{$this->movedId}]]
[[:{$this->movedId}|:{$this->movedId}]]
[[..:..current_ns:test_page|..:..current_ns:test_page]]
[[..:..:current_ns:test_page|..:..:current_ns:test_page]]
[[test_page|test_page]]
[[..:test_page|..:test_page]]
[[..:test_page|..:test_page]]
[[.:..:test_page|.:..:test_page]]
[[new_page|new_page]]
[[..:new_page|..:new_page]]
[[ftp://somewhere.com|ftp://somewhere.com]]
[[http://somewhere.com|http://somewhere.com]]

[[start|start]]
[[parallel_page|parallel_page]]
[[.:|.:]]
[[..current_ns:|..current_ns:]]
[[..:current_ns:|..:current_ns:]]
[[..parallel_ns:|..parallel_ns:]]
[[..:parallel_ns:|..:parallel_ns:]]
[[..:..:|..:..:]]
[[..:..:parent_ns:|..:..:parent_ns:]]
[[parent_ns:new_page|parent_ns:new_page]]
[[parent_ns/new_page|parent_ns/new_page]]
[[/start|/start]]
EOT;
        saveWikiText($this->subNsPage, $text, $summary);
        $references = array_keys(p_get_metadata($this->subNsPage, 'relation references', METADATA_RENDER_UNLIMITED));
        idx_get_indexer()->addMetaKeys($this->subNsPage, 'relation_references', $references);
        parent::setUp();
        // we test under useslash conditions
        $conf['useslash'] = 1;
    }
Example #19
0
    foreach (explode(' ', 'basedir userewrite baseurl useslash') as $x) {
        print '$' . "conf['{$x}'] = '" . $conf[$x] . "';\n";
    }
    foreach (explode(' ', 'DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF ' . 'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x) {
        print '$' . "_SERVER['{$x}'] = '" . $_SERVER[$x] . "';\n";
    }
    print "getID('media'): " . getID('media') . "\n";
    print "getID('media',false): " . getID('media', false) . "\n";
    print '</pre>';
}
$ERROR = false;
// check image permissions
$AUTH = auth_quickaclcheck($IMG);
if ($AUTH >= AUTH_READ) {
    // check if image exists
    $SRC = mediaFN($IMG);
    if (!@file_exists($SRC)) {
        //doesn't exist!
        header("HTTP/1.0 404 File not Found");
        $ERROR = 'File not found';
    }
} else {
    // no auth
    $ERROR = p_locale_xhtml('denied');
}
// this makes some general infos available as well as the info about the
// "parent" page
$INFO = pageinfo();
//start output and load template
header('Content-Type: text/html; charset=utf-8');
include template('detail.php');
Example #20
0
/**
 * Handle 'login', 'logout'
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function act_auth($act)
{
    global $ID;
    global $INFO;
    //already logged in?
    if ($_SERVER['REMOTE_USER'] && $act == 'login') {
        header("Location: " . wl($ID, '', true));
        exit;
    }
    //handle logout
    if ($act == 'logout') {
        $lockedby = checklock($ID);
        //page still locked?
        if ($lockedby == $_SERVER['REMOTE_USER']) {
            unlock($ID);
        }
        //try to unlock
        // do the logout stuff
        auth_logoff();
        // rebuild info array
        $INFO = pageinfo();
        return 'login';
    }
    return $act;
}