蟬知
蟬知企業(yè)門戶系統(tǒng)是由業(yè)內(nèi)資深開發(fā)團(tuán)隊(duì)開發(fā)的一款專向企業(yè)營銷使用的企業(yè)門戶系統(tǒng),企業(yè)使用蟬知系統(tǒng)可以非常方便地搭建一個(gè)專業(yè)的企業(yè)營銷網(wǎng)站摘符,進(jìn)行宣傳贤斜,開展業(yè)務(wù)策吠,服務(wù)客戶。蟬知系統(tǒng)內(nèi)置了文章瘩绒、產(chǎn)品猴抹、論壇、評(píng)論锁荔、會(huì)員蟀给、博客、幫助等功能阳堕,同時(shí)還可以和微信進(jìn)行集成綁定跋理。功能豐富實(shí)用,后臺(tái)操作簡潔方便嘱丢。蟬知系統(tǒng)還內(nèi)置了搜索引擎優(yōu)化必備的功能薪介,比如關(guān)鍵詞,摘要越驻,站點(diǎn)地圖汁政,友好路徑等,使用蟬知系統(tǒng)可以非常方便的搭建對(duì)搜索引擎友好的網(wǎng)站缀旁。
展示效果可以到我的個(gè)人博客海娜博客公告板查看
準(zhǔn)備
下載thinker-md文件 傳送門:海諾修改版thinker-md
下載方式 1: git clone http://git.oschina.net/hainuo/thinker-md
下載方式2:點(diǎn)擊 zip
下載元文件记劈,有用的就是那個(gè)dist文件夾
ps:下載方式1下載的用戶可以進(jìn)行編譯成自己適用的版本。這是多余的話并巍。
#開始修改
將dist更名為thinker-md移動(dòng)到www目錄下
修改文件
文件1:
system/module/ext/view/kindeditor.html.php
新增內(nèi)容為 http://git.oschina.net/hainuo/chanzhi/raw/master/system/module/common/ext/view/kindeditor.html.php文件2:
www/js/thinker-md/javascripts/tohtml.js
增加這個(gè)文件 http://git.oschina.net/hainuo/chanzhi/raw/master/www/js/thinker-md/javascripts/tohtml.js文件3:
www/template/default/view/blog/ext/header.html.php
在64行增加
js::import($jsRoot . "thinker-md/javascripts/thinker-md.vendor.js");
js::import($jsRoot . "thinker-md/javascripts/tohtml.js");
css::import($jsRoot . "thinker-md/stylesheets/thinker-md.user.css");
css::import($jsRoot . "thinker-md/stylesheets/thinker-md.vendor.css");
css::import($jsRoot . "thinker-md/emoji/nature.css");
css::import($jsRoot . "thinker-md/emoji/object.css");
css::import($jsRoot . "thinker-md/emoji/people.css");
css::import($jsRoot . "thinker-md/emoji/place.css");
css::import($jsRoot . "thinker-md/emoji/Sysmbols.css");
css::import($jsRoot . "thinker-md/emoji/twemoji.css");
- 文件4:
www/template/default/view/common/ext/header.lite.html.php
新增 內(nèi)容為
- 文件5:
system/module/file/control.php
第84行 在上個(gè)函數(shù)結(jié)束后增加 以下代碼
/**
* AJAX: the api to recive the file posted through ajax.
*
* @param string $uid
* @access public
* @return array
*/
public function ajaxUploadImage($uid)
{
if(RUN_MODE == 'front' and !commonModel::isAvailable('forum')) exit;
if(!$this->loadModel('file')->canUpload()) $this->send(array('error' => 1, 'message' => $this->lang->file->uploadForbidden));
$file = $this->file->getUpload('img');
$file = $file[0];
if($file)
{
if(!$this->file->checkSavePath()) $this->send(array('error' => 1, 'message' => $this->lang->file->errorUnwritable));
if(!in_array(strtolower($file['extension']), $this->config->file->editorExtensions)) $this->send(array('error' => 1, 'message' => $this->lang->fail));
move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname']);
if(in_array(strtolower($file['extension']), $this->config->file->imageExtensions) !== false)
{
$this->file->compressImage($this->file->savePath . $file['pathname']);
$imageSize = $this->file->getImageSize($this->file->savePath . $file['pathname']);
$file['width'] = $imageSize['width'];
$file['height'] = $imageSize['height'];
}
$url = $this->file->webPath . $file['pathname'];
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = helper::now();
$file['editor'] = 1;
$file['lang'] = 'all';
unset($file['tmpname']);
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$_SESSION['album'][$uid][] = $this->dao->lastInsertID();
$this->loadModel('setting')->setItems('system.common.site', array('lastUpload' => time()));
die( $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'] .$url);
}
}
/**
* Paste image in kindeditor at firefox and chrome.
*
* @param string uid
* @access public
* @return void
*/
public function ajaxPasteImageBase64($uid)
{
if($_POST)
{
echo $this->file->pasteImageBase64($_POST['base64Date'], $uid);
}
}
- 文件6:
system/module/file/model.php
在640行 上個(gè)函數(shù)結(jié)束后增加
/**
* Paste image in kindeditor at firefox and chrome.
*
* @param string $data
* @param string $uid
* @access public
* @return string
*/
public function pasteImageBase64($data, $uid)
{
if (!$this->checkSavePath()) return false;
ini_set('pcre.backtrack_limit', strlen($data));
preg_match('/data:image\/(\S+);base64,(\S+)/', $data, $out);
if($out && !empty($out[2])) {
$imageData = base64_decode($out[2]);
$file['extension'] = $out[1];
$file['pathname'] = $this->setPathName($key, $file['extension']);
$file['size'] = strlen($imageData);
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = helper::today();
$file['title'] = basename($file['pathname']);
$file['editor'] = 1;
file_put_contents($this->savePath . $file['pathname'], $imageData);
$this->compressImage($this->savePath . $file['pathname']);
$imageSize = $this->getImageSize($this->savePath . $file['pathname']);
$file['width'] = $imageSize['width'];
$file['height'] = $imageSize['height'];
$file['lang'] = 'all';
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$_SESSION['album'][$uid][] = $this->dao->lastInsertID();
$data = $this->webPath . $file['pathname'];
return $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].$data;
}else{
return ' ';
}
}
總結(jié)
經(jīng)過以上操作就可以將原來的編輯器更換為thinker-md編輯器目木。
bug
每篇文章的第一行請(qǐng)保留為空,這樣提交后會(huì)避免在前臺(tái)展示時(shí)出現(xiàn)首行code樣式的bug