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


PHP SDV函数代码示例

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


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

示例1: Merge

function Merge($newtext,$oldtext,$pagetext) {
  global $WorkDir,$SysMergeCmd, $SysMergePassthru;
  SDV($SysMergeCmd,"/usr/bin/diff3 -L '' -L '' -L '' -m -E");
  if (substr($newtext,-1,1)!="\n") $newtext.="\n";
  if (substr($oldtext,-1,1)!="\n") $oldtext.="\n";
  if (substr($pagetext,-1,1)!="\n") $pagetext.="\n";
  $tempnew = tempnam($WorkDir,"new");
  $tempold = tempnam($WorkDir,"old");
  $temppag = tempnam($WorkDir,"page");
  if ($newfp=fopen($tempnew,'w')) { fputs($newfp,$newtext); fclose($newfp); }
  if ($oldfp=fopen($tempold,'w')) { fputs($oldfp,$oldtext); fclose($oldfp); }
  if ($pagfp=fopen($temppag,'w')) { fputs($pagfp,$pagetext); fclose($pagfp); }
  $mergetext = '';
  if (IsEnabled($SysMergePassthru, 0)) {
    ob_start();
    passthru("$SysMergeCmd $tempnew $tempold $temppag");
    $mergetext = ob_get_clean();
  }
  else {
    $merge_handle = popen("$SysMergeCmd $tempnew $tempold $temppag",'r');
    if ($merge_handle) {
      while (!feof($merge_handle)) $mergetext .= fread($merge_handle,4096);
      pclose($merge_handle);
    }
  }
  @unlink($tempnew); @unlink($tempold); @unlink($temppag);
  return $mergetext;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:28,代码来源:simuledit.php

示例2: LoadPageTemplate

function LoadPageTemplate($pagename, $tfilefmt)
{
    global $PageStartFmt, $PageEndFmt, $BasicLayoutVars, $HTMLHeaderFmt;
    SDV($BasicLayoutVars, array('HeaderText', 'PageHeaderFmt', 'PageLeftFmt', 'PageTitleFmt', 'PageText', 'PageRightFmt', 'PageFooterFmt'));
    $k = implode('', file(FmtPageName($tfilefmt, $pagename)));
    $sect = preg_split('#[[<]!--(/?Page[A-Za-z]+Fmt|PageText|HeaderText)--[]>]#', $k, 0, PREG_SPLIT_DELIM_CAPTURE);
    $PageStartFmt = array_merge(array('headers:'), preg_split('/[[<]!--((?:wiki|file|function|markup):.*?)--[]>]/s', array_shift($sect), 0, PREG_SPLIT_DELIM_CAPTURE));
    $PageEndFmt = array();
    $ps = 'PageStartFmt';
    while (count($sect) > 0) {
        $k = array_shift($sect);
        $v = preg_split('/[[<]!--((?:wiki|file|function|markup):.*?)--[]>]/', array_shift($sect), 0, PREG_SPLIT_DELIM_CAPTURE);
        if (substr($k, 0, 1) == '/') {
            $GLOBALS[$ps][] = "<!--{$k}-->";
            $GLOBALS[$ps][] = count($v) > 1 ? $v : $v[0];
            continue;
        }
        $GLOBALS[$k] = count($v) > 1 ? $v : $v[0];
        if (in_array($k, $BasicLayoutVars)) {
            $GLOBALS[$ps][] = "<!--{$k}-->";
            if ($k == 'PageText') {
                $ps = 'PageEndFmt';
            }
            if ($k == 'HeaderText') {
                $GLOBALS[$ps][] =& $HTMLHeaderFmt;
            }
            $GLOBALS[$ps][] =& $GLOBALS[$k];
        }
    }
    array_push($PageStartFmt, "\n<div id='wikitext'>\n");
    array_unshift($PageEndFmt, '</div>');
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:32,代码来源:tlayout.php

示例3: FPLByGroup

 function FPLByGroup($pagename, &$matches, $opt)
 {
     global $FPLByGroupStartFmt, $FPLByGroupEndFmt, $FPLByGroupGFmt, $FPLByGroupIFmt, $FPLByGroupOpt;
     SDV($FPLByGroupStartFmt, "<dl class='fplbygroup'>");
     SDV($FPLByGroupEndFmt, '</dl>');
     SDV($FPLByGroupGFmt, "<dt><a href='\$ScriptUrl/\$Group'>\$Group</a> /</dt>\n");
     SDV($FPLByGroupIFmt, "<dd><a href='\$PageUrl'>\$Name</a></dd>\n");
     SDVA($FPLByGroupOpt, array('readf' => 0, 'order' => 'name'));
     $matches = MakePageList($pagename, array_merge((array) $FPLByGroupOpt, $opt), 0);
     if (@$opt['count']) {
         array_splice($matches, $opt['count']);
     }
     if (count($matches) < 1) {
         return '';
     }
     $out = '';
     foreach ($matches as $pn) {
         $pgroup = FmtPageName($FPLByGroupGFmt, $pn);
         if ($pgroup != @$lgroup) {
             $out .= $pgroup;
             $lgroup = $pgroup;
         }
         $out .= FmtPageName($FPLByGroupIFmt, $pn);
     }
     return FmtPageName($FPLByGroupStartFmt, $pagename) . $out . FmtPageName($FPLByGroupEndFmt, $pagename);
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:26,代码来源:transition.php

示例4: EditDraft

function EditDraft(&$pagename, &$page, &$new)
{
    global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $EnableDraftAtomicDiff, $DraftRecentChangesFmt, $RecentChangesFmt, $Now;
    SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
    $basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
    $draftname = $basename . $DraftSuffix;
    if ($_POST['postdraft'] || $_POST['postedit']) {
        $pagename = $draftname;
    } else {
        if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
            $pagename = $basename;
            if (IsEnabled($EnableDraftAtomicDiff, 0)) {
                $page = ReadPage($basename);
                foreach ($new as $k => $v) {
                    # delete draft history
                    if (preg_match('/:\\d+(:\\d+:)?$/', $k) && !preg_match("/:{$Now}(:\\d+:)?\$/", $k)) {
                        unset($new[$k]);
                    }
                }
                unset($new['rev']);
                SDVA($new, $page);
            }
            $WikiDir->delete($draftname);
        } else {
            if (PageExists($draftname) && $pagename != $draftname) {
                Redirect($draftname, '$PageUrl?action=edit');
                exit;
            }
        }
    }
    if ($pagename == $draftname && isset($DraftRecentChangesFmt)) {
        $RecentChangesFmt = $DraftRecentChangesFmt;
    }
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:34,代码来源:draft.php

示例5: AuthUserId

function AuthUserId($pagename, $id, $pw = NULL)
{
    global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, $AuthId, $AuthList, $MessagesFmt;
    $auth = $AuthUser;
    $authid = '';
    # load information from Site.AuthUser (or page in $AuthUserPageFmt)
    SDV($AuthUserPageFmt, '$SiteGroup.AuthUser');
    SDVA($AuthUserFunctions, array('htpasswd' => 'AuthUserHtPasswd', 'ldap' => 'AuthUserLDAP', $id => 'AuthUserConfig'));
    $pn = FmtPageName($AuthUserPageFmt, $pagename);
    $apage = ReadPage($pn, READPAGE_CURRENT);
    if ($apage && preg_match_all("/\n\\s*([@\\w][^\\s:]*):(.*)/", $apage['text'], $matches, PREG_SET_ORDER)) {
        foreach ($matches as $m) {
            if (!preg_match_all('/\\bldap:\\S+|[^\\s,]+/', $m[2], $v)) {
                continue;
            }
            if ($m[1][0] == '@') {
                foreach ($v[0] as $g) {
                    $auth[$g][] = $m[1];
                }
            } else {
                $auth[$m[1]] = array_merge((array) @$auth[$m[1]], $v[0]);
            }
        }
    }
    if (is_null($pw)) {
        $authid = $id;
    } else {
        foreach ($AuthUserFunctions as $k => $fn) {
            if ($auth[$k] && $fn($pagename, $id, $pw, $auth[$k])) {
                $authid = $id;
                break;
            }
        }
    }
    if (!$authid) {
        $GLOBALS['InvalidLogin'] = 1;
        return;
    }
    if (!isset($AuthId)) {
        $AuthId = $authid;
    }
    @session_start();
    $_SESSION['authid'] = $authid;
    $_SESSION['authlist']["id:{$authid}"] = 1;
    $_SESSION['authlist']["id:-{$authid}"] = -1;
    $_SESSION['authlist']["id:*"] = 1;
    foreach ((array) @$auth[$authid] as $g) {
        if ($g[0] == '@') {
            @($_SESSION['authlist'][$g] = 1);
        }
    }
    foreach ((array) @$auth['*'] as $g) {
        if ($g[0] == '@') {
            @($_SESSION['authlist'][$g] = 1);
        }
    }
    $AuthList = array_merge($AuthList, $_SESSION['authlist']);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:58,代码来源:authuser.php

示例6: HTTPBasicAuth

function HTTPBasicAuth($pagename, $level, $authprompt = true)
{
    global $AuthRealmFmt, $AuthDeniedFmt, $DefaultPasswords, $AllowPassword, $GroupAttributesFmt;
    SDV($GroupAttributesFmt, '$Group/GroupAttributes');
    SDV($AllowPassword, 'nopass');
    SDV($AuthRealmFmt, $GLOBALS['WikiTitle']);
    SDV($AuthDeniedFmt, 'A valid password is required to access this feature.');
    $page = ReadPage($pagename);
    if (!$page) {
        return false;
    }
    $passwd = @$page["passwd{$level}"];
    if ($passwd == "") {
        $grouppg = ReadPage(FmtPageName($GroupAttributesFmt, $pagename));
        $passwd = @$grouppg["passwd{$level}"];
        if ($passwd == '') {
            $passwd = @$DefaultPasswords[$level];
        }
        if ($passwd == '') {
            $passwd = @$page["passwdread"];
        }
        if ($passwd == '') {
            $passwd = @$grouppg["passwdread"];
        }
        if ($passwd == '') {
            $passwd = @$DefaultPasswords['read'];
        }
    }
    if ($passwd == '') {
        return $page;
    }
    if (crypt($AllowPassword, $passwd) == $passwd) {
        return $page;
    }
    @session_start();
    if (@$_SERVER['PHP_AUTH_PW']) {
        @$_SESSION['authpw'][$_SERVER['PHP_AUTH_PW']]++;
    }
    $authpw = array_keys((array) @$_SESSION['authpw']);
    foreach (array_merge((array) $DefaultPasswords['admin'], (array) $passwd) as $pwchal) {
        foreach ($authpw as $pwresp) {
            if (@crypt($pwresp, $pwchal) == $pwchal) {
                return $page;
            }
        }
    }
    if (!$authprompt) {
        return false;
    }
    $realm = FmtPageName($AuthRealmFmt, $pagename);
    header("WWW-Authenticate: Basic realm=\"{$realm}\"");
    header("Status: 401 Unauthorized");
    header("HTTP-Status: 401 Unauthorized");
    PrintFmt($pagename, $AuthDeniedFmt);
    exit;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:56,代码来源:httpauth.php

示例7: AuthUserId

function AuthUserId($pagename, $id, $pw=NULL) {
  global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, 
    $AuthId, $MessagesFmt, $AuthUserPat;

  $auth = array();
  foreach((array)$AuthUser as $k=>$v) $auth[$k] = (array)$v;
  $authid = '';

  # load information from SiteAdmin.AuthUser (or page in $AuthUserPageFmt)
  SDV($AuthUserPageFmt, '$SiteAdminGroup.AuthUser');
  SDVA($AuthUserFunctions, array(
    'htpasswd' => 'AuthUserHtPasswd',
    'ldap' => 'AuthUserLDAP',
#    'mysql' => 'AuthUserMySQL',
    $id => 'AuthUserConfig'));

  SDV($AuthUserPat, "/^\\s*([@\\w][^\\s:]*):(.*)/m");
  $pn = FmtPageName($AuthUserPageFmt, $pagename);
  $apage = ReadPage($pn, READPAGE_CURRENT);
  if ($apage && preg_match_all($AuthUserPat, 
                               $apage['text'], $matches, PREG_SET_ORDER)) {
    foreach($matches as $m) {
      if (!preg_match_all('/\\bldaps?:\\S+|[^\\s,]+/', $m[2], $v))
        continue;
      if ($m[1]{0} == '@') 
        foreach($v[0] as $g) $auth[$g][] = $m[1];
      else $auth[$m[1]] = array_merge((array)@$auth[$m[1]], $v[0]);
    }
  }

  if (func_num_args()==2) $authid = $id;
  else
    foreach($AuthUserFunctions as $k => $fn) 
      if (@$auth[$k] && $fn($pagename, $id, $pw, $auth[$k], $authlist)) 
        { $authid = $id; break; }

  if (!$authid) { $GLOBALS['InvalidLogin'] = 1; return; }
  if (!isset($AuthId)) $AuthId = $authid;
  $authlist["id:$authid"] = 1;
  $authlist["id:-$authid"] = -1;
  foreach(preg_grep('/^@/', (array)@$auth[$authid]) as $g) 
    $authlist[$g] = 1;
  foreach(preg_grep('/^@/', (array)@$auth['*']) as $g) 
    $authlist[$g] = 1;
  foreach(preg_grep('/^@/', array_keys($auth)) as $g) # useless? PITS:01201
    if (in_array($authid, $auth[$g])) $authlist[$g] = 1;
  if ($auth['htgroup']) {
    foreach(AuthUserHtGroup($pagename, $id, $pw, $auth['htgroup']) as $g)
      $authlist["@$g"] = 1;
  }
  foreach(preg_grep('/^@/', (array)@$auth["-$authid"]) as $g) 
    unset($authlist[$g]);
  SessionAuth($pagename, array('authid' => $authid, 'authlist' => $authlist));
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:54,代码来源:authuser.php

示例8: VarLink

function VarLink($pagename,$tgt,$txt) {
  global $VarIndex,$FmtV,$VarLinkMissingFmt,$VarLinkExistsFmt;
  SDV($VarLinkMissingFmt,'$LinkText');
  SDV($VarLinkExistsFmt,"<a class='varlink' href='\$LinkUrl'><code class='varlink'>\$LinkText</code></a>");
  VarIndexLoad($pagename);
  $FmtV['$LinkText'] = str_replace('$', '&#36;', $txt);
  $FmtV['$LinkUrl'] = @$VarIndex[$tgt]['url'];
  if (@!$VarIndex[$tgt]['url'])
    return FmtPageName($VarLinkMissingFmt,$pagename);
  return FmtPageName($VarLinkExistsFmt,$pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:11,代码来源:vardoc.php

示例9: HTTPBasicAuthPrompt

function HTTPBasicAuthPrompt($pagename)
{
    global $AuthRealmFmt, $AuthDeniedFmt;
    SDV($AuthRealmFmt, $GLOBALS['WikiTitle']);
    SDV($AuthDeniedFmt, 'A valid password is required to access this feature.');
    $realm = FmtPageName($AuthRealmFmt, $pagename);
    header("WWW-Authenticate: Basic realm=\"{$realm}\"");
    header("Status: 401 Unauthorized");
    header("HTTP-Status: 401 Unauthorized");
    PrintFmt($pagename, $AuthDeniedFmt);
    exit;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:12,代码来源:httpauth.php

示例10: MergeSimulEdits

function MergeSimulEdits($pagename, &$page, &$new)
{
    global $MessagesFmt, $WorkDir, $SysMergeCmd;
    SDV($SysMergeCmd, "/usr/bin/diff3 -L '' -L '' -L '' -m -E");
    if (@(!$_POST['basetime']) || !PageExists($pagename) || $_POST['basetime'] >= $page['time']) {
        return;
    }
    unset($_POST['post']);
    $MessagesFmt[] = "<p class='editconflict'>The page you are \n    editing has been modified since you started editing it.  \n    The modifications have been merged into the text below,\n    you may want to verify the results of the merge before\n    pressing save.  Conflicts the system couldn't resolve are\n    bracketed by &lt;&lt;&lt;&lt;&lt;&lt;&lt; and \n    &gt;&gt;&gt;&gt;&gt;&gt;&gt;.  (<a target='_blank' \n    href='\$PageUrl?action=diff'>View changes</a>)</p>\n";
    $old = array();
    RestorePage($pagename, $page, $old, "diff:{$_POST['basetime']}");
    $new['text'] = Merge($new['text'], $old['text'], $page['text']);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:13,代码来源:simuledit.php

示例11: dg_SetLogoHeightWidth

function dg_SetLogoHeightWidth($wPad, $hPad = 0)
{
    global $PageLogoUrl, $PageLogoUrlHeight, $PageLogoUrlWidth;
    if (!isset($PageLogoUrlWidth) || !isset($PageLogoUrlHeight)) {
        $size = @getimagesize($PageLogoUrl);
        if (!isset($PageLogoUrlWidth)) {
            SDV($PageLogoUrlWidth, ($size ? $size[0] + $wPad : 0) . 'px');
        }
        if (!isset($PageLogoUrlHeight)) {
            SDV($PageLogoUrlHeight, ($size ? $size[1] + $hPad : 0) . 'px');
        }
    }
}
开发者ID:Nepherim,项目名称:DropShadow,代码行数:13,代码来源:skin.php

示例12: VarLink

function VarLink($pagename, $tgt, $txt)
{
    global $VarIndex, $FmtV, $VarLinkMissingFmt, $VarLinkExistsFmt;
    SDV($VarLinkMissingFmt, '$LinkText');
    SDV($VarLinkExistsFmt, "<a class='varlink' href='\$LinkUrl'><code class='varlink'>\$LinkText</code></a>");
    VarIndexLoad($pagename);
    $FmtV = array();
    $FmtV['$LinkText'] = $txt;
    $FmtV['$LinkUrl'] = @$VarIndex[$tgt]['url'];
    if (@(!$VarIndex[$tgt]['url'])) {
        return FmtPageName($VarLinkMissingFmt, $pagename);
    }
    return FmtPageName($VarLinkExistsFmt, $pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:14,代码来源:vardoc.php

示例13: HandleUpload

function HandleUpload($pagename)
{
    global $FmtV, $UploadExtMax, $HandleUploadFmt, $PageStartFmt, $PageEndFmt, $PageUploadFmt;
    $page = RetrieveAuthPage($pagename, 'upload');
    if (!$page) {
        Abort("?cannot upload to {$pagename}");
    }
    SetPage($pagename, $page);
    $FmtV['$UploadName'] = MakeUploadName($pagename, @$_REQUEST['upname']);
    $upresult = @$_REQUEST['upresult'];
    $FmtV['$upext'] = @$_REQUEST['upext'];
    $FmtV['$upmax'] = @$_REQUEST['upmax'];
    $FmtV['$UploadResult'] = $upresult ? FmtPageName("<i>\$UploadName</i>: \$[UL{$upresult}]", $pagename) : '';
    SDV($HandleUploadFmt, array(&$PageStartFmt, &$PageUploadFmt, &$PageEndFmt));
    PrintFmt($pagename, $HandleUploadFmt);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:16,代码来源:upload.php

示例14: EditDraft

function EditDraft(&$pagename, &$page, &$new) {
  global $WikiDir, $DraftSuffix, $DeleteKeyPattern, 
    $DraftRecentChangesFmt, $RecentChangesFmt;
  SDV($DeleteKeyPattern, "^\\s*delete\\s*$");
  $basename = preg_replace("/$DraftSuffix\$/", '', $pagename);
  $draftname = $basename . $DraftSuffix;
  if ($_POST['postdraft'] || $_POST['postedit']) $pagename = $draftname; 
  else if ($_POST['post'] && !preg_match("/$DeleteKeyPattern/", $new['text'])) { 
    $pagename = $basename; 
    # $page = ReadPage($basename); # breaks restores, PITS:01007, Test:DraftRestore
    $WikiDir->delete($draftname);
  }
  else if (PageExists($draftname) && $pagename != $draftname)
    { Redirect($draftname, '$PageUrl?action=edit'); exit(); }
  if ($pagename == $draftname && isset($DraftRecentChangesFmt))
    $RecentChangesFmt = $DraftRecentChangesFmt;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:17,代码来源:draft.php

示例15: Merge

function Merge($newtext, $oldtext, $pagetext)
{
    global $WorkDir, $SysMergeCmd;
    SDV($SysMergeCmd, "/usr/bin/diff3 -L '' -L '' -L '' -m -E");
    if (substr($newtext, -1, 1) != "\n") {
        $newtext .= "\n";
    }
    if (substr($oldtext, -1, 1) != "\n") {
        $oldtext .= "\n";
    }
    if (substr($pagetext, -1, 1) != "\n") {
        $pagetext .= "\n";
    }
    $tempnew = tempnam($WorkDir, "new");
    $tempold = tempnam($WorkDir, "old");
    $temppag = tempnam($WorkDir, "page");
    if ($newfp = fopen($tempnew, 'w')) {
        fputs($newfp, $newtext);
        fclose($newfp);
    }
    if ($oldfp = fopen($tempold, 'w')) {
        fputs($oldfp, $oldtext);
        fclose($oldfp);
    }
    if ($pagfp = fopen($temppag, 'w')) {
        fputs($pagfp, $pagetext);
        fclose($pagfp);
    }
    $mergetext = '';
    $merge_handle = popen("{$SysMergeCmd} {$tempnew} {$tempold} {$temppag}", 'r');
    if ($merge_handle) {
        while (!feof($merge_handle)) {
            $mergetext .= fread($merge_handle, 4096);
        }
        pclose($merge_handle);
    }
    @unlink($tempnew);
    @unlink($tempold);
    @unlink($temppag);
    return $mergetext;
}
开发者ID:libcrack,项目名称:pmwiki,代码行数:41,代码来源:simuledit.php


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