本文整理汇总了PHP中tempdir函数的典型用法代码示例。如果您正苦于以下问题:PHP tempdir函数的具体用法?PHP tempdir怎么用?PHP tempdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tempdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tmpdir
private function tmpdir()
{
if ($this->tmpdir_ === null && ($this->tmpdir_ = tempdir()) === false) {
$this->warnings[] = "Could not create temporary directory.";
}
return $this->tmpdir_;
}
示例2: ListMoreSp
/**
*子栏目
**/
function ListMoreSp()
{
global $db, $pre, $fid, $webdb, $fidDB;
$order = 'list';
$order && ($_order = " ORDER BY {$order} DESC ");
$rows = 4;
$leng = 30;
$query = $db->query("SELECT * FROM {$pre}spsort WHERE fup={$fid} ORDER BY list DESC");
while ($rs = $db->fetch_array($query)) {
$SQL = "WHERE fid={$rs['fid']} {$_order} LIMIT {$rows}";
$which = '*';
$rs[article] = list_special($SQL, $which, $leng);
//如果本栏目不能获取到专题,将获取其所有子栏目的专题
if (!$rs[article]) {
$array_fid = Get_SonFid("{$pre}spsort", $rs[fid]);
if ($array_fid) {
$SQL = "WHERE fid IN (" . implode(',', $array_fid) . ") {$_order} LIMIT {$rows}";
$rs[article] = list_special($SQL, $which, $leng);
}
}
$rs[logo] && ($rs[logo] = tempdir($rs[logo]));
$listdb[] = $rs;
}
return $listdb;
}
示例3: __construct
/**
* Constructor of the executable runner.
*
* @param $workingDir Working directory (current directory) to be used when
* running the program.
*/
public function __construct($submission, $workingDir = NULL)
{
// parent::__construct();
if ($workingDir == NULL) {
$workingDir = tempdir($submission->getWorkDir(), ExecutableRunner::OUTPUT_PREFIX);
}
$this->setWorkingDir($workingDir);
}
示例4: get_examples
function get_examples($id)
{
global $pre, $db;
$query = $db->query("SELECT * FROM {$pre}example WHERE fid='{$id}' AND ifhide=0 LIMIT 50");
while ($rs = $db->fetch_array($query)) {
$rs[logo] = tempdir($rs[logo]);
$_listdb[] = $rs;
}
$num = 5 - count($_listdb) % 5;
for ($i = 0; $i < $num; $i++) {
$_listdb[] = array('display' => 'none');
}
$listdb = array_chunk($_listdb, 5);
return $listdb;
}
示例5: list_title
function list_title($type = 'new', $rows = 10)
{
global $db, $pre, $_pre;
if ($type == 'new') {
$SQL = " ORDER BY A.id DESC LIMIT {$rows}";
} elseif ($type == 'hot') {
$SQL = " ORDER BY A.hits DESC LIMIT {$rows}";
} elseif ($type == 'com') {
$SQL = " WHERE A.levels=1 ORDER BY A.levelstime DESC LIMIT {$rows}";
}
$query = $db->query("SELECT A.*,B.* FROM {$_pre}content A LEFT JOIN {$_pre}content_1 B ON B.id=A.id {$SQL}");
while ($rs = $db->fetch_array($query)) {
$rs[picurl] && ($rs[picurl] = tempdir($rs[picurl]));
$listdb[] = $rs;
}
return $listdb;
}
示例6: date
exit;
}
}
// Calculate report starttime and endtime
$report_start = date('Y.m.d H:i', $starttime);
$report_end = date('Y.m.d H:i', $endtime);
# print <<< ENDHTML
#</br>
#Starttime : $starttime</br>
#Timeperiod: $timeperiod</br>
#STime : $stime</br>
#Start : $report_start</br>
#End : $report_end</br>
#ENDHTML;
// Setup temporary file/directory names
$z_tmpimg_path = tempdir($z_tmp_path);
$tmp_pdf_data = tempnam($z_tmp_path, "zabbix_report");
// Set Timezone
date_default_timezone_set("{$timezone}");
// Print Header if debug is on
if ($debug) {
header('Content-type: text/html; charset=utf-8');
if (isset($hostid)) {
echo "<b>HostID: </b>" . $hostid . "</br>\n";
}
if (isset($groupid)) {
echo "<b>GroupID: </b>" . $groupid . "</br>\n";
}
if (isset($reporttype)) {
echo "<b>Report Type: </b>" . $reporttype . "</br>\n";
}
示例7: sprintf
$importtemplateoutput .= "<div class='messagebox ui-corner-all'>";
if ($demoModeOnly === true) {
$importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
$importtemplateoutput .= sprintf($clang->gT("Demo mode: Uploading templates is disabled."), $basedestdir) . "<br/><br/>\n";
$importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
$importtemplateoutput .= "</div>\n";
return;
}
require "classes/phpzip/phpzip.inc.php";
//$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name'];
$zipfile = $_FILES['the_file']['tmp_name'];
$z = new PHPZip();
// Create temporary directory
// If dangerous content is unzipped
// then no one will know the path
$extractdir = tempdir($tempdir);
$basedestdir = $usertemplaterootdir;
$newdir = str_replace('.', '', strip_ext(sanitize_paranoid_string($_FILES['the_file']['name'])));
$destdir = $basedestdir . '/' . $newdir . '/';
if (!is_writeable($basedestdir)) {
$importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
$importtemplateoutput .= sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir) . "<br/><br/>\n";
$importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
$importtemplateoutput .= "</div>\n";
return;
}
if (!is_dir($destdir)) {
mkdir($destdir);
} else {
$importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
$importtemplateoutput .= sprintf($clang->gT("Template '%s' does already exist."), $newdir) . "<br/><br/>\n";
示例8: gdpic
//多生成一张1:1的图片,方便标签调用
gdpic(ROOT_PATH . "{$webdb['updir']}/{$postdb['picurl']}", "{$Newpicpath}.jpg.jpg", $picWidth ? $picWidth : 300, $picWidth ? $picWidth : 300, $webdb[autoCutSmallPic] ? array('fix' => 1) : '');
gdpic(ROOT_PATH . "{$webdb['updir']}/{$postdb['picurl']}", $Newpicpath, $picWidth ? $picWidth : 300, $picHeight ? $picHeight : 225, $webdb[autoCutSmallPic] ? array('fix' => 1) : '');
if (file_exists($Newpicpath)) {
$postdb[picurl] = $smallpic;
//FTP上传文件到远程服务器
if ($webdb[ArticleDownloadUseFtp]) {
ftp_upfile($Newpicpath, $postdb[picurl]);
}
}
} else {
if (file_exists(ROOT_PATH . "{$webdb['updir']}/{$post_picurl}.jpg")) {
move_attachment($lfjuid, tempdir("{$post_picurl}.jpg"), $downloadDIR, 'small');
}
if (file_exists(ROOT_PATH . "{$webdb['updir']}/{$post_picurl}.jpg.jpg")) {
move_attachment($lfjuid, tempdir("{$post_picurl}.jpg.jpg"), $downloadDIR, 'small');
}
}
}
//FTP上传文件到远程服务器
if ($webdb[ArticleDownloadUseFtp] && $file_db) {
foreach ($file_db as $key => $value) {
if (is_file(ROOT_PATH . "{$webdb['updir']}/{$value}")) {
ftp_upfile(ROOT_PATH . "{$webdb['updir']}/{$value}", $value);
}
}
}
//如果系统设置自动提取关键字的话,只有当用户没设置关键字,才自动提取.
if ($job == 'postnew' && $webdb[autoGetKeyword] && !$postdb[keywords]) {
$postdb[keywords] = keyword_ck($postdb[keywords], $postdb[title]);
}
示例9: while
//系统推荐主题
$myotherDB = $comDB = '';
$query = $db->query("SELECT * FROM {$pre}article ORDER BY levels DESC,levelstime DESC,aid DESC LIMIT 11");
while ($rs = $db->fetch_array($query)) {
if (!$comDB) {
//今日导读
$comDB = $rs;
} else {
$myotherDB[] = $rs;
}
}
//我的图片主题
$myphotoDB = '';
$query = $db->query("SELECT * FROM {$pre}article WHERE ispic=1 AND uid='{$uid}' ORDER BY aid DESC LIMIT 6");
while ($rs = $db->fetch_array($query)) {
$rs[picurl] = tempdir($rs[picurl]);
$myphotoDB[] = $rs;
}
//论坛贴子
$mybbsDB = '';
if (ereg("^pwbbs", $webdb[passport_type])) {
$query = $db->query("SELECT * FROM {$TB_pre}threads WHERE authorid='{$uid}' ORDER BY tid DESC LIMIT 10");
while ($rs = $db->fetch_array($query)) {
$mybbsDB[] = $rs;
}
}
//过滤不健康的字
$rsdb[truename] = replace_bad_word($rsdb[truename]);
$rsdb[introduce] = replace_bad_word($rsdb[introduce]);
$rsdb[address] = replace_bad_word($rsdb[address]);
require get_member_tpl('homepage');
示例10: get_label_mv
function get_label_mv($string)
{
global $jobs;
preg_match_all("/\\(mv,([\\d]+),([\\d]+),(false|true)\\)([^\\(]+)\\(\\/mv\\)/is", $string, $array);
foreach ($array[4] as $key => $value) {
$value = str_replace("\r", "", $value);
$detail = explode("\n", $value);
foreach ($detail as $key2 => $value2) {
list($url, $name, $fen, $type) = explode("@@@", $value2);
if (!$url || $fen) {
continue;
}
$url = tempdir($url);
$string = preg_replace("/\\(mv,([\\d]+),([\\d]+),(false|true)\\)([^\\(]+)\\(\\/mv\\)/is", "", $string);
$playcode = player($url, $array[1][$key], $array[2][$key], $array[3][$key], $type);
if ($jobs == 'show') {
//视频会档住标签,所以要特别处理
return "<div class='player' style='padding-top:20px;'>{$playcode}</div>{$string}";
}
return "<div class='player'>{$playcode}</div>{$string}";
}
}
}
示例11: unlink
$size++;
unlink($name);
}
}
return $size;
}
$directory = dirname(__FILE__) . "/tgz";
$iterator = new DirectoryIterator($directory);
$files = array();
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile()) {
$files[$fileinfo->getPathname()] = $fileinfo->getFilename();
}
}
ksort($files);
foreach ($files as $path => $file) {
$p = new PharData($path);
$tmpdir = tempdir();
$p->extractTo($tmpdir);
var_dump($file);
var_dump(getFileCount($tmpdir));
$delIter = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tmpdir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
foreach ($delIter as $info) {
if ($info->isDir()) {
rmdir($info->getPathname());
} else {
unlink($path);
}
}
rmdir($tmpdir);
}
示例12: showerr
<?php
require "global.php";
//导航条
@(include Mpath . "data/guide_fid.php");
$mid = 2;
/**
*获取信息正文的内容
**/
$rsdb = $db->get_one("SELECT A.*,B.*,M.icon FROM `{$_pre}person` A LEFT JOIN `{$_pre}content_{$mid}` B ON A.id=B.id LEFT JOIN {$pre}memberdata M ON A.uid=M.uid WHERE A.id='{$id}'");
if (!$rsdb) {
showerr("内容不存在");
} elseif (!$web_admin && $rsdb[uid] != $lfjuid && $rsdb[cuid] != $lfjuid) {
showerr("你无权查看");
}
$rsdb[picurl] = tempdir($rsdb[icon]);
$rsdb[C] = $db->get_one("SELECT * FROM {$_pre}content WHERE id='{$rsdb['cid']}'");
$field_db = $module_DB[$mid]['field'];
/**
*对信息内容字段的处理
**/
$Module_db->hidefield = true;
$Module_db->classidShowAll = true;
$Module_db->showfield($field_db, $rsdb, 'show');
$rsdb[posttime] = date("Y-m-d H:i:s", $rsdb[posttime]);
require getTpl("print_member");
示例13: in_array
$job_path .= '/' . $jobid;
}
// Setup directories (including ssh/host vars)
// do we force this plugin to run locally as chris?
$force_chris_local = in_array($plugin_name, explode(',', CHRIS_RUN_AS_CHRIS_LOCAL));
$host = CLUSTER_HOST;
if ($status == 100 || $force_chris_local) {
$host = 'localhost';
}
$ssh = new Net_SSH2($host);
if (!$ssh->login($username, $password)) {
die('Login Failed');
}
$ssh->exec('umask 0002 ; mkdir -p ' . $job_path);
// dprint($of, "job_path = $job_path\n");
$job_path_output = tempdir($ssh, $job_path);
// dprint($of, "job_path_output = $job_path_output\n");
// replace ${OUTPUT} pattern in the command and in the parameters
$command = str_replace("{OUTPUT}", $job_path, $command);
$command = str_replace("{FEED_ID}", $feed_id, $command);
$command = str_replace("{USER_ID}", $user_id, $command);
$parameters = str_replace("{OUTPUT}", $job_path, $parameters);
$parameters = str_replace("{FEED_ID}", $feed_id, $parameters);
$parameters = str_replace("{USER_ID}", $user_id, $parameters);
// add meta information to the feed
FeedC::addMetaS($feed_id, 'parameters', $parameters, 'simple');
// add owner
FeedC::addMetaS($feed_id, 'root_id', (string) $feed_id, 'extra');
// append the log files to the command
$command .= ' >> ' . $job_path_output . '/chris.std 2> ' . $job_path_output . '/chris.err';
// create the chris.env and chris.run file
示例14: die
die("Invalid upload (1)");
}
if ($_FILES['filenameuploaded']['type'] != "application/x-zip-compressed" && $_FILES['filenameuploaded']['type'] != "application/zip") {
die("Invalid upload (2)");
}
// Make sure the file name doesn't contain any funky characters - e.g. / or perhaps unicode which will confuse things.
// This regexp probably rules out brackets e.g Copy of Foo (1).zip which is quite common.
if (preg_match('![^-a-z0-9_\\.]!i', $_FILES['filenameuploaded']['name'])) {
die("Supplied file name contains invalid characters, remove any non-alphanumerics and retry.");
}
_load_language_file("/website_code/php/import_template.inc");
// Clean uploaded file name. Remove non-(alphanumerics or - or . characters).
// as we use the user's provided file name later on in file paths etc.
$userProvidedFileName = $_FILES['filenameuploaded']['name'];
// Create a unique, random, temporary directory.
$temp_dir = tempdir();
$zip_file = $temp_dir . DIRECTORY_SEPARATOR . $userProvidedFileName;
// Copy the uploaded file into the tempdir, unzip it and then remove it.
if (@move_uploaded_file($_FILES['filenameuploaded']['tmp_name'], $zip_file)) {
$zip = new dUnzip2($zip_file);
$zip->debug = false;
$zip->getList();
$zip->unzipAll($temp_dir);
$zip->close();
unlink($zip_file);
} else {
_debug("Upload of template failed - " . print_r($_FILES, true));
die("Upload failed - couldn't process uploaded file. ({$new_file_name}) ");
}
// XXX: What should $_POST['folder'] look like? Presumably something like 'Nottingham'.
if (!empty($_POST['folder'])) {
示例15: showfield
function showfield($field_db, &$rsdb, $type = 'show')
{
foreach ($field_db as $key => $rs) {
if ($type == 'list' && !$rs[listshow]) {
//列表页的话,需要后台设置在列表页显示
//continue;
}
//隐藏某些用户组没权限看的字段
if ($this->hidefield && $rs[allowview]) {
global $groupdb, $web_admin, $lfjuid;
if (!$web_admin && $lfjuid != $rsdb[uid] && !in_array($groupdb['gid'], explode(",", $rs[allowview]))) {
$rsdb[$key] = "<font color=red>权限不够,无法查看!</font>";
continue;
}
}
if ($rs[form_type] == 'textarea') {
if ($type == 'show') {
//内容页完整显示
require_once ROOT_PATH . "inc/encode.php";
$rsdb[$key] = format_text($rsdb[$key]);
} elseif ($type == 'list') {
//列表页部分显示
$rsdb[$key] = get_word($rsdb[$key], 100);
}
} elseif ($rs[form_type] == 'ieedit' || $rs[form_type] == 'ieeditsimp') {
if ($type == 'show') {
//内容页完整显示
$rsdb[$key] = En_TruePath($rsdb[$key], 0, 1);
} elseif ($type == 'list') {
//列表页部分显示
$rsdb[$key] = @preg_replace('/<([^>]*)>/is', "", $rsdb[$key]);
$rsdb[$key] = get_word($rsdb[$key], 100);
}
} elseif ($type == 'show' && ($rs[form_type] == 'upfile' || $rs[form_type] == 'onepic')) {
$rsdb[$key] = tempdir($rsdb[$key]);
} elseif ($type == 'show' && ($rs[form_type] == 'upmorepic' || $rs[form_type] == 'upmorefile')) {
$detail = explode("\n", $rsdb[$key]);
unset($rsdb[$key]);
foreach ($detail as $_key => $value) {
list($_url, $_name) = explode("@@@", $value);
$rsdb[$key][url][] = tempdir($_url);
$rsdb[$key][title][] = $_name;
}
} elseif ($rs[form_type] == 'classdb') {
$rsdb[$key] = $this->classdb_show($rsdb[$key]);
} elseif ($rs[form_type] == 'select' || $rs[form_type] == 'radio') {
if (strstr($rs[form_set], "|")) {
$rs[form_set] = str_replace("\r", "", $rs[form_set]);
$detail = explode("\n", $rs[form_set]);
foreach ($detail as $key2 => $value2) {
list($_key, $_value) = explode("|", $value2);
$_key == $rsdb[$key] && $_value && ($rsdb[$key] = $_value);
}
}
} elseif ($rs[form_type] == 'checkbox') {
if (strstr($rs[form_set], "|")) {
$rs[form_set] = str_replace("\r", "", $rs[form_set]);
$detail = explode("\n", $rs[form_set]);
foreach ($detail as $key2 => $value2) {
list($_key, $_value) = explode("|", $value2);
if ($_value) {
//以下还需要进一步改进的
$rsdb[$key] = str_replace($_key, $_value, $rsdb[$key]);
}
}
}
$rsdb[$key] = str_replace("/", "、", $rsdb[$key]);
}
if ($rs[field_type] == 'int' && $rsdb[$key] == '0' && !$rs[form_units]) {
$rsdb[$key] = '';
} elseif ($rs[form_units] && $type == 'show') {
$rsdb[$key] .= " {$rs['form_units']}";
}
}
}