本文整理汇总了PHP中dmkdir函数的典型用法代码示例。如果您正苦于以下问题:PHP dmkdir函数的具体用法?PHP dmkdir怎么用?PHP dmkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_html
public static function make_html()
{
global $_G;
if (self::$htmlfilename) {
$filepath = DISCUZ_ROOT . '/' . self::$htmlfilename . '.' . $_G['setting']['makehtml']['extendname'];
dmkdir(dirname($filepath));
$cend = '</body></html>';
$code = ob_get_clean() . $cend;
$code = preg_replace('/language\\s*=[\\s|\'|\\"]*php/is', '_', $code);
$code = str_replace(array('<?', '?>'), array('<?', '?>'), $code);
if (file_put_contents($filepath, $code) !== false) {
$_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
if (self::$callback && is_callable(self::$callback)) {
call_user_func(self::$callback);
self::$callback = self::$callbackdata = null;
}
self::$returndata['status'] = 'html_ok';
if (isset(self::$viewurl)) {
self::$returndata['path'] = self::$viewurl;
} else {
self::$returndata['path'] = self::$htmlfilename . '.' . $_G['setting']['makehtml']['extendname'];
}
showmessage('do_success', null, self::$returndata);
}
}
}
示例2: update_mokuai
function update_mokuai($biaoshi, $version, $mukauidata)
{
global $_G;
require_once libfile('class/xml');
$mokuais = $mokuais_temp = xml2array(file_get_contents(MOKUAI_DIR . "/server/1.0/Data/mokuai.xml"));
if (!is_dir(MOKUAI_DIR . '/' . $biaoshi)) {
$mokuais_temp[$biaoshi]['biaoshi'] = $biaoshi;
dmkdir(MOKUAI_DIR . '/' . $biaoshi);
}
$mokuaivers = getmokuaivers($biaoshi);
if (count($mokuaivers) == 1) {
$mokuais_temp[$biaoshi]['currentversion'] = $mokuaivers[0];
}
if (!is_dir(MOKUAI_DIR . '/' . $biaoshi . '/' . $version)) {
$mokuais_temp[$biaoshi]['version'][$version]['biaoshi'] = $version;
dmkdir(MOKUAI_DIR . '/' . $biaoshi . '/' . $version);
}
foreach (array('Controler', 'Modal', 'View', 'Data') as $k => $v) {
if (!is_dir(MOKUAI_DIR . '/' . $biaoshi . '/' . $version . '/' . $v)) {
dmkdir(MOKUAI_DIR . '/' . $biaoshi . '/' . $version . '/' . $v);
}
}
foreach ($mukauidata as $k2 => $v2) {
$mokuais_temp[$biaoshi]['version'][$version][$k2] = $v2;
}
if ($mokuais != $mokuais_temp) {
$mokuais = $mokuais_temp;
$mokuais = array_sort($mokuais, 'displayorder', 'asc');
file_put_contents(MOKUAI_DIR . "/server/1.0/Data/mokuai.xml", diconv(array2xml($mokuais, 1), "UTF-8", $_G['charset'] . "//IGNORE"));
}
}
示例3: check_github_update
function check_github_update($path = '')
{
global $_G;
//dump('1');
$github_dir = 'C:\\GitHub\\17xue8';
//本地的GitHub的17xue8文件夹
clearstatcache();
if ($path == '') {
$path = $github_dir;
}
$out_path = substr(DISCUZ_ROOT, 0, -1) . str_replace($github_dir, '', $path);
//本地的wamp的17xue8文件夹
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && substr($file, 0, 1) != "." && $file != "mokuai") {
if (is_dir($path . "/" . $file)) {
if (!is_dir($out_path . "/" . $file)) {
dmkdir($out_path . "/" . $file);
}
check_github_update($path . "/" . $file);
} else {
if (filemtime($path . "/" . $file) > filemtime($out_path . "/" . $file)) {
//GitHub文件修改时间大于wamp时
file_put_contents($out_path . "/" . $file, diconv(file_get_contents($path . "/" . $file), "UTF-8", "GBK//IGNORE"));
}
}
}
}
}
}
示例4: init
private function init()
{
if (!function_exists('curl_init')) {
throw new Exception('您的当前环境不支持curl,请开通后再使用');
}
$this->ch = curl_init();
if ($this->debug && $this->proxy) {
//本机开启代理,抓包时非常有用.
curl_setopt($this->ch, CURLOPT_PROXY, $this->proxy);
}
curl_setopt($this->ch, CURLOPT_HEADER, false);
//将头文件的信息作为数据流输出。
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
// 获取的信息以文件流的形式返回
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
// 对认证证书来源的检查
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
// 从证书中检查SSL加密算法是否存在
curl_setopt($this->ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
// 模拟用户使用的浏览器
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
// 使用自动跳转
curl_setopt($this->ch, CURLOPT_MAXREDIRS, 5);
//指定最多的HTTP重定向的数量,这个选项是和CURLOPT_FOLLOWLOCATION一起使用的。
curl_setopt($this->ch, CURLOPT_AUTOREFERER, true);
// 自动设置Referer
curl_setopt($this->ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
// curl_setopt($this->ch_, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded"));
if ($this->is_save_cookie) {
if (!$this->cookie_file) {
$uri = parse_url($this->url);
$this->cookie_file = str_replace('.', '_', $uri['host']) . '.txt';
}
if (!is_dir(dirname(__FILE__) . '/' . $this->dir)) {
dmkdir(dirname(__FILE__) . '/' . $this->dir);
}
$this->cookie_file = dirname(__FILE__) . '/' . $this->dir . $this->cookie_file;
if (!file_exists($this->cookie_file)) {
file_put_contents($this->cookie_file, '');
}
curl_setopt($this->ch, CURLOPT_COOKIE, true);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie_file);
// 存放Cookie信息的文件名称
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookie_file);
// 读取上面所储存的Cookie信息
}
curl_setopt($this->ch, CURLOPT_TIMEOUT, 30);
// 设置超时限制防止死循环
curl_setopt($this->ch, CURLOPT_HEADER, $this->is_get_headers);
// 显示返回的Header区域内容
curl_setopt($this->ch, CURLOPT_REFERER, $this->referer ? $this->referer : $this->url);
$this->header = array("Accept: */*", "Accept-Language: zh-CN,zh;q=0.8", "Cache-Control:no-cache", "Connection:keep-alive", "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT']);
if ($this->ip) {
$this->header[] = "X-Forwarded-For: " . $this->ip;
$this->header[] = "CLIENT-IP: " . $this->ip;
}
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->header);
//设置头信息的地方
}
示例5: album_update_pic
function album_update_pic($albumid, $picid = 0)
{
global $_G;
$setarr = array();
if ($picid) {
$wheresql = "AND picid='{$picid}'";
} else {
$wheresql = "ORDER BY picid DESC LIMIT 1";
$piccount = getcount('home_pic', array('albumid' => $albumid, 'status' => '0'));
if (empty($piccount) && getcount('home_pic', array('albumid' => $albumid)) == 0) {
DB::query("DELETE FROM " . DB::table('home_album') . " WHERE albumid='{$albumid}'");
return false;
} else {
$setarr['picnum'] = $piccount;
}
}
$query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE albumid='{$albumid}' {$wheresql}");
if (!($pic = DB::fetch($query))) {
return false;
}
$from = $pic['remote'];
$pic['remote'] = $pic['remote'] > 1 ? $pic['remote'] - 2 : $pic['remote'];
$basedir = !getglobal('setting/attachdir') ? DISCUZ_ROOT . './data/attachment/' : getglobal('setting/attachdir');
$picdir = 'cover/' . substr(md5($albumid), 0, 2) . '/';
dmkdir($basedir . './album/' . $picdir);
if ($pic['remote']) {
$picsource = pic_get($pic['filepath'], $from > 1 ? 'forum' : 'album', $pic['thumb'], $pic['remote'], 0);
} else {
$picsource = $basedir . './' . ($from > 1 ? 'forum' : 'album') . '/' . $pic['filepath'];
}
require_once libfile('class/image');
$image = new image();
if ($image->Thumb($picsource, 'album/' . $picdir . $albumid . '.jpg', 120, 120, 2)) {
$setarr['pic'] = $picdir . $albumid . '.jpg';
$setarr['picflag'] = 1;
if (getglobal('setting/ftp/on')) {
if (ftpcmd('upload', 'album/' . $picdir . $albumid . '.jpg')) {
$setarr['picflag'] = 2;
@unlink($_G['setting']['attachdir'] . 'album/' . $picdir . $albumid . '.jpg');
}
}
} else {
if ($pic['status'] == 0) {
$setarr['pic'] = $pic['thumb'] ? $pic['filepath'] . '.thumb.jpg' : $pic['filepath'];
}
if ($from > 1) {
$setarr['picflag'] = $pic['remote'] ? 4 : 3;
} else {
$setarr['picflag'] = $pic['remote'] ? 2 : 1;
}
}
$setarr['updatetime'] = $_G['timestamp'];
DB::update('home_album', $setarr, array('albumid' => $albumid));
return true;
}
示例6: album_update_pic
function album_update_pic($albumid, $picid = 0)
{
global $_G;
$setarr = array();
if (!$picid) {
$piccount = C::t('home_pic')->check_albumpic($albumid, 0);
if (empty($piccount) && C::t('home_pic')->check_albumpic($albumid) == 0) {
C::t('home_album')->delete($albumid);
return false;
} else {
$setarr['picnum'] = $piccount;
}
}
$query = C::t('home_pic')->fetch_all_by_albumid($albumid, 0, 1, $picid, 1);
if (!($pic = $query[0])) {
return false;
}
$from = $pic['remote'];
$pic['remote'] = $pic['remote'] > 1 ? $pic['remote'] - 2 : $pic['remote'];
$basedir = !getglobal('setting/attachdir') ? DISCUZ_ROOT . './data/attachment/' : getglobal('setting/attachdir');
$picdir = 'cover/' . substr(md5($albumid), 0, 2) . '/';
dmkdir($basedir . './album/' . $picdir);
if ($pic['remote']) {
$picsource = pic_get($pic['filepath'], $from > 1 ? 'forum' : 'album', $pic['thumb'], $pic['remote'], 0);
} else {
$picsource = $basedir . './' . ($from > 1 ? 'forum' : 'album') . '/' . $pic['filepath'];
}
require_once libfile('class/image');
$image = new image();
if ($image->Thumb($picsource, 'album/' . $picdir . $albumid . '.jpg', 120, 120, 2)) {
$setarr['pic'] = $picdir . $albumid . '.jpg';
$setarr['picflag'] = 1;
if (getglobal('setting/ftp/on')) {
if (ftpcmd('upload', 'album/' . $picdir . $albumid . '.jpg')) {
$setarr['picflag'] = 2;
@unlink($_G['setting']['attachdir'] . 'album/' . $picdir . $albumid . '.jpg');
}
}
} else {
if ($pic['status'] == 0) {
$setarr['pic'] = $pic['thumb'] ? getimgthumbname($pic['filepath']) : $pic['filepath'];
}
if ($from > 1) {
$setarr['picflag'] = $pic['remote'] ? 4 : 3;
} else {
$setarr['picflag'] = $pic['remote'] ? 2 : 1;
}
}
$setarr['updatetime'] = $_G['timestamp'];
C::t('home_album')->update($albumid, $setarr);
return true;
}
示例7: getQRcodeBySid
public function getQRcodeBySid($sid)
{
$target = './qrcode/' . $sid[0] . '/' . $sid . '.png';
$targetpath = dirname(getglobal('setting/attachdir') . $target);
dmkdir($targetpath);
if (@getimagesize(getglobal('setting/attachdir') . $target)) {
return getglobal('setting/attachurl') . $target;
} else {
//生成二维码
QRcode::png(getglobal('siteurl') . 's.php?sid=' . $sid, getglobal('setting/attachdir') . $target, 'M', 4, 2);
return getglobal('setting/attachurl') . $target;
}
}
示例8: downloadmyappicon
function downloadmyappicon($appid)
{
$iconpath = getglobal('setting/attachdir') . './' . 'myapp/icon/' . $appid . '.jpg';
if (!is_dir(dirname($iconpath))) {
dmkdir(dirname($iconpath));
}
DB::update('common_myapp', array('iconstatus' => '-1'), array('appid' => $appid));
$icondata = file_get_contents(getmyappiconpath($appid, 0));
if ($icondata) {
file_put_contents($iconpath, $icondata);
DB::update('common_myapp', array('iconstatus' => '1', 'icondowntime' => TIMESTAMP), array('appid' => $appid));
}
}
示例9: upload
function upload($file)
{
global $_G;
if (!class_exists('upload')) {
include ROOT_PATH . 'web/upload.class.php';
}
if (!is_array($file)) {
$file = $this->file;
}
$upload = new upload();
$img_arr = $attach = array();
$upload_path = '/assets/uploads/';
$rs = $upload->init($file, $upload_path);
if (!$rs) {
return false;
}
$attach =& $upload->attach;
if ($attach['extension'] != 'jpg' && $attach['extension'] != 'png') {
$this->file_type = '.' . $attach['extension'];
$this->__construct();
}
if ($attach['extension'] == 'attach' && $attach['isimage'] != 1) {
$this->msg = '上传的文件非图片';
L($this->msg);
@unlink($attach['tmp_name']);
return false;
//非可上传的文件,就禁止上传了
}
$upload_max_size = $_G['setting']['upload_max_size'] ? intval($_G['setting']['upload_max_size']) : 2;
if ($attach['size'] > 1024 * 1024 * $upload_max_size) {
$this->msg = '上传文件失败,系统设置最大上传大为:' . $upload_max_size . 'MB';
L($this->msg);
@unlink($attach['tmp_name']);
return false;
}
if ($attach['errorcode']) {
$this->msg = '上传图片失败' . errormessage();
@unlink($attach['tmp_name']);
L($this->msg);
return false;
}
$lang_path = ROOT_PATH . $upload_path . $this->dir2;
if (!is_dir($lang_path)) {
dmkdir($lang_path);
}
$attach['target'] = $lang_path . $this->name;
$upload->save();
return $upload_path . $this->dir2 . $this->name;
}
示例10: srsysfilecache
function srsysfilecache($data, $file)
{
global $_G;
$data = stripcslashes($data);
$dir = DISCUZ_ROOT . './data/sysdata/';
if (!is_dir($dir)) {
dmkdir($dir, 0777);
}
if ($fp = @fopen($dir . 'cache_' . $file, 'wb')) {
fwrite($fp, $data);
fclose($fp);
} else {
exit('Can not write to cache files, please check directory ./data/ and ./data/sysdata/ .');
}
}
示例11: set_cache
function set_cache($key, $value, $life)
{
global $_G;
$data = array($key => array('data' => $value, 'life' => $life));
require_once libfile('function/cache');
$cache_file = $this->get_cache_file_path($key);
dmkdir(dirname($cache_file));
$cachedata = "\$data = " . arrayeval($data) . ";\n";
if ($fp = @fopen($cache_file, 'wb')) {
fwrite($fp, "<?php\n//Discuz! cache file, DO NOT modify me!" . "\n//Created: " . date("M j, Y, G:i") . "\n//Identify: " . md5($cache_file . $cachedata . $_G['config']['security']['authkey']) . "\n\nif(!defined('IN_DISCUZ')) {\n\texit('Access Denied');\n}\n\n{$cachedata}?>");
fclose($fp);
} else {
exit('Can not write to cache files, please check directory ./data/ and ./data/ultraxcache/ .');
}
return true;
}
示例12: writetocache
function writetocache($script, $cachedata, $prefix = 'cache_', $define_path = '')
{
global $_G;
if ($define_path) {
$dir = $define_path;
} else {
$dir = SITE_ROOT . './data/sysdata/';
}
if (!is_dir($dir)) {
dmkdir($dir, 0777);
}
if ($fp = @fopen("{$dir}{$prefix}{$script}.php", 'wb')) {
fwrite($fp, "<?php\n//DZF! cache file, DO NOT modify me!\n//Identify: " . md5($prefix . $script . '.php' . $cachedata . $_G['config']['security']['authkey']) . "\n\n{$cachedata}?>");
fclose($fp);
} else {
exit('Can not write to cache files, please check directory ./data/ and ./data/sysdata/ .');
}
}
示例13: make_html
public static function make_html()
{
global $_G;
if (self::$htmlfilename) {
$filepath = DISCUZ_ROOT . '/' . self::$htmlfilename . '.' . $_G['setting']['makehtml']['extendname'];
dmkdir(dirname($filepath));
$cend = '</body></html>';
if (file_put_contents($filepath, ob_get_clean() . $cend) !== false) {
$_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
if (self::$callback && is_callable(self::$callback)) {
call_user_func(self::$callback);
self::$callback = self::$callbackdata = null;
}
self::$returndata['status'] = 'html_ok';
if (isset(self::$viewurl)) {
self::$returndata['path'] = self::$viewurl;
} else {
self::$returndata['path'] = self::$htmlfilename . '.' . $_G['setting']['makehtml']['extendname'];
}
showmessage('do_success', null, self::$returndata);
}
}
}
示例14: setthreadcover
function setthreadcover($pid, $tid = 0, $aid = 0)
{
global $_G;
$cover = 0;
if (empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbwidth']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
return false;
}
if (($pid || $aid) && empty($tid)) {
if ($aid) {
$attachtable = getattachtablebyaid($aid);
$wheresql = "aid='{$aid}' AND isimage IN ('1', '-1')";
} else {
$attachtable = getattachtablebypid($pid);
$wheresql = "pid='{$pid}' AND isimage IN ('1', '-1') ORDER BY width DESC LIMIT 1";
}
$query = DB::query("SELECT * FROM " . DB::table($attachtable) . " WHERE {$wheresql}");
if (!($attach = DB::fetch($query))) {
return false;
}
if (empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
return false;
}
$pid = empty($pid) ? $attach['pid'] : $pid;
$tid = empty($tid) ? $attach['tid'] : $tid;
$basedir = !$_G['setting']['attachdir'] ? DISCUZ_ROOT . './data/attachment/' : $_G['setting']['attachdir'];
$coverdir = 'threadcover/' . substr(md5($tid), 0, 2) . '/' . substr(md5($tid), 2, 2) . '/';
dmkdir($basedir . './forum/' . $coverdir);
$picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
require_once libfile('class/image');
$image = new image();
if ($image->Thumb($picsource, 'forum/' . $coverdir . $tid . '.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
$remote = '';
if (getglobal('setting/ftp/on')) {
if (ftpcmd('upload', 'forum/' . $coverdir . $tid . '.jpg')) {
$remote = '-';
}
}
$cover = DB::result_first("SELECT COUNT(*) FROM " . DB::table($attachtable) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1')");
$cover = $remote . $cover;
} else {
return false;
}
}
if ($tid || $cover) {
if (empty($cover)) {
$oldcover = DB::result_first("SELECT cover FROM " . DB::table('forum_thread') . " WHERE tid='{$tid}'");
$cover = DB::result_first("SELECT COUNT(*) FROM " . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1')");
$cover = $cover && $oldcover < 0 ? '-' . $cover : $cover;
}
DB::update('forum_thread', array('cover' => $cover), array('tid' => $tid));
}
return true;
}
示例15: setthreadcover
function setthreadcover($pid, $tid = 0, $aid = 0, $countimg = 0, $imgurl = '')
{
global $_G;
$cover = 0;
if (empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbheight']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
return false;
}
if (($pid || $aid) && empty($countimg)) {
if (empty($imgurl)) {
if ($aid) {
$attachtable = 'aid:' . $aid;
$attach = C::t('forum_attachment_n')->fetch('aid:' . $aid, $aid, array(1, -1));
} else {
$attachtable = 'pid:' . $pid;
$attach = C::t('forum_attachment_n')->fetch_max_image('pid:' . $pid, 'pid', $pid);
}
if (!$attach) {
return false;
}
if (empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
return false;
}
$pid = empty($pid) ? $attach['pid'] : $pid;
$tid = empty($tid) ? $attach['tid'] : $tid;
$picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
} else {
$attachtable = 'pid:' . $pid;
$picsource = $imgurl;
}
$basedir = !$_G['setting']['attachdir'] ? DISCUZ_ROOT . './data/attachment/' : $_G['setting']['attachdir'];
$coverdir = 'threadcover/' . substr(md5($tid), 0, 2) . '/' . substr(md5($tid), 2, 2) . '/';
dmkdir($basedir . './forum/' . $coverdir);
require_once libfile('class/image');
$image = new image();
if ($image->Thumb($picsource, 'forum/' . $coverdir . $tid . '.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
$remote = '';
if (getglobal('setting/ftp/on')) {
if (ftpcmd('upload', 'forum/' . $coverdir . $tid . '.jpg')) {
$remote = '-';
}
}
$cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);
if ($imgurl && empty($cover)) {
$cover = 1;
}
$cover = $remote . $cover;
} else {
return false;
}
}
if ($countimg) {
if (empty($cover)) {
$thread = C::t('forum_thread')->fetch($tid);
$oldcover = $thread['cover'];
$cover = C::t('forum_attachment_n')->count_image_by_id('tid:' . $tid, 'pid', $pid);
if ($cover) {
$cover = $oldcover < 0 ? '-' . $cover : $cover;
}
}
}
if ($cover) {
C::t('forum_thread')->update($tid, array('cover' => $cover));
return true;
}
}