本文整理汇总了PHP中util::random方法的典型用法代码示例。如果您正苦于以下问题:PHP util::random方法的具体用法?PHP util::random怎么用?PHP util::random使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util
的用法示例。
在下文中一共展示了util::random方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doupload
function doupload()
{
@header('Content-type: text/html; charset=' . WIKI_CHARSET);
$did = $this->post['did'] ? $this->post['did'] : 0;
if (!$this->setting['attachment_open']) {
exit;
}
$okfile = '';
$this->setting['coin_download'] = isset($this->setting['coin_download']) ? $this->setting['coin_download'] : 10;
$count = count($_FILES['attachment']['name']);
for ($i = 0; $i < $count; $i++) {
if (!(bool) $_FILES['attachment']['name'][$i]) {
continue;
}
$size = $_FILES['attachment']['size'][$i] / 1024;
$name = $_FILES['attachment']['name'][$i];
$attachment_type = $_ENV['attachment']->get_attachment_type();
$filetype = strtolower(substr($name, strrpos($name, ".") + 1));
if ($attachment_type[0] != '*' && !in_array($filetype, $attachment_type)) {
echo '<script>parent.Attachment.error("' . $name . ': ' . $this->view->lang['attachTypeError'] . '");</script>';
continue;
}
if ($size > $this->setting['attachment_size'] || empty($size)) {
echo '<script>parent.Attachment.error("' . $name . ': ' . $this->view->lang['attachSizeError2'] . '");</script>';
continue;
}
$destfile = 'data/attachment/' . date('y-m') . '/' . date('Y-m-d') . '_' . util::random(10) . '.attach';
file::createaccessfile('data/attachment/' . date('y-m') . '/');
$result = file::uploadfile($_FILES['attachment']['tmp_name'][$i], $destfile, $this->setting['attachment_size'], 0);
if ($result) {
$okfile .= $name . '|';
$coindown = $this->post['coin_download'][$i];
if (empty($coindown) || !is_numeric($coindown)) {
$coindown = 0;
} else {
if (0 > $coindown) {
$coindown = 0;
} else {
if ($this->setting['coin_download'] < $coindown) {
$coindown = $this->setting['coin_download'];
}
}
}
$_ENV['attachment']->add_attachment($this->user['uid'], $did, $name, $destfile, $this->post['attachmentdesc'][$i], $filetype, 0, $coindown);
}
}
echo '<script>';
if ($okfile) {
echo 'parent.Attachment.addok("' . $okfile . '");';
}
echo '</script>';
}
示例2: add
public function add()
{
if (!isset($_POST['submit'])) {
$pid = $this->get[0];
$categr = self::cate($pid);
$this->assign('code', strtoupper(util::random(14)));
$this->assign('goodcate', $categr);
$tag = M('GoodsTag');
$this->assign('list_goods_tag', $tag->select());
$listConTag = M('GoodsTagContent');
$this->assign('list_this_goods_tag', $listConTag->select());
$type = M('GoodsType');
$this->assign('list_goods_type', $type->select());
$list_brand = M('Brand');
$this->assign('list_brand', $list_brand->select());
$this->display();
} else {
$goods = M('Good');
//图片上传
if (!empty($_FILES)) {
//print_r($_FILES);
//exit;
//如果有文件上传 上传附件
$up_result = $this->_upload();
//dump($up_result);exit;
if (false == $up_result) {
$this->assign('message', '上传图片失败');
$this->display();
exit;
}
} else {
$this->assign('message', '请选图片上传');
$this->display();
exit;
}
if ($data = $goods->create()) {
for ($i = 0; $i <= count($up_result); $i++) {
$data['goodspic' . ($i + 1)] = $up_result[$i]['savename'];
}
if (false !== $goods->add($data)) {
$this->redirect('lists', array('message' => 'MESSAGE_SUCCESS'));
} else {
$this->assign('message', '添加失败');
$this->display();
}
} else {
$this->assign('message', '添加失败');
$this->display();
}
}
}
示例3: add_randomstr
function add_randomstr(&$text)
{
if (empty($this->base->setting['random_text'])) {
return false;
}
$random_text = explode('<br />', nl2br($this->base->setting['random_text']));
$totalitem = count($random_text);
if (0 == $totalitem) {
return false;
}
$maxpos = 256;
$fontColor = "#FFFFFF";
$st = util::random(6, 2);
$rndstyleValue = ".{$st} { display:none; }";
$rndstyleName = $st;
$reString = "<style> {$rndstyleValue} </style>\r\n";
$rndem[1] = 'font';
$rndem[2] = 'div';
$rndem[3] = 'span';
$rndem[4] = 'p';
$bodylen = strlen($text) - 1;
$prepos = 0;
for ($i = 0; $i <= $bodylen; $i++) {
if ($i + 2 >= $bodylen || $i < 50) {
$reString .= $text[$i];
} else {
$ntag = @strtolower($text[$i] . $text[$i + 1] . $text[$i + 2]);
if ($ntag == '</p' || $ntag == '<br' && $i - $prepos > $maxpos) {
$dd = mt_rand(1, 4);
$emname = $rndem[$dd];
$dd = mt_rand(0, $totalitem - 1);
$rnstr = $random_text[$dd];
if ($emname != 'font') {
$rnstr = " <{$emname} class='{$rndstyleName}'>{$rnstr}</{$emname}> ";
} else {
$rnstr = " <font color='{$fontColor}'>{$rnstr}</font> ";
}
$reString .= $rnstr . $text[$i];
$prepos = $i;
} else {
$reString .= $text[$i];
}
}
}
$text = $reString;
return true;
}
示例4: doinstall
function doinstall()
{
$appid = $this->get[2];
if (is_numeric($appid)) {
$pluginurl = $this->setting['app_url'] . '/hdapp.php?action=download&type=plugin&install=1&id=' . $appid . '&url=' . urlencode(WIKI_URL);
$zipcontent = @util::hfopen($pluginurl);
if (empty($zipcontent)) {
$this->message($this->view->lang['msgConnectFailed']);
}
$tmpname = HDWIKI_ROOT . '/data/tmp/' . util::random(6) . '.zip';
file::writetofile($tmpname, $zipcontent);
if (function_exists('gzopen')) {
require HDWIKI_ROOT . "/lib/zip.class.php";
$zip = new zip();
if (!$zip->chk_zip) {
$this->message($this->view->lang['pluginInstallNoZlib'], '');
}
$ziplist = @$zip->get_List($tmpname);
if (!(bool) $ziplist) {
unlink($tmpname);
$this->message($this->view->lang['pluginAddr'] . $pluginurl . $this->view->lang['pluginAddrFail']);
}
$lastpos = strpos($ziplist[0]['filename'], '/');
$identifier = substr($ziplist[0]['filename'], 0, $lastpos);
@$zip->Extract($tmpname, HDWIKI_ROOT . '/plugins');
} else {
$this->message($this->view->lang['pluginInstallNoZlib']);
}
unlink($tmpname);
} else {
$identifier = $this->get[2];
}
$plugin = $this->db->fetch_by_field('plugin', 'identifier', $identifier);
if ($plugin) {
$this->message($this->view->lang['pluginAddrName'] . $identifier . $this->view->lang['pluginHasInstall'], 'index.php?admin_plugin-list');
}
$this->loadplugin($identifier);
$plugin = $_ENV["{$identifier}"]->install();
$_ENV['plugin']->add_plugin($plugin);
$this->cache->removecache('plugin');
$this->message($this->view->lang['pluginInstallSuccess'], 'index.php?admin_plugin-list');
}
示例5: init_user
function init_user()
{
$sid = $this->hgetcookie('sid');
//notice error
$auth = $this->hgetcookie('auth');
list($uid, $password) = empty($auth) ? array(0, 0) : string::haddslashes(explode("\t", $this->authcode($auth, 'DECODE')), 1);
if (!$sid) {
$sid = util::random(6);
$this->hsetcookie('sid', $sid, 24 * 3600 * 365);
}
if ($uid) {
if ($password == '') {
$sql = 'select u.*, g.grouptitle,g.regulars,g.default,g.type,g.creditslower,g.creditshigher,g.stars,g.color,g.groupavatar from ' . DB_TABLEPRE . 'user u,' . DB_TABLEPRE . 'usergroup g where u.uid=' . $uid . ' and g.groupid=1';
} else {
$sql = 'select u.*, g.* from ' . DB_TABLEPRE . 'user u,' . DB_TABLEPRE . 'usergroup g where u.uid=' . $uid . ' and u.groupid=g.groupid';
}
$user = $this->db->fetch_first($sql);
if ($password == $user['password']) {
$this->user = $user;
UC_OPEN && $_ENV['ucenter']->avatar();
}
}
if (!(bool) $this->user) {
$this->user = $this->db->fetch_first('select * from ' . DB_TABLEPRE . 'usergroup where groupid=1');
$this->user['uid'] = 0;
}
$this->user['sid'] = $sid;
}
示例6: dobackup
function dobackup()
{
set_time_limit(0);
$filedir = HDWIKI_ROOT . "/data/db_backup/";
file::createaccessfile($filedir);
if (!isset($this->post['backupsubmit']) && !isset($this->get[9])) {
$sqlfilename = date("Ymd", $this->time) . "_" . util::random(8);
$tables = $_ENV['db']->showtables();
file::forcemkdir($filedir);
$filename = $_ENV['db']->get_sqlfile_list($filedir);
$this->view->assign('filename', $filename);
$this->view->assign('filedir', $filedir);
$this->view->assign('tables', $tables);
$this->view->assign('sqlfilename', $sqlfilename);
$this->view->display("admin_dbbackup");
} else {
$sqldump = '';
$type = isset($this->post['type']) ? $this->post['type'] : $this->get[2];
$sqlfilename = isset($this->post['sqlfilename']) ? $this->post['sqlfilename'] : rawurldecode($this->get[3]);
$sizelimit = isset($this->post['sizelimit']) ? $this->post['sizelimit'] : intval($this->get[4]);
$tableid = intval($this->get[5]);
$startfrom = intval($this->get[6]);
$volume = intval($this->get[7]) + 1;
$compression = isset($this->post['compression']) ? $this->post['compression'] : intval($this->get[8]);
$backupfilename = $filedir . $sqlfilename;
$backupsubmit = 1;
$tables = array();
if (substr(trim(ini_get('memory_limit')), 0, -1) < 32 && substr(trim(ini_get('memory_limit')), 0, -1) > 0) {
@ini_set('memory_limit', '32M');
}
if (!util::is_mem_available($sizelimit * 1024 * 3)) {
$this->message($sizelimit . "KB" . $this->view->lang['dblimitsizeBig'], 'index.php?admin_db-backup');
}
switch ($type) {
case "full":
$tables = $_ENV['db']->showtables();
break;
case "stand":
$tables = array(DB_TABLEPRE . "category", DB_TABLEPRE . "doc", DB_TABLEPRE . "edition", DB_TABLEPRE . "user");
break;
case "min":
$tables = array(DB_TABLEPRE . "doc", DB_TABLEPRE . "user");
break;
case "custom":
if (!(bool) $this->post['tables']) {
$tables = $this->cache->getcache('backup_tables', '0');
} else {
$tables = $this->post['tables'];
$this->cache->writecache('backup_tables', $tables);
}
break;
}
if ($sizelimit < 512) {
$this->message($this->view->lang['dblimitsizeSmall'], 'BACK');
}
if (count($tables) == 0) {
$this->message($this->view->lang['dbChooseOne'], 'BACK');
}
if (!file_exists($filedir)) {
file::forcemkdir($filedir);
}
if (!file::iswriteable($filedir)) {
$this->message($this->view->lang['dbFileNotWrite'], 'index.php?admin_db-backup');
}
if (in_array(DB_TABLEPRE . "usergroup", $tables)) {
$num = array_search(DB_TABLEPRE . "usergroup", $tables);
$tables[$num] = $tables[0];
$tables[0] = DB_TABLEPRE . "usergroup";
}
if (in_array(DB_TABLEPRE . "user", $tables)) {
$num = array_search(DB_TABLEPRE . "user", $tables);
if ($tables[0] == DB_TABLEPRE . "usergroup") {
$tables[$num] = $tables[1];
$tables[1] = DB_TABLEPRE . "user";
} else {
$tables[$num] = $tables[0];
$tables[0] = DB_TABLEPRE . "user";
}
}
$complete = TRUE;
for (; $complete && $tableid < count($tables) && strlen($sqldump) + 500 < $sizelimit * 1000; $tableid++) {
$result = $_ENV['db']->sqldumptable($tables[$tableid], $complete, $sizelimit, $startfrom, strlen($sqldump));
$sqldump .= $result['tabledump'];
$complete = $result['complete'];
if ($complete) {
$startfrom = 0;
} else {
$startfrom = $result['startfrom'];
}
}
$dumpfile = $backupfilename . "_%s" . '.sql';
!$complete && $tableid--;
if (trim($sqldump)) {
$result = $_ENV['db']->write_to_sql($sqldump, $dumpfile, $volume);
if (!$result) {
$this->message($this->view->lang['dbBackupWriteSqlFiled'], 'BACK');
} else {
$url = "index.php?admin_db-backup-{$type}-" . rawurlencode($sqlfilename) . "-{$sizelimit}-{$tableid}-{$startfrom}-{$volume}-{$compression}-{$backupsubmit}";
$this->message("<image src='style/default/loading.gif'><br />" . $this->view->lang['dbBackupNext1'] . $volume . $this->view->lang['dbBackupNext2'] . "<script type=\"text/JavaScript\">setTimeout(\"window.location.replace('{$url}');\", 2000);</script>", '');
}
//.........这里部分代码省略.........
示例7: doEachHex
function doEachHex(&$hako, &$island)
{
global $init;
// 導出値
$name = $island['name'];
$id = $island['id'];
$land = $island['land'];
$landValue = $island['landValue'];
$oilFlag = $island['oil'];
// 増える人口のタネ値
$addpop = 10;
// 村、町
$addpop2 = 0;
// 都市
// ???
$pop = $island['pop'];
//
if (isset($island['food'])) {
}
if (!isset($island['propaganda'])) {
$island['propaganda'] = "";
}
if ($island['food'] <= 0) {
// 食料不足
$addpop = -30;
} elseif ($island['ship'][10] + $island['ship'][11] + $island['ship'][12] + $island['ship'][13] + $island['ship'][14] > 0) {
// 海賊船が出没中は成長しない
$addpop = 0;
} elseif ($island['park'] > 0) {
// 遊園地があると人が集まる
$addpop += 10;
$addpop2 += 1;
} elseif ($island['propaganda'] == 1) {
// 誘致活動中
$addpop = 30;
$addpop2 = 3;
} else {
}
$monsterMove = array();
$bx = 0;
$by = 0;
// ループ
for ($i = 0; $i < $init->pointNumber; $i++) {
$x = $this->rpx[$i];
$y = $this->rpy[$i];
$landKind = $land[$x][$y];
$lv = $landValue[$x][$y];
switch ($landKind) {
case $init->landWaste:
//荒地
if ($island['isBF'] == 1) {
$land[$x][$y] = $init->landPlains;
$landValue[$x][$y] = 0;
}
break;
case $init->landTown:
case $init->landSeaCity:
// 町系
if ($addpop < 0) {
// 不足
$lv -= Util::random(-$addpop) + 1;
if ($lv <= 0 && $landKind == $init->landSeaCity) {
// 海に戻す
$land[$x][$y] = $init->landSea;
$landValue[$x][$y] = 0;
continue;
} elseif ($lv <= 0 && $landKind == $init->landTown) {
$land[$x][$y] = $init->landPlains;
$landValue[$x][$y] = 0;
continue;
}
} else {
// 成長
if ($lv < 100) {
$lv += Util::random($addpop) + 1;
if ($lv > 100) {
$lv = 100;
}
} else {
// 都市になると成長遅い
if ($addpop2 > 0) {
$lv += Util::random($addpop2) + 1;
}
}
}
if ($lv > 250) {
$lv = 250;
}
$landValue[$x][$y] = $lv;
break;
case $init->landNewtown:
// ニュータウン系
$townCount = Turn::countAround($land, $x, $y, 19, array($init->landTown, $init->landNewtown, $init->landBigtown));
if ($townCount > 17) {
if (Util::random(1000) < 3) {
if ($lv > 200) {
$land[$x][$y] = $init->landBigtown;
}
}
}
//.........这里部分代码省略.........
示例8: upload_attachment
function upload_attachment($did)
{
if (!$this->base->setting['attachment_open']) {
return false;
}
$count = count($_FILES['attachment']['name']);
for ($i = 0; $i < $count; $i++) {
if (!(bool) $_FILES['attachment']['name'][$i]) {
continue;
}
$attachment_type = $this->get_attachment_type();
$filetype = strtolower(substr($_FILES['attachment']['name'][$i], strrpos($_FILES['attachment']['name'][$i], ".") + 1));
if (!in_array($filetype, $attachment_type)) {
$message .= $_FILES['attachment']['name'][$i] . $this->base->view->lang['attachTypeError'] . "<br />";
continue;
}
if ($this->base->setting['attachment_size'] < $_FILES['attachment']['size'][$i] / 1024) {
$message .= $_FILES['attachment']['name'][$i] . $this->base->view->lang['attachSizeError'] . "<br />";
continue;
}
$destfile = 'data/attachment/' . date('y-m') . '/' . date('Y-m-d') . '_' . util::random(10) . '.attach';
file::createaccessfile('data/attachment/' . date('y-m') . '/');
$result = file::uploadfile($_FILES['attachment']['tmp_name'][$i], $destfile, $this->base->setting['attachment_size'], 0);
if ($result) {
$_ENV['attachment']->add_attachment($this->base->user['uid'], $did, $_FILES['attachment']['name'][$i], $destfile, $this->base->post['attachmentdesc'][$i], $filetype, 0);
}
}
return $message;
}
示例9: doedit
function doedit()
{
if (!isset($this->post['submit'])) {
$id = $this->get[2];
$gift = $_ENV['gift']->get($id);
$this->view->assign("gift", $gift);
$this->view->display('admin_editgift');
} else {
$id = trim($this->post['id']);
$gift = $_ENV['gift']->get($id);
$title = htmlspecialchars(trim($this->post['title']));
$credit = trim($this->post['credit']);
$description = htmlspecialchars(trim($this->post['description']));
$imgname = $_FILES['giftfile']['name'];
/*
if($gift['image']){
$destfile=str_replace('_s.', '.', $gift['image']);
}else{
$extname=file::extname($imgname);
$destfile = 'uploads/gift/'.util::random(8).'.'.$extname;
}
*/
if ('' != $imgname) {
$extname = file::extname($imgname);
$destfile = 'uploads/gift/' . util::random(8) . '.' . $extname;
file::uploadfile($_FILES['giftfile'], $destfile);
util::image_compress($destfile, '', 500, 500, '');
$iamge = util::image_compress($destfile, '', 106, 106, '_s');
$destfile = $iamge['tempurl'];
}
$_ENV['gift']->edit($id, $title, $credit, $description, $destfile);
$this->message($this->view->lang['usermanageOptSuccess'], 'index.php?admin_gift-search');
}
}
示例10: dopreview
function dopreview()
{
$settingsnew = $this->post['settingsnew'];
if ($settingsnew['watermarktype'] == 2) {
//文字水印
$settingsnew['watermarktext']['size'] = intval($this->post['settingsnew']['watermarktext']['size']);
$settingsnew['watermarktext']['angle'] = intval($this->post['settingsnew']['watermarktext']['angle']);
$settingsnew['watermarktext']['shadowx'] = intval($this->post['settingsnew']['watermarktext']['shadowx']);
$settingsnew['watermarktext']['shadowy'] = intval($this->post['settingsnew']['watermarktext']['shadowy']);
$settingsnew['watermarktext']['fontpath'] = str_replace(array('\\', '/'), '', $this->post['settingsnew']['watermarktext']['fontpath']);
if ($settingsnew['watermarktype'] == 2 && $settingsnew['watermarktext']['fontpath']) {
$fontpath = $settingsnew['watermarktext']['fontpath'];
$settingsnew['watermarktext']['fontpath'] = file_exists('./style/default/' . $fontpath) ? $fontpath : (file_exists('./style/default/' . $fontpath) ? $fontpath : '');
if (!$settingsnew['watermarktext']['fontpath']) {
$this->message($this->view->lang['watermark_fontpath_error'], 'index.php?admin_setting-watermark');
}
}
} else {
unset($settingsnew['watermarktext']);
}
if ($settingsnew[watermarkstatus] == '0') {
$this->message($this->view->lang['noWaterMark'], '');
}
$this->load("watermark");
$pic = "./style/default/watermark/preview.jpg";
$previewpic = "./style/default/watermark/preview_tem.jpg";
@unlink($previewpic);
if (!is_file($pic)) {
$this->message('预览需要的图片不存在。', '');
}
if ($_ENV['watermark']->image($pic, $previewpic, $settingsnew)) {
echo '<img src="' . $previewpic . '?' . util::random() . '" />';
} else {
$this->message('图片加水印失败,请检查你设置的参数。', '');
}
}
示例11: doinstall
function doinstall()
{
if (isset($this->get[2]) && is_numeric($this->get[2])) {
$style_download_url = $this->setting['app_url'] . "/hdapp.php?action=download&type=template&install=1&id=" . $this->get[2] . "&url=" . WIKI_URL;
$zipcontent = @util::hfopen($style_download_url);
$tmpdir = HDWIKI_ROOT . '/data/tmp/';
file::forcemkdir($tmpdir);
$tmpname = $tmpdir . util::random(6) . '.zip';
file::writetofile($tmpname, $zipcontent);
require HDWIKI_ROOT . "/lib/zip.class.php";
require HDWIKI_ROOT . "/lib/xmlparser.class.php";
$zip = new zip();
if (!$zip->chk_zip) {
$this->message($this->view->lang['styleInstallNoZlib'], '');
}
$ziplist = @$zip->get_List($tmpname);
if (!(bool) $ziplist) {
@unlink($tmpname);
$this->message($this->view->lang['styleZipFail'], 'BACK');
}
$theme_name = $_ENV['theme']->get_theme_name($ziplist);
@$zip->Extract($tmpname, $tmpdir);
@unlink($tmpname);
//move file
$syle_path = $tmpdir . 'hdwiki';
if (is_dir(HDWIKI_ROOT . '/style/' . $theme_name)) {
@file::removedir($syle_path);
$this->message($this->view->lang['stylePathRepeat'], 'BACK');
}
@file::copydir($syle_path, HDWIKI_ROOT);
@file::removedir($syle_path);
//save db
$style_xml = HDWIKI_ROOT . '/style/' . $theme_name . '/desc.xml';
if (!is_file($style_xml)) {
$this->message($this->view->lang['styleXmlNotExist'], 'BACK');
}
$xmlnav = $_ENV['theme']->read_xml($theme_name);
$style['name'] = $xmlnav['name'];
$style['copyright'] = $xmlnav['copyright'];
$style['path'] = $theme_name;
$stylecon = $_ENV['theme']->add_check_style($style['path']);
if ($stylecon == null) {
$_ENV['theme']->add_style($style);
$this->cache->removecache('style');
$this->message($this->view->lang['styleInstallSuccess'], 'BACK');
} else {
$this->message($this->view->lang['styleDbPathRepeat'], 'index.php?admin_theme');
}
} else {
$this->message($this->view->lang['commonParametersInvalidTip'], 'index.php?admin_theme');
}
}
示例12: share_plugin
function share_plugin($plugin)
{
$identifier = $plugin['identifier'];
$descxml = "<?xml version=\"1.0\" encoding=\"" . WIKI_CHARSET . "\"?>\n" . "<theme>\n" . "<author><![CDATA[" . $plugin['author'] . "]]></author>\n" . "<authorurl><![CDATA[" . $plugin['authorurl'] . "]]></authorurl>\n" . "<name><![CDATA[" . $plugin['name'] . "]]></name>\n" . "<tag><![CDATA[" . $plugin['tag'] . "]]></tag>\n" . "<desc><![CDATA[" . $plugin['description'] . "]]></desc>\n" . "<weburl><![CDATA[" . $plugin['weburl'] . "]]></weburl>\n" . "<version><![CDATA[" . $plugin['version'] . "]]></version>\n" . "<hdversion><![CDATA[" . $plugin['hdversion'] . "]]></hdversion>\n" . "<copyright><![CDATA[" . $plugin['copyright'] . "]]></copyright>\n" . "<charset><![CDATA[" . WIKI_CHARSET . "]]></charset>\n" . "</theme>";
file::writetofile(HDWIKI_ROOT . '/plugins/' . $identifier . '/desc.xml', $descxml);
require_once HDWIKI_ROOT . '/lib/zip.class.php';
$zip = new zip();
$filedir = array('plugins/' . $identifier);
$zipdir = array($identifier);
$tmpname = HDWIKI_ROOT . '/data/tmp/' . util::random(6) . '.zip';
@$zip->zip_dir($filedir, $tmpname, $zipdir);
$zip_content = file::readfromfile($tmpname);
$upload_url = $this->base->setting['app_url'] . '/hdapp.php?action=upload&type=plugin';
$data = 'data=' . base64_encode($zip_content);
if ('1' == @util::hfopen($upload_url, 0, $data)) {
unlink($tmpname);
return true;
}
return false;
}