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

PHP getFileContents函数代码示例

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

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



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

示例1: gzip_compress_file

/**
 * Compresses a file (creates a gzipped file)
 *
 * @param string $srcName the source file
 * @param string $dstName the destination file name (the compressed one)
 *
 * @return bool returns true on success, false else
 **/
function gzip_compress_file($srcName, $dstName)
{
    $success = false;
    $data = getFileContents($srcName);
    if ($data != "") {
        $success = gzip_writeToFile($dstName, $data);
    }
    return $success;
}
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:17,代码来源:files.inc.php


示例2: importTangram

function importTangram($files, $returnFile = true)
{
    global $MATCHED, $DEBUG, $IMPORTED;
    $output = "";
    if (is_string($files)) {
        $files = array($files);
    } else {
        if (!is_array($files)) {
            return $output;
        }
    }
    if ($DEBUG) {
        var_dump($files);
    }
    foreach ($files as $file) {
        if (strrpos($file, '*')) {
            $output .= importTangram(getPackage(str_replace(array(".", '*'), array('/', ''), $file)));
        } elseif (in_array($file, $IMPORTED)) {
            continue;
        } else {
            $IMPORTED[] = $file;
            $file = str_replace(".", '/', $file) . ".js";
            if ($DEBUG) {
                echo "Importing: " . $file . ", returnFile {$returnFile}\n";
            }
            if (!in_array($file, $MATCHED)) {
                $content = getFileContents($file);
                if (!$content) {
                    if ($DEBUG) {
                        echo "no content... \n;";
                    }
                    continue;
                }
                $MATCHED[] = $file;
                $matches = array();
                //去掉注释
                $content = trim(preg_replace("/\\/\\*(.*?)\\*\\//ies", "", $content)) . "\n";
                $output .= preg_replace("/\\/\\/\\/import\\s+([\\w\\-\$]+(\\.[\\w\\-\$]+)*);?/ies", "importTangram('\\1')", $content);
            }
        }
    }
    return $output;
}
开发者ID:eou,项目名称:Magic,代码行数:43,代码来源:import.php


示例3: getAvailableFiles

function getAvailableFiles($sModule, $sFolder = "langs")
{
    global $sIncPath;
    global $sModulesUrl;
    //--- Get info which was set by admin in the Ray Base ---//
    $aFileContents = getFileContents($sModule, "/xml/" . $sFolder . ".xml", true);
    $aFiles = $aFileContents['contents'];
    //--- Get info from file system ---//
    $aRealFiles = getExtraFiles($sModule, $sFolder, false, true);
    //--- Merge info from these arrays ---//
    $aResult = array();
    foreach ($aFiles as $sFile => $bEnabled) {
        if ($bEnabled == TRUE_VAL && ($sKey = array_search($sFile, $aRealFiles['files'])) !== false) {
            $aResult['files'][] = $sFile;
            $aResult['dates'][] = $aRealFiles['dates'][$sKey];
        }
    }
    $aResult['default'] = $aFiles['_default_'];
    return $aResult;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:20,代码来源:functions.inc.php


示例4: deployChangeSet

/**
 * Deploys commits to the file-system
 */
function deployChangeSet($postData)
{
    global $CONFIG, $DEPLOY, $DEPLOY_BRANCH;
    global $processed;
    global $rmdirs;
    $o = json_decode($postData);
    if (!$o) {
        // could not parse ?
        echo "    ! Invalid JSON file\n";
        return false;
    }
    // determine the destination of the deployment
    if (array_key_exists($o->repository->slug, $DEPLOY)) {
        $deployLocation = $DEPLOY[$o->repository->slug] . (substr($DEPLOY[$o->repository->slug], -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR);
    } else {
        // unknown repository ?
        echo "    ! Repository not configured for sync: {$o->repository->slug}\n";
        return false;
    }
    // determine from which branch to get the data
    if (isset($DEPLOY_BRANCH) && array_key_exists($o->repository->slug, $DEPLOY_BRANCH)) {
        $deployBranch = $DEPLOY_BRANCH[$o->repository->slug];
    } else {
        // use the default branch
        $deployBranch = $CONFIG['deployBranch'];
    }
    // build URL to get the updated files
    $baseUrl = $o->canon_url;
    # https://bitbucket.org
    $apiUrl = '/api/1.0/repositories';
    # /api/1.0/repositories
    $repoUrl = $o->repository->absolute_url;
    # /user/repo/
    $rawUrl = 'raw/';
    # raw/
    $branchUrl = $deployBranch . '/';
    # branch/
    // prepare to get the files
    $pending = array();
    // loop through commits
    foreach ($o->commits as $commit) {
        // check if the branch is known at this step
        loginfo("    > Change-set: " . trim($commit->message) . "\n");
        if (!empty($commit->branch) || !empty($commit->branches)) {
            // if commit was on the branch we're watching, deploy changes
            if ($commit->branch == $deployBranch || !empty($commit->branches) && array_search($deployBranch, $commit->branches) !== false) {
                // if there are any pending files, merge them in
                $files = array_merge($pending, $commit->files);
                // get a list of files
                foreach ($files as $file) {
                    if ($file->type == 'modified' || $file->type == 'added') {
                        if (empty($processed[$file->file])) {
                            $processed[$file->file] = 1;
                            // mark as processed
                            $contents = getFileContents($baseUrl . $apiUrl . $repoUrl . $rawUrl . $branchUrl . $file->file);
                            if ($contents == 'Not Found') {
                                // try one more time, BitBucket gets weirdo sometimes
                                $contents = getFileContents($baseUrl . $apiUrl . $repoUrl . $rawUrl . $branchUrl . $file->file);
                            }
                            if ($contents != 'Not Found' && $contents !== false) {
                                if (!is_dir(dirname($deployLocation . $file->file))) {
                                    // attempt to create the directory structure first
                                    mkdir(dirname($deployLocation . $file->file), 0755, true);
                                }
                                file_put_contents($deployLocation . $file->file, $contents);
                                loginfo("      - Synchronized {$file->file}\n");
                            } else {
                                echo "      ! Could not get file contents for {$file->file}\n";
                                flush();
                            }
                        }
                    } else {
                        if ($file->type == 'removed') {
                            unlink($deployLocation . $file->file);
                            $processed[$file->file] = 0;
                            // to allow for subsequent re-creating of this file
                            $rmdirs[dirname($deployLocation . $file->file)] = dirname($file->file);
                            loginfo("      - Removed {$file->file}\n");
                        }
                    }
                }
            }
            // clean pending files, if any
            $pending = array();
        } else {
            // unknown branch for now, keep these files
            $pending = array_merge($pending, $commit->files);
        }
    }
    return true;
}
开发者ID:susan88323,项目名称:bitbucket-sync,代码行数:94,代码来源:deploy.php


示例5: submit_solution

/**
 * This function takes a (set of) temporary file(s) of a submission,
 * validates it and puts it into the database. Additionally it
 * moves it to a backup storage.
 */
function submit_solution($team, $prob, $contest, $lang, $files, $filenames, $origsubmitid = NULL)
{
    global $DB;
    if (empty($team)) {
        error("No value for Team.");
    }
    if (empty($prob)) {
        error("No value for Problem.");
    }
    if (empty($contest)) {
        error("No value for Contest.");
    }
    if (empty($lang)) {
        error("No value for Language.");
    }
    if (!is_array($files) || count($files) == 0) {
        error("No files specified.");
    }
    if (count($files) > dbconfig_get('sourcefiles_limit', 100)) {
        error("Tried to submit more than the allowed number of source files.");
    }
    if (!is_array($filenames) || count($filenames) != count($files)) {
        error("Nonmatching (number of) filenames specified.");
    }
    if (count($filenames) != count(array_unique($filenames))) {
        error("Duplicate filenames detected.");
    }
    $sourcesize = dbconfig_get('sourcesize_limit');
    // If no contest has started yet, refuse submissions.
    $now = now();
    $contestdata = $DB->q('MAYBETUPLE SELECT starttime,endtime FROM contest WHERE cid = %i', $contest);
    if (!isset($contestdata)) {
        error("Contest c{$contest} not found.");
    }
    if (difftime($contestdata['starttime'], $now) > 0) {
        error("The contest is closed, no submissions accepted. [c{$contest}]");
    }
    // Check 2: valid parameters?
    if (!($langid = $DB->q('MAYBEVALUE SELECT langid FROM language
	                        WHERE langid = %s AND allow_submit = 1', $lang))) {
        error("Language '{$lang}' not found in database or not submittable.");
    }
    if (!($teamid = $DB->q('MAYBEVALUE SELECT teamid FROM team
	                        WHERE teamid = %i AND enabled = 1', $team))) {
        error("Team '{$team}' not found in database or not enabled.");
    }
    $probdata = $DB->q('MAYBETUPLE SELECT probid, points FROM problem
	                    INNER JOIN contestproblem USING (probid)
	                    WHERE probid = %s AND cid = %i AND allow_submit = 1', $prob, $contest);
    if (empty($probdata)) {
        error("Problem p{$prob} not found in database or not submittable [c{$contest}].");
    } else {
        $points = $probdata['points'];
        $probid = $probdata['probid'];
    }
    // Reindex arrays numerically to allow simultaneously iterating
    // over both $files and $filenames.
    $files = array_values($files);
    $filenames = array_values($filenames);
    $totalsize = 0;
    for ($i = 0; $i < count($files); $i++) {
        if (!is_readable($files[$i])) {
            error("File '" . $files[$i] . "' not found (or not readable).");
        }
        if (!preg_match(FILENAME_REGEX, $filenames[$i])) {
            error("Illegal filename '" . $filenames[$i] . "'.");
        }
        $totalsize += filesize($files[$i]);
    }
    if ($totalsize > $sourcesize * 1024) {
        error("Submission file(s) are larger than {$sourcesize} kB.");
    }
    logmsg(LOG_INFO, "input verified");
    // Insert submission into the database
    $id = $DB->q('RETURNID INSERT INTO submission
	              (cid, teamid, probid, langid, submittime, origsubmitid)
	              VALUES (%i, %i, %i, %s, %s, %i)', $contest, $teamid, $probid, $langid, $now, $origsubmitid);
    for ($rank = 0; $rank < count($files); $rank++) {
        $DB->q('INSERT INTO submission_file
		        (submitid, filename, rank, sourcecode) VALUES (%i, %s, %i, %s)', $id, $filenames[$rank], $rank, getFileContents($files[$rank], false));
    }
    // Recalculate scoreboard cache for pending submissions
    calcScoreRow($contest, $teamid, $probid);
    // Log to event table
    $DB->q('INSERT INTO event (eventtime, cid, teamid, langid, probid, submitid, description)
	        VALUES(%s, %i, %i, %s, %i, %i, "problem submitted")', now(), $contest, $teamid, $langid, $probid, $id);
    if (is_writable(SUBMITDIR)) {
        // Copy the submission to SUBMITDIR for safe-keeping
        for ($rank = 0; $rank < count($files); $rank++) {
            $fdata = array('cid' => $contest, 'submitid' => $id, 'teamid' => $teamid, 'probid' => $probid, 'langid' => $langid, 'rank' => $rank, 'filename' => $filenames[$rank]);
            $tofile = SUBMITDIR . '/' . getSourceFilename($fdata);
            if (!@copy($files[$rank], $tofile)) {
                warning("Could not copy '" . $files[$rank] . "' to '" . $tofile . "'");
            }
        }
//.........这里部分代码省略.........
开发者ID:22a,项目名称:Cleaner-Ducss-Judge,代码行数:101,代码来源:lib.misc.php


示例6: parseXml

             $aContents[] = parseXml($aXmlTemplates['widget'], $sInner, $sVersion, $sTitle, $sAuthor, $sAuthorUrl, $sImageUrl, $sStatus, $sAdminUrl);
             $aTitles[] = $sTitle;
             array_multisort($aTitles, $aContents);
             $sContent = implode("", $aContents);
         }
     }
     $sContents = makeGroup($sContent, "widgets");
     break;
     /**
      * Gets widget code.
      */
 /**
  * Gets widget code.
  */
 case 'getWidgetCode':
     $aResult = getFileContents($sWidget, "/xml/main.xml", true);
     if ($aResult['status'] == SUCCESS_VAL) {
         $aContents = $aResult['contents'];
         $sCode = $aContents['code'];
         if (empty($sCode)) {
             if (secureCheckWidgetName($sWidget)) {
                 require_once $sModulesPath . $sWidget . "/inc/constants.inc.php";
                 $sCode = $aInfo['code'];
             }
         }
         $sContents = parseXml($aXmlTemplates['result'], SUCCESS_VAL, $sCode, $aContents['license']);
     } else {
         $sContents = parseXml($aXmlTemplates['result'], $aResult['value'], FAILED_VAL);
     }
     break;
     /**
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:31,代码来源:actions.inc.php


示例7: index_site


//.........这里部分代码省略.........
                    //  if relocated,  print message and redirect to new URL
                    printRedirected($url_status['relocate'], $url_status['path'], $cl);
                    if (strstr($url_status['path'], "//")) {
                        //  if redirected to absolute URL, use this for further usage
                        $url = $url_status['path'];
                    } else {
                        $relo_url = str_replace($url_parts['query'], "", $url);
                        //  url without query
                        $relo_url = substr($url, 0, strrpos($relo_url, "/") + 1);
                        //  url without file name
                        if (strpos($url_status['path'], "./") === 0) {
                            //  if redirected relativ to same folder depth
                            $url_status['path'] = str_replace("./", "", $url_status['path']);
                            $url = "" . $relo_url . "" . $url_status['path'] . "";
                        }
                        if (strpos($url_status['path'], "../") === 0) {
                            //  if redirected relativ and one folder up
                            $url_status['path'] = str_replace("./", "", $url_status['path']);
                            $relo_url = substr($url, 0, strpos($url_parts['path']));
                            //  url without file name
                            $relo_url = substr($url, 0, strrpos($relo_url, "/") + 1);
                            //  url without last folder
                            $url = "" . $relo_url . "" . $url_status['path'] . "";
                        }
                    }
                }
                //  read file
                $contents = array();
                $file = '';
                $file = file_get_contents($url);
                if ($file === FALSE) {
                    //  we know another way to get the content
                    $get_charset = '';
                    $contents = getFileContents($url, $get_charset);
                    $file = $contents['file'];
                }
                //  parse header only
                preg_match("@<head[^>]*>(.*?)<\\/head>@si", $file, $regs);
                $headdata = $regs[1];
                //  fetch the tag value
                preg_match("/<meta +name *=[\"']?Sphider-plus[\"']? *content=[\"'](.*?)[\"']/i", $headdata, $res);
                if (isset($res)) {
                    if ($authent != $res[1]) {
                        //  invalid value in authentication tag
                        $skip = '1';
                        printHeader($omit, $url, $command_line);
                        printStandardReport('Skipped_03', $command_line, $no_log);
                    }
                } else {
                    //  no authentication tag found in header
                    $skip = '1';
                    printHeader($omit, $url, $command_line);
                    printStandardReport('Skipped_02', $command_line, $no_log);
                }
            } else {
                $skip = '1';
                printHeader($omit, $url, $command_line);
                printStandardReport('statError', $command_line, $no_log);
            }
        }
        if (!$skip) {
            if ($site_id != "" && $reindex == 1) {
                mysqltest();
                $sql_query = "INSERT into " . $mysql_table_prefix . "temp (link, level, id) values ('{$url}', 0, '{$sessid}')";
                $db_con->query($sql_query);
                if ($debug && $db_con->errno) {
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:67,代码来源:spiderfuncs.php


示例8: updateHexImage

function updateHexImage($hColorData, $sFilePath)
{
    $sTargetFileLocation = DIR_IMAGES . $sFilePath;
    $sFileContent = getFileContents($sFilePath);
    if (!$sFileContent) {
        return false;
    }
    // Ursprünglichen Hue-Wert durch Wert der CI-Farbe ersetzen
    $sFileContent = str_replace($hColorData['replace']['search'], $hColorData['replace']['replace'], $sFileContent);
    // Neue Dateiinhalte in Zielgrafik schreiben
    if (!file_put_contents($sTargetFileLocation, $sFileContent)) {
        say('Grafik konnte nicht ueberschrieben werden: ' . $sTargetFileLocation);
        return false;
    }
    say("Grafik eingefaerbt: " . $sTargetFileLocation);
    return true;
}
开发者ID:enigmatic-user,项目名称:resellershop,代码行数:17,代码来源:color-update.php


示例9: rest_encode_file

/**
 * Encode file contents for POST-ing to REST API.
 * Returns contents of $file (optionally limited in size, see
 * getFileContents) as encoded string.
 */
function rest_encode_file($file, $sizelimit = TRUE)
{
    return urlencode(base64_encode(getFileContents($file, $sizelimit)));
}
开发者ID:reduanrafi,项目名称:domjudge,代码行数:9,代码来源:judgedaemon.main.php


示例10: getFileContents

    $select .= "<option value='{$val}' {$selected}>{$val}</option>";
}
$select .= "</select>";
?>

<h1>Visa annons</h1>

<p>Välj den annons som du vill visa.</p>

<form method="post">
    <fieldset>
        <p>
            <label for="input1">Annonser:</label><br>
            <?php 
echo $select;
?>
        </p>

        <p>
        <div style="background:#eee; border:1px solid #999;padding:1em; overflow: auto; text-align: center;">
            <p><?php 
if ($filename) {
    echo getFileContents($filename);
}
?>
</p>
        </div>
        </p>

    </fieldset>
</form>
开发者ID:bex1,项目名称:MePage,代码行数:31,代码来源:read.php


示例11: explode

if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
    $encodings = explode(',', strtolower(preg_replace("/\\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
}
if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
    $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
    $supportsGzip = true;
}
// Use cached file disk cache, if possible
if ($supportsGzip && file_exists($cacheFile)) {
    header("Content-Encoding: " . $enc);
    echo getFileContents($cacheFile);
    die;
} else {
    // Add custom files
    foreach ($custom as $file) {
        $content .= getFileContents($file . '.js');
    }
    // Generate GZIP'd content, if possible
    if ($supportsGzip) {
        header("Content-Encoding: " . $enc);
        $cacheData = gzencode($content, 9, FORCE_GZIP);
        // Write gz file
        if ($cacheKey != "") {
            putFileContents($cacheFile, $cacheData);
        }
        // Stream to client
        echo $cacheData;
    } else {
        // Stream uncompressed content
        echo $content;
    }
开发者ID:sharathvignesh,项目名称:Tamil-Readers-Association,代码行数:31,代码来源:index.php


示例12: getFileContents

    $stmt = $mysqli->query('SELECT id FROM user_competition WHERE user_id = ' . $userId . ' AND competition_id = ' . $competitionId);
    if ($stmt->num_rows > 0) {
        $userEntered = 1;
    }
    $mysqli->close();
    return $userEntered;
}
$competitionId = 1;
$compTag = 'beyondthewharf';
if (isset($_GET['competitionId'])) {
    $competitionId = $_GET['competitionId'];
}
if ($competitionId == 2) {
    $compTag = 'vividsydney';
}
$wharfs = getFileContents('../json/wharfs.json');
$userEntered = 0;
if (isset($_GET['step']) || isset($instagramData)) {
    if (isset($_GET['step'])) {
        $step = $_GET['step'];
    } else {
        $step = 2;
    }
} else {
    $step = 1;
}
if (isset($instagramData)) {
    $instagramUsername = $instagramData->user->username;
    $instagramId = $instagramData->user->id;
    $userDetails = getUserDetails($instagramId, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
    if ($userDetails['id'] > 0) {
开发者ID:Steadroy,项目名称:hcf-btw,代码行数:31,代码来源:enter-competition.php


示例13: initializeFileList

 public function initializeFileList()
 {
     if (!file_exists($GLOBALS['tupac_directory'] . '/tupac_filelist')) {
         sendMessage('creatingFileList', array());
         $GLOBALS['pacman_file_list'] = new PacmanFilesList();
     } else {
         if (!$GLOBALS['pacman_file_list']) {
             //sendMessage('reusingFileList',array());
             $GLOBALS['pacman_file_list'] = unserialize(getFileContents($GLOBALS['tupac_directory'] . '/tupac_filelist'));
             if ($GLOBALS['pacman_file_list'] === false) {
                 unlink($GLOBALS['tupac_directory'] . '/tupac_filelist');
                 sendMessage('corruptedFileList', array());
                 $GLOBALS['pacman_file_list'] = new PacmanFilesList();
             } else {
                 $GLOBALS['pacman_file_list']->updateFileList();
             }
         }
     }
 }
开发者ID:Kett,项目名称:tupac,代码行数:19,代码来源:PacmanData.class.php


示例14: index_url

function index_url($url, $level, $site_id, $md5sum, $domain, $indexdate, $sessid, $can_leave_domain, $reindex)
{
    global $min_delay;
    global $command_line;
    global $min_words_per_page;
    global $supdomain, $index_vpaths;
    global $user_agent, $tmp_urls, $delay_time, $domain_arr;
    global $db;
    $deletable = 0;
    $url_status = url_status($url);
    $thislevel = $level - 1;
    if (strstr($url_status['state'], "Relocation")) {
        $url = preg_replace("/ /", "", url_purify($url_status['path'], $url, $can_leave_domain));
        if ($url != '') {
            $result = $db->query("SELECT link FROM " . TABLE_PREFIX . "temp WHERE link=" . $db->quote($url) . " AND id=" . $db->quote($sessid));
            echo sql_errorstring(__FILE__, __LINE__);
            if ($result->fetch()) {
                $result->closeCursor();
                $db->exec("INSERT INTO " . TABLE_PREFIX . "temp (link, level, id) VALUES (" . $db->quote($url) . ", " . $db->quote($level) . ", " . $db->quote($sessid) . ")");
                echo sql_errorstring(__FILE__, __LINE__);
            }
        }
        $url_status['state'] == "redirected";
    }
    if (!$index_vpaths && $url_status['state'] == 'ok') {
        $url_parts = parse_url($url);
        $base = basename($url_parts['path']);
        if (strstr($base, '.') == false) {
            $url_status['state'] = "directory listing or default redirect";
        }
    }
    ini_set("user_agent", $user_agent);
    if ($url_status['state'] == 'ok') {
        $OKtoIndex = 1;
        $file_read_error = 0;
        if (time() - $delay_time < $min_delay) {
            sleep($min_delay - (time() - $delay_time));
        }
        $delay_time = time();
        if (!fst_lt_snd(phpversion(), "4.3.0")) {
            $file = file_get_contents($url);
            if ($file === FALSE) {
                $file_read_error = 1;
            }
        } else {
            $fl = @fopen($url, "r");
            if ($fl) {
                while ($buffer = @fgets($fl, 4096)) {
                    $file .= $buffer;
                }
            } else {
                $file_read_error = 1;
            }
            fclose($fl);
        }
        if ($file_read_error) {
            $contents = getFileContents($url);
            $file = $contents['file'];
        }
        $pageSize = number_format(strlen($file) / 1024, 2, ".", "");
        printPageSizeReport($pageSize);
        if ($url_status['content'] != 'text') {
            $file = extract_text($file, $url_status['content']);
        }
        printStandardReport('starting', $command_line);
        $newmd5sum = md5($file);
        if ($reindex == 0) {
            if ($md5sum == $newmd5sum) {
                printStandardReport('md5notChanged', $command_line);
                $OKtoIndex = 0;
            } else {
                if (isDuplicateMD5($newmd5sum)) {
                    $OKtoIndex = 0;
                    printStandardReport('duplicate', $command_line);
                }
            }
        }
        if (($md5sum != $newmd5sum || $reindex == 1) && $OKtoIndex == 1) {
            $urlparts = parse_url($url);
            $newdomain = $urlparts['host'];
            $type = 0;
            // remove link to css file
            //get all links from file
            $data = clean_file($file, $url, $url_status['content']);
            if ($data['noindex'] == 1) {
                $OKtoIndex = 0;
                $deletable = 1;
                printStandardReport('metaNoindex', $command_line);
            }
            $wordarray = unique_array(explode(" ", $data['content']));
            if ($data['nofollow'] != 1) {
                $links = get_links($file, $url, $can_leave_domain, $data['base']);
                $links = distinct_array($links);
                $all_links = count($links);
                $numoflinks = 0;
                //if there are any, add to the temp table, but only if there isnt such url already
                if (is_array($links)) {
                    reset($links);
                    while ($thislink = each($links)) {
                        if (!isset($tmp_urls[$thislink[1]]) || $tmp_urls[$thislink[1]] != 1) {
//.........这里部分代码省略.........
开发者ID:highestgoodlikewater,项目名称:sphider-pdo,代码行数:101,代码来源:spider.php


示例15: get_url_content

function get_url_content($url)
{
    $data = getFileContents($url);
    if ($data["state"] == "ok") {
        return $data["file"];
    } else {
        return getfile($url);
    }
}
开发者ID:tanny2015,项目名称:DataStructure,代码行数:9,代码来源:start.php


示例16: checkCache

function checkCache()
{
    // Check if we hgave cache
    if (!file_exists($GLOBALS['tupac_directory'] . '/tupac_data')) {
        // If any of the main files is missing, regenerate cache
        Std::rm($GLOBALS['tupac_directory'] . '/tupac_data');
        Std::rm($GLOBALS['tupac_directory'] . '/tupac_filelist');
        sendMessage('generatingCache', array());
        // Gather information
        $GLOBALS['data'] = new PacmanData();
        $GLOBALS['data']->updateList();
    } else {
        // Read Cache
        $GLOBALS['data'] = unserialize(getFileContents($GLOBALS['tupac_directory'] . '/tupac_data'));
        if ($GLOBALS['data'] === false) {
            // Unserialized failed
            sendMessage('generatingCacheCorrupted', array());
            Std::rm($GLOBALS['tupac_directory'] . '/tupac_data');
            Std::rm($GLOBALS['tupac_directory'] . '/tupac_filelist');
            $GLOBALS['data'] = new PacmanData();
            $GLOBALS['data']->updateList();
        } else {
            switch ($GLOBALS['data']->verifyIntegrity()) {
                case 'cache_updated':
                    sendMessage('generatingCacheTupacUpdated', array());
                    Std::rm($GLOBALS['tupac_directory'] . '/tupac_data');
                    Std::rm($GLOBALS['tupac_directory'] . '/tupac_filelist');
                    $GLOBALS['data'] = new PacmanData();
                    $GLOBALS['data']->updateList();
                    break;
                case 'database_outdated':
                    //sendMessage('generatingCacheDatabaseUpdated',array());
                    $anyChanges = false;
                    // Get currently available repos
                    $available_repos = array();
                    $dh = getRepoDirList();
                    foreach ($dh as $repo) {
                        if (!substr($repo, 0, 1) == '.' && is_dir(getRepoDir($repo))) {
                            $available_repos[$repo] = false;
                        }
                    }
                    // The database needs to be updated
                    $mustRecheckLocal = false;
                    $repo_list = $GLOBALS['data']->repo_list;
                    foreach ($repo_list as $repo => $repoData) {
                        unset($available_repos[$repo]);
                        if ($repo == 'local' && $GLOBALS['data']->verification[$repo] != PacmanData::verifyRepo($repo)) {
                            // We check local separately, since it is not a repo.
                            sendMessage('repoIsUpdated', array('%r' => $repo));
                            $anyChanges = true;
                            $installed = true;
                            $available_packages = array();
                            // get current packages
                            $dh = opendir(getRepoDir($repo));
                            while (FALSE !== ($package = readdir($dh))) {
                                if (substr($package, 0, 1) != '.' && is_dir(getRepoDir($repo) . $package)) {
                                    $packageName = preg_replace('/\\-[0-9a-z\\._A-Z]*\\-[0-9a-z\\._A-Z]*$/', '', $package);
                                    $available_packages[$packageName] = $package;
                                }
                            }
                            closedir($dh);
                            $installed_packages = $GLOBALS['data']->installed_packages;
                            // Walk packages of the current repo
                            foreach ($installed_packages as $packageName => $packageData) {
                                if (!$available_packages[$packageName]) {
                                    // The package is not installed anymore
                                    sendMessage('removePackage', array('%p' => $packageName));
                                    unset($repo_list['local'][$packageName]);
                                    foreach ($repo_list as $tmpRepo => $tmpRepoData) {
                                        if ($tmpRepoData[$packageName]) {
                                            $repo_list[$tmpRepo][$packageName]['installed'] = 'false';
                                        }
                                    }
                                    unset($installed_packages[$packageName]);
                                } elseif ($packageData['dir'] != $available_packages[$packageName]) {
                                    // Package updated. Since it is the list of installed packages, set its version to installed version
                                    sendMessage('updatePackage', array('%p' => $packageName));
                                    $installed_packages[$packageName] = PacmanData::getPackageData($repo, $available_packages[$packageName], 'true');
                                    $installed_info = $installed_packages[$packageName]['version'];
                                    $installed_packages[$packageName]['installed'] = $installed_info;
                                    foreach ($repo_list as $tmpRepo => $tmpRepoData) {
                                        if ($tmpRepoData[$packageName]) {
                                            $repo_list[$tmpRepo][$packageName]['installed'] = $installed_info;
                                            // in local installed version equals to avaiable version
                                            if ($repo == 'local') {
                                                $repo_list[$tmpRepo][$packageName]['version'] = $installed_info;
                                            }
                                        }
                                    }
                                }
                                unset($available_packages[$packageName]);
                            }
                            // Add new packages. This is, packages that are listed in the repo directory but that aren't marked as installed.
                            foreach ($available_packages as $packageName => $package) {
                                if ($package) {
                                    $packageFound = false;
                                    sendMessage('addPackage', array('%p' => $packageName));
                                    $installed_packages[$packageName] = PacmanData::getPackageData($repo, $available_packages[$packageName], 'true');
                                    $installed_info = $installed_packages[$packageName]['version'];
                                    $installed_packages[$packageName]['installed'] = $installed_info;
//.........这里部分代码省略.........
开发者ID:Kett,项目名称:tupac,代码行数:101,代码来源:tupac.inc.php


示例17: usleep

            $data['next_step'] = 1;
            $Cache->save('debugger', $data, 2);
            usleep(1500000);
            $contents = $Cache->get('debugger');
            if ($contents['next_step'] == 0) {
                if ($contents['flags'] == 2) {
                    $output['finished'] = true;
                } else {
                    $output['data'] = array('script' => basename($contents['file']), 'file' => SYSTEM_PATH . DS . $contents['file'], 'line' => $contents['line'], 'file_contents' => getFileContents($contents['file'], $contents['line']));
                }
            }
            break;
        case 'finish':
            $data['flags'] = 1;
            $Cache->save('debugger', $data, 2);
            break;
        case 'status':
            $output['data'] = $data;
            $out = $data['output'];
            if ($out != null) {
                $data['output'] = null;
                $Cache->save('debugger', $data, 2);
                $output['data']['output'] = highlight($out);
            }
            break;
        case 'getFile':
            $output['data'] = getFileContents($data['file'], $data['line']);
            break;
    }
}
echo output($output);
开发者ID:Kheros,项目名称:Plexis,代码行数:31,代码来源:ajax.php


示例18: getFileContents

// Add core
$content .= getFileContents( 'tiny_mce.js' );

// Patch loading functions
$content .= 'tinyMCEPreInit.start();';

// Add all languages (WP)
include_once( dirname(__FILE__).'/langs/wp-langs.php' );
$content .= $strings;

// Add themes
$content .= getFileContents( 'themes/' . $theme . '/editor_template.js' );

// Add plugins
foreach ( $plugins as $plugin ) 
	$content .= getFileContents( 'plugins/' . $plugin . '/editor_plugin.js' );

// Add external plugins and init 
$content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});';

// Generate GZIP'd content
if ( '.gz' == $cache_ext ) {
	header('Content-Encoding: gzip');
	$content = gzencode( $content, 9, FORCE_GZIP );
}

// Stream to client
echo $content;

// Write file
if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {	
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:tiny_mce_config.php


示例19: getAttachmentContentFromFS

 /**
  * Gets the contents of the attachment given by it's database identifier from the filesystem 
  * 
  * @param $id integer the database identifier of the attachment
  * @return string the contents of the attachment or null on error
  */
 protected function getAttachmentContentFromFS($id)
 {
     $query = "SELECT file_size,compression_type,file_path " . " FROM {$this->tables['attachments']} WHERE id = {$id}";
     $row = $this->db->fetchFirstRow($query);
     $content = null;
     if ($row) {
         $filePath = $row['file_path'];
         $fileSize = $row['file_size'];
         $destFPath = $this->repositoryPath . DIRECTORY_SEPARATOR . $filePath;
         switch ($row['compression_type']) {
             case TL_REPOSITORY_COMPRESSIONTYPE_NONE:
                 $content = getFileContents($destFPath);
                 break;
             case TL_REPOSITORY_COMPRESSIONTYPE_GZIP:
                 $content = gzip_readFileContent($destFPath, $fileSize);
                 break;
         }
     }
     return $content;
 }
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:26,代码来源:tlAttachmentRepository.class.php


示例20: downloadAllFilesPerUser


                      

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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