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


PHP isWindows函数代码示例

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


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

示例1: open

 function open($mode = 'w')
 {
     if ($this->_dbh) {
         return;
     }
     // already open.
     $watchdog = $this->_timeout;
     global $ErrorManager;
     $this->_dba_open_error = false;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_dba_open_error_handler'));
     // oops, you don't have DBA support.
     if (!function_exists("dba_open")) {
         echo "You don't seem to have DBA support compiled into PHP.";
     }
     // lock supported since 4.3.0:
     if (check_php_version(4, 3, 0) and strlen($mode) == 1) {
         // PHP 4.3.x Windows lock bug workaround: http://bugs.php.net/bug.php?id=23975
         if (isWindows()) {
             $mode .= "-";
             // suppress locking, or
         } elseif ($this->_handler != 'gdbm') {
             // gdbm does it internally
             $mode .= "d";
             // else use internal locking
         }
     }
     while (($dbh = dba_open($this->_file, $mode, $this->_handler)) < 1) {
         if ($watchdog <= 0) {
             break;
         }
         flush();
         // "c" failed, try "w" instead.
         if (substr($mode, 0, 1) == "c" and file_exists($this->_file)) {
             $mode = "w";
         }
         // conflict: wait some random time to unlock (see ethernet)
         $secs = 0.5 + (double) rand(1, 32767) / 32767;
         sleep($secs);
         $watchdog -= $secs;
         if (strlen($mode) == 2) {
             $mode = substr($mode, 0, -1);
         }
     }
     $ErrorManager->popErrorHandler();
     if (!$dbh) {
         if ($error = $this->_dba_open_error) {
             $error->errno = E_USER_ERROR;
             $error->errstr .= "\nfile: " . $this->_file . "\nmode: " . $mode . "\nhandler: " . $this->_handler;
             $ErrorManager->handleError($error);
         } else {
             trigger_error("dba_open failed", E_USER_ERROR);
         }
     }
     $this->_dbh = $dbh;
     return !empty($dbh);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:56,代码来源:DbaDatabase.php

示例2: runCmd

function runCmd($command, $debug = false)
{
    $nl = PHP_EOL;
    if (isWindows() && strpos(phpversion(), "5.2") !== false) {
        $command = "\"" . $command . "\"";
    }
    if ($debug) {
        echo '-Running Command: ' . $nl . '   ' . $command . $nl;
    }
    $output = array();
    $status = 1;
    @exec($command, $output, $status);
    if ($debug) {
        echo '-Command Output: ' . $nl . '   ' . implode($nl . '  ', $output) . $nl;
    }
    return $output;
}
开发者ID:ehsanguru,项目名称:nnplus,代码行数:17,代码来源:util.php

示例3: serverload

function serverload($int = false)
{
    if ($int == false) {
        $unknown = '-';
    } else {
        $unknown = -1;
    }
    if (isWindows() == true) {
        return $unknown;
    }
    if (@file_exists("/proc/loadavg")) {
        $load = @file_get_contents("/proc/loadavg");
        $serverload = explode(" ", $load);
        $serverload[0] = round($serverload[0], 4);
    }
    if (viscacha_function_exists('sys_getloadavg')) {
        $serverload = @sys_getloadavg();
    }
    if (empty($serverload[0]) && viscacha_function_exists('exec') == true) {
        $load = @exec("uptime");
        $load = preg_split("~load averages?: ~i", $load);
        if (isset($load[1])) {
            $serverload = explode(",", $load[1]);
        }
    }
    if (isset($serverload[0])) {
        $returnload = trim($serverload[0]);
    }
    if (empty($returnload)) {
        $returnload = $unknown;
    }
    return $returnload;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:33,代码来源:function.global.php

示例4: error_and_exit

function error_and_exit()
{
    global $errors, $tikipath;
    $PHP_CONFIG_FILE_PATH = PHP_CONFIG_FILE_PATH;
    $httpd_conf = 'httpd.conf';
    /*
            ob_start();
            phpinfo (INFO_MODULES);
    
            if (preg_match('/Server Root<\/b><\/td><td\s+align="left">([^<]*)</', ob_get_contents(), $m)) {
                    $httpd_conf = $m[1] . '/' . $httpd_conf;
            }
    
            ob_end_clean();
    */
    print "<html><body>\n<h2><IMG SRC=\"img/tiki/Tiki_WCG.png\" ALT=\"\" BORDER=0><br /\\>\n\t<font color='red'>Tiki Installer cannot proceed</font></h2>\n<pre>\n{$errors}";
    if (!isWindows()) {
        print "<br /><br />Your options:\n\n\n1- With FTP access:\n\ta) Change the permissions (chmod) of the directories to 777.\n\tb) Create any missing directories\n\tc) <a href='tiki-install.php'>Execute the Tiki installer again</a> (Once you have executed these commands, this message will disappear!)\n\nor\n\n2- With shell (SSH) access, you can run the command below.\n\n\ta) To run setup.sh, follow the instructions:\n\t\t\$ cd {$tikipath}\n\t\t\$ sh setup.sh\n\n\t\tThe script will offer you options depending on your server configuration.\n\n\tb) <a href='tiki-install.php'>Execute the Tiki installer again</a> (Once you have executed these commands, this message will disappear!)\n\n\n<hr>\nIf you have problems accessing a directory, check the open_basedir entry in\n{$PHP_CONFIG_FILE_PATH}/php.ini or {$httpd_conf}.\n\n<hr>\n\n<a href='http://doc.tiki.org/Installation' target='_blank'>Consult the tiki.org installation guide</a> if you need more help or <a href='http://tiki.org/tiki-forums.php' target='_blank'>visit the forums</a>\n\n";
    }
    print "</pre></body></html>";
    exit;
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:22,代码来源:tiki-installer.php

示例5: _get_ini_separator

 /**
  * The system-dependent path-separator character. On UNIX systems,
  * this character is ':'; on Win32 systems it is ';'.
  * Fixme:
  * On Mac it cannot be : because this is the seperator there!
  *
  * @access private
  * @return string path_separator.
  */
 function _get_ini_separator()
 {
     return isWindows() ? ';' : ':';
     // return preg_match('/^Windows/', php_uname())
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:14,代码来源:FileFinder.php

示例6: glob

	public function glob($pattern, $handle = null) {
		$path = null;
		$output = null;
		if(isWindows() == true) {
			$slash='\\';
		}
		else {
			$slash='/';
		}
		$lastpos = strrpos($pattern, $slash);
		if($lastpos !== false) {
			$path = substr($pattern, 0, -$lastpos-1);
			$pattern = substr($pattern, $lastpos);
		}
		else {
			$path = getcwd();
		}
		if(is_array($handle) && !empty($handle)) {
			while($dir = each($handle)) {
				if($this->glob_pattern_match($pattern, $dir)) {
					$output[] = $dir;
				}
			}
		}
		else {
			$handle = @opendir($path);
			if($handle === false) {
				return false;
			}
			while($dir = readdir($handle)) {
				if($this->glob_pattern_match($pattern, $dir)) {
					$output[] = $dir;
				}
			}
			closedir($handle);
		}
		if(is_array($output)) {
			return $output;
		}
		else {
			return false;
		}
	}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:43,代码来源:class.FTPClient.php

示例7: define

 * Administrative actions:
 *   [Watch] WatchPage - add a page, or delete watch handlers into the users 
 *                       pref[notifyPages] slot.
 *   My WatchList      - view or edit list/regex of pref[notifyPages].
 *   EMailConfirm methods: send and verify
 *
 * Helper functions:
 *   getPageChangeEmails
 *   MailAdmin
 *   ? handle emailed confirmation links (EmailSignup, ModeratedPage)
 *
 * @package MailNotify
 * @author  Reini Urban
 */
if (!defined("MAILER_LOG")) {
    if (isWindows()) {
        define("MAILER_LOG", 'c:/wikimail.log');
    } else {
        define("MAILER_LOG", '/var/log/wikimail.log');
    }
}
class MailNotify
{
    function MailNotify($pagename)
    {
        $this->pagename = $pagename;
        /* which page */
        $this->emails = array();
        /* to which addresses */
        $this->userids = array();
        /* corresponding array of displayed names, 
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:MailNotify.php

示例8: link

 function link($link, $linktext = false)
 {
     global $WikiTheme;
     list($moniker, $page) = explode(":", $link, 2);
     if (!isset($this->_map[$moniker])) {
         return HTML::span(array('class' => 'bad-interwiki'), $linktext ? $linktext : $link);
     }
     $url = $this->_map[$moniker];
     // localize Upload:links for WIKIDUMP
     if (!empty($WikiTheme->DUMP_MODE) and $moniker == 'Upload') {
         global $request;
         include_once "lib/config.php";
         $url = getUploadFilePath();
         // calculate to a relative local path to /uploads for pdf images.
         $doc_root = $request->get("DOCUMENT_ROOT");
         $ldir = NormalizeLocalFileName($url);
         $wikiroot = NormalizeLocalFileName('');
         if (isWindows()) {
             $ldir = strtolower($ldir);
             $doc_root = strtolower($doc_root);
             $wikiroot = strtolower($wikiroot);
         }
         if (string_starts_with($ldir, $doc_root)) {
             $link_prefix = substr($url, strlen($doc_root));
         } elseif (string_starts_with($ldir, $wikiroot)) {
             $link_prefix = NormalizeWebFileName(substr($url, strlen($wikiroot)));
         }
     }
     // Urlencode page only if it's a query arg.
     // FIXME: this is a somewhat broken heuristic.
     if ($moniker == 'Upload') {
         $page_enc = $page;
         $page = rawurldecode($page);
     } else {
         $page_enc = strstr($url, '?') ? rawurlencode($page) : $page;
     }
     if (strstr($url, '%s')) {
         $url = sprintf($url, $page_enc);
     } else {
         $url .= $page_enc;
     }
     $link = HTML::a(array('href' => $url));
     if (!$linktext) {
         $link->pushContent(PossiblyGlueIconToText('interwiki', "{$moniker}:"), HTML::span(array('class' => 'wikipage'), $page));
         $link->setAttr('class', 'interwiki');
     } else {
         $link->pushContent(PossiblyGlueIconToText('interwiki', $linktext));
         $link->setAttr('class', 'named-interwiki');
     }
     return $link;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:51,代码来源:PageType.php

示例9: fixConfigIni

function fixConfigIni($match, $new)
{
    $file = FindFile("config/config.ini");
    $found = false;
    if (is_writable($file)) {
        $in = fopen($file, "rb");
        $out = fopen($tmp = tempnam(FindFile("uploads"), "cfg"), "wb");
        if (isWindows()) {
            $tmp = str_replace("/", "\\", $tmp);
        }
        while ($s = fgets($in)) {
            if (preg_match($match, $s)) {
                $s = $new . (isWindows() ? "\r\n" : "\n");
                $found = true;
            }
            fputs($out, $s);
        }
        fclose($in);
        fclose($out);
        if (!$found) {
            echo " <b><font color=\"red\">", _("FAILED"), "</font></b>: ", sprintf(_("%s not found"), $match);
            unlink($out);
        } else {
            @unlink("{$file}.bak");
            @rename($file, "{$file}.bak");
            if (rename($tmp, $file)) {
                echo " <b>", _("FIXED"), "</b>";
            } else {
                echo " <b>", _("FAILED"), "</b>: ";
                sprintf(_("couldn't move %s to %s"), $tmp, $file);
                return false;
            }
        }
        return $found;
    } else {
        echo " <b><font color=\"red\">", _("FAILED"), "</font></b>: ", sprintf(_("%s is not writable"), $file);
        return false;
    }
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:39,代码来源:upgrade.php

示例10: getUploadedFile

 function getUploadedFile($postname)
 {
     global $HTTP_POST_FILES;
     // Against php5 with !ini_get('register-long-arrays'). See Bug #1180115
     if (empty($HTTP_POST_FILES) and !empty($_FILES)) {
         $HTTP_POST_FILES =& $_FILES;
     }
     if (!isset($HTTP_POST_FILES[$postname])) {
         return false;
     }
     $fileinfo =& $HTTP_POST_FILES[$postname];
     if ($fileinfo['error']) {
         // See https://sourceforge.net/forum/message.php?msg_id=3093651
         $err = (int) $fileinfo['error'];
         // errmsgs by Shilad Sen
         switch ($err) {
             case 1:
                 trigger_error(_("Upload error: file too big"), E_USER_WARNING);
                 break;
             case 2:
                 trigger_error(_("Upload error: file too big"), E_USER_WARNING);
                 break;
             case 3:
                 trigger_error(_("Upload error: file only partially recieved"), E_USER_WARNING);
                 break;
             case 4:
                 trigger_error(_("Upload error: no file selected"), E_USER_WARNING);
                 break;
             default:
                 trigger_error(_("Upload error: unknown error #") . $err, E_USER_WARNING);
         }
         return false;
     }
     // With windows/php 4.2.1 is_uploaded_file() always returns false.
     // Be sure that upload_tmp_dir ends with a slash!
     if (!is_uploaded_file($fileinfo['tmp_name'])) {
         if (isWindows()) {
             if (!($tmp_file = get_cfg_var('upload_tmp_dir'))) {
                 $tmp_file = dirname(tempnam('', ''));
             }
             $tmp_file .= '/' . basename($fileinfo['tmp_name']);
             /* but ending slash in php.ini upload_tmp_dir is required. */
             if (realpath(ereg_replace('/+', '/', $tmp_file)) != realpath($fileinfo['tmp_name'])) {
                 trigger_error(sprintf("Uploaded tmpfile illegal: %s != %s.", $tmp_file, $fileinfo['tmp_name']) . "\n" . "Probably illegal TEMP environment or upload_tmp_dir setting.", E_USER_ERROR);
                 return false;
             } else {
                 /*
                                     trigger_error(sprintf("Workaround for PHP/Windows is_uploaded_file() problem for %s.",
                                                           $fileinfo['tmp_name'])."\n".
                               "Probably illegal TEMP environment or upload_tmp_dir setting.", 
                               E_USER_NOTICE);
                 */
             }
         } else {
             trigger_error(sprintf("Uploaded tmpfile %s not found.", $fileinfo['tmp_name']) . "\n" . " Probably illegal TEMP environment or upload_tmp_dir setting.", E_USER_WARNING);
         }
     }
     return new Request_UploadedFile($fileinfo);
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:59,代码来源:Request.php

示例11: ShellWhoAmI

 function ShellWhoAmI()
 {
     // By virtue of this small change this function needs to be renamed.
     //
     if (isWindows()) {
         // This will fail in IIS so run this from the command line.
         echo "Is windows\n";
         return $this->zzArraySafe($_SERVER, "USERNAME", "");
     } else {
         echo "Not windows\n";
         return $this->ShellExec('whoami');
     }
 }
开发者ID:KlabsTechnology,项目名称:andro,代码行数:13,代码来源:androInstallBuild.php

示例12: setPath

function setPath()
{
    $path = ini_get("include_path");
    $base = substr(__FILE__, 0, strrpos(__FILE__, DIRECTORY_SEPARATOR));
    $delimiter = ":";
    if (isWindows()) {
        $delimiter = ";";
    }
    /* add locations */
    $path .= $delimiter . $base;
    $path .= $delimiter . $base . DIRECTORY_SEPARATOR . "admin";
    $path .= $delimiter . $base . DIRECTORY_SEPARATOR . "custom";
    $path .= $delimiter . $base . DIRECTORY_SEPARATOR . "display";
    $path .= $delimiter . $base . DIRECTORY_SEPARATOR . "display" . DIRECTORY_SEPARATOR . "templates";
    $path .= $delimiter . $base . DIRECTORY_SEPARATOR . "language";
    $path .= $delimiter . $base . DIRECTORY_SEPARATOR . "templates";
    /* update path */
    ini_set("include_path", $path);
}
开发者ID:nubissurveying,项目名称:nubis,代码行数:19,代码来源:functions.php

示例13: open

 function open($mode = 'w')
 {
     if ($this->_dbh) {
         return;
     }
     // already open.
     $watchdog = $this->_timeout;
     global $ErrorManager;
     $this->_dba_open_error = false;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_dba_open_error_handler'));
     // oops, you don't have DBA support.
     if (!function_exists("dba_open")) {
         echo "You don't seem to have DBA support compiled into PHP.";
     }
     if (READONLY) {
         $mode = 'r';
     }
     if (strlen($mode) == 1) {
         // PHP 4.3.x Windows lock bug workaround: http://bugs.php.net/bug.php?id=23975
         if (isWindows()) {
             $mode .= "-";
             // suppress locking, or
         } elseif ($this->_handler != 'gdbm') {
             // gdbm does it internally
             $mode .= "d";
             // else use internal locking
         }
     }
     while (($dbh = dba_open($this->_file, $mode, $this->_handler)) < 1) {
         if ($watchdog <= 0) {
             break;
         }
         // "c" failed, try "w" instead.
         if ($mode == "w" and file_exists($this->_file) and (isWindows() or !is_writable($this->_file))) {
             // try to continue with read-only
             if (!defined("READONLY")) {
                 define("READONLY", true);
             }
             $GLOBALS['request']->_dbi->readonly = true;
             $this->readonly = true;
             $mode = "r";
         }
         if (substr($mode, 0, 1) == "c" and file_exists($this->_file) and !READONLY) {
             $mode = "w";
         }
         // conflict: wait some random time to unlock (as with ethernet)
         $secs = 0.5 + (double) rand(1, 32767) / 32767;
         sleep($secs);
         $watchdog -= $secs;
         if (strlen($mode) == 2) {
             $mode = substr($mode, 0, -1);
         }
     }
     $ErrorManager->popErrorHandler();
     if (!$dbh) {
         if ($error = $this->_dba_open_error) {
             $error->errno = E_USER_ERROR;
             $error->errstr .= "\nfile: " . $this->_file . "\nmode: " . $mode . "\nhandler: " . $this->_handler;
             // try to continue with read-only
             if (!defined("READONLY")) {
                 define("READONLY", true);
             }
             $GLOBALS['request']->_dbi->readonly = true;
             $this->readonly = true;
             if (!file_exists($this->_file)) {
                 $ErrorManager->handleError($error);
                 flush();
             }
         } else {
             trigger_error("dba_open failed", E_USER_ERROR);
         }
     }
     $this->_dbh = $dbh;
     return !empty($dbh);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:75,代码来源:DbaDatabase.php

示例14: execute

 /**
  * Execute system command until the outfile $until exists.
  *
  * @param  cmd   string   command to be invoked
  * @param  until string   expected output filename
  * @return       boolean  error status; true=ok; false=error
  */
 function execute($cmd, $until = false)
 {
     // cmd must redirect stderr to stdout though!
     $errstr = exec($cmd);
     //, $outarr, $returnval); // normally 127
     //$errstr = join('',$outarr);
     $ok = empty($errstr);
     if (!$ok) {
         trigger_error("\n" . $cmd . " failed: {$errstr}", E_USER_WARNING);
     } elseif ($GLOBALS['request']->getArg('debug')) {
         trigger_error("\n" . $cmd . ": success\n", E_USER_NOTICE);
     }
     if (!isWindows()) {
         if ($until) {
             $loop = 100000;
             while (!file_exists($until) and $loop > 0) {
                 $loop -= 100;
                 usleep(100);
             }
         } else {
             usleep(5000);
         }
     }
     if ($until) {
         return file_exists($until);
     }
     return $ok;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:35,代码来源:WikiPluginCached.php

示例15: PclZipUtilTranslateWinPath

function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
{
    if (isWindows() == true) {
        // ----- Look for potential disk letter
        if ($p_remove_disk_letter && ($v_position = strpos($p_path, ':')) != false) {
            $p_path = substr($p_path, $v_position + 1);
        }
        // ----- Change potential windows directory separator
        if (strpos($p_path, '\\') > 0 || substr($p_path, 0, 1) == '\\') {
            $p_path = strtr($p_path, '\\', '/');
        }
    }
    return $p_path;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:14,代码来源:class.zip.php


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