Exemple #1
0
 function dodefault()
 {
     $len = strlen('plugin-momo-momo-default-');
     $title = substr($_SERVER['QUERY_STRING'], $len);
     $title = urldecode($title);
     $title = trim($title);
     $title2 = $title;
     $title = urldecode($title);
     if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
         $title = string::hiconv($title, $to = 'gbk', $from = 'utf-8');
     }
     $doc = $_ENV['momo']->get_doc_by_title($title);
     if ($doc) {
         $doc['image'] = util::getfirstimg($doc['content']);
         $momourl = trim($this->plugin[momo][vars][momourl]);
         if ($momourl) {
             $doc['url'] = $momourl . "index.php?doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
         } else {
             $doc['url'] = $this->setting['site_url'] . "/" . $this->setting['seo_prefix'] . "doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
         }
         $doc_exists = 1;
     } else {
         $url = 'http://www.hudong.com/validateDocSummary.do?doc_title=' . $title2;
         $data = util::hfopen($url);
         $doc_exists = 1;
         if ($data && stripos($data, '<flag>true</flag>') && preg_match_all("/<\\!\\[CDATA\\[(.*)\\]\\]>/", $data, $matches)) {
             $summary = $matches[1][1];
             $image = $matches[1][2];
             if ($summary == 'null') {
                 $summary = '';
             }
             if ($image == 'null') {
                 $image = '';
             }
             if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
                 $summary = string::hiconv($summary, $to = 'gbk', $from = 'utf-8');
             }
             $doc = array('image' => $image, 'url' => 'http://www.hudong.com/wiki/' . $title, 'summary' => $summary);
         } else {
             $doc_exists = 0;
         }
     }
     $this->view->assign("doc_exists", $doc_exists);
     $this->view->assign("doc", $doc);
     $this->view->assign("encode", WIKI_CHARSET);
     $this->view->assign("title", $title);
     $this->view->display('file://plugins/momo/view/momo');
 }
Exemple #2
0
 function doshortcut()
 {
     $shortcut = trim($this->post['link']);
     if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
         $shortcut = string::hiconv($shortcut, 'gbk', 'utf-8');
     }
     $setting['shortcut'] = $shortcut;
     $setting['shortcutstate'] = $this->post['shortcutstate'];
     $_ENV['setting']->update_setting($setting);
     $this->cache->removecache('setting');
     $this->message("1", "", 2);
 }
Exemple #3
0
 function doaddrelatedoc()
 {
     $did = trim($this->post['did']);
     if (is_numeric($did)) {
         $relate = trim($this->post['relatename']);
         $title = htmlspecialchars(trim($this->post['title']));
         if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
             $relate = string::hiconv($relate, 'gbk', 'utf-8');
             $title = string::hiconv($title, 'gbk', 'utf-8');
         }
         $list = array();
         if ($relate) {
             $list = array_unique(explode(';', $relate));
             foreach ($list as $key => $relatename) {
                 $relatename = htmlspecialchars($relatename);
                 if ($_ENV['doc']->have_danger_word($relatename)) {
                     unset($list[$key]);
                     $this->message("2", "", 2);
                 }
             }
         }
         $_ENV['doc']->add_relate_title($did, $title, $list);
         $this->message("1", "", 2);
     }
 }