• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_filename函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: is_freeze

function is_freeze($page, $clearcache = FALSE)
{
    global $function_freeze;
    static $is_freeze = array();
    if ($clearcache === TRUE) {
        $is_freeze = array();
    }
    if (isset($is_freeze[$page])) {
        return $is_freeze[$page];
    }
    if (!$function_freeze || !is_page($page)) {
        $is_freeze[$page] = FALSE;
        return FALSE;
    } else {
        $fp = fopen(get_filename($page), 'rb') or die('is_freeze(): fopen() failed: ' . htmlspecialchars($page));
        // flock($fp, LOCK_SH) or die('is_freeze(): flock() failed');
        @flock($fp, LOCK_SH);
        rewind($fp);
        $buffer = fgets($fp, 9);
        // flock($fp, LOCK_UN) or die('is_freeze(): flock() failed');
        @flock($fp, LOCK_UN);
        fclose($fp) or die('is_freeze(): fclose() failed: ' . htmlspecialchars($page));
        $is_freeze[$page] = $buffer != FALSE && rtrim($buffer, "\r\n") == '#freeze';
        return $is_freeze[$page];
    }
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:26,代码来源:func.php


示例2: plugin_ls_convert

function plugin_ls_convert()
{
    global $vars;
    $with_title = FALSE;
    if (func_num_args()) {
        $args = func_get_args();
        $with_title = in_array('title', $args);
    }
    $prefix = $vars['page'] . '/';
    $page = isset($vars['page']) ? $vars['page'] : '';
    $pages = array();
    foreach (Auth::get_existpages() as $page) {
        if (strpos($page, $prefix) === 0) {
            $pages[] = $page;
        }
    }
    natcasesort($pages);
    $ls = array();
    foreach ($pages as $page) {
        $comment = '';
        if ($with_title) {
            $array = file_head(get_filename($page), 1);
            if ($array) {
                $comment = ' - ' . preg_replace(array('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/S', '/^(?:-+|\\*+)/'), array('$1$2', null), current($array));
            }
        }
        $ls[] = "-[[{$page}]] {$comment}";
    }
    return RendererFactory::factory($ls);
}
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:30,代码来源:ls.inc.php


示例3: is_page_newer

 /**
  * Check if the page timestamp is newer than the file timestamp
  *
  * PukiWiki API Extension
  *
  * @param string $page pagename
  * @param string $file filename
  * @param bool $ignore_notimestamp Ignore notimestamp edit and see the real time editted
  * @return boolean
  */
 function is_page_newer($page, $file, $ignore_notimestamp = TRUE)
 {
     $filestamp = file_exists($file) ? filemtime($file) : 0;
     if ($ignore_notimestamp) {
         // See the diff file. PukiWiki Trick.
         $pagestamp = is_page($page) ? filemtime(DIFF_DIR . encode($page) . '.txt') : 0;
     } else {
         $pagestamp = is_page($page) ? filemtime(get_filename($page)) : 0;
     }
     return $pagestamp > $filestamp;
 }
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:21,代码来源:xxx.inc.php


示例4: is_page

function is_page($page,$reload=FALSE)
{
	global $InterWikiName;
	static $is_page = array();
	
	if ($reload or !array_key_exists($page,$is_page))
	{
		$is_page[$page] = file_exists(get_filename($page));
	}
	
	return $is_page[$page];
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:12,代码来源:func.php


示例5: plugin_list_array

function plugin_list_array($pages)
{
    $qm = get_qm();
    $symbol = ' ';
    $other = 'zz';
    $list = array();
    $cnd = 0;
    //並び替える
    foreach ($pages as $file => $page) {
        $pgdata = array();
        $pgdata['urlencoded'] = rawurlencode($page);
        $pgdata['sanitized'] = htmlspecialchars($page, ENT_QUOTES);
        $pgdata['passage'] = get_pg_passage($page, FALSE);
        $pgdata['mtime'] = date('Y年m月d日 H時i分s秒', filemtime(get_filename($page)));
        $pgdata['title'] = get_page_title($page);
        $pgdata['title'] = $pgdata['title'] == $pgdata['sanitized'] ? '' : '(' . $pgdata['title'] . ')';
        $pgdata['filename'] = htmlspecialchars($file);
        $head = preg_match('/^([A-Za-z])/', $page, $matches) ? $matches[1] : (preg_match('/^([ -~])/', $page, $matches) ? $symbol : $other);
        $list[$head][$page] = $pgdata;
        $cnt++;
    }
    ksort($list);
    $tmparr = isset($list[$symbol]) ? $list[$symbol] : null;
    unset($list[$symbol]);
    $list[$symbol] = $tmparr;
    $retlist = array();
    foreach ($list as $head => $pages) {
        if (is_null($pages)) {
            continue;
        }
        ksort($pages);
        if ($head === $symbol) {
            $head = $qm->m['func']['list_symbol'];
        } else {
            if ($head === $other) {
                $head = $qm->m['func']['list_other'];
            }
        }
        $retlist[$head] = $pages;
    }
    return $retlist;
}
开发者ID:big2men,项目名称:qhm,代码行数:42,代码来源:list.inc.php


示例6: get_function_files

function get_function_files($dir)
{
    global $FUNCTIONS;
    if ($dh = @opendir($dir . "/functions")) {
        while (($file = readdir($dh)) !== FALSE) {
            if (ereg("\\.xml\$", $file)) {
                $FUNCTIONS[] = strtolower(str_replace(array(".xml", "-"), array("", "_"), $file));
            }
        }
        closedir($dh);
    } else {
        $dh = @opendir($dir . "/");
        if ($ch === FALSE) {
            die("Unable to find phpdoc XML files in {$dir} folder\n");
        }
        while (($file = readdir($dh)) !== FALSE) {
            if (!ereg("\\.xml\$", $file)) {
                continue;
            }
            $class = get_filename($file);
            if (!is_dir($dir . "/" . $class . "/")) {
                continue;
            }
            $cdh = @opendir($dir . "/" . $class . "/");
            if ($cdh === FALSE) {
                continue;
            }
            while (($method = readdir($cdh)) !== FALSE) {
                if (!ereg("\\.xml\$", $method)) {
                    continue;
                }
                $FUNCTIONS[] = strtolower($class . "::" . get_filename($method));
            }
        }
    }
}
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:36,代码来源:makefunclist.php


示例7: get_string

<?php 
require "counter.php";
require_once "language.inc.php";
$LinkMenu["default"]["filename"] = "main.php";
$LinkMenu["default"]["title"] = get_string($WelcomeText);
$LinkMenu["default"]["datename"] = "xml/news.xml";
$LinkMenu["screenshots"]["filename"] = "screenshots.php";
$LinkMenu["screenshots"]["title"] = get_string($ScreenshotsText);
$LinkMenu["screenshots"]["datename"] = "xml/screenshots.xml";
$LinkMenu["downloads"]["filename"] = "downloads.php";
$LinkMenu["downloads"]["title"] = get_string($DownloadsText);
$LinkMenu["downloads"]["datename"] = "downloads.php";
$LinkMenu["faq"]["filename"] = "faq.php";
$LinkMenu["faq"]["title"] = get_string($FAQText);
$LinkMenu["faq"]["datename"] = get_filename("xml/faq.xml");
$LinkMenu["links"]["filename"] = "links.php";
$LinkMenu["links"]["title"] = get_string($LinksText);
$LinkMenu["links"]["datename"] = "links.php";
$LinkMenu["contact"]["filename"] = "contact.php";
$LinkMenu["contact"]["title"] = get_string($ContactText);
$LinkMenu["contact"]["datename"] = "contact.php";
/*
  $LinkMenu["gallery"]["filename"]="gallery.php";
  $LinkMenu["gallery"]["title"]=get_string($GalleryText);
  $LinkMenu["gallery"]["datename"]="gallery.php";

  $LinkMenu["gallery_add_user"]["filename"]="gallery_add_user.php";
  $LinkMenu["gallery_add_user"]["title"]=get_string($GalleryText);
  $LinkMenu["gallery_add_user"]["datename"]="gallery.php";
*/
开发者ID:polluks,项目名称:simplemail,代码行数:30,代码来源:index.php


示例8: plugin_ajaxtree_write_after

function plugin_ajaxtree_write_after()
{
    global $vars;
    plugin_ajaxtree_init();
    if ($vars['plugin'] == 'rename') {
        plugin_ajaxtree_reset_cache();
        return;
    }
    $current = $vars['page'];
    if (PLUGIN_AJAXTREE_CHECK_MTIME) {
        $file = get_filename($current);
        if (filemtime($file) > filemtime(DATA_DIR)) {
            return;
        }
    }
    if (PLUGIN_AJAXTREE_COUNT_DESCENDANTS) {
        $ancestors = plugin_ajaxtree_get_ancestors($current);
        $ancestors[] = '/';
    } else {
        $pos = strrpos($current, '/');
        $parent = $pos ? substr($current, 0, $pos) : '/';
        if (PLUGIN_AJAXTREE_HIDE_TOPLEVEL_LEAVES && strpos($parent, '/') === false) {
            $ancestors = array($parent, '/');
        } else {
            $ancestors = array($parent);
        }
    }
    foreach ($ancestors as $ancestor) {
        plugin_ajaxtree_update_cache($ancestor);
    }
}
开发者ID:lolo3-sight,项目名称:wiki,代码行数:31,代码来源:ajaxtree.inc.php


示例9: plugin_convert_haik_set_meta

function plugin_convert_haik_set_meta()
{
    $pages = get_existpages();
    foreach ($pages as $page) {
        $data = array();
        $title = '';
        $pagefile = get_filename($page);
        $metafile = 'haik-contents/meta/' . encode($page) . '.php';
        include $metafile;
        foreach ($meta as $key => $val) {
            switch ($key) {
                case 'title':
                    $title = 'TITLE:' . $val;
                    break;
                case 'description':
                case 'keywords':
                    $data[$key] = '#' . $key . '(' . $val . ')';
                    break;
                case 'user_head':
                    $data[$key] = "#beforescript{{\n{$val}\n}}\n";
                    break;
            }
        }
        switch ($meta['close']) {
            case 'closed':
                $data[$key] = "#close";
                break;
            case 'password':
                $data[$key] = "#secret({$meta['password']})";
                break;
            case 'redirect':
                $status = $meta['redirect_status'] == '301' ? ',301' : '';
                $data[$key] = "#redirect({$meta['redirect']}{$status})";
                break;
        }
        array_unshift($data, $title);
        $src = join("\n", $data) . "\n\n";
        $src .= get_source($page, TRUE, TRUE);
        file_put_contents($pagefile, $src, LOCK_EX);
        plugin_convert_haik_write_log("[{$page}]ページ情報の移行をしました");
    }
    return true;
}
开发者ID:big2men,项目名称:qhm,代码行数:43,代码来源:convert_haik.inc.php


示例10: tpl

        $design->footer(1);
    }
}
#anzeigen
$design->header();
$tpl = new tpl('selfbp', 1);
$akl = '';
if (isset($_REQUEST['akl'])) {
    $akl = $_REQUEST['akl'];
}
#löschen
if (isset($_REQUEST['del'])) {
    $del = $_REQUEST['del'];
    $a = substr($del, 0, 1);
    $e = substr($del, 1);
    if ($e != 'neu') {
        unlink('include/contents/selfbp/self' . $a . '/' . $e);
    }
}
$text = get_text($akl);
$properties = get_properties($text);
if (!isset($properties['wysiwyg'])) {
    $properties['wysiwyg'] = 1;
}
$text = edit_text($text, false);
#$text = rteSafe($text);
$filename = get_filename($akl);
$akl = get_akl($akl);
$view = get_view($properties['view']);
$tpl->set_ar_out(array('akl' => $akl, 'text' => $text, 'filename' => $filename, 'exfilename' => $filename, 'wysiwyg' => $properties['wysiwyg'], 'title' => $properties['title'], 'hmenu' => $properties['hmenu'], 'view' => $view, 'viewoptions' => $properties['viewoptions'], 'wysiwyg_editor' => $properties['wysiwyg'] == 1 ? '<script type="text/javascript">buttonPath = "include/images/icons/editor/"; imageBrowse = "admin.php?selfbp-imagebrowser"; makeWhizzyWig("bbwy", "all");</script>' : ''), 0);
$design->footer();
开发者ID:kveldscholten,项目名称:Ilch-1.1,代码行数:31,代码来源:selfbp.php


示例11: plugin_search2_do_search

function plugin_search2_do_search($word, $type = 'AND', $non_format = FALSE, $base = '')
{
    global $script, $whatsnew, $non_list, $search_non_list, $foot_explain;
    global $search_auth, $show_passage, $username, $vars;
    $qm = get_qm();
    $retval = array();
    $b_type = $type == 'AND';
    // AND:TRUE OR:FALSE
    mb_language('Japanese');
    $word = mb_convert_encoding($word, SOURCE_ENCODING, "UTF-8,EUC-JP,SJIS,ASCII,JIS");
    $word = mb_ereg_replace(" ", " ", $word);
    $keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
    foreach ($keys as $key => $value) {
        $keys[$key] = '/' . $value . '/S';
    }
    $pages = get_existpages();
    // Avoid
    if ($base != '') {
        $pages = preg_grep('/^' . preg_quote($base, '/') . '/S', $pages);
    }
    if (!$search_non_list) {
        $pages = array_diff($pages, preg_grep('/' . $non_list . '/S', $pages));
    }
    $pages = array_flip($pages);
    unset($pages[$whatsnew]);
    $count = count($pages);
    // Search for page contents
    global $ignore_plugin, $strip_plugin, $strip_plugin_inline;
    $titles = array();
    $head10s = array();
    // 一時的に認証を外す
    $user_name = null;
    if (isset($_SESSION['usr'])) {
        $user_name = $_SESSION['usr'];
        unset($_SESSION['usr']);
    }
    foreach (array_keys($pages) as $page) {
        $vars['page'] = $page;
        $b_match = FALSE;
        // Search auth for page contents
        if (!check_readable($page, false, false, TRUE)) {
            unset($pages[$page]);
            continue;
        }
        $lines = get_source($page, TRUE, FALSE);
        //--- 検索専用のデータの作成、更新 ---
        $srh_fname = CACHE_DIR . encode($page) . '_search.txt';
        if (!file_exists($srh_fname) || filemtime($srh_fname) < filemtime(get_filename($page))) {
            $p_title = $page;
            $p_heads = '';
            foreach ($lines as $k => $l) {
                if (preg_match($ignore_plugin, $l)) {
                    // 省く
                    $lines = array();
                    break;
                }
                if (preg_match($strip_plugin, $l, $ms)) {
                    // 省く
                    unset($lines[$k]);
                }
                if (preg_match('/^TITLE:(.*)/', $l, $ms)) {
                    $p_title = trim($ms[1]);
                    if ($p_title !== $page) {
                        $p_title = $p_title . ' ' . $page;
                    }
                    unset($lines[$k]);
                }
                if (preg_match('/^(?:!|(\\*){1,3})(.*)\\[#\\w+\\]\\s?/', $l, $ms)) {
                    $p_heads .= trim($ms[2]) . ' ';
                    unset($lines[$k]);
                }
            }
            $lines = preg_replace($strip_plugin_inline, '', $lines);
            // 省く
            $html = convert_html($lines);
            $html = preg_replace('/<(script|style)[^>]*>.*?<\\/\\1>/i', '', $html);
            $html = preg_replace('/<img\\b[^>]*alt="(.*?)"[^>]*>/i', '\\1', $html);
            $p_body = trim(strip_tags($html));
            foreach ($foot_explain as $id => $note) {
                $p_body .= "\n" . strip_tags($note);
            }
            $foot_explain = array();
            $p_body = count($lines) > 0 ? $p_title . "\n" . $p_heads . "\n" . $p_body : '';
            file_put_contents($srh_fname, $p_body);
        } else {
            $fp = fopen($srh_fname, "r");
            flock($fp, LOCK_SH);
            $lines = file($srh_fname);
            flock($fp, LOCK_UN);
            fclose($fp);
            $p_title = trim($lines[0]);
            unset($lines[0]);
            $p_heads = trim($lines[1]);
            unset($lines[1]);
            $p_body = implode('', $lines);
        }
        //////////////////////////////////////////////
        //
        //  検索スタート!
        //
//.........这里部分代码省略.........
开发者ID:big2men,项目名称:qhm,代码行数:101,代码来源:search2.inc.php


示例12: DbMySqli

<?php

include_once $_SERVER['DOCUMENT_ROOT'] . "/common/lib/common.php";
$db = new DbMySqli();
$name = addslashes($_POST['name']);
$title = addslashes($_POST['title']);
$content = addslashes($_POST['content']);
//첨부파일 업로드
if (is_uploaded_file($_FILES["filename"]["tmp_name"])) {
    $filename = $_FILES["filename"]["name"];
    $filesize = $_FILES["filename"]["size"];
    $origin_filename = $filename;
    $ext = strtolower(get_ext($filename));
    new_check_ext($ext);
    //금지파일 체크
    $filename = get_filename($filepath1, $ext);
    move_uploaded_file($_FILES["filename"]["tmp_name"], get_real_filepath($filepath1) . "/" . $filename);
} else {
    $filesize = 0;
}
$userip = $_SERVER['REMOTE_ADDR'];
$sql = "select ifnull(max(idx), 0) + 1 from tbl_qna";
$result = $db->query($sql);
$rows = mysqli_fetch_row($result);
$f_idx = $rows[0];
$table = "tbl_qna";
$idx_field = "idx";
$db['f_idx'] = $f_idx;
$db['thread'] = "a";
$db['name'] = $name;
$db['title'] = $title;
开发者ID:kisstest,项目名称:snu_stress_manage,代码行数:31,代码来源:write_proc.php


示例13: mysql_free_result

    }
    mysql_free_result($result);
    return $since_dt;
}
function create_from_obj($param, $fromid)
{
    $graph_url = 'https://graph.facebook.com/fql?access_token=' . $param->token . '&q=' . urlencode('select first_name, last_name from user where uid=') . $fromid;
    $fb = get_graphapi_data($graph_url);
    $user = $fb->data;
    $from = new stdclass();
    $from->name = $user[0]->first_name . ' ' . $user[0]->last_name;
    $from->id = $fromid;
    return $from;
}
/////////////////////////////////////////////////////////////////////////////////////////////
$updater_file = get_filename($_SERVER["PHP_SELF"]);
$fbid = empty($argv[1]) ? $_GET['fbid'] : $argv[1];
$token = empty($argv[2]) ? $_GET['token'] : $argv[2];
//$fbid = '1216568374';
//$token = 'CAAEtGOhTURQBAMSC2vYBAvOwjdR5nZCeOI1w3V6pMpwA6YeUBXE7Keli9vsd0eqz0r82IZA76o4a7xaOqTumI3rVCSKCJVyHLkQNiIZC5mAwSrP2cx5ceOIiZAUhyogfHzrTTYWZBbuZBccjk8ZC1F566lo5bG91jpKD0PMcIa1tyC2MNQYQsfJs5aDgZABZAO64ZD';
if (empty($fbid) or empty($token)) {
    logme('no fbid or token in cookie');
    die('no fbid or token in cookie');
}
$graph_url = "https://graph.facebook.com/{$fbid}/";
$execution_time['totalstart'] = get_time();
$execution_time['start'] = get_time();
$param->fbid = $fbid;
$param->token = $token;
$param->graph_url = $graph_url;
$param->limit = 25;
开发者ID:vlad1500,项目名称:example-code,代码行数:31,代码来源:fbphoto_updater.php


示例14: plugin_pcomment_insert

function plugin_pcomment_insert()
{
    global $vars, $now, $_title_updated, $_no_name, $_pcmt_messages;
    $refer = isset($vars['refer']) ? $vars['refer'] : '';
    $page = isset($vars['page']) ? $vars['page'] : '';
    $page = get_fullname($page, $refer);
    if (!is_pagename($page)) {
        return array('msg' => 'Invalid page name', 'body' => 'Cannot add comment', 'collided' => TRUE);
    }
    check_editable($page, true, true);
    $ret = array('msg' => $_title_updated, 'collided' => FALSE);
    $msg = str_replace('$msg', rtrim($vars['msg']), PLUGIN_PCOMMENT_FORMAT_MSG);
    $name = !isset($vars['name']) || $vars['name'] == '' ? $_no_name : $vars['name'];
    $name = $name == '' ? '' : str_replace('$name', $name, PLUGIN_PCOMMENT_FORMAT_NAME);
    $date = !isset($vars['nodate']) || $vars['nodate'] != '1' ? str_replace('$now', $now, PLUGIN_PCOMMENT_FORMAT_NOW) : '';
    if ($date != '' || $name != '') {
        $msg = str_replace("" . 'MSG' . "", $msg, PLUGIN_PCOMMENT_FORMAT_STRING);
        $msg = str_replace("" . 'NAME' . "", $name, $msg);
        $msg = str_replace("" . 'DATE' . "", $date, $msg);
    }
    $reply_hash = isset($vars['reply']) ? $vars['reply'] : '';
    if ($reply_hash || !is_page($page)) {
        $msg = preg_replace('/^\\-+/', '', $msg);
    }
    $msg = rtrim($msg);
    if (!is_page($page)) {
        $postdata = '[[' . htmlsc(strip_bracket($refer)) . ']]' . "\n\n" . '-' . $msg . "\n";
    } else {
        $postdata = get_source($page);
        $count = count($postdata);
        $digest = isset($vars['digest']) ? $vars['digest'] : '';
        if (md5(join('', $postdata)) != $digest) {
            $ret['msg'] = $_pcmt_messages['title_collided'];
            $ret['body'] = $_pcmt_messages['msg_collided'];
        }
        $start_position = 0;
        while ($start_position < $count) {
            if (preg_match('/^\\-/', $postdata[$start_position])) {
                break;
            }
            ++$start_position;
        }
        $end_position = $start_position;
        $dir = isset($vars['dir']) ? $vars['dir'] : '';
        // Find the comment to reply
        $level = 1;
        $b_reply = FALSE;
        if ($reply_hash != '') {
            while ($end_position < $count) {
                $matches = array();
                if (preg_match('/^(\\-{1,2})(?!\\-)(.*)$/', $postdata[$end_position++], $matches) && md5($matches[2]) == $reply_hash) {
                    $b_reply = TRUE;
                    $level = strlen($matches[1]) + 1;
                    while ($end_position < $count) {
                        if (preg_match('/^(\\-{1,3})(?!\\-)/', $postdata[$end_position], $matches) && strlen($matches[1]) < $level) {
                            break;
                        }
                        ++$end_position;
                    }
                    break;
                }
            }
        }
        if ($b_reply == FALSE) {
            $end_position = $dir == '0' ? $start_position : $count;
        }
        // Insert new comment
        array_splice($postdata, $end_position, 0, str_repeat('-', $level) . $msg . "\n");
        if (PLUGIN_PCOMMENT_AUTO_LOG) {
            $_count = isset($vars['count']) ? $vars['count'] : '';
            plugin_pcomment_auto_log($page, $dir, $_count, $postdata);
        }
        $postdata = join('', $postdata);
    }
    page_write($page, $postdata, PLUGIN_PCOMMENT_TIMESTAMP);
    if (PLUGIN_PCOMMENT_TIMESTAMP) {
        if ($refer != '') {
            pkwk_touch_file(get_filename($refer));
        }
        put_lastmodified();
    }
    return $ret;
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:83,代码来源:pcomment.inc.php


示例15: plugin_dav_action


//.........这里部分代码省略.........
            }
            // 'admin only.'
            $obj =& plugin_dav_getfileobj($path_info, false);
            if (!isset($obj)) {
                plugin_dav_error_exit(403, 'no page');
            }
            if ($obj->exist) {
                unlink($tmpfilename);
                plugin_dav_error_exit(403, 'already exist.');
            }
            $size = intval($req_headers['Content-Length']);
            // Windows 7のクライアントは、まず0バイト書いて、
            // それをLOCKしてから、上書きしにくる。
            // しかし、Pukiwikiは基本上書き禁止。
            // そこで0バイトの時は無視する。
            if ($size > 0) {
                if ($size > PLUGIN_ATTACH_MAX_FILESIZE) {
                    plugin_dav_error_exit(403, 'file size error');
                }
                $tmpfilename = tempnam('/tmp', 'dav');
                $fp = fopen($tmpfilename, 'wb');
                $size = 0;
                $putdata = fopen('php://input', 'rb');
                while ($data = fread($putdata, 1024)) {
                    $size += strlen($data);
                    fwrite($fp, $data);
                }
                fclose($putdata);
                fclose($fp);
                if (copy($tmpfilename, $obj->filename)) {
                    chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
                }
                if (is_page($obj->page)) {
                    touch(get_filename($obj->page));
                }
                $obj->getstatus();
                $obj->status['pass'] = $pass !== TRUE && $pass !== NULL ? md5($pass) : '';
                $obj->putstatus();
                unlink($tmpfilename);
            }
            break;
        case 'DELETE':
            // FIXME
            // フォルダーは消せないくせに、消せたように処理してしまう。
            //
            $pass = NULL;
            if (auth::check_role('readonly')) {
                plugin_dav_error_exit(403, 'PKWK_READONLY prohibits editing');
            }
            // 添付する際にパスワードまたは、管理者のみの場合は、認証を要求
            if (PLUGIN_ATTACH_PASSWORD_REQUIRE || PLUGIN_ATTACH_UPLOAD_ADMIN_ONLY) {
                if (isset($req_headers['Authorization'])) {
                    $pass = plugin_dav_getbasicpass($req_headers['Authorization']);
                }
                //  else
                // PLUGIN_ATTACH_UPLOAD_ADMIN_ONLY ? 'admin password' : 'password';
                //    plugin_dav_error_exit(401);
            }
            if (PLUGIN_ATTACH_UPLOAD_ADMIN_ONLY && $pass !== TRUE && ($pass === NULL || !pkwk_login($pass))) {
                plugin_dav_error_exit(401);
            }
            // 'admin only.'
            $obj =& plugin_dav_getfileobj($path_info, false);
            if (!isset($obj)) {
                plugin_dav_error_exit(403);
            }
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:67,代码来源:dav.inc.php


示例16: is_page_newer

 /**
  * Check if the page timestamp is newer than the file timestamp
  *
  * PukiWiki API Extension
  *
  * @access public
  * @static
  * @param string $page pagename
  * @param string $file filename
  * @param bool $ignore_notimestamp see true editted time
  * @return boolean
  * @version $Id: v 1.1 2008-07-16 11:14:46 sonots $
  */
 function is_page_newer($page, $file, $ignore_notimestamp = false)
 {
     $filestamp = file_exists($file) ? filemtime($file) : 0;
     $pagestamp = 0;
     if ($ignore_notimestamp) {
         // See the diff file. PukiWiki Trick.
         $difffile = DIFF_DIR . encode($page) . '.txt';
         if (file_exists($difffile)) {
             $pagestamp = filemtime($difffile);
         }
     }
     if ($pagestamp === 0) {
         if (is_page($page)) {
             $pagestamp = filemtime(get_filename($page));
         }
     }
     return $pagestamp > $filestamp;
 }
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:31,代码来源:sonots.class.php


示例17: show_attachment_link

function show_attachment_link($attachment)
{
    $name = get_filename($attachment->name);
    $name = htmlentities($name);
    $path = htmlentities($attachment->path);
    echo "<a href=\"{$path}\" target=\"_blank\" class=\"attachment\">{$name}</a>\n";
}
开发者ID:our,项目名称:net,代码行数:7,代码来源:functions.php


示例18: die_message

if ($temp) {
    if ($die) {
        $die .= "\n";
    }
    // A breath
    $die .= 'Define(s) not found: (Maybe the old *.ini.php?)' . "\n" . $temp;
}
if ($die) {
    die_message(nl2br("\n\n" . $die));
}
unset($die, $temp);
/////////////////////////////////////////////////
// 必須のページが存在しなければ、空のファイルを作成する
foreach (array($defaultpage, $whatsnew, $interwiki) as $page) {
    if (!is_page($page)) {
        touch(get_filename($page));
    }
}
/////////////////////////////////////////////////
// 外部からくる変数のチェック
// Prohibit $_GET attack
foreach (array('msg', 'pass') as $key) {
    if (isset($_GET[$key])) {
        die_message('Sorry, already reserved: ' . $key . '=');
    }
}
// Expire risk
unset($HTTP_GET_VARS, $HTTP_POST_VARS);
//, 'SERVER', 'ENV', 'SESSION', ...
unset($_REQUEST);
// Considered harmful
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:31,代码来源:init.php


示例19: put_lastmodified

function put_lastmodified()
{
    global $maxshow, $whatsnew, $autolink, $autobasealias;
    // if (PKWK_READONLY) return; // Do nothing
    if (auth::check_role('readonly')) {
        return;
    }
    // Do nothing
    // Get WHOLE page list
    $pages = get_existpages();
    // Check ALL filetime
    $recent_pages = array();
    foreach ($pages as $page) {
        if ($page != $whatsnew && !check_non_list($page)) {
            $recent_pages[$page] = get_filetime($page);
        }
    }
    // Sort decending order of last-modification date
    arsort($recent_pages, SORT_NUMERIC);
    // Cut unused lines
    // BugTrack2/179: array_splice() will break integer keys in hashtable
    $count = $maxshow + PKWK_MAXSHOW_ALLOWANCE;
    $_recent = array();
    foreach ($recent_pages as $key => $value) {
        unset($recent_pages[$key]);
        $_recent[$key] = $value;
        if (--$count < 1) {
            break;
        }
    }
    $recent_pages =& $_recent;
    // Re-create PKWK_MAXSHOW_CACHE
    $file = CACHE_DIR . PKWK_MAXSHOW_CACHE;
    pkwk_touch_file($file);
    $fp = fopen($file, 'r+') or die_message('Cannot open' . 'CACHE_DIR/' . PKWK_MAXSHOW_CACHE);
    set_file_buffer($fp, 0);
    @flock($fp, LOCK_EX);
    $last = ignore_user_abort(1);
    ftruncate($fp, 0);
    rewind($fp);
    foreach ($recent_pages as $page => $time) {
        fputs($fp, $time . "\t" . $page . "\n");
    }
    ignore_user_abort($last);
    @flock($fp, LOCK_UN);
    @fclose($fp);
    // Create RecentChanges
    $file = get_filename($whatsnew);
    pkwk_touch_file($file);
    $fp = fopen($file, 'r+') or die_message('Cannot open ' . htmlspecialchars($whatsnew));
    set_file_buffer($fp, 0);
    @flock($fp, LOCK_EX);
    $last = ignore_user_abort(1);
    ftruncate($fp, 0);
    rewind($fp);
    foreach (array_keys($recent_pages) as $page) {
        $time = $recent_pages[$page];
        // $s_lastmod = htmlspecialchars(format_date($time));
        $s_lastmod = '&epoch(' . $time . ');';
        $s_page = htmlspecialchars($page);
        fputs($fp, '-' . $s_lastmod . ' - [[' . $s_page . ']]' . "\n");
    }
    fputs($fp, '#norelated' . "\n");
    // :)
    ignore_user_abort($last);
    @flock($fp, LOCK_UN);
    @fclose($fp);
    // For AutoLink
    if ($autolink) {
        autolink_pattern_write(CACHE_DIR . PKWK_AUTOLINK_REGEX_CACHE, get_autolink_pattern($pages, $autolink));
    }
    // AutoBaseAlias
    if ($autobasealias) {
        autobasealias_write(CACHE_DIR . PKWK_AUTOBASEALIAS_CACHE, $pages);
    }
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:76,代码来源:file.php


示例20: delete

 function delete($pass)
 {
     global $_attach_messages, $notify, $notify_subject;
     if ($this->status['freeze']) {
         return attach_info('msg_isfreeze');
     }
     if (!pkwk_login($pass)) {
         if (PLUGIN_ATTACH_DELETE_ADMIN_ONLY || $this->age) {
             return attach_info('err_adminpass');
         } else {
             if (PLUGIN_ATTACH_PASSWORD_REQUIRE && md5($pass) != $this->status['pass']) {
                 return attach_info('err_password');
             }
         }
     }
     // バックアップ
     if ($this->age || PLUGIN_ATTACH_DELETE_ADMIN_ONLY && PLUGIN_ATTACH_DELETE_ADMIN_NOBACKUP) {
         @unlink($this->filename);
     } else {
         do {
             $age = ++$this->status['age'];
         } while (file_exists($this->basename . '.' . $age));
         if (!rename($this->basename, $this->basename . '.' . $age)) {
             // 削除失敗 why?
             return array('msg' => $_attach_messages['err_delete']);
         }
         $this->status['count'][$age] = $this->status['count'][0];
         $this->status['count'][0] = 0;
         $this->putstatus();
     }
     if (is_page($this->page)) {
         touch(get_filename($this->page));
     }
     if ($notify) {
         $footer['ACTION'] = 'File deleted';
         $footer['FILENAME'] =& $this->file;
         $footer['PAGE'] =& $this->page;
         $footer['URI'] = get_script_uri() . '?' . rawurlencode($this->page);
         $footer['USER_AGENT'] = TRUE;
         $footer['REMOTE_ADDR'] = TRUE;
         pkwk_mail_notify($notify_subject, "\n", $footer) or die('pkwk_mail_notify(): Failed');
     }
     return array('msg' => $_attach_messages['msg_deleted']);
 }
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:44,代码来源:attach.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_filename_extension函数代码示例发布时间:2022-05-15
下一篇:
PHP get_file_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap