本文整理汇总了PHP中jio函数的典型用法代码示例。如果您正苦于以下问题:PHP jio函数的具体用法?PHP jio怎么用?PHP jio使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jio函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cache_file
function cache_file()
{
global $_J;
$this->prefix = 'cache_file_';
if (defined('TEMPLATE_ROOT_PATH')) {
$root_path = TEMPLATE_ROOT_PATH;
$this->prefix .= basename(TEMPLATE_ROOT_PATH) . '_';
} else {
$root_path = ROOT_PATH;
}
$this->path = $root_path . 'data/cache/cache_file/';
if ($_J['config']['memory_enable'] && $_J['config']['cache_file_to_memory']) {
$this->memory = jclass('memory');
}
if (!$this->memory) {
$this->io = jio();
}
}
示例2: OpenTable
function OpenTable()
{
$this->unicode_table = array();
if ($this->config['SourceLang'] == 'GBK' || $this->config['TargetLang'] == 'GBK') {
$this->table = CODETABLE_DIR . $this->config['GBtoUnicode_table'];
} elseif ($this->config['SourceLang'] == 'BIG5' || $this->config['TargetLang'] == 'BIG5') {
$this->table = CODETABLE_DIR . $this->config['BIG5toUnicode_table'];
}
$table_cache_file = CACHE_PATH . $this->config['SourceLang'] . '-' . $this->config['TargetLang'] . ".cache.php";
if (include $table_cache_file) {
$this->unicode_table = $unicode_table;
unset($unicode_table);
return null;
}
$fp = @fopen($this->table, 'rb');
$tabletmp = @fread($fp, filesize($this->table));
for ($i = 0; $i < strlen($tabletmp); $i += 4) {
$tmp = unpack('nkey/nvalue', substr($tabletmp, $i, 4));
if ($this->config['TargetLang'] == 'UTF-8') {
$this->unicode_table[$tmp['key']] = '0x' . dechex($tmp['value']);
} elseif ($this->config['SourceLang'] == 'UTF-8') {
$this->unicode_table[$tmp['value']] = '0x' . dechex($tmp['key']);
} elseif ($this->config['TargetLang'] == 'UNICODE') {
$this->unicode_table[$tmp['key']] = dechex($tmp['value']);
}
}
if (!is_dir(CODETABLE_DIR)) {
jio()->MakeDir(CODETABLE_DIR);
}
is_writeable(CODETABLE_DIR) || die("编码缓存目录不可写。请检查:" . CODETABLE_DIR);
if (!is_dir(dirname($table_cache_file))) {
jio()->MakeDir(dirname($table_cache_file));
}
$fp = @fopen($table_cache_file, 'wb');
fwrite($fp, "<?php\r\n\$unicode_table=" . var_export($this->unicode_table, true) . ";?>");
fclose($fp);
}
示例3: __is_image
/**
* 作者:狐狸<foxis@qq.com>
* 功能描述: 图片相关
* @version $Id: image.func.php 5268 2013-12-16 08:28:12Z wuliyong $
*/
function __is_image($filename, $allow_types = array('gif' => 1, 'jpg' => 1, 'png' => 1, 'bmp' => 1, 'jpeg' => 1))
{
clearstatcache();
if (!is_file($filename)) {
return false;
}
$imagetypes = array('1' => 'gif', '2' => 'jpg', '3' => 'png', '4' => 'swf', '5' => 'psd', '6' => 'bmp', '7' => 'tiff', '8' => 'tiff', '9' => 'jpc', '10' => 'jp2', '11' => 'jpx', '12' => 'jb2', '13' => 'swc', '14' => 'iff', '15' => 'wbmp', '16' => 'xbm', '17' => 'jpeg');
if (!$allow_types) {
$allow_types = array('gif' => 1, 'jpg' => 1, 'png' => 1, 'bmp' => 1, 'jpeg' => 1);
}
$typeid = 0;
$imagetype = '';
if (function_exists('exif_imagetype')) {
$typeid = exif_imagetype($filename);
} elseif (function_exists('getimagesize')) {
$_tmps = getimagesize($filename);
if ($_tmps) {
$typeid = (int) $_tmps[2];
}
} else {
$str2 = jio()->ReadFile($filename, 2);
if ($str2) {
$strInfo = unpack("C2chars", $str2);
$fileTypes = array(7790 => 'exe', 7784 => 'midi', 8297 => 'rar', 255216 => 'jpg', 7173 => 'gif', 6677 => 'bmp', 13780 => 'png');
$imagetype = $fileTypes[intval($strInfo['chars1'] . $strInfo['chars2'])];
}
}
$file_ext = strtolower(trim(substr(strrchr($filename, '.'), 1)));
if ($typeid > 0) {
$imagetype = $imagetypes[$typeid];
}
if ($allow_types && $file_ext && $imagetype && isset($allow_types[$file_ext]) && isset($allow_types[$imagetype])) {
return true;
}
return false;
}
示例4: face
function face($p = array(), $modify = 1)
{
global $_J;
$pic_file = $p['pic_file'] && is_image($p['pic_file']) ? $p['pic_file'] : '';
$pic_url = $p['pic_url'] && false !== strpos($p['pic_url'], ':/' . '/') ? $p['pic_url'] : '';
$p['pic_field'] = $p['pic_field'] ? $p['pic_field'] : 'face';
$pic_field = $p['pic_field'] && $_FILES[$p['pic_field']] ? $p['pic_field'] : '';
if (!$pic_file && !$pic_url && !$pic_field) {
return jerror('pic is empty', 0);
}
$uid = $p['uid'] ? (int) $p['uid'] : MEMBER_ID;
if ($uid < 1) {
return jerror('请指定一个用户ID', -1);
}
$member = jsg_member_info($uid);
if (!$member) {
return jerror('用户已经不存在了', -2);
}
if (!$_J['config']['edit_face_enable'] && $member['__face__'] && 'admin' != MEMBER_ROLE_TYPE) {
return jerror('不允许用户修改头像', -3);
}
$src_x = max(0, (int) $p['x']);
$src_y = max(0, (int) $p['y']);
$src_w = max(0, (int) $p['w']);
$src_h = max(0, (int) $p['h']);
$image_path = RELATIVE_ROOT_PATH . 'images/' . ($_J['config']['face_verify'] ? 'face_verify' : 'face') . '/' . face_path($uid);
$image_name = $uid . '_b.jpg';
$image_file = $image_path . $image_name;
$image_file_small = $image_path . $uid . '_s.jpg';
$image_file_temp = $image_path . $uid . '_t.jpg';
if (!is_dir($image_path)) {
jmkdir($image_path);
}
if (!$modify && is_image($image_file)) {
return jerror('头像已经存在了', -4);
}
if ($pic_file) {
$src_file = $pic_file;
} elseif ($pic_url) {
$image_data = dfopen($pic_url, 99999999, '', '', true, 3, $_SERVER['HTTP_USER_AGENT']);
if ($image_data) {
jio()->WriteFile($image_file, $image_data);
if (is_image($image_file)) {
$src_file = $image_file;
}
}
} elseif ($pic_field) {
jupload()->init($image_path, $pic_field, true, false);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result && is_image($image_file)) {
$src_file = $image_file;
}
}
if (!is_image($src_file)) {
return jerror('源头像不存在了,请上传正确的图片文件', -5);
}
$w = max(50, min(128, $src_w > 50 ? $src_w : 200));
$make_result = makethumb($src_file, $image_file, $w, $w, 0, 0, $src_x, $src_y, $src_w, $src_h);
$make_result = makethumb($src_file, $image_file_small, 50, 50, 0, 0, $src_x, $src_y, $src_w, $src_h);
$face_url = '';
if ($_J['config']['ftp_on']) {
$ftp_key = randgetftp();
$get_ftps = jconf::get('ftp');
$face_url = $get_ftps[$ftp_key]['attachurl'];
$ftp_result = ftpcmd('upload', $image_file, '', $ftp_key);
if ($ftp_result > 0) {
ftpcmd('upload', $image_file_small, '', $ftp_key);
jio()->DeleteFile($image_file);
jio()->DeleteFile($image_file_small);
}
}
if ($_J['config']['face_verify']) {
$count = DB::result_first("SELECT COUNT(1) FROM " . DB::table('members_verify') . " WHERE `uid`='{$uid}'");
if ($count) {
$sql = "update `" . TABLE_PREFIX . "members_verify` set `face_url`='{$face_url}', `face`='{$image_file_small}' where `uid`='{$uid}'";
} else {
$sql = "insert into `" . TABLE_PREFIX . "members_verify` (`uid`,`nickname`,`face_url`,`face`) values('{$uid}','{$member['nickname']}','{$face_url}','{$image_file_small}')";
}
DB::query($sql);
if ($_J['config']['notice_to_admin']) {
$pm_post = array('message' => $member['nickname'] . " 修改了头像进入审核,<a href='admin.php?mod=verify&code=fs_verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $_J['config']['notice_to_admin']));
$admin_info = jsg_member_info(1);
jlogic('pm')->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']);
}
} else {
$sql = "update `" . TABLE_PREFIX . "members` set `face_url`='{$face_url}', `face`='{$image_file_small}' where `uid`='{$uid}'";
DB::query($sql);
if ($_J['config']['extcredits_enable'] && $uid > 0) {
update_credits_by_action('face', $uid);
}
}
return true;
}
示例5: upload
function upload($p)
{
$sys_config = jconf::get();
if (!$_FILES[$p['field']] || !$_FILES[$p['field']]['name']) {
return array('error' => 'attach is empty', 'code' => -1);
}
$itemid = is_numeric($p['itemid']) ? $p['itemid'] : 0;
$item = '';
if ($itemid > 0) {
$item = $p['item'];
}
$uid = (int) ($p['uid'] ? $p['uid'] : MEMBER_ID);
if ($uid < 1 || false == ($member_info = jsg_member_info($uid))) {
return array('error' => 'uid is invalid', 'code' => -2);
}
$_FILES[$p['field']]['name'] = get_safe_code($_FILES[$p['field']]['name']);
$att_id = $this->add($uid, $member_info['nickname'], $item, $itemid);
if ($att_id < 1) {
return array('error' => 'write database is invalid', 'code' => -3);
}
$filetype = end(explode('.', $_FILES[$p['field']]['name']));
$att_name = $att_id . '.' . $filetype;
$att_path = RELATIVE_ROOT_PATH . 'data/attachs/topic/' . face_path($att_id);
$att_file = $att_path . $att_name;
if (!is_dir($att_path)) {
jio()->MakeDir($att_path);
}
jupload()->init($att_path, $p['field'], false, true);
jupload()->setMaxSize($sys_config['attach_size_limit']);
jupload()->setNewName($att_name);
$ret = jupload()->doUpload();
if (!$ret) {
$this->delete($att_id);
$rets = jupload()->getError();
$ret = $rets ? implode(" ", (array) $rets) : 'image upload is invalid';
return array('error' => $ret, 'code' => -5);
}
$site_url = '';
if ($sys_config['ftp_on']) {
$ftp_key = randgetftp();
$get_ftps = jconf::get('ftp');
$site_url = $get_ftps[$ftp_key]['attachurl'];
$ftp_result = ftpcmd('upload', $att_file, '', $ftp_key);
if ($ftp_result > 0) {
jio()->DeleteFile($att_file);
$att_file = $site_url . '/' . str_replace('./', '', $att_file);
}
}
$att_size = filesize($att_file);
$p = array('id' => $att_id, 'site_url' => $site_url, 'photo' => $att_file, 'name' => $_FILES[$p['field']]['name'], 'filesize' => $att_size, 'filetype' => $filetype, 'tid' => max(0, (int) $p['tid']), 'uid' => $uid, 'username' => $member_info['nickname'], 'dateline' => (int) time());
$this->modify($p);
return $p;
}
示例6: DoAddADV
function DoAddADV()
{
$html = '';
$location = jget('location', 'trim');
$adid = jget('adid', 'int');
if ($adid) {
$sql = " select * from `" . TABLE_PREFIX . "ad` where `adid` = '{$adid}' ";
$ad_info = DB::fetch_first($sql);
$ad_info || $this->Messager("您要修改的广告不存在或已删除。", -1);
}
$location || $ad_info['location'] || $this->Messager("这个是哪里的广告位?", 'admin.php?mod=income');
$title = jget('title', 'trim');
if (!$title) {
$this->Messager("请输入广告标题", -1);
}
$hcode = jget('hcode');
if (count($hcode['page']) < 1) {
$this->Messager("广告投放范围必须要有哦", -1);
}
$ftime = jget('ftime', 'trim');
if ($ftime) {
$ftime = strtotime($ftime);
}
$ttime = jget('ttime', 'trim');
if ($ttime) {
$ttime = strtotime($ttime);
}
$type = jget('type', 'int');
switch ($type) {
case 1:
#代码
if (!$hcode['html']) {
$this->Messager("广告HTML代码必须要有哦", -1);
}
$html = $hcode['html'];
break;
case 2:
#文字
if (!$hcode['word']) {
$this->Messager("文字内容必须要有哦", -1);
}
if (!$hcode['word_url']) {
$this->Messager("文字链接必须要有哦", -1);
}
if ($hcode['word_size']) {
$word_size = 'style="font-size:' . $hcode['word_size'] . 'px"';
}
$html = '<a href="' . $hcode['word_url'] . '" target="_blank"><span ' . $word_size . '>' . $hcode['word'] . '</span></a>';
break;
case 3:
#图片
if ($_FILES['image']['name']) {
$name = time() . MEMBER_ID;
$image_name = $name . ".jpg";
$image_path = RELATIVE_ROOT_PATH . 'images/ad/';
$image_file = $image_path . $image_name;
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
jupload()->init($image_path, 'image', true);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result) {
$result = is_image($image_file);
}
if (!$result) {
unlink($image_file);
$this->Messager("图片上传失败。", -1);
}
if ($this->Config['ftp_on']) {
$ftp_key = randgetftp();
$get_ftps = jconf::get('ftp');
$site_url = $get_ftps[$ftp_key]['attachurl'];
$ftp_result = ftpcmd('upload', $image_file, '', $ftp_key);
if ($ftp_result > 0) {
jio()->DeleteFile($image_file);
$image_file = $site_url . '/' . str_replace('./', '', $image_file);
}
}
$hcode['image'] = $image_file;
} else {
if (!$adid) {
$this->Messager("图片必须要有哦", -1);
} else {
$un_hcode = unserialize(base64_decode($ad_info['hcode']));
$hcode['image'] = $un_hcode['image'];
}
}
$hcode['pic_url'] || $this->Messager("图片链接必须要有哦", -1);
$image_width_html = $hcode['pic_width'] ? ' width=' . $hcode['pic_width'] : '';
$image_height_html = $hcode['pic_height'] ? ' height= ' . $hcode['pic_height'] : '';
$html = '<a href="' . $hcode[pic_url] . '" target="_blank" title="' . $hcode['pic_title'] . '"><img src="' . $hcode['image'] . '" ' . $image_width_html . $image_height_html . '></a>';
break;
default:
$this->Messager("展现方式必须要有哦", -1);
break;
}
$ser_hcode = base64_encode(serialize($hcode));
#保存到数据库
$data = array('location' => $location, 'title' => $title, 'type' => $type, 'ftime' => $ftime, 'ttime' => $ttime, 'hcode' => $ser_hcode);
//.........这里部分代码省略.........
示例7: onloadPic
function onloadPic()
{
if (!$this->MemberHandler->HasPermission($this->Module, 'create')) {
js_alert_showmsg($this->MemberHandler->GetError());
}
if ('admin' != MEMBER_ROLE_TYPE) {
$is_allowed = jlogic('event')->allowedCreate(MEMBER_ID, $this->Member);
if ($is_allowed) {
js_alert_showmsg($is_allowed);
}
}
if ($_FILES['pic']['name']) {
$name = time() . MEMBER_ID;
$image_name = $name . "_b.jpg";
$image_path = RELATIVE_ROOT_PATH . 'images/event/';
$image_file = $image_path . $image_name;
$image_name_show = $name . "_s.jpg";
$image_file_min = $image_path . $image_name_show;
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
jupload()->init($image_path, 'pic', true);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result) {
$result = is_image($image_file);
}
if (!$result) {
unlink($image_file);
unlink($image_file_min);
echo "<script language='Javascript'>";
echo "parent.document.getElementById('message').style.display='block';";
echo "parent.document.getElementById('uploading').style.display='none';";
if ($this->Post['top'] == 'top') {
echo "parent.document.getElementById('back1').style.display='block';";
echo "parent.document.getElementById('next3').style.display='block';";
}
echo "parent.document.getElementById('message').innerHTML='图片上载失败'";
echo "</script>";
exit;
}
makethumb($image_file, $image_file_min, 60, 60, 0, 0, 0, 0, 0, 0);
image_thumb($image_file, $image_file, 100, 128, 1, 0, 0);
if ($this->Config['watermark_enable']) {
jlogic('image')->watermark($image_file);
}
if ($this->Config['ftp_on']) {
$ftp_key = randgetftp();
$get_ftps = jconf::get('ftp');
$site_url = $get_ftps[$ftp_key]['attachurl'];
$ftp_result = ftpcmd('upload', $image_file, '', $ftp_key);
if ($ftp_result > 0) {
ftpcmd('upload', $image_file_min, '', $ftp_key);
jio()->DeleteFile($image_file);
jio()->DeleteFile($image_file_min);
$image_file = $site_url . '/' . str_replace('./', '', $image_file);
}
}
$hid_pic = $this->Post['hid_pic'];
$eid = (int) $this->Post['id'];
$this->doUnlink($hid_pic, $eid);
echo "<script language='Javascript'>";
echo "parent.document.getElementById('uploading').style.display='none';";
if ($this->Post['top'] == 'top') {
echo "parent.document.getElementById('back1').style.display='block';";
echo "parent.document.getElementById('next3').style.display='block';";
}
echo "parent.document.getElementById('message').style.display='none';";
echo "parent.document.getElementById('img').style.display='block';";
echo "parent.document.getElementById('showimg').src='{$image_file}';";
echo "parent.document.getElementById('hid_pic').value='{$image_file}';";
echo "</script>";
exit;
}
}
示例8: topic_image
if ($imageid > 0) {
/*
//高级接口,需要额外的申请
$p['url'] = topic_image($imageid, 'original', 0);
$rets = sina_weibo_api('2/statuses/upload_url_text', $p);
*/
$p['pic'] = topic_image($imageid, 'original', 1);
if ($GLOBALS['_J']['config']['ftp_on']) {
$p['pic'] = RELATIVE_ROOT_PATH . 'data/cache/temp_images/topic/' . $p['pic'];
if (!is_file($p['pic'])) {
$ppic = topic_image($imageid, 'original', 0);
if (false !== strpos($ppic, ':/' . '/')) {
$temp_image = dfopen($ppic, 99999999, '', '', true, 3, $_SERVER['HTTP_USER_AGENT']);
if (!$temp_image) {
jio()->MakeDir(dirname($p['pic']));
jio()->WriteFile($p['pic'], $temp_image);
}
}
}
}
if (is_image($p['pic'])) {
$rets = sina_weibo_api('2/statuses/upload', $p, 'POST', null, 1);
} else {
unset($p['pic']);
$rets = sina_weibo_api('2/statuses/update', $p);
}
} else {
$rets = sina_weibo_api('2/statuses/update', $p);
}
} else {
if (false == ($xbt = DB::fetch_first("select * from " . DB::table('xwb_bind_topic') . " where `tid`='{$totid}'"))) {
示例9: Face
function Face()
{
if (MEMBER_ID < 1) {
js_alert_output("请先登录或者注册一个帐号", 'alert');
}
$uid = jget('uid', 'int', 'G');
$uid = $uid ? $uid : MEMBER_ID;
$member = jsg_member_info($uid);
if ('admin' != MEMBER_ROLE_TYPE) {
if (!$this->Config['edit_face_enable'] && $member['__face__']) {
js_alert_output('本站不允许用户修改头像。', 'alert');
}
if ($uid != MEMBER_ID) {
js_alert_output('您没有权限修改此头像');
}
}
$field = 'face';
$temp_img_size = intval($_FILES[$field]['size'] / 1024);
if ($temp_img_size >= 2048) {
js_alert_output('图片文件过大,2MB以内', 'alert');
}
$type = trim(strtolower(end(explode(".", $_FILES[$field]['name']))));
if ($type != 'gif' && $type != 'jpg' && $type != 'png' && $type != 'jpeg') {
js_alert_output('图片格式不对', 'alert');
}
$image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}";
$image_path = RELATIVE_ROOT_PATH . 'images/temp/face_images/' . $image_name[0] . '/';
$image_file = $image_path . $image_name;
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
jupload()->init($image_path, $field, true, false);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result) {
$result = is_image($image_file);
}
if (!$result) {
js_alert_output('图片上载失败', 'alert');
}
list($w, $h) = getimagesize($image_file);
if ($w > 601) {
$tow = 599;
$toh = round($tow * ($h / $w));
$result = makethumb($image_file, $image_file, $tow, $toh);
if (!$result) {
jio()->DeleteFile($image_file);
js_alert_output('大图片缩略失败', 'alert');
}
}
$up_image_path = addslashes($image_file);
echo "<script language='Javascript'>";
if ($this->Post['temp_face']) {
echo "window.parent.location.href='{$this->Config[site_url]}/index.php?mod=settings&code=face&temp_face={$up_image_path}'";
} else {
echo "parent.document.getElementById('cropbox').src='{$up_image_path}';";
echo "parent.document.getElementById('img_path').value='{$up_image_path}';";
echo "parent.document.getElementById('temp_face').value='{$up_image_path}';";
echo "parent.document.getElementById('jcrop_init_id').onclick();";
echo "parent.document.getElementById('cropbox_img1').value='{$up_image_path}';";
}
echo "</script>";
}
示例10: DoExport
function DoExport()
{
global $sizelimit, $startrow, $extendins, $sqlcompat, $sqlcharset, $dumpcharset, $usehex, $complete, $excepttables;
$excepttables = array(TABLE_PREFIX . "sessions", TABLE_PREFIX . "cache");
$time = $timestamp = time();
$tablepre = TABLE_PREFIX;
$this->DatabaseHandler->Query('SET SQL_QUOTE_SHOW_CREATE=1', 'SKIP_ERROR');
$filename = get_param('filename');
if (!$filename || preg_match("/(\\.)(exe|php|jsp|asp|aspx|cgi|fcgi|pl)(\\.|\$)/i", $filename) || !preg_match('~^[\\w\\d\\-\\_]+$~', $filename)) {
$this->Messager("备份文件名无效");
}
$type = get_param('type');
$setup = get_param('setup');
$customtables = get_param('customtables');
$startrow = get_param('startrow');
$extendins = get_param('extendins');
$usehex = get_param('usehex');
$usezip = get_param('usezip');
$sizelimit = get_param('sizelimit');
$volume = (int) get_param('volume');
$method = 'multivol';
$sqlcharset = get_param('sqlcharset');
$sqlcompat = get_param('sqlcompat');
if ($type == 'all_tables') {
$tables = $this->_array_keys2($this->_fetch_table_list($tablepre), 'Name');
} elseif ($type == 'custom') {
$tables = array();
$cache_id = "tables";
if (empty($setup)) {
$tables = cache_file('get', $cache_id);
} else {
cache_file('set', $cache_id, $customtables);
$tables =& $customtables;
}
if (!is_array($tables) || empty($tables)) {
$this->Messager("没有要导出的数据表");
}
}
$volume = intval($volume) + 1;
$idstring = '# Identify: ' . base64_encode("{$timestamp}," . SYS_VERSION . ",{$type},{$method},{$volume}") . "\n";
$dumpcharset = $sqlcharset ? $sqlcharset : str_replace('-', '', $this->Config['charset']);
$setnames = $sqlcharset && $this->DatabaseHandler->GetVersion() > '4.1' && (!$sqlcompat || $sqlcompat == 'MYSQL41') ? "SET NAMES '{$dumpcharset}';\n\n" : '';
if ($this->DatabaseHandler->GetVersion() > '4.1') {
if ($sqlcharset) {
$this->DatabaseHandler->Query("SET NAMES '" . $sqlcharset . "';\n\n");
}
if ($sqlcompat == 'MYSQL40') {
$this->DatabaseHandler->Query("SET SQL_MODE='MYSQL40'");
} elseif ($sqlcompat == 'MYSQL41') {
$this->DatabaseHandler->Query("SET SQL_MODE=''");
}
}
$f = str_replace(array('/', '\\', '.'), '', $filename);
$f = dir_safe($f);
$backupdir = 'db/' . $f;
$backupfilename = './data/backup/' . $backupdir . '/' . $f;
if (!is_dir($d = dirname($backupfilename))) {
jio()->MakeDir($d);
}
if ($usezip) {
require_once ROOT_PATH . 'include/func/zip.func.php';
}
if ($method == 'multivol') {
$sqldump = '';
$tableid = intval(get_param('tableid'));
$startfrom = intval(get_param('startfrom'));
$complete = TRUE;
for (; $complete && $tableid < count($tables) && strlen($sqldump) + 500 < $sizelimit * 1000; $tableid++) {
$sqldump .= $this->_sql_dump_table($tables[$tableid], $startfrom, strlen($sqldump));
if ($complete) {
$startfrom = 0;
}
}
$dumpfile = $backupfilename . "-%s" . '.sql';
!$complete && $tableid--;
if (trim($sqldump)) {
$sqldump = "{$idstring}" . "# <?php exit(); ?>\n" . "# JishiGou Multi-Volume Data Dump Vol.{$volume}\n" . "# Version: JishiGou " . SYS_VERSION . "\n" . "# Time: {$time}\n" . "# Type: {$type}\n" . "# Table Prefix: {$tablepre}\n" . "#\n" . "# JishiGou Home: http:\\/\\/www.jishigou.net\n" . "# Please visit our website for newest infomation about JishiGou\n" . "# --------------------------------------------------------\n\n\n" . "{$setnames}" . $sqldump;
$dumpfilename = sprintf($dumpfile, $volume);
$fp = fopen($dumpfilename, 'wb');
flock($fp, 2);
if (!fwrite($fp, $sqldump)) {
fclose($fp);
$this->Messager("备份文件写入失败,请检查是否有足够的权限或联系管理员");
} else {
fclose($fp);
if ($usezip == 2) {
$fp = @fopen($dumpfilename, "r");
$content = @fread($fp, filesize($dumpfilename));
fclose($fp);
$zip = new zipfile();
$zip->addFile($content, basename($dumpfilename));
$fp = @fopen(sprintf($backupfilename . "-%s" . '.zip', $volume), 'w');
if (fwrite($fp, $zip->file()) !== FALSE) {
@unlink($dumpfilename);
}
fclose($fp);
}
unset($sqldump, $zip, $content);
$this->Messager("分卷备份: 数据文件 #{$volume} 成功创建,程序将自动继续。\r\n", "admin.php?mod=db&code=doexport&type=" . rawurlencode($type) . "&saveto=server&filename=" . rawurlencode($filename) . "&method=multivol&sizelimit=" . rawurlencode($sizelimit) . "&volume=" . rawurlencode($volume) . "&tableid=" . rawurlencode($tableid) . "&startfrom=" . rawurlencode($startrow) . "&extendins=" . rawurlencode($extendins) . "&sqlcharset=" . rawurlencode($sqlcharset) . "&sqlcompat=" . rawurlencode($sqlcompat) . "&exportsubmit=yes&usehex={$usehex}&usezip={$usezip}");
}
//.........这里部分代码省略.........
示例11: DoModify
function DoModify()
{
$field = 'theme';
$image_id = MEMBER_ID;
$theme_bg_image = str_replace($this->Config['site_url'] . '/', '', $this->Post['theme_bg_image']);
$image_path = RELATIVE_ROOT_PATH . 'images/' . $field . '/' . face_path($image_id);
$image_name = $image_id . "_o.jpg";
$image_file = $image_path . $image_name;
if ($_FILES && $_FILES[$field]['name']) {
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
jupload()->init($image_path, $field, true);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result) {
$result = is_image($image_file);
}
if (!$result) {
jio()->DeleteFile($image_file);
$this->Messager("[图片上载失败]" . implode(" ", (array) jupload()->getError()), null);
} else {
$theme_bg_image = $image_file;
}
} else {
if ($theme_bg_image != $image_file) {
}
}
$theme_id = $this->Post['theme_id'];
$theme_bg_color = $this->Post['theme_bg_color'];
$theme_text_color = $this->Post['theme_text_color'];
$theme_link_color = $this->Post['theme_link_color'];
$theme_bg_image_type = $this->Post['theme_bg_image_type'];
$theme_bg_repeat = $this->Post['theme_bg_repeat'] ? 1 : 0;
$theme_bg_fixed = $this->Post['theme_bg_fixed'] ? 1 : 0;
$sql = "update " . TABLE_PREFIX . "members set\r\n\t\t\t`theme_bg_image`='{$theme_bg_image}', `theme_bg_color`='{$theme_bg_color}', `theme_text_color`='{$theme_text_color}',\r\n\t\t\t`theme_link_color`='{$theme_link_color}' , theme_id='{$theme_id}' , theme_bg_image_type='{$theme_bg_image_type}' ,\r\n\t\t\t`theme_bg_repeat`='{$theme_bg_repeat}' , `theme_bg_fixed`='{$theme_bg_fixed}'\r\n\t\t\twhere `uid`='" . MEMBER_ID . "'";
$this->DatabaseHandler->Query($sql);
if ('admin' == MEMBER_ROLE_TYPE && $this->Post['set_default']) {
$config = array();
$config['theme_id'] = $theme_id;
$config['theme_bg_image'] = $theme_bg_image;
$config['theme_bg_color'] = $theme_bg_color;
$config['theme_text_color'] = $theme_text_color;
$config['theme_link_color'] = $theme_link_color;
$config['theme_bg_image_type'] = $theme_bg_image_type;
$config['theme_bg_repeat'] = $theme_bg_repeat;
$config['theme_bg_fixed'] = $theme_bg_fixed;
jconf::update($config);
}
$query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "members where `uid`='" . MEMBER_ID . "'");
$this->_initTheme($query->GetRow());
$this->Messager("设置成功", 'index.php?mod=topic&code=myhome');
}
示例12: Delete
function Delete()
{
$ids = $this->Post['ids'] ? $this->Post['ids'] : $this->Get['ids'];
if (!$ids) {
$this->Messager("请指定要删除的对象");
}
$ids = (array) $ids;
foreach ($ids as $id) {
$id = is_numeric($id) ? $id : 0;
if ($id > 0) {
$sql = "delete from `" . TABLE_PREFIX . "share` where `id` = '{$id}'";
$this->DatabaseHandler->Query($sql);
$file = ROOT_PATH . 'templates/default/share/sharetemp_' . $id . '.html';
jio()->DeleteFile($file);
jconf::set('sharetemp_' . $id, array());
jio()->DeleteFile('./setting/sharetemp_' . $id . '.php');
}
}
$this->Messager("删除成功", "admin.php?mod=share");
}
示例13: doVerify
function doVerify()
{
$act = $this->Get['act'];
$uids = array();
$uid = (int) $this->Get['uid'];
$uids = $this->Post['uids'];
if ($uid) {
$uids[$uid] = $uid;
}
$msg = jget('msg');
if ($act == 'yes') {
if ($uids) {
foreach ($uids as $uid) {
if ($uid < 1) {
continue;
}
$message = '';
$nickname = DB::result_first(" select `nickname` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'");
$query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "members_verify where `uid` = '{$uid}'");
$member_verify = $query->GetRow();
if ($member_verify) {
if ($member_verify['face'] || $member_verify['face_url']) {
$image_path = RELATIVE_ROOT_PATH . 'images/face/' . face_path($uid);
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
$image_file_b = $dst_file = $image_path . $uid . '_b.jpg';
$image_file_s = $dst_file = $image_path . $uid . '_s.jpg';
$image_verify_path = RELATIVE_ROOT_PATH . 'images/face_verify/' . face_path($uid);
$image_verify_file_b = $dst_file = $image_verify_path . $uid . '_b.jpg';
$image_verify_file_s = $dst_file = $image_verify_path . $uid . '_s.jpg';
if ($member_verify['face_url']) {
$ftp_key = getftpkey($member_verify['face_url']);
if ($ftp_key < 0) {
$this->Messager('请检查FTP是否可用');
}
ftpcmd('get', $image_file_b, $image_verify_file_b, $ftp_key);
ftpcmd('get', $image_file_s, $image_verify_file_s, $ftp_key);
$ftp_result = ftpcmd('upload', $image_file_b, '', $ftp_key);
$ftp_result = ftpcmd('upload', $image_file_s, '', $ftp_key);
$sql = "update `" . TABLE_PREFIX . "members` set `face`='{$image_file_s}', `face_url`='{$member_verify['face_url']}' where `uid`='" . $uid . "'";
$this->DatabaseHandler->Query($sql);
} else {
if ($member_verify['face']) {
@copy($image_verify_file_b, $image_file_b);
@copy($image_verify_file_s, $image_file_s);
$sql = "update `" . TABLE_PREFIX . "members` set `face`='{$image_file_s}' where `uid`='" . $uid . "'";
$this->DatabaseHandler->Query($sql);
}
}
if ($this->Config['extcredits_enable'] && $member_verify['uid'] > 0) {
update_credits_by_action('face', $member_verify['uid']);
}
$message .= '你更新的头像已经通过审核,可以通过ctrl+f5强制刷新来查看新头像;';
}
if ($member_verify["signature"]) {
$sql = "update " . TABLE_PREFIX . "members set signature = '{$member_verify['signature']}',signtime = '" . time() . "' where uid = '{$uid}' ";
$this->DatabaseHandler->Query($sql);
$message .= '你更新的签名已经更过审核;';
}
$this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "members_verify where uid = '{$uid}'");
$pm_post = array('message' => $message, 'to_user' => $nickname);
jlogic('pm')->pmSend($pm_post);
}
}
}
} else {
if ($msg) {
$to_user = DB::result_first("select `nickname` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'");
if ($to_user) {
$pm_post = array('message' => $msg, 'to_user' => $to_user);
jlogic('pm')->pmSend($pm_post);
}
}
$this->DatabaseHandler->Query("delete from `" . TABLE_PREFIX . "members_verify` where `uid` = '{$uid}'");
}
$this->Messager("操作成功");
}
示例14: VipIntro
function VipIntro()
{
if (MEMBER_ID < 1) {
$this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=member&code-login', 3);
}
$member = jsg_member_info(MEMBER_ID);
$notUpToStandardVipConditions = $this->CheckVipCpnditions();
if (!$notUpToStandardVipConditions) {
Load::logic('validate_category');
$this->ValidateLogic = new ValidateLogic($this);
$is_card_pic = $this->Config['card_pic_enable']['is_card_pic'];
if ($this->Post['postFlag']) {
$validate_info = $this->Post['validate_remark'];
$validate_info = trim(strip_tags((string) $validate_info));
if (empty($validate_info)) {
$this->Messager('认证说明不能为空', -1);
}
$f_rets = filter($validate_info);
if ($f_rets && $f_rets['error']) {
$this->Messager($f_rets['msg'], -1);
}
$category_fid = $this->Post['category_fid'];
$category_id = $this->Post['category_id'];
if (empty($category_fid) || empty($category_id)) {
$this->Messager('认证类别不能为空', -1);
}
$city = (int) $this->Post['city'];
if ($city < 1) {
$this->Messager('请填写所在区域', -1);
}
$validate_true_name = strip_tags(jpost('validate_true_name', 'txt'));
if (empty($validate_true_name)) {
$this->Messager('真实姓名不能为空', -1);
}
$validate_card_type = jpost('validate_card_type', 'txt');
if (empty($validate_card_type)) {
$this->Messager('证件类型不能为空', -1);
}
$validate_card_id = strip_tags(jpost('validate_card_id', 'txt'));
if (empty($validate_card_id)) {
$this->Messager('证件号码不能为空', -1);
}
if ($is_card_pic) {
$field = 'card_pic';
if (empty($_FILES) || !$_FILES[$field]['name']) {
$this->Messager("请上传证件图片", -1);
}
}
$data = array('uid' => MEMBER_ID, 'category_fid' => (int) $this->Post['category_fid'], 'category_id' => (int) $this->Post['category_id'], 'province' => jpost('province', 'txt'), 'city' => jpost('city', 'txt'), 'is_audit' => 0, 'dateline' => TIMESTAMP);
$return_info = $this->ValidateLogic->Member_Validate_Add($data);
if ($return_info['ids']) {
if ($is_card_pic) {
$image_id = $return_info['ids'];
if (empty($_FILES) || !$_FILES[$field]['name']) {
$this->Messager("请上传证件图片", -1);
}
$image_path = RELATIVE_ROOT_PATH . 'images/' . $field . '/' . $image_id . '/';
$image_name = $image_id . "_o.jpg";
$image_file = $image_path . $image_name;
$image_file_small = $image_path . $image_id . "_s.jpg";
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
jupload()->init($image_path, $field, true);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result) {
$result = is_image($image_file);
}
if (!$result) {
$this->Messager("上传图片失败", -1);
}
list($w, $h) = getimagesize($image_file);
if ($w > 601) {
$tow = 599;
$toh = round($tow * ($h / $w));
$result = makethumb($image_file, $image_file, $tow, $toh);
if (!$result) {
jio()->DeleteFile($image_file);
js_alert_output('大图片缩略失败');
}
}
$image_file = addslashes($image_file);
$validate_card_pic = " `validate_card_pic` = '{$image_file}' ,";
}
$sql = "update " . TABLE_PREFIX . "memberfields\r\n\t\t\t\t\t\tset {$validate_card_pic}\r\n\t\t\t\t\t\t\t`validate_remark` = '" . jpost('validate_remark', 'txt') . "' ,\r\n\t\t\t\t\t\t\t`validate_true_name`='" . jpost('validate_true_name', 'txt') . "' ,\r\n\t\t\t\t\t\t\t`validate_card_id` = '" . jpost('validate_card_id', 'txt') . "' ,\r\n\t\t\t\t\t\t\t`validate_card_type` = '" . jpost('validate_card_type', 'txt') . "'\r\n\t\t\t\t\t\twhere `uid`='" . MEMBER_ID . "'";
$this->DatabaseHandler->Query($sql);
if ($notice_to_admin = $this->Config['notice_to_admin']) {
$message = "用户" . MEMBER_NICKNAME . "申请了身份认证,<a href='admin.php?mod=vipintro&code=vipintro_manage' target='_blank'>点击</a>进入审核。";
$pm_post = array('message' => $message, 'to_user' => str_replace('|', ',', $notice_to_admin));
$admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1');
load::logic('pm');
$PmLogic = new PmLogic();
$PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']);
}
}
if ($return_info['msg_info']) {
$this->Messager($return_info['msg_info']);
}
}
//.........这里部分代码省略.........
示例15: upload_pic
function upload_pic($id)
{
$image_name = $id . ".png";
$image_path = RELATIVE_ROOT_PATH . 'images/channel/' . face_path($id);
$image_file = $image_path . $image_name;
if (!is_dir($image_path)) {
jio()->MakeDir($image_path);
}
jupload()->init($image_path, 'image', true);
jupload()->setMaxSize(1000);
jupload()->setNewName($image_name);
$result = jupload()->doUpload();
if ($result) {
$result = is_image($image_file);
}
if (!$result) {
unlink($image_file);
return false;
} else {
if ($GLOBALS['_J']['config']['ftp_on']) {
$ftp_key = randgetftp();
$get_ftps = jconf::get('ftp');
$site_url = $get_ftps[$ftp_key]['attachurl'];
$ftp_result = ftpcmd('upload', $image_file, '', $ftp_key);
if ($ftp_result > 0) {
jio()->DeleteFile($image_file);
$image_file = $site_url . '/' . str_replace('./', '', $image_file);
}
}
DB::update('channel', array('picture' => $image_file), array('ch_id' => $id));
}
return true;
}