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


PHP SaveFile函数代码示例

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


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

示例1: php_syntax_error

/**
 * Summary of php_syntax_error
 * @param mixed $code Code
 * @return bool|string
 */
function php_syntax_error($code)
{
    $code .= "\n echo 'zzz';";
    $code = '<?' . $code . '?>';
    //echo DOC_ROOT;exit;
    $fileName = md5(time() . rand(0, 10000)) . '.php';
    $filePath = DOC_ROOT . '/cached/' . $fileName;
    SaveFile($filePath, $code);
    if (substr(php_uname(), 0, 7) == "Windows") {
        $cmd = DOC_ROOT . '/../server/php/php -l ' . $filePath;
    } else {
        $cmd = 'php -l ' . $filePath;
    }
    exec($cmd, $out);
    unlink($filePath);
    if (preg_match('/no syntax errors detected/is', $out[0])) {
        return false;
    } elseif (!trim(implode("\n", $out))) {
        return false;
    } else {
        $res = implode("\n", $out);
        $res = preg_replace('/Errors parsing.+/is', '', $res);
        return trim($res) . "\n";
    }
}
开发者ID:cdkisa,项目名称:majordomo,代码行数:30,代码来源:php_check.class.php

示例2: GoogleTTS

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
  function GoogleTTS($message, $lang='ru') {
   $filename=md5($message).'.mp3';

   if (file_exists(ROOT.'cached/voice/'.$filename)) {
    @touch(ROOT.'cached/voice/'.$filename);
    return ROOT.'cached/voice/'.$filename;
   }

   $base_url = 'http://translate.google.com/translate_tts?';
   $qs = http_build_query(array(
    'tl' => $lang,
    'ie' => 'UTF-8',
    'q' => $message
   ));
   $contents = file_get_contents($base_url . $qs);
   if ($contents) {
    if (!is_dir(ROOT.'cached/voice')) {
     @mkdir(ROOT.'cached/voice', 0777);
    }
    SaveFile(ROOT.'cached/voice/'.$filename, $contents);
    return ROOT.'cached/voice/'.$filename;
   } else {
    return 0;
   }
  }
开发者ID:novozhenets,项目名称:majordomo,代码行数:32,代码来源:tts.class.php

示例3: YandexTTS

/**
 * YandexTTS
 * @param mixed $message Message
 * @param mixed $lang    Language (default 'ru-RU')
 * @return int|string
 */
function YandexTTS($message, $lang = 'ru-RU')
{
    $filename = md5($message) . '_ya.mp3';
    $cachedVoiceDir = ROOT . 'cached/voice';
    $cachedFileName = $cachedVoiceDir . '/' . $filename;
    $base_url = 'https://tts.voicetech.yandex.net/generate?';
    if (file_exists($cachedFileName)) {
        @touch($cachedFileName);
        return $cachedFileName;
    }
    $qs = http_build_query(array('format' => 'mp3', 'lang' => $lang, 'speaker' => 'omazh', 'key' => SETTINGS_YANDEX_TTS_KEY, 'text' => $message));
    try {
        $contents = file_get_contents($base_url . $qs);
    } catch (Exception $e) {
        registerError('yandextts', get_class($e) . ', ' . $e->getMessage());
    }
    if (isset($contents)) {
        CreateDir($cachedVoiceDir);
        SaveFile($cachedFileName, $contents);
        return $cachedFileName;
    }
    return 0;
}
开发者ID:cdkisa,项目名称:majordomo,代码行数:29,代码来源:tts.class.php

示例4: YandexTTS

function YandexTTS($message, $lang = 'ru')
{
    $filename = md5($message) . '_ya.mp3';
    if (file_exists(ROOT . 'cached/voice/' . $filename)) {
        @touch(ROOT . 'cached/voice/' . $filename);
        return ROOT . 'cached/voice/' . $filename;
    }
    $base_url = 'https://tts.voicetech.yandex.net/generate?';
    $qs = http_build_query(array('format' => 'mp3', 'lang' => 'ru-RU', 'speaker' => 'omazh', 'key' => SETTINGS_YANDEX_TTS_KEY, 'text' => $message));
    try {
        $contents = file_get_contents($base_url . $qs);
    } catch (Exception $e) {
        registerError('yandextts', get_class($e) . ', ' . $e->getMessage());
    }
    if ($contents) {
        if (!is_dir(ROOT . 'cached/voice')) {
            @mkdir(ROOT . 'cached/voice', 0777);
        }
        SaveFile(ROOT . 'cached/voice/' . $filename, $contents);
        return ROOT . 'cached/voice/' . $filename;
    } else {
        return 0;
    }
}
开发者ID:NioFBI,项目名称:majordomo,代码行数:24,代码来源:tts.class.php

示例5: DebMes

/**
 * Write Exceptions
 * @param $errorMessage string Exception message
 * @param $logLevel string exception level, default=debug
 */
function DebMes($errorMessage, $logLevel = "debug")
{
    // DEBUG MESSAGE LOG
    if (!is_dir(ROOT . 'debmes')) {
        mkdir(ROOT . 'debmes', 0777);
    }
    if (!file_exists(ROOT . 'debmes/' . date('Y-m-d') . '.log')) {
        SaveFile(ROOT . 'debmes/' . date('Y-m-d') . '.log', "Added " . date('Y-m-d H:i:s' . "\n"));
    }
    $log = Logger::getRootLogger();
    if (defined('SETTINGS_LOGGER_DESTINATION')) {
        $errorDestination = strtolower(SETTINGS_LOGGER_DESTINATION);
        if ($errorDestination == "database") {
            $log = Logger::getLogger('dblog');
        }
        if ($errorDestination == "both") {
            $log = Logger::getLogger('db_and_file');
        }
    }
    //$dbLog = Logger::getLogger('dblog');
    switch ($logLevel) {
        case "trace":
            $log->trace($errorMessage);
            //$dbLog->trace($errorMessage);
            break;
        case "fatal":
            $log->fatal($errorMessage);
            //$dbLog->fatal($errorMessage);
            break;
        case "error":
            $log->error($errorMessage);
            //$dbLog->error($errorMessage);
            break;
        case "warn":
            $log->warn($errorMessage);
            //$dbLog->warn($errorMessage);
            break;
        case "info":
            $log->info($errorMessage);
            //$dbLog->info($errorMessage);
            break;
        default:
            $log->debug($errorMessage);
            //$dbLog->debug($errorMessage);
    }
}
开发者ID:NioFBI,项目名称:majordomo,代码行数:51,代码来源:general.class.php

示例6: header

        }
    }
}
// END: language constants
if (!headers_sent()) {
    header("HTTP/1.0: 200 OK\n");
    header('Content-Type: text/html; charset=utf-8');
}
function echobig($string, $bufferSize = 8192)
{
    $chars = strlen($string) - 1;
    for ($start = 0; $start <= $chars; $start += $bufferSize) {
        echo substr($string, $start, $bufferSize);
    }
}
startMeasure('final_echo');
ob_start("ob_gzhandler");
// should be un-commented for production server
echobig($result);
endMeasure('final_echo', 1);
if ($cache_filename != '' && $cached_result == '') {
    SaveFile(ROOT . 'cached/' . $cache_filename, $result);
}
$session->save();
// closing database connection
$db->Disconnect();
// end calculation of execution time
endMeasure('TOTAL');
// print performance report
performanceReport();
// ob_end_flush();
开发者ID:vasvlad,项目名称:majordomo,代码行数:31,代码来源:index.php

示例7: upload


//.........这里部分代码省略.........
     if ($restore != '') {
         //$file=ROOT.'saverestore/'.$restore;
         $file = $restore;
     } elseif ($file != '') {
         copy($file, ROOT . 'saverestore/' . $file_name);
         //$file=ROOT.'saverestore/'.$file_name;
         $file = $file_name;
     }
     umask(0);
     @mkdir(ROOT . 'saverestore/temp', 0777);
     if ($file != '') {
         // && mkdir(ROOT.'saverestore/temp', 0777)
         chdir(ROOT . 'saverestore/temp');
         if (substr(php_uname(), 0, 7) == "Windows") {
             // for windows only
             exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
             exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
             //@unlink('../'.str_replace('.tgz', '.tar', $file));
         } else {
             exec('tar xzvf ../' . $file, $output, $res);
         }
         @unlink(ROOT . 'saverestore/temp' . $folder . '/config.php');
         //print_r($output);exit;
         if (1) {
             chdir('../../');
             if ($this->method == 'direct') {
                 // UPDATING FILES DIRECTLY
                 $this->copyTree(ROOT . 'saverestore/temp' . $folder, ROOT, 1);
                 // restore all files
             } elseif ($this->method == 'ftp') {
                 // UPDATING FILES BY FTP
                 $conn_id = @ftp_connect($this->config['FTP_HOST']);
                 if ($conn_id) {
                     $login_result = @ftp_login($conn_id, $this->config['FTP_USERNAME'], $this->config['FTP_PASSWORD']);
                     if ($login_result) {
                         $systyp = ftp_systype($conn_id);
                         if (@ftp_chdir($conn_id, $this->config['FTP_FOLDER'] . 'saverestore')) {
                             @ftp_chdir($conn_id, $this->config['FTP_FOLDER']);
                             // ok, we're in. updating!
                             $log = '';
                             $files = $this->getLocalFilesTree(ROOT . 'saverestore/temp' . $folder, '.+', 'installed', $log, 0);
                             $total = count($files);
                             $modules_processed = array();
                             for ($i = 0; $i < $total; $i++) {
                                 $file = $files[$i];
                                 $file['REMOTE_FILENAME'] = preg_replace('/^' . preg_quote(ROOT . 'saverestore/temp/' . $folder, '/') . '/is', $this->config['FTP_FOLDER'], $file['FILENAME']);
                                 $file['REMOTE_FILENAME'] = str_replace('//', '/', $file['REMOTE_FILENAME']);
                                 $res_f = $this->ftpput($conn_id, $file['REMOTE_FILENAME'], $file['FILENAME'], FTP_BINARY);
                                 if (preg_match('/\\.class\\.php$/', basename($file['FILENAME'])) && !$modules_processed[dirname($file['REMOTE_FILENAME'])]) {
                                     // if this a module then we should update attributes for folder and remove 'installed' file
                                     $modules_processed[dirname($file['REMOTE_FILENAME'])] = 1;
                                     @ftp_site($conn_id, "CHMOD 0777 " . dirname($file['REMOTE_FILENAME']));
                                     @ftp_delete($conn_id, dirname($file['REMOTE_FILENAME']) . '/installed');
                                 }
                             }
                         } else {
                             $out['FTP_ERR'] = 'Incorrect folder (' . $ftp_folder . ')';
                         }
                     } else {
                         $out['FTP_ERR'] = 'Incorrect username/password';
                     }
                     ftp_close($conn_id);
                 } else {
                     $out['FTP_ERR'] = 'Cannot connect to host (' . $ftp_host . ')';
                     $this->redirect("?err_msg=" . urlencode($out['FTP_ERR']));
                 }
             }
             //if (is_dir(ROOT.'saverestore/temp/'.$folder.'modules')) {
             // code restore
             $source = ROOT . 'modules';
             if ($dir = @opendir($source)) {
                 while (($file = readdir($dir)) !== false) {
                     if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') {
                         // && !file_exists($source."/".$file."/installed")
                         @unlink(ROOT . "modules/" . $file . "/installed");
                     }
                 }
             }
             @unlink(ROOT . "modules/control_modules/installed");
             @SaveFile(ROOT . 'reboot', 'updated');
             //}
             if (file_exists(ROOT . 'saverestore/temp' . $folder . '/dump.sql')) {
                 // data restore
                 $this->restoredatabase(ROOT . 'saverestore/temp' . $folder . '/dump.sql');
             }
             $this->config['LATEST_UPDATED_ID'] = $out['LATEST_ID'];
             $this->saveConfig();
             $this->redirect("?mode=clear&ok_msg=" . urlencode("Updates Installed!"));
         }
     }
     /*
          require 'Tar.php';
          $tar_object = new Archive_Tar($file);
          if ($tar_object->extract(ROOT.'skins/'.$basename)) {
           $out['OK_EXT']=1;
          } else {
           $out['ERR_FORMAT']=1;
          }
     */
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:101,代码来源:saverestore.class.php

示例8: apiCall

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function apiCall($command)
 {
     $this->getConfig();
     $command = preg_replace('/^\\//', '', $command);
     $url = $this->config['ZWAVE_API_URL'] . $command;
     $cookie_file = ROOT . 'cached/zwave_cookie.txt';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json, text/javascript', 'Content-Type: application/json'));
     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
     curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
     $result = curl_exec($ch);
     curl_close($ch);
     if (preg_match('/307 Temporary Redirect/is', $result)) {
         if ($this->connect()) {
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json, text/javascript', 'Content-Type: application/json'));
             curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
             curl_setopt($ch, CURLOPT_URL, $url);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
             curl_setopt($ch, CURLOPT_TIMEOUT, 30);
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
             $result = curl_exec($ch);
             curl_close($ch);
         } else {
             return false;
         }
     }
     SaveFile(ROOT . 'cached/zwave_api.txt', $url . "\n\n" . $result);
     return json_decode($result);
 }
开发者ID:sergejey,项目名称:majordomo-zwave,代码行数:42,代码来源:zwave.class.php

示例9: upload

 function upload(&$out)
 {
     set_time_limit(0);
     global $restore;
     global $file;
     global $file_name;
     global $folder;
     if (!$folder) {
         if (substr(php_uname(), 0, 7) == "Windows") {
             $folder = '/.';
         } else {
             $folder = '/';
         }
     } else {
         $folder = '/' . $folder;
     }
     if ($restore != '') {
         $file = $restore;
     } elseif ($file != '') {
         copy($file, ROOT . 'saverestore/' . $file_name);
         $file = $file_name;
     }
     umask(0);
     @mkdir(ROOT . 'saverestore/temp', 0777);
     if ($file != '') {
         // && mkdir(ROOT.'saverestore/temp', 0777)
         chdir(ROOT . 'saverestore/temp');
         if (substr(php_uname(), 0, 7) == "Windows") {
             // for windows only
             exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
             //echo DOC_ROOT.'/tar xvf ../'.str_replace('.tgz', '.tar', $file);exit;
             exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
         } else {
             exec('tar xzvf ../' . $file, $output, $res);
         }
         $x = 0;
         $dir = opendir('./');
         while (($filec = readdir($dir)) !== false) {
             if ($filec == '.' || $filec == '..') {
                 continue;
             }
             if (is_Dir($filec)) {
                 $latest_dir = $filec;
             } elseif (is_File($filec)) {
                 $latest_file = $filec;
             }
             $x++;
         }
         if ($x == 1 && $latest_dir) {
             $folder = '/' . $latest_dir;
         }
         @unlink(ROOT . 'saverestore/temp' . $folder . '/config.php');
         @unlink(ROOT . 'saverestore/temp' . $folder . '/README.md');
         chdir('../../');
         // UPDATING FILES DIRECTLY
         $this->copyTree(ROOT . 'saverestore/temp' . $folder, ROOT, 1);
         // restore all files
         $source = ROOT . 'modules';
         if ($dir = @opendir($source)) {
             while (($file = readdir($dir)) !== false) {
                 if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') {
                     // && !file_exists($source."/".$file."/installed")
                     @unlink(ROOT . "modules/" . $file . "/installed");
                 }
             }
         }
         @unlink(ROOT . "modules/control_modules/installed");
         @SaveFile(ROOT . 'reboot', 'updated');
         global $name;
         global $version;
         $rec = SQLSelectOne("SELECT * FROM plugins WHERE MODULE_NAME LIKE '" . DBSafe($name) . "'");
         $rec['MODULE_NAME'] = $name;
         $rec['CURRENT_VERSION'] = $version;
         $rec['IS_INSTALLED'] = 1;
         $rec['LATEST_UPDATE'] = date('Y-m-d H:i:s');
         if ($rec['ID']) {
             SQLUpdate('plugins', $rec);
         } else {
             SQLInsert('plugins', $rec);
         }
         $this->redirect("?mode=clear&ok_msg=" . urlencode("Updates Installed!"));
     }
 }
开发者ID:vasvlad,项目名称:majordomo,代码行数:83,代码来源:market.class.php

示例10: checkAllHosts

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function checkAllHosts($limit = 1000)
 {
     // ping hosts
     $pings = SQLSelect("SELECT * FROM pinghosts WHERE CHECK_NEXT<=NOW() ORDER BY CHECK_NEXT LIMIT " . $limit);
     $total = count($pings);
     for ($i = 0; $i < $total; $i++) {
         $host = $pings[$i];
         echo "Checking " . $host['HOSTNAME'] . "\n";
         $online_interval = $host['ONLINE_INTERVAL'];
         if (!$online_interval) {
             $online_interval = 60;
         }
         $offline_interval = $host['OFFLINE_INTERVAL'];
         if (!$offline_interval) {
             $offline_interval = $online_interval;
         }
         if ($host['STATUS'] == '1') {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $online_interval);
         } else {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $offline_interval);
         }
         SQLUpdate('pinghosts', $host);
         $online = 0;
         // checking
         if (!$host['TYPE']) {
             //ping host
             $online = ping(processTitle($host['HOSTNAME']));
         } else {
             //web host
             $online = getURL(processTitle($host['HOSTNAME']), 0);
             SaveFile("./cached/host_" . $host['ID'] . '.html', $online);
             if ($host['SEARCH_WORD'] != '' && !is_integer(strpos($online, $host['SEARCH_WORD']))) {
                 $online = 0;
             }
             if ($online) {
                 $online = 1;
             }
         }
         if ($online) {
             $new_status = 1;
         } else {
             $new_status = 2;
         }
         $old_status = $host['STATUS'];
         if ($host['COUNTER_REQUIRED']) {
             $old_status_expected = $host['STATUS_EXPECTED'];
             $host['STATUS_EXPECTED'] = $new_status;
             if ($old_status_expected != $host['STATUS_EXPECTED']) {
                 $host['COUNTER_CURRENT'] = 0;
                 $host['LOG'] = date('Y-m-d H:i:s') . ' tries counter reset (status: ' . $host['STATUS_EXPECTED'] . ')' . "\n" . $host['LOG'];
             } elseif ($host['STATUS'] != $host['STATUS_EXPECTED']) {
                 $host['COUNTER_CURRENT']++;
                 $host['LOG'] = date('Y-m-d H:i:s') . ' tries counter increased to ' . $host['COUNTER_CURRENT'] . ' (status: ' . $host['STATUS_EXPECTED'] . ')' . "\n" . $host['LOG'];
             }
             if ($host['COUNTER_CURRENT'] >= $host['COUNTER_REQUIRED']) {
                 $host['STATUS'] = $host['STATUS_EXPECTED'];
                 $host['COUNTER_CURRENT'] = 0;
             } else {
                 $interval = min($online_interval, $offline_interval, 20);
                 $online_interval = $interval;
                 $offline_interval = $interval;
             }
         } else {
             $host['STATUS'] = $new_status;
             $host['STATUS_EXPECTED'] = $host['STATUS'];
             $host['COUNTER_CURRENT'] = 0;
         }
         $host['CHECK_LATEST'] = date('Y-m-d H:i:s');
         if ($host['LINKED_OBJECT'] != '' && $host['LINKED_PROPERTY'] != '') {
             setGlobal($host['LINKED_OBJECT'] . '.' . $host['LINKED_PROPERTY'], $host['STATUS']);
         }
         if ($host['STATUS'] == '1') {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $online_interval);
         } else {
             $host['CHECK_NEXT'] = date('Y-m-d H:i:s', time() + $offline_interval);
         }
         if ($old_status != $host['STATUS']) {
             if ($host['STATUS'] == 2) {
                 $host['LOG'] .= date('Y-m-d H:i:s') . ' Host is offline' . "\n";
             } elseif ($host['STATUS'] == 1) {
                 $host['LOG'] .= date('Y-m-d H:i:s') . ' Host is online' . "\n";
             }
             $tmp = explode("\n", $host['LOG']);
             $total = count($tmp);
             if ($total > 50) {
                 $tmp = array_slice($tmp, 0, 50);
                 $host['LOG'] = implode("\n", $tmp);
             }
         }
         SQLUpdate('pinghosts', $host);
         if ($old_status != $host['STATUS'] && $old_status != 0) {
             // do some status change actions
             $run_script_id = 0;
//.........这里部分代码省略.........
开发者ID:cdkisa,项目名称:majordomo,代码行数:101,代码来源:pinghosts.class.php

示例11: getURL

/**
* Title
*
* Description
*
* @access public
*/
 function getURL($url, $cache=600, $username='', $password='') {
  $cache_file=ROOT.'cached/urls/'.preg_replace('/\W/is', '_', str_replace('http://', '', $url)).'.html';
  if (!$cache || !is_file($cache_file) || ((time()-filemtime($cache_file))>$cache)) {
   //download
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
   if ($username!='') {
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
    curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password); 
   }
   $result = curl_exec($ch);
   if ($cache>0) {
    if (!is_dir(ROOT.'cached/urls')) {
     @mkdir(ROOT.'cached/urls', 0777);
    }
    SaveFile($cache_file, $result);
   }
  } else {
   $result=LoadFile($cache_file);
  }
  return $result;
 }
开发者ID:novozhenets,项目名称:majordomo,代码行数:31,代码来源:common.class.php

示例12: curl_setopt

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
    $result = curl_exec($ch);
    curl_close($ch);
    SaveFile(ROOT . 'cached/zwave_login.txt', $result);
    //RECHECK
    $url = $this->config['ZWAVE_API_URL'];
    $fields = array();
    foreach ($fields as $key => $value) {
        $fields_string .= $key . '=' . urlencode($value) . '&';
    }
    rtrim($fields_string, '&');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, count($fields));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
    $result = curl_exec($ch);
    curl_close($ch);
    SaveFile(ROOT . 'cached/zwave_recheck.txt', $result);
    if (preg_match('/307 Temporary Redirect/is', $result)) {
        return false;
    }
}
return 1;
开发者ID:vasvlad,项目名称:majordomo,代码行数:31,代码来源:zwave_connect.inc.php

示例13: upload

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function upload(&$out)
 {
     set_time_limit(0);
     global $restore;
     global $file;
     global $file_name;
     global $folder;
     if (!$folder) {
         $folder = IsWindowsOS() ? '/.' : '/';
     } else {
         $folder = '/' . $folder;
     }
     if ($restore != '') {
         //$file=ROOT.'saverestore/'.$restore;
         $file = $restore;
     } elseif ($file != '') {
         copy($file, ROOT . 'saverestore/' . $file_name);
         //$file=ROOT.'saverestore/'.$file_name;
         $file = $file_name;
     }
     umask(0);
     @mkdir(ROOT . 'saverestore/temp', 0777);
     if ($file != '') {
         // && mkdir(ROOT.'saverestore/temp', 0777)
         chdir(ROOT . 'saverestore/temp');
         if (IsWindowsOS()) {
             // for windows only
             exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
             exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
             //@unlink('../'.str_replace('.tgz', '.tar', $file));
         } else {
             exec('tar xzvf ../' . $file, $output, $res);
         }
         @unlink(ROOT . 'saverestore/temp' . $folder . '/config.php');
         //print_r($output);exit;
         chdir('../../');
         $ignores = SQLSelect("SELECT * FROM ignore_updates ORDER BY NAME");
         $total = count($ignores);
         for ($i = 0; $i < $total; $i++) {
             $name = $ignores[$i]['NAME'];
             if (is_dir(ROOT . 'saverestore/temp/modules/' . $name)) {
                 $this->removeTree(ROOT . 'saverestore/temp/modules/' . $name);
             }
             if (is_dir(ROOT . 'saverestore/temp/templates/' . $name)) {
                 $this->removeTree(ROOT . 'saverestore/temp/templates/' . $name);
             }
         }
         // UPDATING FILES DIRECTLY
         $this->copyTree(ROOT . 'saverestore/temp' . $folder, ROOT, 1);
         // restore all files
         //if (is_dir(ROOT.'saverestore/temp/'.$folder.'modules')) {
         // code restore
         $source = ROOT . 'modules';
         if ($dir = @opendir($source)) {
             while (($file = readdir($dir)) !== false) {
                 if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') {
                     // && !file_exists($source."/".$file."/installed")
                     @unlink(ROOT . "modules/" . $file . "/installed");
                 }
             }
         }
         @unlink(ROOT . "modules/control_modules/installed");
         @SaveFile(ROOT . 'reboot', 'updated');
         //}
         if (file_exists(ROOT . 'saverestore/temp' . $folder . '/dump.sql')) {
             // data restore
             $this->restoredatabase(ROOT . 'saverestore/temp' . $folder . '/dump.sql');
         }
         $this->config['LATEST_UPDATED_ID'] = $out['LATEST_ID'];
         setGlobal('UpdateVersion', $this->config['LATEST_UPDATED_ID']);
         $this->saveConfig();
         global $with_extensions;
         $this->redirect("?mode=clear&ok_msg=" . urlencode("Updates Installed!") . "&with_extensions=" . $with_extensions);
     }
     /*
          require 'Tar.php';
          $tar_object = new Archive_Tar($file);
          if ($tar_object->extract(ROOT.'skins/'.$basename)) {
           $out['OK_EXT']=1;
          } else {
           $out['ERR_FORMAT']=1;
          }
     */
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:91,代码来源:saverestore.class.php

示例14: RoundedCorners

                 * Скругленные углы
                 */
                $file = RoundedCorners($T, $_GET['file'], $size, 10, 10);
                break;
            case 'fx':
                /**
                 * Фиксированный ресайз
                 */
                $file = FixedResize($T, $_GET['file'], $size);
                break;
            default:
                header("HTTP/1.0 404 Not Found");
                die;
                break;
        }
        SaveFile($T, $file);
    } catch (Exception $e) {
        header("HTTP/1.0 404 Not Found");
        die;
    }
} else {
    header("HTTP/1.0 404 Not Found");
    die;
}
/**
 * Обычный ресайз
 *
 * Стандартное изменение размера картинки, по двум сторонам
 * или только по ширине, если параметр $size[1] не будет задан.
 *
 * @param   Object    $T (phpThumb)
开发者ID:Rpsl,项目名称:iCacher,代码行数:31,代码来源:iCacher.php

示例15: fopen

    } else {
        $shorttext = $text;
    }
    $handle = fopen($path, "w");
    fwrite($handle, $shorttext);
    fclose($handle);
}
$wikiword = $HTTP_GET_VARS["wikiword"];
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    ?>
asdf

<?php 
} else {
    $input = $GLOBALS['HTTP_RAW_POST_DATA'];
    $value = $json->decode($input);
    class Response
    {
        var $status;
        var $remoteentry;
        var $remoteversion;
    }
    $response = new Response();
    $response->remoteentry = $value->entry;
    $response->remoteversion = 0;
    $response->status = "failed";
    SaveFile($wikiword, $value->entry);
    $response->status = "saved";
    $output = $json->encode($response);
    print $output;
}
开发者ID:jcouv,项目名称:jcouv.github.io,代码行数:31,代码来源:SaveEntry.php


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