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


PHP pclose函数代码示例

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


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

示例1: hook_post_auth_update_zonep_config

function hook_post_auth_update_zonep_config($login = null, $password = null) {
    global $ad_server, $ad_base_dn, $ad_bind_dn, $ad_bind_pw;
    global $ldap_server, $ldap_base_dn, $adminRdn, $adminPw, $se3Ip;

    // Check arguments
    if(!is_string($login) or !is_string($password))
	return false;

    // Ensure we have an ActiveDirectory server or LDAP server to contact
    if (empty($ad_server) && empty($ldap_server))
	return false;
	
	// Connect to AD or LDAP
	if (!empty($ad_server))    
		$ds = ldap_connect($ad_server);
	else
		$ds = ldap_connect($ldap_server);	

    if(!$ds)
	return false;
	
    // admin Bind on AD or LDAP
	if (!empty($ad_server))    
    	$r = ldap_bind($ds, $ad_bind_dn, $ad_bind_pw);
    else
    	$r = ldap_bind($ds, $adminRddn.$ldap_base_dn, $adminPw);    

    if(!$r)
	return false;

    // Fetch UNC from Active Directory
    $attributes = array('homeDirectory');

	if (!empty($ad_server))
    	$sr = ldap_search($ds, $ad_base_dn, "(sAMAccountName=$login)", $attributes);
    else 	
    	$sr = ldap_search($ds, $ldap_base_dn, "(uid=$login)", $attributes);

    if (! $sr)
	return false;

    $entries = ldap_get_entries($ds, $sr);

    if(empty($entries[0]['homedirectory'][0]))
	return false;

    if (!empty($ad_server))
    	$smb_share = str_replace('\\', '/', $entries[0]['homedirectory'][0]);
    else
    	$smb_share = "//$se3Ip/$login";

    // Call sudo wrapper to create autofs configuration file
    $handle = popen('sudo lcs-zonep-update-credentials', 'w');
    fwrite($handle, "$login\n$password\n$smb_share\n");
    $status = pclose($handle) >> 8;
    if ($status != 0)
	return false;

    return true;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:60,代码来源:update_zonep_config.php

示例2: SendMail

 function SendMail($to, $subject, $body, $headers)
 {
     $command = $this->sendmail_path . " -t";
     if (isset($this->delivery["Headers"])) {
         $headers_values = $this->delivery["Headers"];
         for ($return_path = "", $header = 0, Reset($headers_values); $header < count($headers_values); $header++, Next($headers_values)) {
             if (strtolower(Key($headers_values)) == "return-path") {
                 $return_path = $headers_values[Key($headers_values)];
                 break;
             }
         }
         if (strlen($return_path)) {
             $command .= " -f {$return_path}";
         }
     }
     if (strlen($this->sendmail_arguments)) {
         $command .= " " . $this->sendmail_arguments;
     }
     if (!($pipe = popen($command, "w"))) {
         return $this->OutputError("it was not possible to open sendmail input pipe");
     }
     if (!fputs($pipe, "To: {$to}\n") || !fputs($pipe, "Subject: {$subject}\n") || $headers != "" && !fputs($pipe, "{$headers}\n") || !fputs($pipe, "\n{$body}")) {
         return $this->OutputError("it was not possible to write sendmail input pipe");
     }
     pclose($pipe);
     return "";
 }
开发者ID:BackupTheBerlios,项目名称:aligilo-svn,代码行数:27,代码来源:sendmail_message.php

示例3: 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

示例4: SendMail

 function SendMail($to, $subject, $body, $headers, $return_path)
 {
     $command = $this->sendmail_path . " -t";
     switch ($this->delivery_mode) {
         case SENDMAIL_DELIVERY_DEFAULT:
         case SENDMAIL_DELIVERY_INTERACTIVE:
         case SENDMAIL_DELIVERY_BACKGROUND:
         case SENDMAIL_DELIVERY_QUEUE:
         case SENDMAIL_DELIVERY_DEFERRED:
             break;
         default:
             return $this->OutputError("it was specified an unknown sendmail delivery mode");
     }
     if ($this->delivery_mode != SENDMAIL_DELIVERY_DEFAULT) {
         $command .= " -O DeliveryMode=" . $this->delivery_mode;
     }
     if (strlen($return_path)) {
         $command .= " -f '" . ereg_replace("'", "'\\''", $return_path) . "'";
     }
     if (strlen($this->sendmail_arguments)) {
         $command .= " " . $this->sendmail_arguments;
     }
     if (!($pipe = popen($command, "w"))) {
         return $this->OutputError("it was not possible to open sendmail input pipe");
     }
     if (!fputs($pipe, "To: {$to}\n") || !fputs($pipe, "Subject: {$subject}\n") || $headers != "" && !fputs($pipe, "{$headers}\n") || !fputs($pipe, "\n{$body}")) {
         return $this->OutputError("it was not possible to write sendmail input pipe");
     }
     pclose($pipe);
     return "";
 }
开发者ID:ranakhurram,项目名称:playSMS,代码行数:31,代码来源:sendmail_message.php

示例5: processor_man

function processor_man($formatter, $value = "")
{
    global $DBInfo;
    if ($value[0] == '#' and $value[1] == '!') {
        list($line, $value) = explode("\n", $value, 2);
    }
    if ($line) {
        list($tag, $args) = explode(' ', $line, 2);
    }
    $vartmp_dir =& $DBInfo->vartmp_dir;
    $tmpf = tempnam($vartmp_dir, "MAN");
    $fp = fopen($tmpf, "w");
    fwrite($fp, $value);
    fclose($fp);
    if (!empty($DBInfo->man_man2html) and $DBInfo->man_man2html == 'groff') {
        $man2html = "groff -Thtml -mman {$tmpf}";
    } else {
        $man2html = "man2html {$tmpf}";
    }
    $html = '';
    $fp = popen($man2html . $formatter->NULL, 'r');
    while ($s = fgets($fp, 1024)) {
        $html .= $s;
    }
    pclose($fp);
    unlink($tmpf);
    $html = preg_replace('@^Content-type: text/html@', '', $html);
    $html = preg_replace('/<\\/?META[^>]*>|<\\/?HTML>|<\\/?HEAD>|<\\/?BODY>|<TITLE>[^>]+<\\/TITLE>/i', '', $html);
    $html = preg_replace('/http:\\/\\/localhost\\/cgi\\-bin\\/man\\/man2html\\?.\\+/', '?action=man_get&man=', $html);
    $html = preg_replace('/http:\\/\\/localhost\\/cgi\\-bin\\/man\\/man2html/', '?goto=ManPage', $html);
    return $html;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:32,代码来源:man.php

示例6: shellexec

 function shellexec($cmd)
 {
     global $disablefunc;
     $result = "";
     if (!empty($cmd)) {
         if (is_callable("exec") and !in_array("exec", $disablefunc)) {
             exec($cmd, $result);
             $result = join("\n", $result);
         } elseif (($result = `{$cmd}`) !== FALSE) {
         } elseif (is_callable("system") and !in_array("system", $disablefunc)) {
             $v = ob_get_contents();
             ob_clean();
             system($cmd);
             $result = ob_get_contents();
             ob_clean();
             echo $v;
         } elseif (is_resource($fp = popen($cmd, "r"))) {
             $result = "";
             while (!feof($fp)) {
                 $result .= fread($fp, 1024);
             }
             pclose($fp);
         }
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:26,代码来源:lostdc_shell.php

示例7: flush_log

function flush_log()
{
    $handle = popen("env NOCOLOR=1 /usr/local/bin/sudo /usr/local/bin/cbsd task mode=flushall", "r");
    $read = fgets($handle, 4096);
    pclose($handle);
    header('Location: taskls.php');
}
开发者ID:mergar,项目名称:cw,代码行数:7,代码来源:taskls.php

示例8: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $data[IN] = NULL;
     $data[OUT] = NULL;
     $data_time = 0;
     if (preg_match("/^!(.*)\$/", $targetstring, $matches)) {
         $command = $matches[1];
         debug("ExternalScript ReadData: Running {$command}\n");
         // run the command here
         if (($pipe = popen($command, "r")) === false) {
             warn("ExternalScript ReadData: Failed to run external script. [WMEXT01]\n");
         } else {
             $i = 0;
             while ($i < 5 && !feof($pipe)) {
                 $lines[$i++] = fgets($pipe, 1024);
             }
             pclose($pipe);
             if ($i == 5) {
                 $data[IN] = floatval($lines[0]);
                 $data[OUT] = floatval($lines[1]);
                 $item->add_hint("external_line1", $lines[0]);
                 $item->add_hint("external_line2", $lines[1]);
                 $item->add_hint("external_line3", $lines[2]);
                 $item->add_hint("external_line4", $lines[3]);
                 $data_time = time();
             } else {
                 warn("ExternalScript ReadData: Not enough lines read from external script ({$i} read, 4 expected) [WMEXT02]\n");
             }
         }
     }
     debug("ExternalScript ReadData: Returning (" . ($data[IN] === NULL ? 'NULL' : $data[IN]) . "," . ($data[OUT] === NULL ? 'NULL' : $data[OUT]) . ",{$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:33,代码来源:WeatherMapDataSource_external.php

示例9: System_Pipe

 function System_Pipe($command)
 {
     $handle = popen($command . ' 2>&1', 'r');
     $read = fread($handle, 2096);
     pclose($handle);
     return $read;
 }
开发者ID:olesmith,项目名称:poops,代码行数:7,代码来源:Hash.php

示例10: output

 /**
  * @param $request_string
  * @return string
  */
 private function output($request_string)
 {
     // 静态 GET /1.html HTTP/1.1 ...
     // 动态 GET /user.cgi?id=1 HTTP/1.1 ...
     $request_array = explode(" ", $request_string);
     if (count($request_array) < 2) {
         return "";
     }
     $uri = $request_array[1];
     echo "request:" . web_config::WEB_ROOT . $uri . "\n";
     $query_string = null;
     if ($uri == "/favicon.ico") {
         return "";
     }
     if (strpos($uri, "?")) {
         $uriArr = explode("?", $uri);
         $uri = $uriArr[0];
         $query_string = isset($uriArr[1]) ? $uriArr[1] : null;
     }
     $filename = web_config::WEB_ROOT . $uri;
     if ($this->cgi_check($uri)) {
         $this->set_env($query_string);
         $handle = popen(web_config::WEB_ROOT . $uri, "r");
         $read = stream_get_contents($handle);
         pclose($handle);
         return $this->add_header($read);
     }
     // 静态文件的处理
     if (file_exists($filename)) {
         return $this->add_header(file_get_contents($filename));
     } else {
         return $this->not_found();
     }
 }
开发者ID:jasper2007111,项目名称:notes,代码行数:38,代码来源:server.php

示例11: cvs_max_rev

function cvs_max_rev($filename, $start, $end)
{
    static $lastfile = "";
    static $array = array();
    if ($filename != $lastfile) {
        $cmd = "/usr/bin/cvs annotate {$filename} 2>/dev/null";
        $fp = popen($cmd, "r");
        if (!$fp) {
            return false;
        }
        $n = 0;
        $array = array();
        $lastfile = $filename;
        while (!feof($fp)) {
            $line = fgets($fp);
            if (empty($line)) {
                continue;
            }
            $tokens = explode(" ", $line);
            $array[++$n] = explode(".", $tokens[0]);
        }
        pclose($fp);
    }
    $max = array();
    for ($n = $start; $n <= $end; $n++) {
        if (rev_cmp($max, $array[$n])) {
            $max = $array[$n];
        }
    }
    return $max;
}
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:31,代码来源:reference-split.php

示例12: close

 /**
  * Closes any open pipe handle and sets the exit code.
  *
  * @return  void
  */
 public function close()
 {
     if (is_resource($this->handle)) {
         $this->exitCode = pclose($this->handle);
     }
     $this->handle = null;
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:12,代码来源:pipereader.php

示例13: newsletter_start_commandline_sending

/**
 * Start the commandline to send a newsletter
 * This is offloaded because it could take a while and/or resources
 *
 * @param Newsletter $entity Newsletter entity to be processed
 *
 * @return void
 */
function newsletter_start_commandline_sending(Newsletter $entity)
{
    if (!elgg_instanceof($entity, 'object', Newsletter::SUBTYPE)) {
        return;
    }
    // prepare commandline settings
    $settings = ['entity_guid' => $entity->getGUID(), 'host' => $_SERVER['HTTP_HOST'], 'memory_limit' => ini_get('memory_limit'), 'secret' => newsletter_generate_commanline_secret($entity->getGUID())];
    if (isset($_SERVER['HTTPS'])) {
        $settings['https'] = $_SERVER['HTTPS'];
    }
    // ini settings
    $ini_param = '';
    $ini_file = php_ini_loaded_file();
    if (!empty($ini_file)) {
        $ini_param = "-c {$ini_file} ";
    }
    // which script to run
    $script_location = dirname(dirname(__FILE__)) . '/procedures/cli.php';
    // convert settings to commandline params
    $query_string = http_build_query($settings, '', ' ');
    // start the correct commandline
    if (PHP_OS === 'WINNT') {
        pclose(popen('start /B php ' . $ini_param . $script_location . ' ' . $query_string, 'r'));
    } else {
        exec('php ' . $ini_param . $script_location . ' ' . $query_string . ' > /dev/null &');
    }
}
开发者ID:coldtrick,项目名称:newsletter,代码行数:35,代码来源:functions.php

示例14: experimentmail__send

function experimentmail__send($recipient, $subject, $message, $headers, $env_sender = "")
{
    global $settings;
    if (isset($settings['bcc_all_outgoing_emails']) && $settings['bcc_all_outgoing_emails'] == 'y' && isset($settings['bcc_all_outgoing_emails__address']) && $settings['bcc_all_outgoing_emails__address']) {
        $headers = $headers . "Bcc: " . $settings['bcc_all_outgoing_emails__address'] . "\r\n";
    }
    if (!$env_sender) {
        $env_sender = $settings['support_mail'];
    }
    if ($settings['email_sendmail_type'] == "indirect") {
        if ($settings['email_sendmail_path']) {
            $sendmail_path = $settings['email_sendmail_path'];
        } else {
            $sendmail_path = "/usr/sbin/sendmail";
        }
        $sendmail = $sendmail_path . " -t -i -f {$env_sender}";
        $fd = popen($sendmail, "w");
        fputs($fd, "To: {$recipient}\r\n");
        fputs($fd, $headers);
        fputs($fd, "Subject: {$subject}\r\n");
        fputs($fd, "X-Mailer: orsee\r\n\r\n");
        fputs($fd, $message);
        pclose($fd);
        $done = true;
    } else {
        $headers = "Errors-To: " . $settings['support_mail'] . "\r\n" . $headers;
        $done = mail($recipient, $subject, $message, $headers, '-f ' . $env_sender);
    }
    return $done;
}
开发者ID:danorama,项目名称:orsee,代码行数:30,代码来源:experimentmail.php

示例15: doRepositoryTest

 function doRepositoryTest($repo)
 {
     if ($repo->accessType != "ssh") {
         return -1;
     }
     $basePath = "../../../plugins/access.ssh/";
     // Check file exists
     if (!file_exists($basePath . "class.sshAccessDriver.php") || !file_exists($basePath . "class.SSHOperations.php") || !file_exists($basePath . "manifest.xml") || !file_exists($basePath . "showPass.php") || !file_exists($basePath . "sshActions.xml")) {
         $this->failedInfo .= "Missing at least one of the plugin files (class.sshDriver.php, class.SSHOperations.php, manifest.xml, showPass.php, sshActions.xml).\nPlease reinstall from lastest release.";
         return FALSE;
     }
     // Check if showPass is executable from ssh
     $stat = stat($basePath . "showPass.php");
     $mode = $stat['mode'] & 0x7fff;
     // We don't care about the type
     if (!is_executable($basePath . 'showPass.php') && ($mode & 0x40 && $stat['uid'] == posix_getuid()) && ($mode & 0x8 && $stat['gid'] == posix_getgid()) && $mode & 0x1) {
         chmod($basePath . 'showPass.php', 0555);
         if (!is_executable($basePath . 'showPass.php')) {
             $this->failedInfo .= "showPass.php must be executable. Please log in on your server and set showPass.php as executable (chmod u+x showPass.php).";
             return FALSE;
         }
     }
     // Check if ssh is accessible
     $handle = popen("ssh 2>&1", "r");
     $usage = fread($handle, 30);
     pclose($handle);
     if (strpos($usage, "usage") === FALSE) {
         $this->failedInfo .= "Couldn't find or execute 'ssh' on your system. Please install latest SSH client.";
         return FALSE;
     }
     return TRUE;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:32,代码来源:test.sshAccess.php


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