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


PHP fixperms函数代码示例

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


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

示例1: ThumbShoeHandleDelete

function ThumbShoeHandleDelete($pagename, $auth = 'delete')
{
    global $WikiLibDirs, $WikiDir, $LastModFile;
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort("?cannot delete {$pagename}");
        return;
    }
    $deleted = false;
    foreach ((array) $WikiLibDirs as $dir) {
        if ($dir->exists($pagename) and $dir->iswrite) {
            $dir->delete($pagename);
            $deleted = true;
            break;
        }
    }
    if (!$deleted) {
        // look in the default WikiDir
        if ($WikiDir->exists($pagename)) {
            $WikiDir->delete($pagename);
            $deleted = true;
        }
    }
    if ($deleted && $LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    Redirect($pagename);
    exit;
}
开发者ID:rubykat,项目名称:pmwiki-thumbshoe,代码行数:30,代码来源:delete.php

示例2: HandleGuestDelete

function HandleGuestDelete($pagename, $auth)
{
    global $WikiDir, $LastModFile;
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort("?cannot delete {$pagename}");
        return;
    }
    $WikiDir->delete($pagename);
    if ($LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    Redirect(substr($pagename, 0, strlen($pagename) - 22));
}
开发者ID:ansgar,项目名称:pmguest,代码行数:15,代码来源:guest.php

示例3: HandlePostUpload

function HandlePostUpload($pagename, $auth = 'upload') {
  global $UploadVerifyFunction, $UploadFileFmt, $LastModFile, 
    $EnableUploadVersions, $Now;
  $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
  if (!$page) Abort("?cannot upload to $pagename");
  $uploadfile = $_FILES['uploadfile'];
  $upname = $_REQUEST['upname'];
  if ($upname=='') $upname=$uploadfile['name'];
  $upname = MakeUploadName($pagename,$upname);
  if (!function_exists($UploadVerifyFunction))
    Abort('?no UploadVerifyFunction available');
  $filepath = FmtPageName("$UploadFileFmt/$upname",$pagename);
  $result = $UploadVerifyFunction($pagename,$uploadfile,$filepath);
  if ($result=='') {
    $filedir = preg_replace('#/[^/]*$#','',$filepath);
    mkdirp($filedir);
    if (IsEnabled($EnableUploadVersions, 0))
      @rename($filepath, "$filepath,$Now");
    if (!move_uploaded_file($uploadfile['tmp_name'],$filepath))
      { Abort("?cannot move uploaded file to $filepath"); return; }
    fixperms($filepath,0444);
    if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); }
    $result = "upresult=success";
  }
  Redirect($pagename,"{\$PageUrl}?action=upload&uprname=$upname&$result");
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:26,代码来源:upload.php

示例4: LinkIndexUpdate

function LinkIndexUpdate($pagelist)
{
    global $LinkIndexFile, $PCache, $LinkIndexTime;
    SDV($LinkIndexTime, 10);
    if (!$pagelist || !$LinkIndexFile) {
        return;
    }
    StopWatch('LinkIndexUpdate begin');
    $pagelist = (array) $pagelist;
    Lock(2);
    $ofp = fopen("{$LinkIndexFile},new", 'w');
    $timeout = time() + $LinkIndexTime;
    foreach ($pagelist as $n) {
        if (time() > $timeout) {
            break;
        }
        if (isset($PCache[$n]['targets'])) {
            $targets = $PCache[$n]['targets'];
        } else {
            $page = ReadPage($n, READPAGE_CURRENT);
            if (!$page) {
                continue;
            }
            $targets = @$page['targets'];
        }
        fputs($ofp, "{$n}={$targets}\n");
    }
    $ifp = @fopen($LinkIndexFile, 'r');
    if ($ifp) {
        while (!feof($ifp)) {
            $line = fgets($ifp, 4096);
            while (substr($line, -1, 1) != "\n" && !feof($ifp)) {
                $line .= fgets($ifp, 4096);
            }
            $i = strpos($line, '=');
            if ($i === false) {
                continue;
            }
            $n = substr($line, 0, $i);
            if (in_array($n, $pagelist)) {
                continue;
            }
            fputs($ofp, $line);
        }
        fclose($ifp);
    }
    fclose($ofp);
    if (file_exists($LinkIndexFile)) {
        unlink($LinkIndexFile);
    }
    rename("{$LinkIndexFile},new", $LinkIndexFile);
    fixperms($LinkIndexFile);
    StopWatch('LinkIndexUpdate end');
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:54,代码来源:pagelist.php

示例5: write

 function write($pagename,$page) {
   global $Now, $Version;
   $page['name'] = $pagename;
   $page['time'] = $Now;
   $page['host'] = $_SERVER['REMOTE_ADDR'];
   $page['agent'] = @$_SERVER['HTTP_USER_AGENT'];
   $page['rev'] = @$page['rev']+1;
   unset($page['version']); unset($page['newline']);
   uksort($page, 'CmpPageAttr');
   $s = false;
   $pagefile = $this->pagefile($pagename);
   $dir = dirname($pagefile); mkdirp($dir);
   if (!file_exists("$dir/.htaccess") && $fp = @fopen("$dir/.htaccess", "w")) 
     { fwrite($fp, "Order Deny,Allow\nDeny from all\n"); fclose($fp); }
   if ($pagefile && ($fp=fopen("$pagefile,new","w"))) {
     $r0 = array('%', "\n", '<');
     $r1 = array('%25', '%0a', '%3c');
     $x = "version=$Version ordered=1 urlencoded=1\n";
     $s = true && fputs($fp, $x); $sz = strlen($x);
     foreach($page as $k=>$v) 
       if ($k > '' && $k{0} != '=') {
         $x = str_replace($r0, $r1, "$k=$v") . "\n";
         $s = $s && fputs($fp, $x); $sz += strlen($x);
       }
     $s = fclose($fp) && $s;
     $s = $s && (filesize("$pagefile,new") > $sz * 0.95);
     if (file_exists($pagefile)) $s = $s && unlink($pagefile);
     $s = $s && rename("$pagefile,new", $pagefile);
   }
   $s && fixperms($pagefile);
   if (!$s)
     Abort("Cannot write page to $pagename ($pagefile)...changes not saved");
   PCache($pagename, $page);
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:34,代码来源:pmwiki.php

示例6: write

 function write($pagename, $page)
 {
     global $Now, $Version, $Newline;
     $page['name'] = $pagename;
     $page['time'] = $Now;
     $page['host'] = $_SERVER['REMOTE_ADDR'];
     $page['agent'] = $_SERVER['HTTP_USER_AGENT'];
     $page['rev'] = @$page['rev'] + 1;
     unset($page['version']);
     unset($page['newline']);
     $s = false;
     $pagefile = FmtPageName($this->dirfmt, $pagename);
     mkdirp(dirname($pagefile));
     if ($pagefile && ($fp = fopen("{$pagefile},new", "w"))) {
         $s = true && fputs($fp, "version={$Version}\nnewline={$Newline}\n");
         foreach ($page as $k => $v) {
             if ($k > '') {
                 $s = $s && fputs($fp, str_replace("\n", $Newline, "{$k}={$v}") . "\n");
             }
         }
         $s = fclose($fp) && $s;
         if (file_exists($pagefile)) {
             $s = $s && unlink($pagefile);
         }
         $s = $s && rename("{$pagefile},new", $pagefile);
     }
     $s && fixperms($pagefile);
     if (!$s) {
         Abort("Cannot write page to {$pagename} ({$pagefile})...changes not saved");
     }
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:31,代码来源:pmwiki.php

示例7: write

 function write($pagename, $page)
 {
     global $Now, $Version, $Newline;
     $page['name'] = $pagename;
     $page['time'] = $Now;
     $page['host'] = $_SERVER['REMOTE_ADDR'];
     $page['agent'] = @$_SERVER['HTTP_USER_AGENT'];
     $page['rev'] = @$page['rev'] + 1;
     unset($page['version']);
     unset($page['newline']);
     uksort($page, 'CmpPageAttr');
     $s = false;
     $pagefile = $this->pagefile($pagename);
     $dir = dirname($pagefile);
     mkdirp($dir);
     if (!file_exists("{$dir}/.htaccess") && ($fp = @fopen("{$dir}/.htaccess", "w"))) {
         fwrite($fp, "Order Deny,Allow\nDeny from all\n");
         fclose($fp);
     }
     if ($pagefile && ($fp = fopen("{$pagefile},new", "w"))) {
         $s = true && fputs($fp, "version={$Version} ordered=1\nnewline={$Newline}\n");
         foreach ($page as $k => $v) {
             if ($k > '' && $k[0] != '=') {
                 $s = $s && fputs($fp, str_replace("\n", $Newline, "{$k}={$v}") . "\n");
             }
         }
         $s = fclose($fp) && $s;
         if (file_exists($pagefile)) {
             $s = $s && unlink($pagefile);
         }
         $s = $s && rename("{$pagefile},new", $pagefile);
     }
     $s && fixperms($pagefile);
     if (!$s) {
         Abort("Cannot write page to {$pagename} ({$pagefile})...changes not saved");
     }
     PCache($pagename, $page);
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:38,代码来源:pmwiki.php

示例8: PageIndexUpdate

function PageIndexUpdate($pagelist = NULL, $dir = '') {
  global $EnableReadOnly, $PageIndexUpdateList, $PageIndexFile, 
    $PageIndexTime, $Now;
  if (IsEnabled($EnableReadOnly, 0)) return;
  $abort = ignore_user_abort(true);
  if ($dir) { flush(); chdir($dir); }
  if (is_null($pagelist)) 
    { $pagelist = (array)$PageIndexUpdateList; $PageIndexUpdateList = array(); }
  if (!$pagelist || !$PageIndexFile) return;
  SDV($PageIndexTime, 10);
  $c = count($pagelist); $updatecount = 0;
  StopWatch("PageIndexUpdate begin ($c pages to update)");
  $pagelist = (array)$pagelist;
  $timeout = time() + $PageIndexTime;
  $cmpfn = create_function('$a,$b', 'return strlen($b)-strlen($a);');
  Lock(2);
  $ofp = fopen("$PageIndexFile,new", 'w');
  foreach($pagelist as $pn) {
    if (@$updated[$pn]) continue;
    @$updated[$pn]++;
    if (time() > $timeout) continue;
    $page = ReadPage($pn, READPAGE_CURRENT);
    if ($page) {
      $targets = str_replace(',', ' ', @$page['targets']);
      $terms = PageIndexTerms(array(@$page['text'], $targets, $pn));
      usort($terms, $cmpfn);
      $x = '';
      foreach($terms as $t) { if (strpos($x, $t) === false) $x .= " $t"; }
      fputs($ofp, "$pn:$Now: $targets :$x\n");
    }
    $updatecount++;
  }
  $ifp = @fopen($PageIndexFile, 'r');
  if ($ifp) {
    while (!feof($ifp)) {
      $line = fgets($ifp, 4096);
      while (substr($line, -1, 1) != "\n" && !feof($ifp)) 
        $line .= fgets($ifp, 4096);
      $i = strpos($line, ':');
      if ($i === false) continue;
      $n = substr($line, 0, $i);
      if (@$updated[$n]) continue;
      fputs($ofp, $line);
    }
    fclose($ifp);
  }
  fclose($ofp);
  if (file_exists($PageIndexFile)) unlink($PageIndexFile); 
  rename("$PageIndexFile,new", $PageIndexFile);
  fixperms($PageIndexFile);
  StopWatch("PageIndexUpdate end ($updatecount updated)");
  ignore_user_abort($abort);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:53,代码来源:pagelist.php

示例9: HandlePostUpload

function HandlePostUpload($pagename, $auth = 'upload') {
  global $UploadVerifyFunction, $UploadFileFmt, $LastModFile, 
    $EnableUploadVersions, $Now, $RecentUploadsFmt, $FmtV,
    $NotifyItemUploadFmt, $NotifyItemFmt, $IsUploadPosted,
    $UploadRedirectFunction;
  UploadAuth($pagename, $auth);
  $uploadfile = $_FILES['uploadfile'];
  $upname = $_REQUEST['upname'];
  if ($upname=='') $upname=$uploadfile['name'];
  $upname = MakeUploadName($pagename,$upname);
  if (!function_exists($UploadVerifyFunction))
    Abort('?no UploadVerifyFunction available');
  $filepath = FmtPageName("$UploadFileFmt/$upname",$pagename);
  $result = $UploadVerifyFunction($pagename,$uploadfile,$filepath);
  if ($result=='') {
    $filedir = preg_replace('#/[^/]*$#','',$filepath);
    mkdirp($filedir);
    if (IsEnabled($EnableUploadVersions, 0))
      @rename($filepath, "$filepath,$Now");
    if (!move_uploaded_file($uploadfile['tmp_name'],$filepath))
      { Abort("?cannot move uploaded file to $filepath"); return; }
    fixperms($filepath,0444);
    if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); }
    $result = "upresult=success";
    $FmtV['$upname'] = $upname;
    $FmtV['$upsize'] = $uploadfile['size'];
    if (IsEnabled($RecentUploadsFmt, 0)) {
      PostRecentChanges($pagename, '', '', $RecentUploadsFmt);
    }
    if (IsEnabled($NotifyItemUploadFmt, 0) && function_exists('NotifyUpdate')) {
      $NotifyItemFmt = $NotifyItemUploadFmt;
      $IsUploadPosted = 1;
      register_shutdown_function('NotifyUpdate', $pagename, getcwd());
    }
  }
  SDV($UploadRedirectFunction, 'Redirect');
  $UploadRedirectFunction($pagename,"{\$PageUrl}?action=upload&uprname=$upname&$result");
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:38,代码来源:upload.php

示例10: HandlePostUpload

function HandlePostUpload($pagename)
{
    global $UploadVerifyFunction, $UploadFileFmt, $LastModFile;
    $page = RetrieveAuthPage($pagename, 'upload');
    if (!$page) {
        Abort("?cannot upload to {$pagename}");
    }
    $uploadfile = $_FILES['uploadfile'];
    $upname = $_REQUEST['upname'];
    if ($upname == '') {
        $upname = $uploadfile['name'];
    }
    $upname = MakeUploadName($pagename, $upname);
    if (!function_exists($UploadVerifyFunction)) {
        Abort('?no UploadVerifyFunction available');
    }
    $filepath = FmtPageName("{$UploadFileFmt}/{$upname}", $pagename);
    $result = $UploadVerifyFunction($pagename, $uploadfile, $filepath);
    if ($result == '') {
        $filedir = preg_replace('#/[^/]*$#', '', $filepath);
        mkdirp($filedir);
        if (!move_uploaded_file($uploadfile['tmp_name'], $filepath)) {
            Abort("?cannot move uploaded file to {$filepath}");
            return;
        }
        fixperms($filepath);
        if ($LastModFile) {
            touch($LastModFile);
            fixperms($LastModFile);
        }
        $result = "upresult=success";
    }
    Redirect($pagename, "\$PageUrl?action=upload&upname={$upname}&{$result}");
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:34,代码来源:upload.php

示例11: PageIndexUpdate

function PageIndexUpdate($pagelist, $dir = '')
{
    global $PageIndexFile, $PageIndexTime, $Now;
    $abort = ignore_user_abort(true);
    if ($dir) {
        chdir($dir);
    }
    SDV($PageIndexTime, 10);
    if (!$pagelist || !$PageIndexFile) {
        return;
    }
    $c = count($pagelist);
    StopWatch("PageIndexUpdate begin ({$c} pages to update)");
    $pagelist = (array) $pagelist;
    $timeout = time() + $PageIndexTime;
    $cmpfn = create_function('$a,$b', 'return strlen($b)-strlen($a);');
    Lock(2);
    $ofp = fopen("{$PageIndexFile},new", 'w');
    foreach ($pagelist as $pn) {
        if (time() > $timeout) {
            break;
        }
        $page = ReadPage($pn, READPAGE_CURRENT);
        if ($page) {
            $targets = str_replace(',', ' ', @$page['targets']);
            $terms = PageIndexTerms(array(@$page['text'], $targets, $pn));
            usort($terms, $cmpfn);
            $x = '';
            foreach ($terms as $t) {
                if (strpos($x, $t) === false) {
                    $x .= " {$t}";
                }
            }
            fputs($ofp, "{$pn}:{$Now}: {$targets} :{$x}\n");
        }
        $updated[$pn]++;
    }
    $ifp = @fopen($PageIndexFile, 'r');
    if ($ifp) {
        while (!feof($ifp)) {
            $line = fgets($ifp, 4096);
            while (substr($line, -1, 1) != "\n" && !feof($ifp)) {
                $line .= fgets($ifp, 4096);
            }
            $i = strpos($line, ':');
            if ($i === false) {
                continue;
            }
            $n = substr($line, 0, $i);
            if (@$updated[$n]) {
                continue;
            }
            fputs($ofp, $line);
        }
        fclose($ifp);
    }
    fclose($ofp);
    if (file_exists($PageIndexFile)) {
        unlink($PageIndexFile);
    }
    rename("{$PageIndexFile},new", $PageIndexFile);
    fixperms($PageIndexFile);
    $c = count($updated);
    StopWatch("PageIndexUpdate end ({$c} updated)");
    ignore_user_abort($abort);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:66,代码来源:pagelist.php

示例12: HandlePostDrawing_draw

/**
 * Handle the .draw file format
 */
function HandlePostDrawing_draw($pagename)
{
    global $UploadVerifyFunction, $UploadFileFmt, $LastModFile, $Now;
    global $RecentChangesFmt, $IsPagePosted, $EnableDrawingRecentChanges;
    $page = RetrieveAuthPage($pagename, 'upload');
    if (!$page) {
        Abort("?cannot upload to {$pagename}");
    }
    $uploadImage = $_FILES['uploadImage'];
    $uploadDrawing = $_FILES['uploadDrawing'];
    $uploadMap = $_FILES['uploadMap'];
    $drawingBaseTime = $_POST['drawingbasetime'];
    // The time the user began editing this drawing.
    $imageupname = $uploadImage['name'];
    $drawingupname = $uploadDrawing['name'];
    $mapupname = $uploadMap['name'];
    $imageupname = MakeUploadName($pagename, $imageupname);
    $drawingupname = MakeUploadName($pagename, $drawingupname);
    $mapupname = MakeUploadName($pagename, $mapupname);
    $imageFilePath = FmtPageName("{$UploadFileFmt}/{$imageupname}", $pagename);
    $drawingFilePath = FmtPageName("{$UploadFileFmt}/{$drawingupname}", $pagename);
    $mapFilePath = FmtPageName("{$UploadFileFmt}/{$mapupname}", $pagename);
    if (file_exists($drawingFilePath)) {
        // Only worth checking timestamps if a drawing actually currently exists!
        if (filemtime($drawingFilePath) > $drawingBaseTime) {
            // Assign a new timestamp to the client... hopefully this time they'll be ok...
            header("PmWikiDraw-DrawingChanged: {$Now}");
            exit;
        }
    }
    // If we've got to here then we can assume its safe to overwrite the current file
    // Note: we should do the history archival/recent changes stuff here.
    if ($EnableDrawingRecentChanges == true && isset($_POST['drawingname'])) {
        $imageModified = $_POST['drawingname'];
        $RecentChangesFmt = array('Main.AllRecentChanges' => '* [[$Group/$Name]]  Drawing - ' . $imageModified . ' modified . . . $CurrentTime', '$Group.RecentChanges' => '* [[$Group/$Name]]  Drawing - ' . $imageModified . ' modified . . . $CurrentTime');
        $IsPagePosted = true;
        $x = "";
        $y = "";
        PostRecentChanges($pagename, $x, $y);
        $IsPagePosted = false;
    }
    $filedir = preg_replace('#/[^/]*$#', '', $imageFilePath);
    mkdirp($filedir);
    if (!move_uploaded_file($uploadImage['tmp_name'], $imageFilePath)) {
        Abort("?cannot move uploaded image to {$imageFilePath}");
        return;
    }
    fixperms($imageFilePath, 0444);
    if ($LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    $filedir = preg_replace('#/[^/]*$#', '', $drawingFilePath);
    mkdirp($filedir);
    if (!move_uploaded_file($uploadDrawing['tmp_name'], $drawingFilePath)) {
        Abort("?cannot move uploaded drawing to {$drawingFilePath}");
        return;
    }
    fixperms($drawingFilePath, 0444);
    if ($LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    $filedir = preg_replace('#/[^/]*$#', '', $mapFilePath);
    mkdirp($filedir);
    if (!move_uploaded_file($uploadMap['tmp_name'], $mapFilePath)) {
        Abort("?cannot move uploaded map to {$mapFilePath}");
        return;
    }
    fixperms($mapFilePath, 0444);
    if ($LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    // Sets the drawingBaseTime header for incremental save support.
    header("PmWikiDraw-DrawingBaseTime: " . filemtime($drawingFilePath));
    exit;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:81,代码来源:AnyWikiDraw.php

示例13: write_cache_file

 function write_cache_file($pagename, $imgdata)
 {
     global $Version;
     $cachefile = $this->cachefile($pagename);
     $dir = dirname($cachefile);
     mkdirp($dir);
     if (!file_exists("{$dir}/.htaccess") && ($fp = @fopen("{$dir}/.htaccess", 'w'))) {
         fwrite($fp, "Order Deny,Allow\nDeny from all\n");
         fclose($fp);
     }
     $st = false;
     if ($cachefile && ($fp = fopen("{$cachefile},new", 'w'))) {
         $st = true;
         if ($imgdata) {
             $st = $st && fwrite($fp, "[image]\n");
             foreach ($imgdata as $k => $v) {
                 $st = $st && fwrite($fp, "{$k} = " . '"' . $v . '"' . "\n");
             }
             $st = $st && fwrite($fp, "\n");
         }
         $st = fclose($fp) && $st;
         if (file_exists($cachefile)) {
             $st = $st && unlink($cachefile);
         }
         $st = $st && rename("{$cachefile},new", $cachefile);
     }
     if ($st) {
         fixperms($cachefile);
     } else {
         Abort("Cannot write page {$pagename} cache to ({$cachefile})...");
     }
 }
开发者ID:rubykat,项目名称:pmwiki-thumbshoe,代码行数:32,代码来源:pagestore.php

示例14: write_xml

 function write_xml($pagename, $page)
 {
     global $Now, $Version, $Charset;
     $page['name'] = $pagename;
     $page['time'] = $Now;
     $page['host'] = $_SERVER['REMOTE_ADDR'];
     $page['agent'] = @$_SERVER['HTTP_USER_AGENT'];
     $page['rev'] = @$page['rev'] + 1;
     unset($page['version']);
     unset($page['newline']);
     uksort($page, 'CmpPageAttr');
     $s = false;
     $pagefile = $this->pagefile($pagename);
     $dir = dirname($pagefile);
     mkdirp($dir);
     if ($pagefile && ($fp = fopen("{$pagefile},new", "w"))) {
         $x = "<?xml version=\"1.0\" encoding=\"{$Charset}\"?>\n<page xmlns=\"http://www.pmwiki.org/cookbook/xmlpage\" version=\"{$Version}\">\n";
         $s = true && fputs($fp, $x);
         $sz = strlen($x);
         foreach ($page as $k => $v) {
             if ($k > '' && $k[0] != '=') {
                 $v = htmlspecialchars($v, ENT_NOQUOTES, $Charset);
                 if (preg_match("/^([a-z]+)(?::(\\d+))(?::(\\d+):)?\$/", $k, $m)) {
                     $p = empty($m[3]) ? "" : " prev=\"{$m[3]}\"";
                     $x = "<{$m[1]} time=\"{$m[2]}\"{$p}>{$v}</{$m[1]}>\n";
                 } else {
                     $x = "<{$k}>{$v}</{$k}>\n";
                 }
                 $s = $s && fputs($fp, $x);
                 $sz += strlen($x);
             }
         }
         $x = "</page>\n";
         $s = $s && fputs($fp, $x);
         $sz += strlen($x);
         $s = fclose($fp) && $s;
         $s = $s && filesize("{$pagefile},new") > $sz * 0.95;
         if (file_exists($pagefile)) {
             $s = $s && unlink($pagefile);
         }
         $s = $s && rename("{$pagefile},new", $pagefile);
     }
     $s && fixperms($pagefile);
     if (!$s) {
         Abort("Cannot write page to {$pagename} ({$pagefile})...changes not saved");
     }
     PCache($pagename, $page);
 }
开发者ID:anomen-s,项目名称:pmwiki-recipes,代码行数:48,代码来源:XMLPageStore.php

示例15: bi_HandleDelete

function bi_HandleDelete($src, $auth = 'comment-edit')
{
    #action=bi_del
    global $WikiDir, $LastModFile;
    $result = array('msg' => XL('Unable to perform delete operation.'), 'result' => 'error');
    $entrytype = PageTextVar($src, 'entrytype');
    if (($entrytype == 'comment' || $entrytype == 'blog') && (bi_Auth(($entrytype == 'comment' ? 'comment-edit' : 'blog-edit') . ' ' . $src) && RetrieveAuthPage($src, 'read', false, READPAGE_CURRENT))) {
        $WikiDir->delete($src);
        if ($LastModFile) {
            touch($LastModFile);
            fixperms($LastModFile);
        }
        $result = array('msg' => XL('Delete successful.'), 'result' => 'success');
    }
    bi_Redirect(bi_Clean('mode', $_GET['bi_Mode']), $result);
}
开发者ID:jefmud,项目名称:pmwiki-kit-bootstrap-compass,代码行数:16,代码来源:blogit.php


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