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

PHP fOpen函数代码示例

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

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



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

示例1: start

 public function start()
 {
     $this->delimiter = "\t";
     //datei oeffnen mit fopen und Parameter w fuer Write mit Dateianlegen
     $this->DumpFileA = fOpen($this->FileNameA, "a");
     $this->DumpFileB = fOpen($this->FileNameB, "a");
 }
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:7,代码来源:csvNTripleDecodeDestination.php


示例2: start

 public function start($language)
 {
     $this->language = $language;
     $this->counter = 0;
     $this->FileName = "TEIL 2 properties_{$language}.sql";
     $this->DumpFile = fOpen($this->FileName, "w");
 }
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:7,代码来源:PropertyExtractor.php


示例3: InitRecordCall

function InitRecordCall($filename, $index, $comment)
{
    //FIXME
    $user = gs_user_get($_SESSION['sudo_user']['name']);
    $call = "Channel: SIP/" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: vm-rec-multiple\n" . "Extension: webdialrecord\n" . "Callerid: {$comment} <Aufnahme>\n" . "Setvar: __user_id=" . $_SESSION['sudo_user']['info']['id'] . "\n" . "Setvar: __user_name=" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __callfile_from_user=" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "Setvar: __record_file=" . $filename . "\n";
    $filename = '/tmp/gs-' . $_SESSION['sudo_user']['info']['id'] . '-' . _pack_int(time()) . rand(100, 999) . '.call';
    $cf = @fOpen($filename, 'wb');
    if (!$cf) {
        gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
        echo 'Failed to write call file.';
        die;
    }
    @fWrite($cf, $call, strLen($call));
    @fClose($cf);
    @chmod($filename, 0666);
    $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        $our_host_ids = @gs_get_listen_to_ids();
        if (!is_array($our_host_ids)) {
            $our_host_ids = array();
        }
        $user_is_on_this_host = in_array($_SESSION['sudo_user']['info']['host_id'], $our_host_ids);
    } else {
        $user_is_on_this_host = true;
    }
    if ($user_is_on_this_host) {
        # the Asterisk of this user and the web server both run on this host
        $err = 0;
        $out = array();
        @exec('sudo mv ' . qsa($filename) . ' ' . qsa($spoolfile) . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            @unlink($filename);
            gs_log(GS_LOG_WARNING, 'Failed to move call file "' . $filename . '" to "' . '/var/spool/asterisk/outgoing/' . baseName($filename) . '"');
            echo 'Failed to move call file.';
            die;
        }
    } else {
        $cmd = 'sudo scp -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa($filename) . ' ' . qsa('root@' . $user['host'] . ':' . $filename);
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        @unlink($filename);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to scp call file "' . $filename . '" to ' . $user['host']);
            echo 'Failed to scp call file.';
            die;
        }
        //remote_exec( $user['host'], $cmd, 10, $out, $err ); // <-- does not use sudo!
        $cmd = 'sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root ' . qsa($user['host']) . ' ' . qsa('mv ' . qsa($filename) . ' ' . qsa($spoolfile));
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to mv call file "' . $filename . '" on ' . $user['host'] . ' to "' . $spoolfile . '"');
            echo 'Failed to mv call file on remote host.';
            die;
        }
    }
}
开发者ID:rkania,项目名称:GS3,代码行数:57,代码来源:forwards_queues.php


示例4: gs_write_error

function gs_write_error($data)
{
    if (!defined('STDERR')) {
        define('STDERR', @fOpen('php://stderr', 'wb'));
    }
    if (php_sapi_name() === 'cli' && STDERR) {
        @fWrite(STDERR, $data, strLen($data));
        @fFlush(STDERR);
    } else {
        echo $data;
    }
}
开发者ID:rkania,项目名称:GS3,代码行数:12,代码来源:util.php


示例5: parse

 function parse($quizFileName)
 {
     $quizFile = fOpen($quizFileName, 'r');
     if ($quizFile) {
         $this->parseStart();
         while (($quizLine = fGets($quizFile, 4096)) !== false) {
             $this->parseLine($quizLine);
         }
         $this->parseEnd();
         fClose($quizFile);
     }
 }
开发者ID:RichardMartin,项目名称:uQuiz,代码行数:12,代码来源:QuizParser.php


示例6: set

 /**
  * @see	\dns\system\cache\source\ICacheSource::set()
  */
 public function set($cacheName, $value, $maxLifetime)
 {
     $filename = $this->getFilename($cacheName);
     $content = "<?php exit; /* cache: " . $cacheName . " (generated at " . gmdate('r') . ") DO NOT EDIT THIS FILE */ ?>\n";
     $content .= serialize($value);
     if (!file_exists($filename)) {
         @touch($filename);
     }
     $handler = fOpen($filename, "a+");
     fWrite($handler, $content);
     fClose($handler);
 }
开发者ID:cengjing,项目名称:Domain-Control-Panel,代码行数:15,代码来源:DiskCacheSource.class.php


示例7: gs_hylafax_authfile_create

function gs_hylafax_authfile_create($authfile)
{
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user list
    #
    $rs = $db->execute('SELECT `id`, `user`, `pin`
FROM `users`
WHERE `nobody_index` IS NULL
ORDER BY `id`');
    if (!$rs) {
        return new GsError('Error.');
    }
    # create temporary hylafax host/user authentication file
    #
    if (file_exists($authfile) && !is_writable($authfile)) {
        @exec('sudo rm -f ' . qsa($authfile) . ' 2>>/dev/null');
    }
    $fh = @fOpen($authfile, 'w');
    if (!$fh) {
        return new GsError('Failed to open HylaFax authfile.');
    }
    # create localhost access without authentication first, if enabled
    #
    if (gs_get_conf('GS_FAX_NOAUTH_LOCALHOST') === true) {
        fWrite($fh, "127.0.0.1\n", strLen("127.0.0.1\n"));
    }
    # create admin entry first
    #
    if (gs_get_conf('GS_FAX_HYLAFAX_ADMIN') != '') {
        $crypted = crypt(gs_get_conf('GS_FAX_HYLAFAX_PASS'), 'pF');
        $user_entry = '^' . preg_quote(gs_get_conf('GS_FAX_HYLAFAX_ADMIN')) . '@:' . '0' . ':' . $crypted . ':' . $crypted . "\n";
        fWrite($fh, $user_entry, strLen($user_entry));
    }
    # create user entries
    #
    while ($user = $rs->fetchRow()) {
        $crypted = crypt($user['pin'], 'ml');
        $user_entry = '^' . preg_quote($user['user']) . '@:' . $user['id'] . ':' . $crypted . "\n";
        fWrite($fh, $user_entry, strLen($user_entry));
    }
    # close file
    #
    if (@fclose($fh)) {
        return true;
    } else {
        return new GsError('Error.');
    }
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:53,代码来源:gs_hylafax_authfile.php


示例8: ask

 /**
  * My prompt func because realine is not default module
  */
 public function ask($string, $length = 1024)
 {
     static $tty;
     if (!isset($tty)) {
         if (substr(PHP_OS, 0, 3) == "WIN") {
             $tty = fOpen("\\con", "rb");
         } else {
             if (!($tty = fOpen("/dev/tty", "r"))) {
                 $tty = fOpen("php://stdin", "r");
             }
         }
     }
     echo $string;
     $result = trim(fGets($tty, $length));
     return $result;
 }
开发者ID:hthetiot,项目名称:basezf,代码行数:19,代码来源:config-generator.php


示例9: makeImgMovie

function makeImgMovie($imgFile)
{
    //Make sure this file is an actual jpg file
    if (is_file($imgFile) && ereg("\\.jpg\$", $imgFile)) {
        //Launch Flash
        $movie = new swfMovie();
        $movie->setBackground(255, 255, 255);
        //Import a bitmap
        $b = new SWFBitmap(fOpen($imgFile, "rb"));
        //Get it's width and height
        $w = $b->getWidth();
        $h = $b->getHeight();
        //Make stage as big as the width and height of our bitmap
        $movie->setDimension($w, $h);
        //Convert Bitmap to a shape for Flash.
        //This process is automated upon import in Flash, but with
        //Ming we have have to do it ourselves. I see it as more control:)
        $s = new SWFShape();
        $f = $s->addFill($b);
        $s->setRightFill($f);
        //draw corners for the bitmap shape
        $s->drawLine($w, 0);
        $s->drawLine(0, $h);
        $s->drawLine(-$w, 0);
        $s->drawLine(0, -$h);
        //CreateEmptyMovieclip
        $p = new SWFSprite();
        //add our bitmap shape to this movieclip
        $p->add($s);
        $p->nextFrame();
        //Add this movieclip to our main movie's timeline
        //Much like dragging a symbol from the library in Flash.
        $i = $movie->add($p);
        //Give this instance a name.. let's call it mImg as in movie image
        $i->setName("mImg");
        //Output the movie.. Ctrl+Enter!
        // header("Content-Type:application/x-shockwave-flash");
        $movie->output();
    }
    //End if
}
开发者ID:vallejos,项目名称:samples,代码行数:41,代码来源:jpg2swf.php


示例10: array

                    echo 'Error.';
                } else {
                    @($_SESSION['sudo_user']['pb-csv-file'] = $filename);
                    $action = 'preview';
                }
            }
        }
    }
}
if ($action === 'preview' || $action === 'import') {
    if (!@array_key_exists('pb-csv-file', @$_SESSION['sudo_user']) || !is_file(@$_SESSION['sudo_user']['pb-csv-file'])) {
        $action = '';
    } else {
        $rem_old_entries = (bool) @$_REQUEST['rem_old_entries'];
        $file = @$_SESSION['sudo_user']['pb-csv-file'];
        $fh = @fOpen($file, 'rb');
        if (!$fh) {
            echo 'Could not read file.';
        } else {
            if (@array_key_exists('sep', @$_REQUEST) && @array_key_exists('encl', @$_REQUEST) && @array_key_exists('enc', @$_REQUEST)) {
                $sep = @$_REQUEST['sep'];
                $encl = @$_REQUEST['encl'];
                $enc = @$_REQUEST['enc'];
            } else {
                # try to guess separator
                $line = @fGets($fh);
                @rewind($fh);
                $cnt = array();
                $cnt['s'] = (int) preg_match_all('/;/', $line, $m);
                $cnt['c'] = (int) preg_match_all('/,/', $line, $m);
                $cnt['t'] = (int) preg_match_all('/\\t/', $line, $m);
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:31,代码来源:pb_csvimport.php


示例11: generate

 public static function generate($key, array $updateIds = [])
 {
     $success = false;
     $reqDBC = [];
     if (file_exists('setup/tools/filegen/' . $key . '.func.php')) {
         require_once 'setup/tools/filegen/' . $key . '.func.php';
     } else {
         if (empty(self::$tplFiles[$key])) {
             CLISetup::log(sprintf(ERR_MISSING_INCL, $key, 'setup/tools/filegen/' . $key . '.func.php', CLISetup::LOG_ERROR));
             return false;
         }
     }
     CLISetup::log('FileGen::generate() - gathering data for ' . $key);
     if (!empty(self::$tplFiles[$key])) {
         list($file, $destPath, $deps) = self::$tplFiles[$key];
         if ($content = file_get_contents(FileGen::$tplPath . $file . '.in')) {
             if ($dest = @fOpen($destPath . $file, "w")) {
                 // replace constants
                 $content = strtr($content, FileGen::$txtConstants);
                 // check for required auxiliary DBC files
                 foreach ($reqDBC as $req) {
                     if (!CLISetup::loadDBC($req)) {
                         continue 2;
                     }
                 }
                 // must generate content
                 // PH format: /*setup:<setupFunc>*/
                 $funcOK = true;
                 if (preg_match_all('/\\/\\*setup:([\\w\\-_]+)\\*\\//i', $content, $m)) {
                     foreach ($m[1] as $func) {
                         if (function_exists($func)) {
                             $content = str_replace('/*setup:' . $func . '*/', $func(), $content);
                         } else {
                             $funcOK = false;
                             CLISetup::log('No function for was registered for placeholder ' . $func . '().', CLISetup::LOG_ERROR);
                             if (!array_reduce(get_included_files(), function ($inArray, $itr) use($func) {
                                 return $inArray || false !== strpos($itr, $func);
                             }, false)) {
                                 CLISetup::log('Also, expected include setup/tools/filegen/' . $name . '.func.php was not found.');
                             }
                         }
                     }
                 }
                 if (fWrite($dest, $content)) {
                     CLISetup::log(sprintf(ERR_NONE, CLISetup::bold($destPath . $file)), CLISetup::LOG_OK);
                     if ($content && $funcOK) {
                         $success = true;
                     }
                 } else {
                     CLISetup::log(sprintf(ERR_WRITE_FILE, CLISetup::bold($destPath . $file)), CLISetup::LOG_ERROR);
                 }
                 fClose($dest);
             } else {
                 CLISetup::log(sprintf(ERR_CREATE_FILE, CLISetup::bold($destPath . $file)), CLISetup::LOG_ERROR);
             }
         } else {
             CLISetup::log(sprintf(ERR_READ_FILE, CLISetup::bold(FileGen::$tplPath . $file . '.in')), CLISetup::LOG_ERROR);
         }
     } else {
         if (!empty(self::$datasets[$key])) {
             if (function_exists($key)) {
                 // check for required auxiliary DBC files
                 foreach ($reqDBC as $req) {
                     if (!CLISetup::loadDBC($req)) {
                         return false;
                     }
                 }
                 $success = $key($updateIds);
             } else {
                 CLISetup::log(' - subscript \'' . $key . '\' not defined in included file', CLISetup::LOG_ERROR);
             }
         }
     }
     set_time_limit(FileGen::$defaultExecTime);
     // reset to default for the next script
     return $success;
 }
开发者ID:aikon-com-cn,项目名称:aowow,代码行数:77,代码来源:fileGen.class.php


示例12: subStr

    if (!$cidnum) {
        $callerid = $firstname_abbr . $user['lastname'] . ' <' . $from_num_effective . '>';
    } else {
        $callerid = $firstname_abbr . $user['lastname'] . ' <' . ($cidnum ? $cidnum : $from_num_effective) . '>';
    }
} else {
    $callerid = 'Anonymous <anonymous>';
}
if (!$is_foreign) {
    //FIXME? - is this code correct for numbers in the same area?
    $to_num = subStr($to_num_obj->dial, 0, 1) === '0' ? '0' . $to_num_obj->dial : $to_num_obj->dial;
    $from_num_dial = subStr($from_num_effective_obj->dial, 0, 1) === '0' ? '0' . $from_num_effective_obj->dial : $from_num_effective_obj->dial;
    $call = "Channel: Local/urldial-" . $from_num_dial . "@to-internal-users-self\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: urldial\n" . "Extension: {$prvPrefix}{$to_num}\n" . "Callerid: Rufaufbau <call>\n" . "Setvar: __user_id=" . $user['id'] . "\n" . "Setvar: __user_name=" . $user['ext'] . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __saved_callerid=" . $callerid . "\n" . "Setvar: __callfile_from_user=" . $user['ext'] . "\n";
    //echo $call;
    $filename = '/tmp/gs-' . $user['id'] . '-' . _pack_int(time()) . rand(100, 999) . '.call';
    $cf = @fOpen($filename, 'wb');
    if (!$cf) {
        gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
        die_error('Failed to write call file.');
    }
    @fWrite($cf, $call, strLen($call));
    @fClose($cf);
    @chmod($filename, 0666);
    $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        $our_host_ids = @gs_get_listen_to_ids();
        if (!is_array($our_host_ids)) {
            $our_host_ids = array();
        }
        $user_is_on_this_host = in_array($user['host_id'], $our_host_ids);
    } else {
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:call-init-2.php


示例13: buildlanguage

 /**
  * build language files from database
  *
  * @param	boolean	$force
  */
 public static function buildlanguage($force = false)
 {
     $availableLanguages = array("de", "en");
     foreach ($availableLanguages as $languageID => $languageCode) {
         $file = DNS_DIR . "/lang/" . $languageCode . ".lang.php";
         if (!file_exists($file) || filemtime($file) + 86400 < time() || $force === true) {
             if (file_exists($file)) {
                 @unlink($file);
             }
             @touch($file);
             $items = self::getDB()->query("select * from dns_language where languageID = ?", array($languageID));
             $content = "<?php\n/**\n* language: " . $languageCode . "\n* encoding: UTF-8\n* generated at " . gmdate("r") . "\n* \n* DO NOT EDIT THIS FILE\n*/\n";
             $content .= "\$lang = array();\n";
             while ($row = self::getDB()->fetch_array($items)) {
                 print_r($row);
                 $content .= "\$lang['" . $row['languageItem'] . "'] = '" . str_replace("\$", '$', $row['languageValue']) . "';\n";
             }
             $handler = fOpen($file, "a+");
             fWrite($handler, $content);
             fClose($handler);
         }
     }
 }
开发者ID:cengjing,项目名称:Domain-Control-Panel,代码行数:28,代码来源:DNS.class.php


示例14: start

 public function start()
 {
     $this->DumpFile = fOpen($this->FileName, "a");
 }
开发者ID:ljarray,项目名称:dbpedia,代码行数:4,代码来源:NTripleDumpDestination.php


示例15: gs_callwaiting_activate

function gs_callwaiting_activate($user, $active)
{
    if (!preg_match('/^[a-z0-9\\-_.]+$/', $user)) {
        return new GsError('User must be alphanumeric.');
    }
    $active = !!$active;
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user_id
    #
    $user_id = $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($user) . '\'');
    if (!$user_id) {
        return new GsError('Unknown user.');
    }
    # get user_ext
    $user_ext = $db->executeGetOne('SELECT `s`.`name` `ext`
FROM
	`users` `u` JOIN
	`ast_sipfriends` `s` ON (`s`.`_user_id`=`u`.`id`)
WHERE `u`.`user`=\'' . $db->escape($user) . '\'');
    if (!$user_ext) {
        return new GsError('Unknown user.');
    }
    # (de)activate
    #
    $num = $db->executeGetOne('SELECT COUNT(*) FROM `callwaiting` WHERE `user_id`=' . $user_id);
    if ($num < 1) {
        $ok = $db->execute('INSERT INTO `callwaiting` (`user_id`, `active`) VALUES (' . $user_id . ', 0)');
    } else {
        $ok = true;
    }
    $ok = $ok && $db->execute('UPDATE `callwaiting` SET `active`=' . (int) $active . ' WHERE `user_id`=' . $user_id);
    if (!$ok) {
        return new GsError('Failed to set call waiting.');
    }
    $call = "Channel: local/toggle@toggle-cwait-hint\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: toggle-cwait-hint\n" . "Extension: toggle\n" . "Callerid: {$user} <Toggle>\n" . "Setvar: __user_id=" . $user_id . "\n" . "Setvar: __user_name=" . $user_ext . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __callfile_from_user=" . $user_ext . "\n" . "Setvar: __record_file=" . $filename . "\n";
    $filename = '/tmp/gs-' . $user_id . '-' . time() . '-' . rand(10000, 99999) . '.call';
    $cf = @fOpen($filename, 'wb');
    if (!$cf) {
        gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
        return new GsError('Failed to write call file.');
    }
    @fWrite($cf, $call, strLen($call));
    @fClose($cf);
    @chmod($filename, 0666);
    $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        $our_host_ids = @gs_get_listen_to_ids();
        if (!is_array($our_host_ids)) {
            $our_host_ids = array();
        }
        $user_is_on_this_host = in_array($_SESSION['sudo_user']['info']['host_id'], $our_host_ids);
    } else {
        $user_is_on_this_host = true;
    }
    if ($user_is_on_this_host) {
        # the Asterisk of this user and the web server both run on this host
        $err = 0;
        $out = array();
        @exec('sudo mv ' . qsa($filename) . ' ' . qsa($spoolfile) . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            @unlink($filename);
            gs_log(GS_LOG_WARNING, 'Failed to move call file "' . $filename . '" to "' . $spoolfile . '"');
            return new GsError('Failed to move call file.');
        }
    } else {
        $cmd = 'sudo scp -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa($filename) . ' ' . qsa('root@' . $user['host'] . ':' . $filename);
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        @unlink($filename);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to scp call file "' . $filename . '" to ' . $user['host']);
            return new GsError('Failed to scp call file.');
        }
        //remote_exec( $user['host'], $cmd, 10, $out, $err ); // <-- does not use sudo!
        $cmd = 'sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root ' . qsa($user['host']) . ' ' . qsa('mv ' . qsa($filename) . ' ' . qsa($spoolfile));
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to mv call file "' . $filename . '" on ' . $user['host'] . ' to "' . $spoolfile . '"');
            return new GsError('Failed to mv call file on remote host.');
        }
    }
    # reload phone config
    #
    //$user_name = $db->executeGetOne( 'SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`='. $user_id );
    //@ exec( 'asterisk -rx \'sip notify snom-reboot '. $user_name .'\'' );
    //@ gs_prov_phone_checkcfg_by_user( $user, false ); //FIXME
    return true;
}
开发者ID:rkania,项目名称:GS3,代码行数:94,代码来源:gs_callwaiting_activate.php


示例16: set_time_limit

<?php

set_time_limit(0);
$command = "/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print \$1}'";
$localIP = exec($command);
echo $localIP;
$socket = stream_socket_server("tcp://{$localIP}" . ':8080', $errorNumber, $errorString);
if (!$socket) {
    echo "{$errorNumber} ({$errorString})<br />\n";
} else {
    while ($conn = stream_socket_accept($socket)) {
        $logFile = fOpen('logFile.txt', 'a');
        echo $socket;
        $input = fread($conn, 1024);
        echo gettype($input);
        logFileAppend($input, $logFile);
        handleIncomingTraffic($input, $conn);
        //print_r($input);
        fwrite($conn, '<html><body>hello</body></html>');
        //fclose($conn);
    }
    fclose($socket);
}
function handleIncomingTraffic($HttpRequest, $connection)
{
    if (strpos($HttpRequest, 'addToBotNet') != 0) {
        echo 'added to botnet';
        checkFingerPrint();
    } else {
        fwrite($connection, "200 OK HTTP/1.1\r\n" . "Connection: close\r\n" . "Content-Type: text/html\r\n" . "\r\n" . "<html><body>Hello World!</html> ");
        echo 'other';
开发者ID:panfake,项目名称:phpBotNet,代码行数:31,代码来源:simpleWebServ.php


示例17: execFFMPEG

 function execFFMPEG($i = '', $o = '', $p = '', $pkey = '')
 {
     if ($pkey == '') {
         $pkey = rand();
     }
     $fpath = FFMPEG_PATH;
     if (empty($fpath)) {
         $this->logError('ffmpeg-progressbar: missing ffmpeg path', date("d-m-y") . '.error.log');
         exit('ffmpeg-progressbar: missing ffmpeg path');
     } else {
         if (!file_exists($fpath)) {
             $this->logError('ffmpeg-progressbar: wrong ffmpeg path \'' . FFMPEG_PATH . '\'', date("d-m-y") . '.error.log');
             exit('ffmpeg-progressbar: wrong ffmpeg path \'' . FFMPEG_PATH . '\'');
         }
     }
     if (empty($i)) {
         $this->logError('ffmpeg: missing argument for option \'i\'', date("d-m-y") . '.error.log');
         exit('ffmpeg: missing argument for option \'i\'');
     } elseif (!file_exists($i)) {
         $this->logError($i . ':  no such file or directory', date("d-m-y") . '.error.log');
         exit($i . ':  no such file or directory');
     } elseif (empty($o)) {
         $this->logError('ffmpeg: At least one output file must be specified', date("d-m-y") . '.error.log');
         exit('ffmpeg: At least one output file must be specified');
     } elseif (file_exists($o)) {
         $this->logError('ffmpeg: File \'' . $o . '\' already exists.', date("d-m-y") . '.error.log');
         exit('ffmpeg: File \'' . $o . '\' already exists.');
     } elseif (empty($p)) {
         $this->logError('ffmpeg: No Param has been specified... use default settings for converting...', date("d-m-y") . '.warn.log');
     } else {
         //Executing FFMPEG
         $handler = fOpen(dirname(__FILE__) . '/../log/' . $pkey . '.ffmpeg.file', "w");
         fWrite($handler, $i . "\n" . $o . "\n" . $p . "\n");
         fClose($handler);
         $this->logError("Sending FFMPEG exec command to " . $_SERVER["HTTP_HOST"] . "...");
         $curdir = getcwd();
         $cmd = " -i '" . $i . "' " . $p . " '" . $o . "' 2> " . $curdir . "/log/" . $pkey . ".ffmpeg";
         $postdata = "cmd=" . $cmd . "&ffmpegpw=" . FFMPEG_PW;
         $fp = fsockopen($_SERVER["HTTP_HOST"], 80, $errno, $errstr, 30);
         fputs($fp, "POST " . dirname($_SERVER["SCRIPT_NAME"]) . "/inc/execFFMPEG.php HTTP/1.0\n");
         fputs($fp, "Host: " . $_SERVER["HTTP_HOST"] . "\n");
         fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
         fputs($fp, "Content-length: " . strlen($postdata) . "\n");
         // Faking User-Agent to Microsoft Internet Explorer 7
         fputs($fp, "User-agent: Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)\n");
         fputs($fp, "Connection: close\n\n");
         fputs($fp, $postdata);
         fclose($fp);
     }
 }
开发者ID:hokten,项目名称:projects,代码行数:50,代码来源:ffmpegprogressbar.class.php


示例18: gs_callforward_activate

function gs_callforward_activate($user, $source, $case, $active)
{
    if (!preg_match('/^[a-z0-9\\-_.]+$/', $user)) {
        return new GsError('User must be alphanumeric.');
    }
    if (!in_array($source, array('internal', 'external'), true)) {
        return new GsError('Source must be internal|external.');
    }
    if (!in_array($case, array('always', 'busy', 'unavail', 'offline'), true)) {
        return new GsError('Case must be always|busy|unavail|offline.');
    }
    if (!in_array($active, array('no', 'std', 'var', 'vml', 'ano', 'trl', 'par'), true)) {
        return new GsError('Active must be no|std|var|vml|ano|trl|par.');
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user_id
    #
    $user_id = $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($user) . '\'');
    if (!$user_id) {
        return new GsError('Unknown user.');
    }
    # get user_ext
    #
    $user_ext = $db->executeGetOne('SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`=\'' . $db->escape($user_id) . '\'');
    if (!$user_ext) {
        return new GsError('Unknown user extension.');
    }
    # check if user has an entry
    #
    $num = $db->executeGetOne('SELECT COUNT(*) FROM `callforwards` WHERE `user_id`=' . $user_id . ' AND `source`=\'' . $db->escape($source) . '\' AND `case`=\'' . $db->escape($case) . '\'');
    if ($num < 1) {
        $ok = $db->execute('INSERT INTO `callforwards` (`user_id`, `source`, `case`, `number_std`, `number_var`, `number_vml`, `active`) VALUES (' . $user_id . ', \'' . $db->escape($source) . '\', \'' . $db->escape($case) . '\', \'\', \'\', \'\', \'no\')');
    } else {
        $ok = true;
    }
    # do not allow time rules if no time rules  are defined
    #
    if ($active == 'trl') {
        $id = (int) $db->executeGetOne('SELECT `_user_id` from `cf_timerules` WHERE `_user_id`=' . $user_id);
        if (!$id) {
            return new GsError('No time rules defined. Cannot activate call forward.');
        }
    } else {
        if ($active == 'par') {
            $id = (int) $db->executeGetOne('SELECT `_user_id` from `cf_parallelcall` WHERE `_user_id`=' . $user_id);
            if (!$id) {
                return new GsError('No parsllel call tragets. Cannot activate call forward.');
            }
        }
    }
    # set state
    #
    $ok = $ok && $db->execute('UPDATE `callforwards` SET
	`active`=\'' . $db->escape($active) . '\'
WHERE
	`user_id`=' . $user_id . ' AND
	`source`=\'' . $db->escape($source) . '\' AND
	`case`=\'' . $db->escape($case) . '\'
LIMIT 1');
    if (!$ok) {
        return new GsError('Failed to set call forwarding status.');
    }
    # do not allow an empty number to be active
    #
    if ($active == 'std' || $active == 'var') {
        $field = 'number_' . $active;
        $number = $db->executeGetOne('SELECT `' . $field . '` FROM `callforwards` WHERE `user_id`=' . $user_id . ' AND `source`=\'' . $db->escape($source) . '\' AND `case`=\'' . $db->escape($case) . '\'');
        if (trim($number) == '') {
            $db->execute('UPDATE `callforwards` SET `active`=\'no\' WHERE `user_id`=' . $user_id . ' AND `source`=\'' . $db->escape($source) . '\' AND `case`=\'' . $db->escape($case) . '\'');
            return new GsError('Number is empty. Cannot activate call forward.');
        }
    }
    if ($case === 'always') {
        $filename = '/tmp/gs-' . $user_id . '-' . time() . '-' . rand(10000, 99999) . '.call';
        $call = "Channel: local/toggle@toggle-cfwd-hint\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: toggle-cfwd-hint\n" . "Extension: toggle\n" . "Callerid: {$user} <Toggle>\n" . "Setvar: __user_id=" . $user_id . "\n" . "Setvar: __user_name=" . $user_ext . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __callfile_from_user=" . $user_ext . "\n" . "Setvar: __record_file=" . $filename . "\n";
        $cf = @fOpen($filename, 'wb');
        if (!$cf) {
            gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
            return new GsError('Failed to write call file.');
        }
        @fWrite($cf, $call, strLen($call));
        @fClose($cf);
        @chmod($filename, 0666);
        $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
        if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
            $our_host_ids = @gs_get_listen_to_ids();
            if (!is_array($our_host_ids)) {
                $our_host_ids = array();
            }
            $user_is_on_this_host = in_array($_SESSION['sudo_user']['info']['host_id'], $our_host_ids);
        } else {
            $user_is_on_this_host = true;
        }
        if ($user_is_on_this_host) {
            # the Asterisk of this user and the web server both run on this host
//.........这里部分代码省略.........
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:101,代码来源:gs_callforward_activate.php


示例19: writeFile

 public static function writeFile($file, $content)
 {
     $success = false;
     if ($handle = @fOpen($file, "w")) {
         if (fWrite($handle, $content)) {
             $success = true;
             self::log(sprintf(ERR_NONE, self::bold($file)), self::LOG_OK);
         } else {
             self::log(sprintf(ERR_WRITE_FILE, self::bold($file)), self::LOG_ERROR);
         }
         fClose($handle);
     } else {
         self::log(sprintf(ERR_CREATE_FILE, self::bold($file)), self::LOG_ERROR);
     }
     if ($success) {
         @chmod($file, Util::FILE_ACCESS);
     }
     return $success;
 }
开发者ID:saqar,项目名称:aowow,代码行数:19,代码来源:CLISetup.class.php


示例20: shReadFile

function shReadFile($shFileName, $asString = false)
{
    $ret = array();
    if (is_readable($shFileName)) {
        $shFile = fOpen($shFileName, 'r');
        do {
            $shRead = fgets($shFile, 1024);
            if (!empty($shRead) && JString::substr($shRead, 0, 1) != '#') {
                $ret[] = JString::trim(stripslashes($shRead));
            }
        } while (!feof($shFile));
        fclose($shFile);
    }
    if ($asString) {
        $ret = implode("\n", $ret);
    }
    return $ret;
}
开发者ID:sangkasi,项目名称:joomla,代码行数:18,代码来源:sh404sef.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP fRp函数代码示例发布时间:2022-05-15
下一篇:
PHP fLabelCell函数代码示例发布时间: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