예제 #1
0
파일: package.php 프로젝트: thu0ng91/jmc
 function delete()
 {
     global $jieqiConfigs;
     global $jieqi_file_postfix;
     jieqi_delfolder($this->getDir('txtdir', true, false));
     if ($jieqiConfigs['article']['makehtml']) {
         jieqi_delfolder($this->getDir('htmldir', true, false));
     }
     if ($jieqiConfigs['article']['makezip']) {
         jieqi_delfile($this->getDir('zipdir', false, false) . '/' . $this->id . $jieqi_file_postfix['zip']);
     }
     if ($jieqiConfigs['article']['makefull']) {
         jieqi_delfile($this->getDir('fulldir', false, false) . '/' . $this->id . $jieqiConfigs['article']['htmlfile']);
     }
     if ($jieqiConfigs['article']['maketxtfull']) {
         jieqi_delfile($this->getDir('txtfulldir', false, false) . '/' . $this->id . $jieqi_file_postfix['txt']);
     }
     //if($jieqiConfigs['article']['makeumd']) jieqi_delfile($this->getDir('umddir', false, false).'/'.$this->id.$jieqi_file_postfix['umd']);
     if ($jieqiConfigs['article']['makeumd']) {
         jieqi_delfolder($this->getDir('umddir', true, false));
     }
     if ($jieqiConfigs['article']['makejar']) {
         jieqi_delfolder($this->getDir('jardir', true, false));
         jieqi_delfolder($this->getDir('jardir', true, false));
     }
     //删除附件
     $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article') . jieqi_getsubdir($this->id) . '/' . $this->id;
     if (is_dir($attachdir)) {
         jieqi_delfolder($attachdir);
     }
 }
예제 #2
0
파일: funpost.php 프로젝트: thu0ng91/jmc
/**
 * 编辑帖子时处理老的附件是否需要删除
 * 
 * @param      array       $post_set 发帖信息设置
 * @param      array       $configs 配置参数
 * @param      object      $attachs_handler 附件查询句柄
 * @access     public
 * @return     void
 */
function jieqi_post_attachold(&$post_set, $configs, &$attachs_handler)
{
    //处理旧附件
    $tmpattachs = $post_set['attachment'];
    $attacholds = array();
    if (!empty($tmpattachs)) {
        $tmpattachary = unserialize($tmpattachs);
        if (!is_array($tmpattachary)) {
            $tmpattachary = array();
        }
        if (!is_array($post_set['oldattach'])) {
            if (is_string($post_set['oldattach'])) {
                $post_set['oldattach'] = array($post_set['oldattach']);
            } else {
                $post_set['oldattach'] = array();
            }
        }
        foreach ($tmpattachary as $val) {
            if (in_array($val['attachid'], $post_set['oldattach'])) {
                $attacholds[] = $val;
            } else {
                //删除旧附件
                $attachs_handler->delete($val['attachid']);
                $afname = jieqi_uploadpath($configs['attachdir'], JIEQI_MODULE_NAME) . '/' . date('Ymd', $post_set['posttime']) . '/' . $post_set['postid'] . '_' . $val['attachid'] . '.' . $val['postfix'];
                if (file_exists($afname)) {
                    jieqi_delfile($afname);
                }
            }
        }
    }
    return $attacholds;
}
예제 #3
0
             $_POST['oldattach'] = array($_POST['oldattach']);
         } else {
             $_POST['oldattach'] = array();
         }
     }
     $oldattachary = array();
     foreach ($tmpattachary as $val) {
         if (in_array($val['attachid'], $_POST['oldattach'])) {
             $oldattachary[] = $val;
         } else {
             //删除旧附件
             include_once $jieqiModules['article']['path'] . '/class/articleattachs.php';
             $attachs_handler =& JieqiArticleattachsHandler::getInstance('JieqiArticleattachsHandler');
             $attachs_handler->delete($val['attachid']);
             $afname = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article') . jieqi_getsubdir($chapter->getVar('articleid', 'n')) . '/' . $chapter->getVar('articleid', 'n') . '/' . $chapter->getVar('chapterid', 'n') . '/' . $val['attachid'] . '.' . $val['postfix'];
             jieqi_delfile($afname);
         }
     }
 } else {
     $oldattachary = array();
 }
 //新附件入库
 if ($attachnum > 0) {
     include_once $jieqiModules['article']['path'] . '/class/articleattachs.php';
     if (!is_object($attachs_handler)) {
         $attachs_handler =& JieqiArticleattachsHandler::getInstance('JieqiArticleattachsHandler');
     }
     $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article');
     if (!file_exists($attachdir)) {
         jieqi_createdir($attachdir);
     }
예제 #4
0
파일: global.php 프로젝트: thu0ng91/jmc
 /**
  * 删除缓存
  * 
  * @param      string      $name 缓存的键名(这里是文件名)
  * @access     public
  * @return     bool
  */
 function delete($name)
 {
     return jieqi_delfile($name);
 }
예제 #5
0
파일: funstatic.php 프로젝트: thu0ng91/jmc
function article_delete_sinfo($id, $output = false)
{
    global $jieqiConfigs;
    if (!isset($jieqiConfigs['article'])) {
        jieqi_getconfigs('article', 'configs');
    }
    if (is_numeric($jieqiConfigs['article']['fakeinfo'])) {
        if (!empty($jieqiConfigs['article']['fakeprefix'])) {
            $jieqiConfigs['article']['fakeinfo'] = '/' . $jieqiConfigs['article']['fakeprefix'] . 'info<{$id|subdirectory}>/<{$id}>' . $jieqiConfigs['article']['fakefile'];
        } else {
            $jieqiConfigs['article']['fakeinfo'] = '/files/article/info<{$id|subdirectory}>/<{$id}>' . $jieqiConfigs['article']['fakefile'];
        }
    }
    $jieqiConfigs['article']['fakeinfo'] = preg_replace('/https?:\\/\\/[^\\/]+/is', '', $jieqiConfigs['article']['fakeinfo']);
    if (substr($jieqiConfigs['article']['fakeinfo'], 0, 1) != '/') {
        $jieqiConfigs['article']['fakeinfo'] = '/' . $jieqiConfigs['article']['fakeinfo'];
    }
    $repfrom = array('<{$id|subdirectory}>', '<{$id}>');
    $repto = array(jieqi_getsubdir($id), $id);
    $fname = JIEQI_ROOT_PATH . trim(str_replace($repfrom, $repto, $jieqiConfigs['article']['fakeinfo']));
    if (is_file($fname)) {
        jieqi_delfile($fname);
    }
    if ($output) {
        echo $id . ' ';
        ob_flush();
        flush();
    }
}
예제 #6
0
파일: dbmanage.php 프로젝트: thu0ng91/jmc
function jieqi_makezip($filename, $volume, $type)
{
    if (@function_exists('gzcompress')) {
        include_once JIEQI_ROOT_PATH . '/lib/compress/zip.php';
        $zip = new JieqiZip();
        if ($type == 1) {
            $zipfilename = MYSQL_BACKUP_PATH . '/' . $filename . '-1' . '.zip';
            if (!$zip->zipstart($zipfilename)) {
                return FALSE;
            }
            for ($i = 1; $i < $volume; $i++) {
                $sqlfilename = MYSQL_BACKUP_PATH . '/' . $filename . '-' . $i . '.sql';
                if (@is_file($sqlfilename)) {
                    $content = jieqi_readfile($sqlfilename);
                    $zip->zipadd(basename($sqlfilename), $content);
                    jieqi_delfile($sqlfilename);
                }
            }
            if ($zip->zipend()) {
                @chmod($zipfilename, 0777);
            }
            return TRUE;
        } elseif ($type == 2) {
            for ($i = 1; $i < $volume; $i++) {
                $zipfilename = MYSQL_BACKUP_PATH . '/' . $filename . '-' . $i . '.zip';
                if (!$zip->zipstart($zipfilename)) {
                    return FALSE;
                }
                $sqlfilename = MYSQL_BACKUP_PATH . '/' . $filename . '-' . $i . '.sql';
                if (@is_file($sqlfilename)) {
                    $content = jieqi_readfile($sqlfilename);
                    $zip->zipadd(basename($sqlfilename), $content);
                    if ($zip->zipend()) {
                        @chmod($zipfilename, 0777);
                    }
                    jieqi_delfile($sqlfilename);
                }
            }
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
예제 #7
0
파일: obookedit.php 프로젝트: thu0ng91/jmc
         $errtext .= sprintf($jieqiLang['obook']['simage_not_image'], $_FILES['obookspic']['name']) . '<br />';
     }
     if (!empty($errtext)) {
         jieqi_delfile($_FILES['obookspic']['tmp_name']);
     }
 }
 if (!empty($_FILES['obooklpic']['name'])) {
     if (eregi("\\.(gif|jpg|jpeg|png|bmp|swf|svg)\$", $_FILES['obooklpic']['name'])) {
         if (strstr(strtolower($_FILES['obooklpic']['name']), strtolower($jieqiConfigs['obook']['imagetype'])) != strtolower($jieqiConfigs['obook']['imagetype'])) {
             $errtext .= sprintf($jieqiLang['obook']['limage_type_error'], $jieqiConfigs['obook']['imagetype']) . '<br />';
         }
     } else {
         $errtext .= sprintf($jieqiLang['obook']['limage_not_image'], $_FILES['obooklpic']['name']) . '<br />';
     }
     if (!empty($errtext)) {
         jieqi_delfile($_FILES['obooklpic']['tmp_name']);
     }
 }
 if (empty($errtext)) {
     //检查是否要关联文章
     if ($_REQUEST['freechapter'] != 1) {
         $_REQUEST['freechapter'] = 0;
     }
     if ($obook->getVar('articleid') > 0) {
         $hasfree = 1;
     } else {
         $hasfree = 0;
     }
     if ($_REQUEST['freechapter'] != $hasfree) {
         $needupdatearticle = false;
         if ($_REQUEST['freechapter'] == 0) {
예제 #8
0
파일: obookset.php 프로젝트: thu0ng91/jmc
    }
} elseif ($_REQUEST['action'] == 'unsale') {
    $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_obook') . ' SET display=2 WHERE obookid=' . intval($_REQUEST['id']));
    $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_ochapter') . ' SET state=display, display=2 WHERE obookid=' . intval($_REQUEST['id']));
    if (!empty($linkfile) && file_exists($linkfile)) {
        global $jieqiObookdata;
        include_once $linkfile;
        $jieqiObookdata['obook']['display'] = 2;
        $varstring = "<?php\n" . jieqi_extractvars('jieqiObookdata', $jieqiObookdata) . "\n?>";
        jieqi_writefile($linkfile, $varstring);
    }
} elseif ($_REQUEST['action'] == 'delete') {
    $obook_handler->db->query('DELETE FROM ' . jieqi_dbprefix('obook_obook') . ' WHERE obookid=' . intval($_REQUEST['id']));
    $obook_handler->db->query('DELETE FROM ' . jieqi_dbprefix('obook_ochapter') . ' WHERE obookid=' . intval($_REQUEST['id']));
    if (!empty($linkfile) && file_exists($linkfile)) {
        jieqi_delfile($linkfile);
    }
}
//更新最新电子书
jieqi_getcachevars('obook', 'obookuplog');
if (!is_array($jieqiObookuplog)) {
    $jieqiObookuplog = array('obookuptime' => 0, 'chapteruptime' => 0);
}
$jieqiObookuplog['obookuptime'] = JIEQI_NOW_TIME;
jieqi_setcachevars('obookuplog', 'jieqiObookuplog', $jieqiObookuplog, 'obook');
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
$obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $jieqiModules['obook']['url'] : $jieqiConfigs['obook']['staticurl'];
$obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $jieqiModules['obook']['url'] : $jieqiConfigs['obook']['dynamicurl'];
//减少电子书和章节积分
/*
include_once(JIEQI_ROOT_PATH.'/class/users.php');
예제 #9
0
파일: newchapter.php 프로젝트: thu0ng91/jmc
             } elseif (in_array($tmpary[$tmpint], $denyary)) {
                 $errtext .= sprintf($jieqiLang['article']['upload_filetype_limit'], $tmpary[$tmpint]) . '<br />';
             }
             if (eregi("\\.(gif|jpg|jpeg|png|bmp)\$", $v)) {
                 $fclass = 'image';
                 if ($_FILES['attachfile']['size'][$k] > intval($jieqiConfigs['article']['maximagesize']) * 1024) {
                     $errtext .= sprintf($jieqiLang['article']['upload_filesize_toolarge'], $v, intval($jieqiConfigs['article']['maximagesize'])) . '<br />';
                 }
             } else {
                 $fclass = 'file';
                 if ($_FILES['attachfile']['size'][$k] > intval($jieqiConfigs['article']['maxfilesize']) * 1024) {
                     $errtext .= sprintf($jieqiLang['article']['upload_filesize_toolarge'], $v, intval($jieqiConfigs['article']['maxfilesize'])) . '<br />';
                 }
             }
             if (!empty($errtext)) {
                 jieqi_delfile($_FILES['attachfile']['tmp_name'][$k]);
             } else {
                 $attachary[$attachnum] = $k;
                 $infoary[$attachnum] = array('name' => $v, 'class' => $fclass, 'postfix' => $tmpary[$tmpint], 'size' => $_FILES['attachfile']['size'][$k]);
                 $attachnum++;
             }
         }
     }
 }
 //有附件的话允许章节没内容,否则必须有
 if ($attachnum == 0 && strlen($_POST['chaptercontent']) == 0) {
     $jieqiLang['article']['need_chapter_content'] . '<br />';
 }
 if (empty($errtext)) {
     //附件入库
     if ($attachnum > 0) {
예제 #10
0
function jieqi_article_delchapter($aid, $criteria, $usescore = false)
{
    global $jieqiModules;
    global $article_handler;
    global $chapter_handler;
    global $jieqiArticleuplog;
    global $jieqiConfigs;
    global $jieqi_file_postfix;
    if (!is_object($criteria)) {
        return false;
    }
    $criteria->add(new Criteria('articleid', intval($aid)));
    $article = $article_handler->get($aid);
    if (!is_object($article)) {
        return false;
    }
    //查询符合条件章节
    $posterary = array();
    $chapter_handler->queryObjects($criteria);
    $chapterary = array();
    $k = 0;
    $cids = '';
    $lastchapterid = intval($article->getVar('lastchapterid'));
    $lastvolumeid = intval($article->getVar('lastvolumeid'));
    $uplastchapter = false;
    //是否更新最新章节
    $uplastvolume = false;
    //是否更新最新章节
    $subsize = 0;
    while ($chapterobj = $chapter_handler->getObject()) {
        $chapterary[$k]['id'] = intval($chapterobj->getVar('chapterid'));
        if ($chapterary[$k]['id'] == $lastchapterid) {
            $uplastchapter = true;
        }
        if ($chapterary[$k]['id'] == $lastvolumeid) {
            $uplastvolume = true;
        }
        if ($cids != '') {
            $cids .= ',';
        }
        $cids .= $chapterary[$k]['id'];
        $chapterary[$k]['size'] = $chapterobj->getVar('size');
        $subsize += intval($chapterary[$k]['size']);
        $chapterary[$k]['attach'] = $chapterobj->getVar('attachment', 'n') == '' ? 0 : 1;
        $k++;
        if (!empty($jieqiConfigs['article']['scorechapter'])) {
            $posterid = intval($chapterobj->getVar('posterid'));
            if (isset($posterary[$posterid])) {
                $posterary[$posterid] += $jieqiConfigs['article']['scorechapter'];
            } else {
                $posterary[$posterid] = $jieqiConfigs['article']['scorechapter'];
            }
        }
    }
    //删除章节
    $chapter_handler->delete($criteria);
    //删除附件数据库
    if ($cids != '') {
        $criteria1 = new CriteriaCompo();
        $criteria1->add(new Criteria('chapterid', '(' . $cids . ')', 'IN'));
        include_once $jieqiModules['article']['path'] . '/class/articleattachs.php';
        $attachs_handler =& JieqiArticleattachsHandler::getInstance('JieqiArticleattachsHandler');
        $attachs_handler->delete($criteria1);
    }
    //删除文本文件、附件文件、html
    $txtdir = jieqi_uploadpath($jieqiConfigs['article']['txtdir'], 'article') . jieqi_getsubdir($aid) . '/' . $aid;
    $htmldir = jieqi_uploadpath($jieqiConfigs['article']['htmldir'], 'article') . jieqi_getsubdir($aid) . '/' . $aid;
    $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article') . jieqi_getsubdir($aid) . '/' . $aid;
    foreach ($chapterary as $c) {
        if (is_file($txtdir . '/' . $c['id'] . $jieqi_file_postfix['txt'])) {
            jieqi_delfile($txtdir . '/' . $c['id'] . $jieqi_file_postfix['txt']);
        }
        if (is_file($htmldir . '/' . $c['id'] . $jieqiConfigs['article']['htmlfile'])) {
            jieqi_delfile($htmldir . '/' . $c['id'] . $jieqiConfigs['article']['htmlfile']);
        }
        if (is_dir($attachdir . '/' . $c['id'])) {
            jieqi_delfolder($attachdir . '/' . $c['id']);
        }
    }
    //重新生成网页和打包
    include_once $jieqiModules['article']['path'] . '/include/repack.php';
    $ptypes = array('makeopf' => 1, 'makehtml' => $jieqiConfigs['article']['makehtml'], 'makezip' => $jieqiConfigs['article']['makezip'], 'makefull' => $jieqiConfigs['article']['makefull'], 'maketxtfull' => $jieqiConfigs['article']['maketxtfull'], 'makeumd' => $jieqiConfigs['article']['makeumd'], 'makejar' => $jieqiConfigs['article']['makejar']);
    article_repack($aid, $ptypes, 0);
    //减少文章和章节积分
    if ($usescore) {
        include_once JIEQI_ROOT_PATH . '/class/users.php';
        $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
        if (!empty($jieqiConfigs['article']['scorearticle'])) {
            $posterid = intval($article->getVar('posterid'));
            if (isset($posterary[$posterid])) {
                $posterary[$posterid] += $jieqiConfigs['article']['scorearticle'];
            } else {
                $posterary[$posterid] = $jieqiConfigs['article']['scorearticle'];
            }
        }
        foreach ($posterary as $pid => $pscore) {
            $users_handler->changeScore($pid, $pscore, false);
        }
    }
    //更新文章信息
    $newsize = $article->getVar('size') - $subsize;
    if ($newsize < 0) {
        $newsize = 0;
    }
    $article->setVar('size', $newsize);
    if ($uplastchapter) {
        $criteria = new CriteriaCompo(new Criteria('articleid', $article->getVar('articleid')));
        $criteria->add(new Criteria('chaptertype', 0, '='));
        $criteria->setSort('chapterorder');
        $criteria->setOrder('DESC');
        $criteria->setStart(0);
        $criteria->setLimit(1);
        $chapter_handler->queryObjects($criteria);
        $tmpchapter = $chapter_handler->getObject();
        if ($tmpchapter) {
            $article->setVar('lastchapter', $tmpchapter->getVar('chaptername', 'n'));
            $article->setVar('lastchapterid', $tmpchapter->getVar('chapterid', 'n'));
            unset($tmpchapter);
        } else {
            $article->setVar('lastchapter', '');
            $article->setVar('lastchapterid', 0);
        }
    }
    if ($uplastvolume) {
        $criteria = new CriteriaCompo(new Criteria('articleid', $article->getVar('articleid')));
        $criteria->add(new Criteria('chaptertype', 1, '='));
        $criteria->setSort('chapterorder');
        $criteria->setOrder('DESC');
        $criteria->setStart(0);
        $criteria->setLimit(1);
        $chapter_handler->queryObjects($criteria);
        $tmpchapter = $chapter_handler->getObject();
        if ($tmpchapter) {
            $article->setVar('lastvolume', $tmpchapter->getVar('chaptername', 'n'));
            $article->setVar('lastvolumeid', $tmpchapter->getVar('chapterid', 'n'));
            unset($tmpchapter);
        } else {
            $article->setVar('lastvolume', '');
            $article->setVar('lastvolumeid', 0);
        }
    }
    $article_handler->insert($article);
    //更新最新文章
    $jieqiArticleuplog['articleuptime'] = JIEQI_NOW_TIME;
    $jieqiArticleuplog['chapteruptime'] = JIEQI_NOW_TIME;
    jieqi_setcachevars('articleuplog', 'jieqiArticleuplog', $jieqiArticleuplog, 'article');
    return $article;
}
예제 #11
0
파일: setavatar.php 프로젝트: thu0ng91/jmc
             } else {
                 //<!--jieqi insert license check-->
                 //保存图片
                 if (!empty($_FILES['avatarimage']['name'])) {
                     $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:
     //显示头像状态,包含区块参数(定制区块)
예제 #12
0
파일: collectset.php 프로젝트: thu0ng91/jmc
require_once '../../../global.php';
jieqi_getconfigs(JIEQI_MODULE_NAME, 'power');
//发表文章权限
jieqi_checkpower($jieqiPower['article']['adminconfig'], $jieqiUsersStatus, $jieqiUsersGroup, false);
jieqi_getconfigs(JIEQI_MODULE_NAME, 'collectsite');
$updateconfig = false;
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'del' && !empty($_REQUEST['config'])) {
    foreach ($jieqiCollectsite as $k => $v) {
        if ($v['config'] == $_REQUEST['config']) {
            unset($jieqiCollectsite[$k]);
            $updateconfig = true;
            break;
        }
    }
}
include_once JIEQI_ROOT_PATH . '/admin/header.php';
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
$jieqiTpl->assign_by_ref('siterows', $jieqiCollectsite);
$jieqiTpl->setCaching(0);
$jieqiTset['jieqi_contents_template'] = $jieqiModules['article']['path'] . '/templates/admin/collectset.html';
include_once JIEQI_ROOT_PATH . '/admin/footer.php';
if ($updateconfig) {
    jieqi_setconfigs('collectsite', 'jieqiCollectsite', $jieqiCollectsite, JIEQI_MODULE_NAME);
    if (file_exists(JIEQI_ROOT_PATH . '/configs/article/site_' . $_REQUEST['config'] . '.php')) {
        jieqi_delfile(JIEQI_ROOT_PATH . '/configs/article/site_' . $_REQUEST['config'] . '.php');
    }
}
예제 #13
0
파일: newarticle.php 프로젝트: thu0ng91/jmc
     }
     if (!empty($errtext)) {
         jieqi_delfile($_FILES['articlespic']['tmp_name']);
     }
 }
 if (!empty($_FILES['articlelpic']['name'])) {
     $limage_postfix = strrchr(trim(strtolower($_FILES['articlelpic']['name'])), ".");
     if (eregi("\\.(gif|jpg|jpeg|png|bmp)\$", $_FILES['articlelpic']['name'])) {
         if (!in_array($limage_postfix, $typeary)) {
             $errtext .= sprintf($jieqiLang['article']['limage_type_error'], $jieqiConfigs['article']['imagetype']) . '<br />';
         }
     } else {
         $errtext .= sprintf($jieqiLang['article']['limage_not_image'], $_FILES['articlelpic']['name']) . '<br />';
     }
     if (!empty($errtext)) {
         jieqi_delfile($_FILES['articlelpic']['tmp_name']);
     }
 }
 if (empty($errtext)) {
     include_once $jieqiModules['article']['path'] . '/class/article.php';
     $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
     //检查文章是否已经发表
     if ($jieqiConfigs['article']['samearticlename'] != 1) {
         if ($article_handler->getCount(new Criteria('articlename', $_POST['articlename'], '=')) > 0) {
             jieqi_printfail(sprintf($jieqiLang['article']['articletitle_has_exists'], jieqi_htmlstr($_POST['articlename'])));
         }
     }
     include_once JIEQI_ROOT_PATH . '/class/users.php';
     $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
     $newArticle = $article_handler->create();
     $newArticle->setVar('siteid', JIEQI_SITE_ID);
예제 #14
0
 $id = $article->getVar('articleid');
 include_once $jieqiModules['article']['path'] . '/class/package.php';
 $package = new JieqiPackage($id);
 $package->editPackage(array('id' => $article->getVar('articleid', 'n'), 'title' => $article->getVar('articlename', 'n'), 'creatorid' => $article->getVar('authorid', 'n'), 'creator' => $article->getVar('author', 'n'), 'subject' => $article->getVar('keywords', 'n'), 'description' => $article->getVar('intro', 'n'), 'publisher' => JIEQI_SITE_NAME, 'contributorid' => $article->getVar('posterid', 'n'), 'contributor' => $article->getVar('poster', 'n'), 'sortid' => $article->getVar('sortid', 'n'), 'typeid' => $article->getVar('typeid', 'n'), 'articletype' => $article->getVar('articletype', 'n'), 'permission' => $article->getVar('permission', 'n'), 'firstflag' => $article->getVar('firstflag', 'n'), 'fullflag' => $article->getVar('fullflag', 'n'), 'imgflag' => $article->getVar('imgflag', 'n'), 'power' => $article->getVar('power', 'n'), 'display' => $article->getVar('display', 'n')));
 //删除老封面
 if ($old_imgflag != $imgflag) {
     $tmpvar = $old_imgflag >> 2 & 7;
     if (isset($imgtary[$tmpvar])) {
         if (is_file($package->getDir('imagedir') . '/' . $id . 's' . $imgtary[$tmpvar])) {
             jieqi_delfile($package->getDir('imagedir') . '/' . $id . 's' . $imgtary[$tmpvar]);
         }
     }
     $tmpvar = $old_imgflag >> 5;
     if (isset($imgtary[$tmpvar])) {
         if (is_file($package->getDir('imagedir') . '/' . $id . 'l' . $imgtary[$tmpvar])) {
             jieqi_delfile($package->getDir('imagedir') . '/' . $id . 'l' . $imgtary[$tmpvar]);
         }
     }
 }
 //保存小图
 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 (JIEQI_USE_CACHE) {
     if (!is_a($jieqiTpl, 'JieqiTpl')) {
         include_once JIEQI_ROOT_PATH . '/lib/template/template.php';