当前位置: 首页>>代码示例>>PHP>>正文


PHP io_createNamespace函数代码示例

本文整理汇总了PHP中io_createNamespace函数的典型用法代码示例。如果您正苦于以下问题:PHP io_createNamespace函数的具体用法?PHP io_createNamespace怎么用?PHP io_createNamespace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了io_createNamespace函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: io_writeWikiPage

/**
 * Used to write out a DokuWiki page to file, and send IO_WIKIPAGE_WRITE events.
 *
 * This generates an action event and delegates to io_saveFile().
 * Action plugins are allowed to modify the page content in transit.
 * The file path should not be changed.
 * (The append parameter is set to false.)
 *
 * Event data:
 * $data[0]    The raw arguments for io_saveFile as an array.
 * $data[1]    ns: The colon separated namespace path minus the trailing page name. (false if root ns)
 * $data[2]    page_name: The wiki page name.
 * $data[3]    rev: The page revision, false for current wiki pages.
 *
 * @author Ben Coburn <btcoburn@silicodon.net>
 */
function io_writeWikiPage($file, $content, $id, $rev = false)
{
    if (empty($rev)) {
        $rev = false;
    }
    if ($rev === false) {
        io_createNamespace($id);
    }
    // create namespaces as needed
    $data = array(array($file, $content, false), getNS($id), noNS($id), $rev);
    return trigger_event('IO_WIKIPAGE_WRITE', $data, '_io_writeWikiPage_action', false);
}
开发者ID:rodrigoaustincascao,项目名称:Service-Desk-IMC,代码行数:28,代码来源:io.php

示例2: ajax_mediaupload

function ajax_mediaupload()
{
    global $NS, $MSG, $INPUT;
    if ($_FILES['qqfile']['tmp_name']) {
        $id = $INPUT->post->str('mediaid', $_FILES['qqfile']['name']);
    } elseif ($INPUT->get->has('qqfile')) {
        $id = $INPUT->get->str('qqfile');
    }
    $id = cleanID($id);
    $NS = $INPUT->str('ns');
    $ns = $NS . ':' . getNS($id);
    $AUTH = auth_quickaclcheck("{$ns}:*");
    if ($AUTH >= AUTH_UPLOAD) {
        io_createNamespace("{$ns}:xxx", 'media');
    }
    if ($_FILES['qqfile']['error']) {
        unset($_FILES['qqfile']);
    }
    if ($_FILES['qqfile']['tmp_name']) {
        $res = media_upload($NS, $AUTH, $_FILES['qqfile']);
    }
    if ($INPUT->get->has('qqfile')) {
        $res = media_upload_xhr($NS, $AUTH);
    }
    if ($res) {
        $result = array('success' => true, 'link' => media_managerURL(array('ns' => $ns, 'image' => $NS . ':' . $id), '&'), 'id' => $NS . ':' . $id, 'ns' => $NS);
    }
    if (!$result) {
        $error = '';
        if (isset($MSG)) {
            foreach ($MSG as $msg) {
                $error .= $msg['msg'];
            }
        }
        $result = array('error' => $msg['msg'], 'ns' => $NS);
    }
    $json = new JSON();
    echo htmlspecialchars($json->encode($result), ENT_NOQUOTES);
}
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:39,代码来源:ajax.php

示例3: _media_upload_action

 /**
  * Moves the temporary file to its final destination.
  *
  * Michael Klier <chi@chimeric.de>
  */
 function _media_upload_action($data)
 {
     global $conf;
     if (is_array($data) && count($data) === 5) {
         io_createNamespace($data[2], 'media');
         if (rename($data[0], $data[1])) {
             chmod($data[1], $conf['fmode']);
             media_notify($data[2], $data[1], $data[3]);
             // add a log entry to the media changelog
             if ($data[4]) {
                 addMediaLogEntry(time(), $data[2], DOKU_CHANGE_TYPE_EDIT);
             } else {
                 addMediaLogEntry(time(), $data[2], DOKU_CHANGE_TYPE_CREATE);
             }
             return $data[2];
         } else {
             return new IXR_ERROR(1, 'Upload failed.');
         }
     } else {
         return new IXR_ERROR(1, 'Upload failed.');
     }
 }
开发者ID:ryankask,项目名称:dokuwiki,代码行数:27,代码来源:xmlrpc.php

示例4: media_upload_finish

/**
 * Saves an uploaded media file
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Michael Klier <chi@chimeric.de>
 * @author Kate Arzamastseva <pshns@ukr.net>
 */
function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'move_uploaded_file')
{
    global $conf;
    global $lang;
    global $REV;
    $old = @filemtime($fn);
    if (!@file_exists(mediaFN($id, $old)) && @file_exists($fn)) {
        // add old revision to the attic if missing
        media_saveOldRevision($id);
    }
    // prepare directory
    io_createNamespace($id, 'media');
    if ($move($fn_tmp, $fn)) {
        @clearstatcache(true, $fn);
        $new = @filemtime($fn);
        // Set the correct permission here.
        // Always chmod media because they may be saved with different permissions than expected from the php umask.
        // (Should normally chmod to $conf['fperm'] only if $conf['fperm'] is set.)
        chmod($fn, $conf['fmode']);
        msg($lang['uploadsucc'], 1);
        media_notify($id, $fn, $imime, $old);
        // add a log entry to the media changelog
        if ($REV) {
            addMediaLogEntry($new, $id, DOKU_CHANGE_TYPE_REVERT, sprintf($lang['restored'], dformat($REV)), $REV);
        } elseif ($overwrite) {
            addMediaLogEntry($new, $id, DOKU_CHANGE_TYPE_EDIT);
        } else {
            addMediaLogEntry($new, $id, DOKU_CHANGE_TYPE_CREATE, $lang['created']);
        }
        return $id;
    } else {
        return array($lang['uploadfail'], -1);
    }
}
开发者ID:yjliugit,项目名称:dokuwiki,代码行数:41,代码来源:media.php

示例5: getNS

    $NS = getNS($DEL);
} elseif ($_REQUEST['edit']) {
    $IMG = cleanID($_REQUEST['edit']);
    $NS = getNS($IMG);
} elseif ($_REQUEST['img']) {
    $IMG = cleanID($_REQUEST['img']);
    $NS = getNS($IMG);
} else {
    $NS = $_REQUEST['ns'];
    $NS = cleanID($NS);
}
// check auth
$AUTH = auth_quickaclcheck("{$NS}:*");
// create the given namespace (just for beautification)
if ($AUTH >= AUTH_UPLOAD) {
    io_createNamespace("{$NS}:xxx", 'media');
}
// handle flash upload
if (isset($_FILES['Filedata'])) {
    $_FILES['upload'] =& $_FILES['Filedata'];
    $JUMPTO = media_upload($NS, $AUTH);
    if ($JUMPTO == false) {
        header("HTTP/1.0 400 Bad Request");
        echo 'Upload failed';
    }
    echo 'ok';
    exit;
}
// give info on PHP catched upload errors
if ($_FILES['upload']['error']) {
    switch ($_FILES['upload']['error']) {
开发者ID:Harvie,项目名称:dokuwiki,代码行数:31,代码来源:mediamanager.php

示例6: ajax_mediaupload

function ajax_mediaupload()
{
    global $NS, $MSG;
    if ($_FILES['qqfile']['tmp_name']) {
        $id = empty($_POST['mediaid']) ? $_FILES['qqfile']['name'] : $_POST['mediaid'];
    } elseif (isset($_GET['qqfile'])) {
        $id = $_GET['qqfile'];
    }
    $id = cleanID($id, false, true);
    $NS = $_REQUEST['ns'];
    $ns = $NS . ':' . getNS($id);
    $AUTH = auth_quickaclcheck("{$ns}:*");
    if ($AUTH >= AUTH_UPLOAD) {
        io_createNamespace("{$ns}:xxx", 'media');
    }
    if ($_FILES['qqfile']['error']) {
        unset($_FILES['qqfile']);
    }
    if ($_FILES['qqfile']['tmp_name']) {
        $res = media_upload($NS, $AUTH, $_FILES['qqfile']);
    }
    if (isset($_GET['qqfile'])) {
        $res = media_upload_xhr($NS, $AUTH);
    }
    if ($res) {
        $result = array('success' => true, 'link' => media_managerURL(array('ns' => $ns, 'image' => $NS . ':' . $id), '&'), 'id' => $NS . ':' . $id, 'ns' => $NS);
    }
    if (!$result) {
        $error = '';
        if (isset($MSG)) {
            foreach ($MSG as $msg) {
                $error .= $msg['msg'];
            }
        }
        $result = array('error' => $msg['msg'], 'ns' => $NS);
    }
    echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
}
开发者ID:hlxlplxl,项目名称:dokuwiki,代码行数:38,代码来源:ajax.php

示例7: media_upload_finish

/**
 * Saves an uploaded media file
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Michael Klier <chi@chimeric.de>
 */
function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite)
{
    global $conf;
    global $lang;
    // prepare directory
    io_createNamespace($id, 'media');
    if (move_uploaded_file($fn_tmp, $fn)) {
        // Set the correct permission here.
        // Always chmod media because they may be saved with different permissions than expected from the php umask.
        // (Should normally chmod to $conf['fperm'] only if $conf['fperm'] is set.)
        chmod($fn, $conf['fmode']);
        msg($lang['uploadsucc'], 1);
        media_notify($id, $fn, $imime);
        // add a log entry to the media changelog
        if ($overwrite) {
            addMediaLogEntry(time(), $id, DOKU_CHANGE_TYPE_EDIT);
        } else {
            addMediaLogEntry(time(), $id, DOKU_CHANGE_TYPE_CREATE);
        }
        return $id;
    } else {
        msg($lang['uploadfail'], -1);
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:30,代码来源:media.php

示例8: moveMedia

 /**
  * Execute a media file move/rename
  *
  * @param string $src original ID
  * @param string $dst new ID
  * @return bool true if the move was successfully executed
  */
 public function moveMedia($src, $dst)
 {
     if (!$this->checkMedia($src, $dst)) {
         return false;
     }
     // get all pages using this media
     $affected_pages = idx_get_indexer()->lookupKey('relation_media', $src);
     $src_ns = getNS($src);
     $src_name = noNS($src);
     $dst_ns = getNS($dst);
     $dst_name = noNS($dst);
     // pass this info on to other plugins
     $eventdata = array('opts' => array('ns' => $src_ns, 'name' => $src_name, 'newns' => $dst_ns, 'newname' => $dst_name), 'affected_pages' => &$affected_pages, 'src_id' => $src, 'dst_id' => $dst);
     // give plugins the option to add their own meta files to the list of files that need to be moved
     // to the oldfiles/newfiles array or to adjust their own metadata, database, ...
     // and to add other pages to the affected pages
     $event = new Doku_Event('PLUGIN_MOVE_MEDIA_RENAME', $eventdata);
     if ($event->advise_before()) {
         /** @var helper_plugin_move_file $FileMover */
         $FileMover = plugin_load('helper', 'move_file');
         /** @var helper_plugin_move_rewrite $Rewriter */
         $Rewriter = plugin_load('helper', 'move_rewrite');
         // Move the Subscriptions & Indexes (new feature since Spring 2013 release)
         $Indexer = idx_get_indexer();
         if (($idx_msg = $Indexer->renameMetaValue('relation_media', $src, $dst)) !== true) {
             msg(sprintf($this->getLang('indexerror'), $idx_msg), -1);
             return false;
         }
         if (!$FileMover->moveMediaMeta($src_ns, $src_name, $dst_ns, $dst_name)) {
             msg(sprintf($this->getLang('mediametamoveerror'), $src), -1);
             return false;
         }
         // prepare directory
         io_createNamespace($dst, 'media');
         // move it FIXME this does not create a changelog entry!
         if (!io_rename(mediaFN($src), mediaFN($dst))) {
             msg(sprintf($this->getLang('mediamoveerror'), $src), -1);
             return false;
         }
         // clean up old ns
         io_sweepNS($src, 'mediadir');
         // Move the old revisions
         if (!$FileMover->moveMediaAttic($src_ns, $src_name, $dst_ns, $dst_name)) {
             // it's too late to stop the move, so just display a message.
             msg(sprintf($this->getLang('mediaatticmoveerror'), $src), -1);
         }
         // Add meta data to all affected pages, so links get updated later
         foreach ($affected_pages as $id) {
             $Rewriter->setMoveMeta($id, $src, $dst, 'media');
         }
     }
     $event->advise_after();
     // store this for later use
     $this->affectedPages = $affected_pages;
     return true;
 }
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:63,代码来源:op.php

示例9: move_media

    /**
     * Move media file
     *
     * @author  Michael Hamann <michael@content-space.de>
     *
     * @param array $opts
     * @param bool  $checkonly Only execute the checks if the media file can be moved
     * @return bool If the move was executed
     */
    public function move_media(&$opts, $checkonly = false) {
        $opts['id'] = cleanID($opts['ns'].':'.$opts['name']);
        $opts['path'] = mediaFN($opts['id']);

        // Check we have rights to move this document
        if ( !file_exists(mediaFN($opts['id']))) {
            msg(sprintf($this->getLang('medianotexist'), hsc($opts['id'])), -1);
            return false;
        }

        if ( auth_quickaclcheck($opts['ns'].':*') < AUTH_DELETE ) {
            msg(sprintf($this->getLang('nomediarights'), hsc($opts['id'])), -1);
            return false;
        }

        // Assemble media name and path
        $opts['new_id'] = cleanID($opts['newns'].':'.$opts['newname']);
        $opts['new_path'] = mediaFN($opts['new_id']);

        // Has the document name and/or namespace changed?
        if ( $opts['newns'] == $opts['ns'] && $opts['newname'] == $opts['name'] ) {
            msg($this->getLang('nomediachange'), -1);
            return false;
        }
        // Check the page does not already exist
        if ( @file_exists($opts['new_path']) ) {
            msg(sprintf($this->getLang('mediaexisting'), $opts['newname'], ($opts['newns'] == '' ? $this->getLang('root') : $opts['newns'])), -1);
            return false;
        }

        // Check if the current user can create the new page
        if (auth_quickaclcheck($opts['new_ns'].':*') < AUTH_UPLOAD) {
            msg(sprintf($this->getLang('nomediatargetperms'), $opts['new_id']), -1);
            return false;
        }

        if ($checkonly) return true;

        /**
         * End of init (checks)
         */

        $affected_pages = idx_get_indexer()->lookupKey('relation_media', $opts['id']);

        $data = array('opts' => &$opts, 'affected_pages' => &$affected_pages);
        // give plugins the option to add their own meta files to the list of files that need to be moved
        // to the oldfiles/newfiles array or to adjust their own metadata, database, ...
        // and to add other pages to the affected pages
        $event = new Doku_Event('PLUGIN_MOVE_MEDIA_RENAME', $data);
        if ($event->advise_before()) {
            // Move the Subscriptions & Indexes
            if (method_exists('Doku_Indexer', 'renamePage')) { // new feature since Spring 2013 release
                $Indexer = idx_get_indexer();
            } else {
                $Indexer = new helper_plugin_move_indexer(); // copy of the new code
            }
            if (($idx_msg = $Indexer->renameMetaValue('relation_media', $opts['id'], $opts['new_id'])) !== true) {
                msg('Error while updating the search index '.$idx_msg, -1);
                return false;
            }
            if (!$this->movemediameta($opts)) {
                msg('The meta files of the media file '.$opts['id'].' couldn\'t be moved', -1);
                return false;
            }

            // prepare directory
            io_createNamespace($opts['new_id'], 'media');

            if (!io_rename($opts['path'], $opts['new_path'])) {
                msg('Moving the media file '.$opts['id'].' failed', -1);
                return false;
            }

            io_sweepNS($opts['id'], 'mediadir');

            // Move the old revisions
            if (!$this->movemediaattic($opts)) {
                // it's too late to stop the move, so just display a message.
                msg('The attic files of media file '.$opts['id'].' couldn\'t be moved. Please move them manually.', -1);
            }

            foreach ($affected_pages as $id) {
                if (!page_exists($id, '', false)) continue;
                $meta = $this->getMoveMeta($id);
                if (!$meta) $meta = array('media_moves' => array());
                if (!isset($meta['media_moves'])) $meta['media_moves'] = array();
                $meta['media_moves'] = $this->resolve_moves($meta['media_moves'], '__');
                $meta['media_moves'][$opts['id']] = $opts['new_id'];
                //if (empty($meta['moves'])) unset($meta['moves']);
                p_set_metadata($id, array('plugin_move' => $meta), false, true);
            }
//.........这里部分代码省略.........
开发者ID:neutrinog,项目名称:Door43,代码行数:101,代码来源:helper.php

示例10: media_upload_finish

/**
 * Saves an uploaded media file
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Michael Klier <chi@chimeric.de>
 */
function media_upload_finish($fn_tmp, $fn, $id, $imime)
{
    global $conf;
    global $lang;
    // prepare directory
    io_createNamespace($id, 'media');
    if (move_uploaded_file($fn_tmp, $fn)) {
        // Set the correct permission here.
        // Always chmod media because they may be saved with different permissions than expected from the php umask.
        // (Should normally chmod to $conf['fperm'] only if $conf['fperm'] is set.)
        chmod($fn, $conf['fmode']);
        msg($lang['uploadsucc'], 1);
        media_notify($id, $fn, $imime);
        return $id;
    } else {
        msg($lang['uploadfail'], -1);
    }
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:24,代码来源:media.php


注:本文中的io_createNamespace函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。