function xstart() { $unix = new unix(); $sock = new sockets(); build_progress("{starting} {creating_new_cache}", 15); $Config = unserialize($sock->GET_INFO("NewCacheCenterWizard")); if (isset($Config["SaveHD"])) { CreateHD(); return; } if (isset($Config["SaveDir"])) { CreateDir(); return; } }
function wpdm_pro_Install() { global $wpdb; delete_option('wpdm_latest'); $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_download_stats` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `pid` int(11) NOT NULL,\n `uid` int(11) NOT NULL,\n `oid` varchar(100) NOT NULL,\n `year` int(4) NOT NULL,\n `month` int(2) NOT NULL,\n `day` int(2) NOT NULL,\n `timestamp` int(11) NOT NULL,\n `ip` varchar(20) NOT NULL,\n PRIMARY KEY (`id`)\n )"; $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_emails` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `email` varchar(255) NOT NULL,\n `pid` int(11) NOT NULL,\n `date` int(11) NOT NULL,\n `custom_data` text NOT NULL,\n `request_status` INT( 1 ) NOT NULL,\n PRIMARY KEY (`id`)\n )"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; foreach ($sqls as $sql) { $wpdb->query($sql); //dbDelta($sql); } if (get_option('_wpdm_etpl') == '') { update_option('_wpdm_etpl', array('title' => 'Your download link', 'body' => file_get_contents(dirname(__FILE__) . '/templates/wpdm-email-lock-template.html'))); } wpdm_common_actions(); flush_rewrite_rules(); CreateDir(); }
function GetFileNewName($aid, $typeid, $timetag, $title, $ismake = 0, $rank = 0, $namerule = '', $typedir = '', $money = 0, $filename = '') { global $cfg_arc_dirname; $articlename = GetFileName($aid, $typeid, $timetag, $title, $ismake, $rank, $namerule, $typedir, $money, $filename); if (ereg("\\?", $articlename)) { return $articlename; } if ($cfg_arc_dirname == 'Y' && ereg("/\$", $articlename)) { $articlename = $articlename . "index.html"; } $slen = strlen($articlename) - 1; for ($i = $slen; $i >= 0; $i--) { if ($articlename[$i] == '/') { $subpos = $i; break; } } $okdir = substr($articlename, 0, $subpos); CreateDir($okdir); return $articlename; }
/** * 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; }
exit; } if ($action == '') { echo "本程序将检测下列目录是否存在,或者是否具有写入的权限,并尝试创建或更改:<br>"; echo "(如果你的主机使用的是windows系统,你无需进行此操作)<br>"; echo "'/include' 目录和 '当前目录/templets' 文件夹请你在FTP中手工更改权限为可写入(0777)<br>"; echo "<pre>" . str_replace('|', '', $needDir) . "</pre>"; echo "</td></tr>\r\n<tr><td bgcolor='#F9FCEF' height='32px' style='padding-left:20px'>\r\n<a href='testenv.php?action=ok' class='np coolbg'><<开始检测>></a> <a href='index_body.php' class='np coolbg'><<返回主页>></a>"; } else { $needDirs = explode('|', $needDir); $needDir = ''; foreach ($needDirs as $needDir) { $needDir = trim($needDir); $needDir = str_replace("\\", "/", $needDir); $needDir = ereg_replace("/{1,}", "/", $needDir); if (CreateDir($needDir)) { echo "成功更改或创建:{$needDir} <br>"; } else { echo "更改或创建目录:{$needDir} <font color='red'>失败!</font> <br>"; } } echo "<br>如果发现更改或创建错误的项目,请<a href='testenv.php?action=ok&play=" . time() . "'><u>重试</u></a>或手动登陆到FTP更改相关目录的权限为777或666<br>"; echo "</td></tr>\r\n<tr><td bgcolor='#F9FCEF' height='32px' style='padding-left:20px'>\r\n<a href='index_body.php' class='np coolbg'><<返回主页>></a>"; CloseFtp(); } ?> </td> </tr> </table> </body> </html>
/** * 显示单独模板页面 * * @access public * @param string * @return string */ function DisplayPartTemplets() { $this->PartView = new PartView($this->TypeID, false); $this->PartView->SetTypeLink($this->TypeLink); $nmfa = 0; $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; if ($this->Fields['ispart'] == 1) { //封面模板 $tempfile = str_replace("{tid}", $this->TypeID, $this->Fields['tempindex']); $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); $tempfile = $tmpdir . "/" . $tempfile; if (!file_exists($tempfile)) { $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default.htm"; } $this->PartView->SetTemplet($tempfile); } else { if ($this->Fields['ispart'] == 2) { //跳转网址 $gotourl = $this->Fields['typedir']; header("Location:{$gotourl}"); exit; } } CreateDir(MfTypedir($this->Fields['typedir'])); $makeUrl = $this->GetMakeFileRule($this->Fields['id'], "index", MfTypedir($this->Fields['typedir']), $this->Fields['defaultname'], $this->Fields['namerule2']); $makeFile = $this->GetTruePath() . $makeUrl; if ($nmfa == 0) { $this->PartView->Display(); } else { if (!file_exists($makeFile)) { $this->PartView->Display(); } else { include $makeFile; } } }
/** * 开始创建列表 * * @access public * @param int $isremote 是否远程 * @return string */ function MakeHtml($isremote = 0) { global $cfg_remote_site; //初步给固定值的标记赋值 $this->ParseTempletsFirst(); $totalpage = ceil($this->TotalResult / $this->PageSize); if ($totalpage == 0) { $totalpage = 1; } CreateDir($GLOBALS['cfg_special']); $murl = ""; for ($this->PageNo = 1; $this->PageNo <= $totalpage; $this->PageNo++) { foreach ($this->dtp->CTags as $tagid => $ctag) { if ($ctag->GetName() == "list") { $limitstart = ($this->PageNo - 1) * $this->PageSize; $row = $this->PageSize; if (trim($ctag->GetInnerText()) == "") { $InnerText = GetSysTemplets("spec_list.htm"); } else { $InnerText = trim($ctag->GetInnerText()); } $this->dtp->Assign($tagid, $this->GetArcList($limitstart, $row, $ctag->GetAtt("col"), $ctag->GetAtt("titlelen"), $ctag->GetAtt("infolen"), $ctag->GetAtt("imgwidth"), $ctag->GetAtt("imgheight"), "spec", $ctag->GetAtt("orderby"), $InnerText, $ctag->GetAtt("tablewidth"))); } else { if ($ctag->GetName() == "pagelist") { $list_len = trim($ctag->GetAtt("listsize")); if ($list_len == "") { $list_len = 3; } $this->dtp->Assign($tagid, $this->GetPageListST($list_len)); } } } //End foreach $makeFile = $GLOBALS['cfg_special'] . "/spec_" . $this->PageNo . $GLOBALS['art_shortname']; $murl = $makeFile; $makeFile = $GLOBALS['cfg_basedir'] . $makeFile; $this->dtp->SaveTo($makeFile); //如果启用远程站点则上传 if ($cfg_remote_site == 'Y' && $isremote == 1) { //分析远程文件路径 $remotefile = str_replace(DEDEROOT, '', $makeFile); $localfile = '..' . $remotefile; $remotedir = preg_replace('/[^\\/]*\\.html/', '', $remotefile); //不相等则说明已经切换目录则可以创建镜像 $this->ftp->rmkdir($remotedir); $this->ftp->upload($localfile, $remotefile, 'acii'); } echo "成功创建:{$murl}<br/>"; } copy($GLOBALS['cfg_basedir'] . $GLOBALS['cfg_special'] . "/spec_1" . $GLOBALS['art_shortname'], $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_special'] . "/index.html"); $murl = $GLOBALS['cfg_special'] . "/index.html"; return $murl; }
function GetMakeFileRule() { $okfile = ''; $namerule = $this->FLInfos['namerule']; $listdir = $this->FLInfos['listdir']; $listdir = str_replace('{cmspath}', $GLOBALS['cfg_cmspath'], $listdir); $okfile = str_replace('{listid}', $this->FLInfos['aid'], $namerule); $okfile = str_replace('{listdir}', $listdir, $okfile); $okfile = str_replace("\\", "/", $okfile); $mdir = ereg_replace("/([^/]*)\$", "", $okfile); if (!ereg("/", $mdir) && ereg("\\.", $mdir)) { return $okfile; } else { CreateDir($mdir, '', ''); return $okfile; } }
function DisplayPartTemplets() { $nmfa = 0; $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; if($this->Fields['ispart']==1){ $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); $tempfile = $tmpdir."/".$tempfile; if(!file_exists($tempfile)){ $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm"; } $this->PartView->SetTemplet($tempfile); }else if($this->Fields['ispart']==2){ $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempone']); $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); if(is_file($tmpdir."/".$tempfile)) $this->PartView->SetTemplet($tmpdir."/".$tempfile); else{ $this->PartView->SetTemplet("这是没有使用模板的单独页!","string"); $nmfa = 1; } } CreateDir($this->Fields['typedir']); $makeUrl = $this->GetMakeFileRule($this->Fields['ID'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']); $makeFile = $this->GetTruePath().$makeUrl; if($nmfa==0) $this->PartView->Display(); else{ if(!file_exists($makeFile)) $this->PartView->Display(); else include($makeFile); } $this->Close(); }
function UploadOneImage($upname,$handurl='',$ddisremote=1,$ntitle='') { global $cuserLogin,$cfg_basedir,$cfg_image_dir,$dsql,$title; if($ntitle!='') $title = $ntitle; $ntime = time(); $filename = ''; $isrm_up = false; $handurl = trim($handurl); //如果用户自行上传了图片 if(!empty($_FILES[$upname]['tmp_name']) && is_uploaded_file($_FILES[$upname]['tmp_name'])) { $istype = 0; $sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png"); $_FILES[$upname]['type'] = strtolower(trim($_FILES[$upname]['type'])); if(!in_array($_FILES[$upname]['type'],$sparr)){ ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!","-1"); exit(); } if(!empty($handurl) && !eregi("^http://",$handurl) && file_exists($cfg_basedir.$handurl) ){ if(!is_object($dsql)) $dsql = new DedeSql(); $dsql->ExecuteNoneQuery("Delete From #@__uploads where url like '$handurl' "); $fullUrl = eregi_replace("\.([a-z]*)$","",$handurl); }else{ $savepath = $cfg_image_dir."/".strftime("%Y-%m",$ntime); CreateDir($savepath); $fullUrl = $savepath."/".strftime("%d",$ntime).dd2char(strftime("%H%M%S",$ntime).'0'.$cuserLogin->getUserID().'0'.mt_rand(1000,9999)); } if(strtolower($_FILES[$upname]['type'])=="image/gif") $fullUrl = $fullUrl.".gif"; else if(strtolower($_FILES[$upname]['type'])=="image/png") $fullUrl = $fullUrl.".png"; else $fullUrl = $fullUrl.".jpg"; //保存 @move_uploaded_file($_FILES[$upname]['tmp_name'],$cfg_basedir.$fullUrl); $filename = $fullUrl; //水印 @WaterImg($imgfile,'up'); $isrm_up = true; } //远程或选择本地图片 else{ if($handurl=='') return ''; //远程图片并要求本地化 if($isremote==1 && eregi("^http://",$handurl)){ $ddinfos = GetRemoteImage($handurl,$cuserLogin->getUserID()); if(!is_array($ddinfos)) $litpic = ""; else $filename = $ddinfos[0]; $isrm_up = true; //本地图片或远程不要求本地化 }else{ $filename = $handurl; } } $imgfile = $cfg_basedir.$filename; if(is_file($imgfile) && $isrm_up && $filename!=''){ $info = ""; $imginfos = GetImageSize($imgfile,$info); //把新上传的图片信息保存到媒体文档管理档案中 $inquery = " INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid) VALUES ('$title','$filename','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".time()."','".$cuserLogin->getUserID()."','0'); "; $dsql = new DedeSql(false); $dsql->ExecuteNoneQuery($inquery); } return $filename; }
function MakeHtml($startpage=1,$makepagesize=0) { if(empty($startpage)) $startpage = 1; $this->CountRecord(); //初步给固定值的标记赋值 $this->ParseTempletsFirst(); CreateDir('/digg','',''); $murl = ""; if($makepagesize>0) $endpage = $startpage+$makepagesize; else $endpage = ($this->TotalPage+1); if($endpage>($this->TotalPage+1)) $endpage = $this->TotalPage; //循环更新HTML for($this->PageNo=$startpage;$this->PageNo<$endpage;$this->PageNo++) { $this->ParseDMFields($this->PageNo,1); $makeFile = $this->NameRule; $makeFile = str_replace("{page}",$this->PageNo,$makeFile); $murl = $makeFile; $makeFile = $this->GetTruePath().$makeFile; $makeFile = ereg_replace("/{1,}","/",$makeFile); $murl = $this->GetTrueUrl($murl); $this->dtp->SaveTo($makeFile); echo "成功创建:<a href='$murl' target='_blank'>$murl</a><br/>"; } $this->Close(); return $murl; }
function GetUpImage($litpic,$isdd=false,$exitErr=false,$iw=0,$ih=0,$iname='') { global $cfg_ml,$cfg_ddimg_width,$cfg_ddimg_height; global $cfg_basedir,$cfg_user_dir,$title,$cfg_mb_upload_size,$cfg_photo_typenames; if($iw==0) $iw = $cfg_ddimg_width; if($ih==0) $ih = $cfg_ddimg_height; $ntime = $nowtme = mytime(); if(!isset($_FILES[$litpic])) return ""; if(is_uploaded_file($_FILES[$litpic]['tmp_name'])) { //超过限定大小的文件不给上传 if($_FILES[$litpic]['size'] > $cfg_mb_upload_size*1024){ @unlink($_FILES[$litpic]['tmp_name']); return ""; } $sparr = $cfg_photo_typenames; $_FILES[$litpic]['type'] = strtolower(trim($_FILES[$litpic]['type'])); if(!in_array($_FILES[$litpic]['type'],$sparr)){ if($exitErr){ ShowMsg("上传的缩略图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!","-1"); exit(); }else{ return ""; } } $savepath = $cfg_user_dir."/".$cfg_ml->M_ID; CreateDir($savepath); if($iname=='') $itname = dd2char($cfg_ml->M_ID."0".strftime("%y%m%d%H%M%S",$nowtme)."0".mt_rand(1000,9999)).'-lit'; else $itname = $iname; $fullUrl = $savepath."/".$itname; //强制检测文件类型 if($iname==''){ if(strtolower($_FILES[$litpic]['type'])=="image/gif") $fullUrl = $fullUrl.".gif"; else if(strtolower($_FILES[$litpic]['type'])=="image/png") $fullUrl = $fullUrl.".png"; else $fullUrl = $fullUrl.".jpg"; }else{ $fullUrl = $fullUrl.'.jpg'; } @move_uploaded_file($_FILES[$litpic]['tmp_name'],$cfg_basedir.$fullUrl); $litpic = $fullUrl; if($isdd) @ImageResize($cfg_basedir.$fullUrl,$iw,$ih); else @WaterImg($cfg_basedir.$fullUrl,'up'); //保存用户上传的记录到数据库 if($title==''){ if($isdd) $title = '用户上传的图片'; else $title = '用户上传的略略图'; } $info = ""; $datas[0] = 0; $datas[1] = 0; $datas = GetImageSize($cfg_basedir.$fullUrl,$info); $addinfos[0] = $datas[0]; $addinfos[1] = $datas[1]; $addinfos[2] = filesize($cfg_basedir.$fullUrl); SaveUploadInfo($title,$fullUrl,1,$addinfos); return $litpic; }else{ return ""; } }
/** * 保存结果为文件 * * @access public * @param string $filename 文件名 * @param string $isremote 是否远程 * @return string */ function SaveToHtml($filename, $isremote = 0) { global $cfg_remote_site; //如果启用远程发布则需要进行判断 if ($this->actype == "download") { if (substr_count($this->TypeLink->TypeInfos['typedir'], "/") > 1) { $a = "/html/download" . str_replace(strrchr($this->TypeLink->TypeInfos['typedir'], "/"), "", $this->TypeLink->TypeInfos['typedir']); CreateDir($a); } } if ($this->TypeLink->TypeInfos['reid'] == 45) { if (substr_count($this->TypeLink->TypeInfos['typedir'], "/") > 1) { $a = "/html" . str_replace(strrchr($this->TypeLink->TypeInfos['typedir'], "/"), "", $this->TypeLink->TypeInfos['typedir']); CreateDir($a); } } if ($cfg_remote_site == 'Y' && $isremote == 1) { //分析远程文件路径 $remotefile = str_replace(DEDEROOT, '', $filename); $localfile = '..' . $remotefile; //创建远程文件夹 $remotedir = preg_replace('/[^\\/]*\\.js/', '', $remotefile); $this->ftp->rmkdir($remotedir); $this->ftp->upload($localfile, $remotefile, 'ascii'); } $this->dtp->SaveTo($filename); }
/** * 储存 * @param $body * @param $path */ function CachePutContents($body, $path) { CreateDir(dirname($path)); $handle = fopen($path, 'w'); fwrite($handle, $body); fclose($handle); }
function wpdm_pro_Install() { global $wpdb; delete_option('wpdm_latest'); /* $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_files` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `description` text NOT NULL, `link_label` varchar(255) NOT NULL, `password` text NOT NULL, `quota` int(11) NOT NULL, `show_quota` tinyint(11) NOT NULL, `show_counter` tinyint(1) NOT NULL, `access` text NOT NULL, `template` varchar(100) NOT NULL, `category` text NOT NULL, `icon` varchar(255) NOT NULL, `preview` varchar(255) NOT NULL, `files` text NOT NULL, `sourceurl` text NOT NULL, `download_count` int(11) NOT NULL, `page_template` varchar(255) NOT NULL, `url_key` varchar(255) NOT NULL, `uid` INT NOT NULL, `create_date` INT NOT NULL, `update_date` INT NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; */ $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_download_stats` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `pid` int(11) NOT NULL,\n `uid` int(11) NOT NULL,\n `oid` varchar(100) NOT NULL,\n `year` int(4) NOT NULL,\n `month` int(2) NOT NULL,\n `day` int(2) NOT NULL,\n `timestamp` int(11) NOT NULL,\n `ip` varchar(20) NOT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; /* $sqls[] = "CREATE TABLE `{$wpdb->prefix}ahm_filemeta` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `pid` INT NOT NULL , `name` VARCHAR( 80 ) NOT NULL , `value` TEXT NOT NULL, `uniq` BOOLEAN NOT NULL DEFAULT '0' ) ENGINE = MyISAM DEFAULT CHARSET=utf8"; */ $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_emails` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `email` varchar(255) NOT NULL,\n `pid` int(11) NOT NULL,\n `date` int(11) NOT NULL,\n `custom_data` text NOT NULL,\n `request_status` INT( 1 ) NOT NULL,\n PRIMARY KEY (`id`)\n )"; /* $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_categories` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `title` VARCHAR( 255 ) NOT NULL , `desc` TEXT NOT NULL , `url_key` VARCHAR( 255 ) NOT NULL , `pcount` INT NOT NULL , `image` VARCHAR( 255 ) NOT NULL , `parent` INT NOT NULL , UNIQUE ( `url_key` ) )";*/ //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `uid` INT NOT NULL"; //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `create_date` INT NOT NULL"; //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `update_date` INT NOT NULL"; //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_files` ADD `url_key` varchar(255) NOT NULL"; //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_emails` ADD `custom_data` TEXT NOT NULL "; //$sqls[] = "ALTER TABLE `{$wpdb->prefix}ahm_emails` ADD `request_status` INT( 1 ) NOT NULL "; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; foreach ($sqls as $sql) { $wpdb->query($sql); //dbDelta($sql); } if (get_option('_wpdm_etpl') == '') { update_option('_wpdm_etpl', array('title' => 'Your download link', 'body' => file_get_contents(dirname(__FILE__) . '/templates/wpdm-email-lock-template.html'))); } wpdm_common_actions(); flush_rewrite_rules(); CreateDir(); }
} if (strstr($v, 'pic')) { $gallery[] = $v; } if (strstr($v, 'annex')) { $annex[] = $v; } } } if ($item_image) { include_once XOOPS_ROOT_PATH . "/class/uploader.php"; $dir = XOOPS_ROOT_PATH . "/uploads/gallery/"; $original_dir = CreateDir($dir); $mid_dir = CreateDir($dir); $thumb_dir = CreateDir($dir); $item_dir = CreateDir($dir); $mid_wh = array(240, 240); $thumb_wh = array(480, 480); $item_wh = array(600, 600); $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png'); $maxfilesize = 5000000000; $maxfilewidth = 20000; $maxfileheight = 20000; $uploader = new XoopsMediaUploader($original_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($item_image)) { $uploader->setPrefix('item_'); if (!$uploader->upload()) { echo $uploader->getErrors(); } else { $item_obj->setVar('item_picture', $uploader->getSavedFileName()); setImageThumb($original_dir, $uploader->getSavedFileName(), $mid_dir, 'mid_' . $uploader->getSavedFileName(), array($mid_wh[0], $mid_wh[1]));
function MakeHtml() { //初步给固定值的标记赋值 $indexfile = ''; $this->ParseTempletsFirst(); $totalpage = ceil($this->TotalResult/$this->PageSize); if($totalpage==0) $totalpage = 1; CreateDir($GLOBALS['cfg_special']); $murl = ""; for($this->PageNo=1;$this->PageNo<=$totalpage;$this->PageNo++) { foreach($this->dtp->CTags as $tagid=>$ctag){ if($ctag->GetName()=="list"){ $limitstart = ($this->PageNo-1) * $this->PageSize; $row = $this->PageSize; if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("spec_list.htm"); } else{ $InnerText = trim($ctag->GetInnerText()); } $this->dtp->Assign($tagid, $this->GetArcList($limitstart,$row, $ctag->GetAtt("col"), $ctag->GetAtt("titlelen"), $ctag->GetAtt("infolen"), $ctag->GetAtt("imgwidth"), $ctag->GetAtt("imgheight"), "spec", $ctag->GetAtt("orderby"), $InnerText, $ctag->GetAtt("tablewidth")) ); } else if($ctag->GetName()=="pagelist"){ $list_len = trim($ctag->GetAtt("listsize")); if($list_len=="") $list_len = 3; $this->dtp->Assign($tagid,$this->GetPageListST($list_len)); } }//End foreach $makeFile = $GLOBALS['cfg_special']."/spec_".$this->PageNo.$GLOBALS['art_shortname']; $murl = $makeFile; $makeFile = $GLOBALS['cfg_basedir'].$makeFile; $this->dtp->SaveTo($makeFile); if(empty($indexfile)){ $indexfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_special']."/index".$GLOBALS['art_shortname']; copy($makeFile,$indexfile); } echo "成功创建:<a href='$murl' target='_blank'>$murl</a><br/>"; } $this->Close(); return $murl; }
<?php require_once(dirname(__FILE__)."/config.php"); require_once(dirname(__FILE__)."/../inc_photograph.php"); if(empty($job)) $job = ""; CheckUserSpace($cfg_ml->M_ID); //检测或创建用户目录 $rootdir = $cfg_user_dir."/".$cfg_ml->M_ID; if(!is_dir($cfg_basedir.$rootdir)){ CreateDir($rootdir); CloseFtp(); } if(empty($uploadfile)) $uploadfile=""; if(!is_uploaded_file($uploadfile)){ ShowMsg("你没有选择上传的文件!","-1"); exit(); } if($uploadfile_size > $cfg_mb_upload_size*1024){ @unlink(is_uploaded_file($uploadfile)); ShowMsg("你上传的文件超过了{$cfg_mb_upload_size}K,不允许上传!","-1"); exit(); } if(!CheckAddonType($uploadfile_name)){ ShowMsg("你所上传的文件类型被禁止,系统只允许上传<br>".$cfg_mb_mediatype." 类型附件!","-1"); exit();
function CreateFile() { echo 'Packaging file ' . basename($this->_OutputPath) . "\n"; // Extract the directory from the output file path. $destDir = dirname($this->_OutputPath); // Create the directory if it doesn't exist. if (!@is_dir($destDir)) { CreateDir($destDir); } // Create the StringBuilder that will hold the output data. $outputData = ''; $uncompressedSize = 0; // Loop through the files. foreach ($this->_Files as $file) { // Read the file. $data = file_get_contents($file); // Strip the UTF-8 BOM, if available. $data = StripUtf8Bom($data); $dataSize = strlen($data); $uncompressedSize += $dataSize; echo ' Adding ' . basename($file) . "\n"; // Compress (if needed) and process its contents. if ($this->CompactJavaScript) { $outputData .= FCKJavaScriptCompressor::Compress(FCKPreProcessor::Process($data), $this->ConstantsProcessor); } else { $outputData .= FCKPreProcessor::Process($data); } // Each file terminates with a CRLF, even if compressed. $outputData .= "\r\n"; } // Replace global vars. if ($this->RenameGlobals) { $funcProcessor = new FCKFunctionProcessor($outputData, NULL, true); $outputData = $funcProcessor->Process(); } // Write the output file. if (strlen($this->Header) > 0) { $outputData = $this->Header . "\r\n" . $outputData; } if (!SaveStringToFile($outputData, $this->_OutputPath, TRUE)) { ExitError('It was not possible to save the file "' . $this->_OutputPath . '".'); } echo "\n"; echo ' Number of files processed: ' . count($this->_Files) . "\n"; echo ' Original size............: ' . number_format($uncompressedSize) . ' bytes' . "\n"; echo ' Output file size.........: ' . number_format(strlen($outputData)) . ' bytes (' . round(strlen($outputData) / $uncompressedSize * 100, 2) . '% of original)' . "\n"; echo "\n"; }
/** * Loads the HTML wms:include tags * * @version 1 * @author Rick de Man <*****@*****.**> */ protected function HTML__Process() { $PregWmsInclude = '/^([\\t ]{1,})(\\<wms:include ([ \\S=\'"]+?)\\/>)/mi'; // Regex tag Attribute & values $PregHtmlTags = '/([\\S]{1,})=["\'](.{0,}?)["\'][\\s]{0,1}/'; // Accessibles functions $Elements = array("Bootstrap_Header", "HTML_Css", "HTML_CssFonts", "HTML_CssPlugins", "Html_Favicon", "Html_HiddenHead", "HTML_JS", "HTML_JsPlugins", "HTML_JsTemplate", "HTML_Menu", "HTML_MetaTags", "HTML_Title", "HTML_WmsData"); // Make sure all values are LowerString $Elements = array_map('strtolower', $Elements); // Get all current content $Result = ob_get_contents(); // Empty current content ob_clean(); // While counter $While = 0; // While counter Page $WhilePage = 3; // While counter Max $WhileMax = 6; // Log process ? $Log = isset($_GET['loghtmlprocess']); // Create dir if not exists if ($Log == true) { CreateDir(WMS_LIB . 'html_process/'); } // Loop while conditions are met while (preg_match_all($PregWmsInclude, $Result, $Matches, PREG_SET_ORDER) && $While <= $WhileMax) { $While++; // Loop through all matches foreach ($Matches as $K => $V) { // Log process steps if ($Log == true) { // Replace Step Backtrace file_put_contents(WMS_ROOT . '/lib/html_process/' . session_id() . '_' . sprintf('%02d', $While) . '_' . sprintf('%02d', $K) . '.html', $Result); } // Variable for all Tag attributes & values $Attributes = array(); // Variable for wms:include method $Method = ''; // Check for Tag attributes preg_match_all($PregHtmlTags, $V[2], $TagRegex); // Store each tag Name & Value foreach ($TagRegex[1] as $IndexKey => $Index) { $Attributes[strtolower($Index)] = $TagRegex[2][$IndexKey]; } // Check for attributes if (isset($Attributes['type']) && isset($Attributes['name'])) { // Create Method name $Method = strtolower($Attributes['type'] . "_" . $Attributes['name']); } // Check if method is allowed and exists if (in_array($Method, $Elements) || $While === $WhilePage && $Method == 'html_page' || $While == $WhileMax && $Method == 'html_builderrors') { // Check if method exists if (method_exists($this, $Method)) { // Call method for output $Replace = $this->{$Method}($V[1], $V[2], $Attributes); if (is_array($Replace)) { $Paramaters = $Replace['Paramaters']; $Replace = $Replace['Result']; } // Remove end Whiteline $Replace = preg_replace('/(' . EOL . ')*$/', '', $Replace); if (isset($Paramaters)) { if ($Paramaters['ClearPage'] === true) { preg_match('/<body>[\\W\\w]+?<div[\\W\\w]+?<\\/div>([\\W\\w]+?[\\W\\w]+?(<div)[\\W\\w]+)<\\/body>/im', $Result, $Match); $Replace = PlaceOffset(' ', $Replace); $Result = str_replace($Match[1], EOL . $Replace . EOL, $Result); $Replace = ''; } } $Replace = PlaceOffset($V[1], $Replace); // strip last EndOfLine if (endswith(EOL, $Replace)) { $Replace = substr($Replace, 0, -strlen(EOL)); } // Replace the tag by the new content in the HTML $Result = str_replace($V[0], $Replace, $Result); } else { // Error - Method not exist $this->BuildErrors[] = $this->Bootstrap_HtmlAlert('wms:include method does not exist: ' . $Method, 'danger'); $Result = str_replace($V[0], '', $Result); } } else { if (!in_array($Method, array('html_page', 'html_builderrors'))) { // Error - Method not allowed $this->BuildErrors[] = $this->Bootstrap_HtmlAlert('wms:include not allowed: ' . htmlentities($V[2]), 'danger'); $Result = str_replace($V[0], '', $Result); } } } } if (preg_match('/([\\t ]{1,})(<wms:PageDebug>)/', $Result, $PageDebug)) { $Result2 = ob_get_contents(); ob_clean(); $Result = str_replace($PageDebug[0], placeoffset($PageDebug[1], $Result2), $Result); } echo $Result; // process wms:components tags $this->Component__Process(); }
function Save($strPage, $strWikiContent) { global $k_strExtension, $k_aConfig, $ChuOpen, $ChuWrite, $ChuClose; // Création du répertoire des pages $strPagePath = GetPagePath(); CreateDir($strPagePath); // Création du répertoire de la page $strPageDir = ComputePageDir($strPagePath, $strPage); CreateDir($strPageDir); if (file_exists($strPageDir . '/lock.txt')) { // Cette page est protégée ErrorUnableToWrite(); } // On enregistre le contenu du fichier $strDate = date('YmdHis'); $strSavePath = $strPageDir . '/' . $strDate . '.' . $k_strExtension; $file = $ChuOpen($strSavePath, 'w9'); if ($file === FALSE) { // Impossible d'ouvrir le fichier en écriture ErrorUnableToWrite(); } $ChuWrite($file, $strWikiContent); $ChuClose($file); @chmod($strSavePath, 0777); // On enregistre le fichier indiquant le dernier changement WriteFile(GetLatestDateFilePath($strPageDir), $strDate); }
/** * Summary of getURL * @param mixed $url Url * @param mixed $cache Cache (default 0) * @param mixed $username User name (default '') * @param mixed $password Password (default '') * @return mixed */ function getURL($url, $cache = 0, $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 try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.14'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // bad style, I know... curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_TIMEOUT, 15); if ($username != '' || $password != '') { curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); } $tmpfname = ROOT . 'cached/cookie.txt'; curl_setopt($ch, CURLOPT_COOKIEJAR, $tmpfname); curl_setopt($ch, CURLOPT_COOKIEFILE, $tmpfname); $result = curl_exec($ch); } catch (Exception $e) { registerError('geturl', $url . ' ' . get_class($e) . ', ' . $e->getMessage()); } if ($cache > 0) { CreateDir(ROOT . 'cached/urls'); SaveFile($cache_file, $result); } } else { $result = LoadFile($cache_file); } return $result; }
/** * 上传一个未经处理的图片 * * @access public * @param string $upname 上传框名称 * @param string $handurl 手工填写的网址 * @param string $ddisremote 是否下载远程图片 0 不下, 1 下载 * @param string $ntitle 注解文字 如果表单有 title 字段可不管 * @return mixed */ function UploadOneImage($upname, $handurl = '', $isremote = 1, $ntitle = '') { global $cuserLogin, $cfg_basedir, $cfg_image_dir, $title, $dsql; if ($ntitle != '') { $title = $ntitle; } $ntime = time(); $filename = ''; $isrm_up = FALSE; $handurl = trim($handurl); //如果用户自行上传了图片 if (!empty($_FILES[$upname]['tmp_name']) && is_uploaded_file($_FILES[$upname]['tmp_name'])) { $istype = 0; $sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png"); $_FILES[$upname]['type'] = strtolower(trim($_FILES[$upname]['type'])); if (!in_array($_FILES[$upname]['type'], $sparr)) { ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!", "-1"); exit; } if (!empty($handurl) && !preg_match("#^http:\\/\\/#i", $handurl) && file_exists($cfg_basedir . $handurl)) { if (!is_object($dsql)) { $dsql = new DedeSql(); } $dsql->ExecuteNoneQuery("DELETE FROM `#@__uploads` WHERE url LIKE '{$handurl}' "); $fullUrl = preg_replace("#\\.([a-z]*)\$#i", "", $handurl); } else { $savepath = $cfg_image_dir . '/' . strftime("%Y-%m", $ntime); CreateDir($savepath); $fullUrl = $savepath . '/' . strftime("%d", $ntime) . dd2char(strftime("%H%M%S", $ntime) . '0' . $cuserLogin->getUserID() . '0' . mt_rand(1000, 9999)); } if (strtolower($_FILES[$upname]['type']) == "image/gif") { $fullUrl = $fullUrl . ".gif"; } else { if (strtolower($_FILES[$upname]['type']) == "image/png") { $fullUrl = $fullUrl . ".png"; } else { $fullUrl = $fullUrl . ".jpg"; } } //保存 @move_uploaded_file($_FILES[$upname]['tmp_name'], $cfg_basedir . $fullUrl); $filename = $fullUrl; //水印 @WaterImg($imgfile, 'up'); $isrm_up = TRUE; } else { if ($handurl == '') { return ''; } //远程图片并要求本地化 if ($isremote == 1 && preg_match("#^http:\\/\\/#i", $handurl)) { $ddinfos = GetRemoteImage($handurl, $cuserLogin->getUserID()); if (!is_array($ddinfos)) { $litpic = ""; } else { $filename = $ddinfos[0]; } $isrm_up = TRUE; //本地图片或远程不要求本地化 } else { $filename = $handurl; } } $imgfile = $cfg_basedir . $filename; if (is_file($imgfile) && $isrm_up && $filename != '') { $info = ""; $imginfos = GetImageSize($imgfile, $info); //把新上传的图片信息保存到媒体文档管理档案中 $inquery = "\n INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,mid)\n VALUES ('{$title}','{$filename}','1','" . $imginfos[0] . "','" . $imginfos[1] . "','0','" . filesize($imgfile) . "','" . time() . "','" . $cuserLogin->getUserID() . "');\n "; $dsql->ExecuteNoneQuery($inquery); } return $filename; }
function ProcessImageDirectory($mode) { echo "<h4>Processing Images</h4>\n<blockquote>\n"; CreateDir(TARGET_IMAGE_DIR); if ($mode == "docs" || $mode == 'print') { CopyFile(NUNIT_IMAGE_DIR, TARGET_IMAGE_DIR, "logo.gif"); CopyFile(NUNIT_IMAGE_DIR, TARGET_IMAGE_DIR, "langfilter.gif"); CopyFile(NUNIT_IMAGE_DIR, TARGET_IMAGE_DIR, "bulletOn.gif"); CopyFile(NUNIT_IMAGE_DIR, TARGET_IMAGE_DIR, "bulletOff.gif"); } else { CopyDirectory(NUNIT_IMAGE_DIR, TARGET_IMAGE_DIR); } echo "</blockquote>\n"; }
static function getRunInstallerForm() { global $controller; if (isset($_POST['startinstall']) && $_POST['startinstall'] == 'true') { //runtime_csfr::Protect(); // set base vars $start = $_POST['startinstall']; $zipfile = $_POST['pkgzip']; $pkgInstall = $_POST['pkg']; $pkgdb = $_POST['pkgdb']; if ($start) { if (!isset($_POST['submit'])) { if (isset($_SESSION['zpuid'])) { $userid = $_SESSION['zpuid']; $currentuser = ctrl_users::GetUserDetail($userid); $hostdatadir = ctrl_options::GetOption('hosted_dir') . "" . $currentuser['username']; $userName = $currentuser['username']; $random = rand(); $sysOS = php_uname('s'); $line = "<h2>Preparing to install " . $pkgInstall . ":</h2>"; if (!isset($startinstall)) { if ($pkgdb == "yes") { $line .= "<font color=\"red\"><strong>This package requires a database and database user.</strong></font><br />"; $line .= "<a target=\"_blank\" href=\"../../../?module=mysql_databases\">»Open« </a> database manager.<br />"; $line .= "<a target=\"_blank\" href=\"../../../?module=mysql_users\">»Open« </a> database user manager."; $line .= "<p> </p>"; } $line .= "<p>Please provide the domain and folder name to start the installation of " . $pkgInstall . ".</p>"; $line .= "<form id=\"form\" name=\"doInstall\" action=\"/?module=sentastico\" method=\"post\">"; $line .= "<table>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"right\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"site_domain\">Select domain: </label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>"; $line .= "<td align=\"center\">"; $list = ListDomain($currentuser['userid']); $line .= $list; $line .= "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"right\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"install_to_base_dir\">Tick to install to domain root:</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"install_to_base_dir\" value=\"0\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" onClick=\"if (this.checked) { document.getElementById('hiderow').style.display = 'none'; } else { document.getElementById('hiderow').style.display = ''; }\" name=\"install_to_base_dir\" value=\"1\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<font size=\"-1\" color=\"red\"><strong>ALL FILES AND FOLDERS WILL BE DELETED!</strong></font>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr id=\"hiderow\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"right\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"dir_to_install\">Install To Sub-Folder: public_html/[domain]/</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"dir_to_install\" style=\"width: 300px\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<font color=\"red\">NOTE:</font> For multiple subfolders use: subfolder/subsubfolder\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p> </p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"2\" class=\"button-align\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<!-- inputs -->\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"startinstall\" value=\"true\"> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"u\" value=" . $currentuser['userid'] . "> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"pkgzip\" value=" . $zipfile . "> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"pkg\" value='" . $pkgInstall . "'> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"pkgdb\" value=" . $_POST['pkgdb'] . ">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-danger btn-small\" type=\"submit\" name=\"submit\" value=\"Install\" onclick=\"\$('#loading').show();\">Install</button> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-danger btn-small\" type=\"button\" name=\"cancel\" value=\"Cancel\" onClick=\"javascript:location.href='?module=sentastico'\">Cancel</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t\t\t\t\t</table>"; $line .= "</form>"; $line .= "<div id=\"loading\" style=\"display:none;\">\n\t\t\t\t\t\t\t\t\t\t\t\tPlease wait...<br />\n\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"modules/sentastico/assets/bar.gif\" alt=\"\" /><br />\n\t\t\t\t\t\t\t\t\t\t\t\tUnpacking " . $pkgInstall . "...\n\t\t\t\t\t\t\t\t\t\t\t</div>"; } } } else { $userid = $_POST['u']; $installed = @$_SESSION['installed']; $install_to_base_dir = $_POST['install_to_base_dir']; $currentuser = ctrl_users::GetUserDetail($userid); $hostdatadir = ctrl_options::GetOption('hosted_dir') . "" . $currentuser['username']; $site_domain = clean($_POST['site_domain']); $dir_to_install = clean($_POST['dir_to_install']); $install_to_base_dir = clean($_POST['install_to_base_dir']); // Retrieve the directory for the Domain selected $domaindir = FetchDomainDir($userid, $site_domain); $completedir = $hostdatadir . "/public_html" . $domaindir . "/" . $dir_to_install . ""; $line = "<h2>Automated " . $pkgInstall . " Installation Status:</h2>"; if (file_exists($completedir) && $install_to_base_dir != '1' && empty($dir_to_install) && $installed != 'true') { $line .= "If not empty root folder<br><br>"; $line .= "<p><font color=\"red\"><strong>Destination folder already exists!</strong></font><br /><br />Sorry, the install folder (<strong>/public_html" . $domaindir . "/" . $dir_to_install . "</strong>) already exists or contains files.<br />Please go back and create a new folder.</p>"; $line .= "<p><button class=\"btn btn-danger btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Start over</button></p>"; // START issue here with showing folder exists even if folder created upon unzip completion } else { if (file_exists($completedir) && $install_to_base_dir != '1' && isset($dir_to_install) && $installed != 'true') { $line .= "If not empty sub folder<br><br>"; $line .= "<p><font color=\"red\"><strong>Destination folder already exists!</strong></font><br /><br />Sorry, the install folder (<strong>/public_html" . $domaindir . "/" . $dir_to_install . "</strong>) already exists or contains files.<br />Please go back and create a new folder.</p>"; $line .= "<p><button class=\"btn btn-danger btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Start over</button></p>"; // START issue here with showing folder exists even if folder created upon unzip completion } else { $line .= "Preparing folder: "; CreateDir($completedir, $domaindir, $dir_to_install); $line .= "<font color=\"green\">Folder created Successfully!</font>"; sleep(1); // Remove all Files in the install Folder emptyDir($completedir); sleep(3); set_time_limit(0); $line .= "<br />Installing files: "; $line .= "<form><input type='hidden' name='installed' value='InS'></form>"; // Un-Compressing The ZIP Archive if (UnZip($zipfile . ".zip", $completedir, $site_domain, $dir_to_install) == 'true') { $line .= "<font color=\"green\">Unzip was successful</font><br />"; $line .= "Package unzipped to: http://" . $site_domain . "/" . $dir_to_install . "<br /><br />"; if (file_exists($completedir . "/sentastico-install.php")) { $line .= "<a target=\"_blank\" href='http://" . $site_domain . "/" . $dir_to_install . "/sentastico-install.php'> <button class=\"btn btn-primary btn-small\" type=\"button\">Install Now</button> </a>"; $line .= "<button class=\"btn btn-danger btn-small\" onClick=\"javascript:location.href='?module=sentastico'\">Install Later</button>"; } else { $line .= "<a target=\"_blank\" href='http://" . $site_domain . "/" . $dir_to_install . "/'><button class=\"btn btn-primary btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Install Now</button></a> "; $line .= "<button class=\"btn btn-danger btn-small\" onClick=\"javascript:location.href='?module=sentastico'\">Install Later</button>"; } } else { $line .= "<font color=\"red\">Unzip was not successful</font><br /><br />"; $line .= "<p><button class=\"btn btn-danger btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Start over</button></p>"; } $_SESSION['installed'] = 'true'; sleep(5); // Set file/folder ownership and permissions if on posix if (php_uname('s') != 'Windows NT') { $line .= "Setting file and folder permissions: " . php_uname('s'); fixPermissions($completedir); } } } } } return $line; } }
function MakeHtml($isclose = true) { global $cfg_basedir; $bookdir = GetBookUrl($this->Fields['id'], $this->Fields['bookname'], 1); $bookurl = GetBookUrl($this->Fields['id'], $this->Fields['bookname']); if (!is_dir($cfg_basedir . $bookdir)) { CreateDir($bookdir); } $this->ParseTempletsFirst(); $fp = fopen($cfg_basedir . $bookurl, 'w'); fwrite($fp, $this->dtp->GetResult()); fclose($fp); if ($isclose) { $this->Close(); } //if($displaysucc) echo "<a href='{$bookurl}' target='_blank'>创建或更新'{$this->Fields['bookname']}'的HTML成功!</a><br />\r\n"; return $bookurl; }
$sname = '.jpg'; //上传后的图片的处理 if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){ $sname = '.jpg'; }else if($imgfile_type=='image/gif'){ $sname = '.gif'; }else if($imgfile_type=='image/png'){ $sname = '.png'; }else if($imgfile_type=='image/wbmp'){ $sname = '.bmp'; } $nowtime = time(); $savepath = $cfg_user_dir."/".$cfg_ml->M_ID."/".strftime("%y%m",$nowtime); CreateDir($savepath); CloseFtp(); $rndname = dd2char(strftime("%d%H%M%S",$nowtime).$cfg_ml->M_ID.mt_rand(1000,9999)); $filename = $savepath."/".$rndname; $rndname = $rndname.$sname; //仅作注解用 //大小图URL $bfilename = $filename.$sname; $litfilename = $filename."_lit".$sname; //大小图真实地址 $fullfilename = $cfg_basedir.$bfilename; $full_litfilename = $cfg_basedir.$litfilename; if(file_exists($fullfilename)){ ShowMsg("本目录已经存在同名的文件,请重试!","-1");
$siteurl = preg_replace("#\\/\$#", "", $siteurl); if (!preg_match("#http:\\/\\/#i", $siteurl)) { ShowMsg("你绑定的二级域名无效,请用(http://host)的形式!", "-1"); exit; } if (preg_match("#" . $cfg_basehost . "#i", $siteurl)) { ShowMsg("你绑定的二级域名与当前站点是同一个域,不需要绑定!", "-1"); exit; } } } //创建目录 if ($ispart != 2) { $true_typedir = str_replace("{cmspath}", $cfg_cmspath, $typedir); $true_typedir = preg_replace("#\\/{1,}#", "/", $true_typedir); if (!CreateDir($true_typedir)) { ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!", "-1"); exit; } } $in_query = "INSERT INTO `#@__arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,\r\n tempindex,templist,temparticle,modname,namerule,namerule2,\r\n ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`)\r\n VALUES('{$reid}','{$topid}','{$sortrank}','{$typename}','{$typedir}','{$isdefault}','{$defaultname}','{$issend}','{$channeltype}',\r\n '{$tempindex}','{$templist}','{$temparticle}','default','{$namerule}','{$namerule2}',\r\n '{$ispart}','{$corank}','{$description}','{$keywords}','{$seotitle}','{$moresite}','{$siteurl}','{$sitepath}','{$ishidden}','{$cross}','{$crossid}','{$content}','{$smalltypes}')"; if (!$dsql->ExecuteNoneQuery($in_query)) { ShowMsg("保存目录数据时失败,请检查你的输入资料是否存在问题!", "-1"); exit; } UpDateCatCache(); if ($reid > 0) { PutCookie('lastCid', GetTopid($reid), 3600 * 24, '/'); } ShowMsg("成功创建一个分类!", "catalog_main.php"); exit;
function wpdm_pro_Install() { global $wpdb; delete_option('wpdm_latest'); $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_download_stats` (\r\n `id` int(11) NOT NULL AUTO_INCREMENT,\r\n `pid` int(11) NOT NULL,\r\n `uid` int(11) NOT NULL,\r\n `oid` varchar(100) NOT NULL,\r\n `year` int(4) NOT NULL,\r\n `month` int(2) NOT NULL,\r\n `day` int(2) NOT NULL,\r\n `timestamp` int(11) NOT NULL,\r\n `ip` varchar(20) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; foreach ($sqls as $sql) { $wpdb->query($sql); //dbDelta($sql); } if (get_option('access_level', 0) == 0) { update_option('access_level', 'level_10'); } if (get_option('_wpdm_thumb_w', 0) == 0) { update_option('_wpdm_thumb_w', '200'); } if (get_option('_wpdm_thumb_h', 0) == 0) { update_option('_wpdm_thumb_h', '100'); } if (get_option('_wpdm_pthumb_w', 0) == 0) { update_option('_wpdm_pthumb_w', '400'); } if (get_option('_wpdm_pthumb_h', 0) == 0) { update_option('_wpdm_pthumb_h', '250'); } if (get_option('_wpdm_athumb_w', 0) == 0) { update_option('_wpdm_athumb_w', '50'); } if (get_option('_wpdm_athumb_h', 0) == 0) { update_option('_wpdm_athumb_h', '50'); } if (get_option('_wpdm_athumb_h', 0) == 0) { update_option('_wpdm_athumb_h', '50'); } if (get_option('_wpdm_wthumb_h', 0) == 0) { update_option('_wpdm_wthumb_h', '150'); } if (get_option('_wpdm_wthumb_h', 0) == 0) { update_option('_wpdm_wthumb_h', '70'); } if (get_option('_wpdm_show_ct_bar', -1) == -1) { update_option('_wpdm_show_ct_bar', '1'); } if (get_option('_wpdm_custom_template', '') == '') { update_option('_wpdm_custom_template', 'page.php'); } update_option('wpdm_default_link_template', "[thumb_100x50]\r\n<br style='clear:both'/>\r\n<b>[popup_link]</b><br/>\r\n<b>[download_count]</b> downloads"); update_option('wpdm_default_page_template', "[thumb_800x500]\r\n<br style='clear:both'/>\r\n[description]\r\n<fieldset class='pack_stats'>\r\n<legend><b>Package Statistics</b></legend>\r\n<table>\r\n<tr><td>Total Downloads:</td><td>[download_count]</td></tr>\r\n<tr><td>Stock Limit:</td><td>[quota]</td></tr>\r\n<tr><td>Total Files:</td><td>[file_count]</td></tr>\r\n</table>\r\n</fieldset><br>\r\n[download_link]"); if (get_option('_wpdm_etpl') == '') { update_option('_wpdm_etpl', array('title' => 'Your download link', 'body' => file_get_contents(dirname(__FILE__) . '/templates/wpdm-email-lock-template.html'))); } wpdm_common_actions(); flush_rewrite_rules(); CreateDir(); }
if(!eregi("http://",$siteurl)){ $dsql->Close(); ShowMsg("你绑定的二级域名无效,请用(http://域名)的形式!","-1"); exit(); } if(eregi($cfg_basehost,$siteurl)){ $dsql->Close(); ShowMsg("你绑定的二级域名与当前站点是同一个域名,不需要绑定!","-1"); exit(); } } //创建目录 $true_typedir = str_replace("{cmspath}",$cfg_cmspath,$typedir); $true_typedir = ereg_replace("/{1,}","/",$true_typedir); if(!CreateDir($true_typedir,$siterefer,$sitepath)) { $dsql->Close(); ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!","-1"); exit(); } }//非跳转网址处理栏目目录 if($channeltype == '-2') $isdefault = '-1'; //子分类 $sonlists = (empty($sonlists) ? '' : $sonlists); $smalltypes = ''; if(is_array($sonlists) && isset($needson)){ $n = count($sonlists); for($i=0;$i<$n;$i++){