$attach_save_path = $attachdir . '/' . $infoary[$k]['attachid'] . '.' . $infoary[$k]['postfix']; $tmp_attachfile = dirname($_FILES['attachfile']['tmp_name'][$v]) . '/' . basename($attach_save_path); @move_uploaded_file($_FILES['attachfile']['tmp_name'][$v], $tmp_attachfile); //图片加水印 if ($make_image_water && eregi("\\.(gif|jpg|jpeg|png)\$", $tmp_attachfile)) { $img = new ImageWater(); $img->save_image_file = $tmp_attachfile; $img->codepage = JIEQI_SYSTEM_CHARSET; $img->wm_image_pos = $jieqiConfigs['article']['attachwater']; $img->wm_image_name = $water_image_file; $img->wm_image_transition = $jieqiConfigs['article']['attachwtrans']; $img->jpeg_quality = $jieqiConfigs['article']['attachwquality']; $img->create($tmp_attachfile); unset($img); } jieqi_copyfile($tmp_attachfile, $attach_save_path, 0777, true); } } foreach ($infoary as $val) { $oldattachary[] = $val; } if (count($oldattachary) > 0) { $attachinfo = serialize($oldattachary); } $chapter->setVar('attachment', $attachinfo); $chapter->setVar('articleid', $article->getVar('articleid')); if (!empty($_SESSION['jieqiUserId'])) { $chapter->setVar('posterid', $_SESSION['jieqiUserId']); $chapter->setVar('poster', $_SESSION['jieqiUserName']); } else { $chapter->setVar('posterid', 0);
/** * 附件文件保存 * * @param array $post_set 发帖信息设置 * @param array $attachary 附件信息数组 * @param array $configs 配置参数 * @access public * @return void */ function jieqi_post_attachfile(&$post_set, &$attachary, $configs) { //判断是否加水印 $make_image_water = false; if (function_exists('gd_info') && $configs['attachwater'] > 0 && JIEQI_MODULE_VTYPE != '' && JIEQI_MODULE_VTYPE != 'Free') { if (strpos($configs['attachwimage'], '/') === false && strpos($configs['attachwimage'], '\\') === false) { $water_image_file = $GLOBALS['jieqiModules'][$post_set['module']]['path'] . '/images/' . $configs['attachwimage']; } else { $water_image_file = $configs['attachwimage']; } if (is_file($water_image_file)) { $make_image_water = true; include_once JIEQI_ROOT_PATH . '/lib/image/imagewater.php'; } } $attachdir = jieqi_uploadpath($configs['attachdir'], $post_set['module']); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= '/' . date('Ymd', $post_set['posttime']); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } foreach ($attachary as $k => $v) { $attach_save_path = $attachdir . '/' . $post_set['postid'] . '_' . $attachary[$k]['attachid'] . '.' . $attachary[$k]['postfix']; $tmp_attachfile = dirname($_FILES['attachfile']['tmp_name'][$v['order']]) . '/' . basename($attach_save_path); @move_uploaded_file($_FILES['attachfile']['tmp_name'][$v['order']], $tmp_attachfile); //图片加水印 if ($make_image_water && eregi("\\.(gif|jpg|jpeg|png)\$", $tmp_attachfile)) { $img = new ImageWater(); $img->save_image_file = $tmp_attachfile; $img->codepage = JIEQI_SYSTEM_CHARSET; $img->wm_image_pos = $configs['attachwater']; $img->wm_image_name = $water_image_file; $img->wm_image_transition = $configs['attachwtrans']; $img->jpeg_quality = $configs['attachwquality']; $img->create($tmp_attachfile); unset($img); } jieqi_copyfile($tmp_attachfile, $attach_save_path, 0777, true); } }
$imagefile = jieqi_uploadpath($jieqiConfigs['system']['avatardir'], 'system'); if (!file_exists($retdir)) { jieqi_createdir($imagefile); } $imagefile .= jieqi_getsubdir($jieqiUsers->getVar('uid', 'n')); if (!file_exists($retdir)) { jieqi_createdir($imagefile); } if ($old_avatar > 0 && isset($jieqi_image_type[$old_avatar])) { $old_imagefile = $imagefile . '/' . $jieqiUsers->getVar('uid', 'n') . $jieqi_image_type[$old_avatar]; if (is_file($old_imagefile)) { jieqi_delfile($old_imagefile); } } $imagefile .= '/' . $jieqiUsers->getVar('uid', 'n') . $image_postfix; jieqi_copyfile($_FILES['avatarimage']['tmp_name'], $imagefile, 0777, true); } jieqi_jumppage(JIEQI_URL . '/setavatar.php', LANG_DO_SUCCESS, $jieqiLang['system']['avatar_set_success']); } } } else { jieqi_printfail($errtext); } break; case 'show': default: //显示头像状态,包含区块参数(定制区块) jieqi_getconfigs('system', 'userblocks', 'jieqiBlocks'); include_once JIEQI_ROOT_PATH . '/header.php'; $avatartype = intval($jieqiUsers->getVar('avatar', 'n')); $avatarimg = '';
jieqi_createdir($imagedir); } $imagedir .= '/' . $_REQUEST['id']; if (!file_exists($imagedir)) { jieqi_createdir($imagedir); } //保存小图 if (!empty($_FILES['obookspic']['name'])) { if (strstr(strtolower($_FILES['obookspic']['name']), strtolower($jieqiConfigs['obook']['imagetype'])) == strtolower($jieqiConfigs['obook']['imagetype'])) { jieqi_copyfile($_FILES['obookspic']['tmp_name'], $imagedir . '/' . $_REQUEST['id'] . 's' . $jieqiConfigs['obook']['imagetype'], 0777, true); } } //保存大图 if (!empty($_FILES['obooklpic']['name'])) { if (strstr(strtolower($_FILES['obooklpic']['name']), strtolower($jieqiConfigs['obook']['imagetype'])) == strtolower($jieqiConfigs['obook']['imagetype'])) { jieqi_copyfile($_FILES['obooklpic']['tmp_name'], $imagedir . '/' . $_REQUEST['id'] . 'l' . $jieqiConfigs['obook']['imagetype'], 0777, true); } } jieqi_jumppage($obook_static_url . '/obookmanage.php?id=' . $_REQUEST['id'], LANG_DO_SUCCESS, $jieqiLang['obook']['edit_obook_success']); } } else { jieqi_printfail($errtext); } break; case 'edit': default: //包含区块参数(定制区块) jieqi_getconfigs('obook', 'authorblocks', 'jieqiBlocks'); include_once JIEQI_ROOT_PATH . '/header.php'; $jieqiTpl->assign('obook_static_url', $obook_static_url); $jieqiTpl->assign('obook_dynamic_url', $obook_dynamic_url);
//待审文章 } if (!$article_handler->insert($newArticle)) { jieqi_printfail($jieqiLang['article']['article_add_failure']); } else { $id = $newArticle->getVar('articleid'); include_once $jieqiModules['article']['path'] . '/class/package.php'; $package = new JieqiPackage($id); $package->initPackage(array('id' => $newArticle->getVar('articleid', 'n'), 'title' => $newArticle->getVar('articlename', 'n'), 'creatorid' => $newArticle->getVar('authorid', 'n'), 'creator' => $newArticle->getVar('author', 'n'), 'subject' => $newArticle->getVar('keywords', 'n'), 'description' => $newArticle->getVar('intro', 'n'), 'publisher' => JIEQI_SITE_NAME, 'contributorid' => $newArticle->getVar('posterid', 'n'), 'contributor' => $newArticle->getVar('poster', 'n'), 'sortid' => $newArticle->getVar('sortid', 'n'), 'typeid' => $newArticle->getVar('typeid', 'n'), 'articletype' => $newArticle->getVar('articletype', 'n'), 'permission' => $newArticle->getVar('permission', 'n'), 'firstflag' => $newArticle->getVar('firstflag', 'n'), 'fullflag' => $newArticle->getVar('fullflag', 'n'), 'imgflag' => $newArticle->getVar('imgflag', 'n'), 'power' => $newArticle->getVar('power', 'n'), 'display' => $newArticle->getVar('display', 'n'))); //保存小图 if (!empty($_FILES['articlespic']['name'])) { jieqi_copyfile($_FILES['articlespic']['tmp_name'], $package->getDir('imagedir') . '/' . $id . 's' . $simage_postfix, 0777, true); } //保存大图 if (!empty($_FILES['articlelpic']['name'])) { jieqi_copyfile($_FILES['articlelpic']['tmp_name'], $package->getDir('imagedir') . '/' . $id . 'l' . $limage_postfix, 0777, true); } //增加发文积分 if (!empty($jieqiConfigs['article']['scorearticle'])) { $users_handler->changeScore($_SESSION['jieqiUserId'], $jieqiConfigs['article']['scorearticle'], true); } //更新最新入库 if ($newArticle->getVar('display') == 0) { jieqi_getcachevars('article', 'articleuplog'); if (!is_array($jieqiArticleuplog)) { $jieqiArticleuplog = array('articleuptime' => 0, 'chapteruptime' => 0); } $jieqiArticleuplog['articleuptime'] = JIEQI_NOW_TIME; jieqi_setcachevars('articleuplog', 'jieqiArticleuplog', $jieqiArticleuplog, 'article'); } //更新静态页