function lookupUser($user) { $script = 'knowledgeBaseCGI.pl'; $action = 'lookup'; debug::message($user); $user = string::low($user); $groupPredicates[0] = new prologString($user); $constructList = new prologConstructCollection(); //Add predicate to construct collection $constructList->addConstruct(new prologPredicate('get_post_value', $groupPredicates)); $userList = $constructList->toArray(); $filename = prolog::transferToProlog($user, $userList); return prolog::exec($script, $action, $filename); }
/** * @brief Parse the human data and return html * * @param string $data The data to parse * @return string The parsed data */ public function parse($content) { $str = $content; $str = string::rereplace($str, '/</', '<'); $str = string::rereplace($str, '/>/', '>'); $str = string::rereplace($str, '/\\\\"/', '"'); // First chunk everything into paragraphs... $str = string::rereplace($str, '/(.+)/', '<p>\\1</p>'); // Then take care of multiple newlines $str = string::rereplace($str, '/(\\r|\\n){2}/', '<br>'); // The usual, bold, italics, etc... $str = string::rereplace($str, '/\\/(.*?)\\//', '<em>\\1</em>'); $str = string::rereplace($str, '/\\*(.*?)\\*/', '<strong>\\1</strong>'); $str = string::rereplace($str, '/_(.*?)_/', '<u>\\1</u>'); $tag_re = '/\\#([a-zA-Z0-9]+)/s'; $group_re = '/\\!([a-zA-Z0-9]+)/s'; /* preg_match_all($tag_re, $content, $tags); preg_match_all($group_re, $content, $groups); $this->setMeta(MarkupParser::META_TAGS, $tags[1]); $this->setMeta(MarkupParser::META_GROUPS, $groups[1]); */ $str = string::rereplace($str, $tag_re, '<a href="/tags/\\1">#\\1</a>'); $str = string::rereplace($str, $group_re, '<a href="/groups/\\1">!\\1</a>'); $str = string::rereplace($str, '/\\@([a-zA-Z0-9]+)/s', '<a href="/user/\\1">@\\1</a>'); // A bit of a hack...but it works... let me know if you have a regex that fixes this :p $str = string::rereplace($str, '/<strong><\\/strong>/', '**'); $str = string::rereplace($str, '/<em><\\/em>/', '//'); $str = string::rereplace($str, '/<u><\\/u>/', '__'); $str = string::rereplace($str, '/(https?:\\/\\/\\S+)/', '<a href="\\1" rel="nofollow">\\1</a>'); return $str; }
/** 添加、编辑参考资料 编辑操作被整合到了add当中,由$_ENV['reference']->add()实现, 如果 $data 当中包含 id 信息则执行edit操作,否则执行add操作。 */ function doadd() { if ($this->get[2] == 'checkable') { if ($this->checkable('reference-add')) { if ($this->setting['doc_verification_reference_code']) { exit('CODE'); } else { exit('OK'); } } else { exit('0'); } } $data = $this->post['data']; //检查验证码 if ($this->setting['checkcode'] != 3 && $this->setting['doc_verification_reference_code'] && strtolower($data['code']) != $_ENV['user']->get_code()) { exit('code.error'); } if (WIKI_CHARSET == 'GBK') { $data['name'] = string::hiconv($data['name']); } if (empty($data['name'])) { exit('0'); } $insert_id = $_ENV['reference']->add($data); if (is_int($insert_id)) { echo $insert_id; } else { echo $insert_id ? '1' : '0'; } }
function doedit() { if (!isset($this->post['editsubmit'])) { $did = isset($this->get[2]) ? $this->get[2] : ''; if (!is_numeric($did)) { $this->message($this->view->lang['docIdMustNum'], 'BACK'); } $focus = $this->db->fetch_by_field('focus', 'did', $did); $focus['time'] = $this->date($focus['time']); $this->view->assign("focus", $focus); $this->view->display("admin_focus_content"); } else { $did = isset($this->post['did']) ? $this->post['did'] : ''; if (!is_numeric($did)) { $this->message($this->view->lang['docIdMustNum'], 'BACK'); } $summary = string::hiconv($this->post['summary']); $image = string::hiconv($this->post['image']); $order = $this->post['displayorder']; $type = $this->post['doctype']; if (is_numeric($order) && $_ENV['doc']->save_focus_content($did, $summary, $image, $order, $type)) { $this->cache->removecache('data_' . $GLOBALS['theme'] . '_index'); $this->message($this->view->lang['docEditSuccess'], "index.php?admin_focus-edit-{$did}"); } else { $this->message($this->view->lang['docEditFail'], 'BACK'); } } }
function existsMacAddr($mac_addr, $app_id = "") { $mac_addr = $this->getFlatMacAddr($mac_addr); $args = array(); $args[0] = $mac_addr; $args['COND'] = ""; if ($app_id != "") { $args['COND'] = " AND app_id != " . string::replaceSql($app_id); } // 実データでチェック $args['TYPE'] = "tbl"; $sql = $this->getQuery('EXISTS_MAC_ADDR', $args); $id = $this->oDb->getOne($sql); if ($id != "") { return true; } // 申請データでチェック $args['TYPE'] = "entry"; $args['COND'] = " AND entry_status = '0'"; $sql = $this->getQuery('EXISTS_MAC_ADDR', $args); $id = $this->oDb->getOne($sql); if ($id != "") { return true; } return false; }
function __autoload($class_name) { if (strstr($class_name, 'app')) { $class_name = string::strtolower(str_replace('app', '', $class_name)); $file = APPS . $class_name . '/' . $class_name . ".app.php"; if (file_exists($file)) { require_once $file; } else { exit("Class <b>{$class_name}</b> not found<br />"); } return true; } $file1 = SYS_ROOT . "libs/" . $class_name . ".php"; $file2 = SYS_ROOT . "core/" . $class_name . ".php"; $file3 = SYS_ROOT . "boot/" . $class_name . ".php"; if (file_exists($file1)) { require_once $file1; } else { if (file_exists($file2)) { require_once $file2; } else { if (file_exists($file3)) { require_once $file3; } else { exit("Class <b>{$class_name}</b> not found<br />"); } } } }
function douniontitle() { @header('Content-type: application/json; charset=' . WIKI_CHARSET); $len = strlen('plugin-hdapi-hdapi-uniontitle-'); $did = substr($_SERVER['QUERY_STRING'], $len); $doc = $_ENV["hdapi"]->get_doc_title_by_id($did, 'title'); if (!isset($doc['title'])) { exit; } $is_private_title = $_ENV['hdapi']->is_private_title($doc['title']); if (!empty($is_private_title)) { exit; } $uniontitle = $_ENV["hdapi"]->get_uniontitle_by_did($did); if (empty($uniontitle)) { $uniontitle = $_ENV["hdapi"]->get_tit_url($doc['title']); if (isset($uniontitle['docdeclaration']) && strtolower(WIKI_CHARSET) == 'gbk') { $uniontitle['docdeclaration'] = string::hiconv($uniontitle['docdeclaration'], 'gbk', 'utf-8'); } if (!empty($uniontitle['docdeclaration'])) { $_ENV["hdapi"]->save_uniontitle_by_did($did, $uniontitle['docdeclaration']); } } if (is_array($uniontitle) && isset($uniontitle['docdeclaration'])) { $uniontitle = $uniontitle['docdeclaration']; } else { $uniontitle = ''; } echo $uniontitle; }
public static function init() { $username = get('username'); $password = get('password'); if (!$username) { exit('Пожалуйста, укажите имя для пользователя.'); } if (!$password) { exit('Пожалуйста, укажите пароль пользователю.'); } if (string::length($password) < 6) { exit('Ваш пароль не может быть менее 6 символов.'); } $user = users::get_by_name($username); if (!$user) { exit('Данного пользователя не существует.'); } if (!crypt::is_valid($password, $user->hash, $user->salt)) { exit('Указанный вами пароль не совпадает с тем, что был указан при регистрации.'); } $is_authorized = template_session::login($user->id); if (!$is_authorized) { exit('Нарушение логической цепи: авторизация не произведена.'); } }
function doupdateorder() { $channel_num = string::stripspecialcharacter(trim($this->post['order'])); $order = explode(",", $channel_num); $_ENV['channel']->updateorder($order); $this->cache->removecache('channel'); }
function highlight($query, $content) { $point_dl = 100; $query = string::utf2win($query); $content = string::utf2win($content); $content = strip_tags($content); $content_st = $content_and = ''; $point = stripos($content, $query); $point1 = $point - $point_dl; if ($point1 < 0) { $point1 = 0; } else { $content_st = '...'; } $len = strlen($content); $point2 = $point + $point_dl; if ($point2 < $len) { $content_end = '...'; } else { $content_end = ''; } $content = $content_st . substr($content, $point1, $point2) . $content_end; $content = str_ireplace($query, '<span style="background-color: yellow; color: black;">' . $query . '</span>', $content); $query = string::win2utf($query); $content = string::highlight(string::win2utf($content), $query); return $content; }
function dolist() { $page = !empty($this->get[2]) && is_numeric($this->get[2]) ? $this->get[2] : 1; $num = !empty($this->get[3]) && is_numeric($this->get[3]) ? $this->get[3] : 50; if ($page < 1) { $page = 1; } $doclist = array(); $count = $_ENV['archiver']->get_total_num(); if (0 < $count) { // 获得词条最大ID $maxdid = $_ENV['archiver']->get_max_did(); $doclist = $_ENV['archiver']->get_doc_list(array('page' => $page, 'num' => $num)); // 分页数据 $totalpage = ceil($count / $num); $outhtml = $_ENV['archiver']->get_html_list($doclist, $totalpage, $num, $count, $maxdid); } else { $outhtml = $_ENV['archiver']->get_html_header() . 'No Body! No Body!' . $_ENV['archiver']->get_html_footer(); } if ('gbk' == strtolower(WIKI_CHARSET)) { $outhtml = string::hiconv($outhtml, 'utf-8', 'gbk'); } $_ENV['archiver']->close_mysql(); echo $outhtml; }
/** * Return a wiki page * @param string $pagename The namespace and page name in the * format of ns:page (ex. wiki:howto) * @return WikiPage The page */ function getPage($pagename, $revision = Wiki::REVISION_LATEST) { list($ns, $uri) = string::parseUri($pagename, 'default'); $db = new DatabaseConnection(); try { if ($revision == Wiki::REVISION_LATEST) { $rs = $db->getSingleRow("SELECT * FROM wiki WHERE ns='%s' AND uri='%s' AND reverted=0 ORDER BY revision DESC LIMIT 1", $ns, $uri); } else { $rs = $db->getSingleRow("SELECT * FROM wiki WHERE ns='%s' AND uri='%s' AND revision='%d'", $ns, $uri, $revision); } $author = null; if ($rs) { $rev = $rs['revision']; $title = $rs['title']; $content = str_replace('\\"', '"', $rs['content']); $author = User::getUser($rs['author']); $edited = $rs['lastedit']; $locked = false; } else { $rev = 1; $title = 'New page'; $content = 'This page has not yet been created or revision not found.'; $edited = null; $author = null; $locked = false; } } catch (DBXException $e) { $rev = 1; $title = 'ERROR'; $content = 'Error retrieving page.'; $locked = true; } $page = new WikiPage(array('ns' => $ns, 'uri' => $uri, 'revision' => $rev, 'lastedit' => $edited, 'author' => $author, 'authorname' => $author->displayname, 'title' => $title, 'content' => $content, 'reverted' => false, 'locked' => $locked, 'hidden' => false)); return $page; }
function dodefault() { if (!isset($this->post['submit'])) { $this->view->assign("relatedoc", $this->setting['relateddoc']); $this->view->assign("isrelate", $this->setting['isrelate']); $this->view->display("admin_relation"); exit; } $isrelate = $this->post['isrelate']; $setting = array(); $relatedoc = trim($this->post['relatedoc']); $relatelist = array_unique(explode(';', $relatedoc)); foreach ($relatelist as $relate) { $relate = trim($relate); $relate = string::stripscript($relate); if (empty($relate)) { unset($relate); } else { $relate = string::haddslashes($relate); $relatelists[] = $relate; } } if (count($relatelist) > 10) { $this->message($this->view->lang['relatedtitlemore'], 'index.php?admin_relation'); } $setting['relateddoc'] = implode(";", $relatelists); $setting['isrelate'] = $isrelate; $_ENV['setting']->update_setting($setting); $this->cache->removecache('setting'); $this->message($this->view->lang['relatedtitlesuccess'], 'index.php?admin_relation'); }
/** * Try to find searched value and return whole sentence * @return string sentence without html * @param string to search in * @param string to be searched */ public function return_relevant($value, $search) { if (empty($search)) { return; } else { $value = strip_tags($value); $word_pos = strpos($value, $search); // Find position of searched word if ($word_pos === FALSE) { // If there is no position, return first sentence $next_fullstop = strpos($value, '. ', 0); if ($next_fullstop === FALSE) { // If there is no fullstop then truncate to certain length return string::trim_text($value, 100) . '...'; } else { return substr($value, 0, $next_fullstop) . '...'; } } else { $next_fullstop = strpos($value, '. ', $word_pos); if ($next_fullstop === FALSE) { // If there is no fullstop then truncate to certain lenght return string::trim_text($value, 100) . '...'; } else { $prev_fullstop = self::rstrpos($value, '. ', $word_pos); return '...' . substr($value, $prev_fullstop, $next_fullstop - $prev_fullstop) . '...'; } } } }
function checkInputdata() { if (!$this->oMgr->checkEmpty($this->request['login_passwd'])) { // エラーメッセージをセット $this->oMgr->setErr('E001', "新しいパスワード"); } else { if (!$this->oMgr->checkEmpty($this->request['login_passwd_conf'])) { // エラーメッセージをセット $this->oMgr->setErr('E001', "新しいパスワード(確認用)"); } else { if ($this->request['login_passwd'] != $this->request['login_passwd_conf']) { // エラーメッセージをセット $this->oMgr->setErr('E501'); } else { $passwd = $this->request['login_passwd']; if (!string::checkAlphanumWide($passwd, 6, 20) || !ereg("[0-9]", $passwd) || !ereg("[a-z]", $passwd) || !ereg("[A-Z]", $passwd)) { $param = array(); $param[0] = "パスワード"; $param[1] = "数字、英字大文字、英字小文字を各1文字以上使用し、6~20文字"; // エラーメッセージをセット $this->oMgr->setErr('E004', $param); } } } } // エラーなし if (sizeof($this->oMgr->aryErrMsg) == 0) { return true; } // エラー発生 $this->errMsg = $this->oMgr->getErrMsg(); return false; }
function edit_marker($did, $marker) { if ('gbk' == strtolower(WIKI_CHARSET)) { $marker['title'] = string::hiconv($marker['title'], 'gbk', 'utf-8'); $marker['description'] = string::hiconv($marker['description'], 'gbk', 'utf-8'); } $this->db->query("REPLACE INTO " . DB_TABLEPRE . "googlemap (`did`,`title`,`description`,`lat`,`lng`,`zoom`,`created`) values \n \t\t({$did}, '{$marker['title']}', '{$marker['description']}', '{$marker['lat']}', '{$marker['lng']}', '{$marker['zoom']}', {$this->base->time});"); }
public static function chinese($len = 4, $add = '') { $chars = "的一是在不了有和人这中大为上个国我以要他时来用们生到作地于出就分对成会可主发年动同工也能下过子说产种面而方后多定行学法所民得经十三之进着等部度家电力里如水化高自二理起小物现实加量都两体制机当使点从业本去把性好应开它合还因由其些然前外天政四日那社义事平形相全表间样与关各重新线内数正心反你明看原又么利比或但质气第向道命此变条只没结解问意建月公无系军很情者最立代想已通并提直题党程展五果料象员革位入常文总次品式活设及管特件长求老头基资边流路级少图山统接知较将组见计别她手角期根论运农指几九区强放决西被干做必战先回则任取据处队南给色光门即保治北造百规热领七海口东导器压志世金增争济阶油思术极交受联什认六共权收证改清己美再采转更单风切打白教速花带安场身车例真务具万每目至达走积示议声报斗完类八离华名确才科张信马节话米整空元况今集温传土许步群广石记需段研界拉林律叫且究观越织装影算低持音众书布复容儿须际商非验连断深难近矿千周委素技备半办青省列习响约支般史感劳便团往酸历市克何除消构府称太准精值号率族维划选标写存候毛亲快效斯院查江型眼王按格养易置派层片始却专状育厂京识适属圆包火住调满县局照参红细引听该铁价严" . $add; for ($i = 0; $i < $len; $i++) { $str .= string::substr($chars, floor(mt_rand(0, mb_strlen($chars, 'utf-8') - 1)), 1); } return $str; }
function prologAtom($atom = "") { if ($atom != '') { if (string::is_caps($atom[0])) { $atom = string::lowFirstChar($atom); } } $this->atom = $atom; }
function doedit() { $regularname = string::hiconv(trim($this->post['regularname'])); $regularexpr = trim($this->post['regularexpr']); $regulargroupid = $this->post['regulargroupid']; $regulargroupid = is_numeric($regulargroupid) ? intval($regulargroupid) : 0; $regularname = string::hiconv($regularname); $_ENV['regular']->edit_regular($regularname, $regularexpr, $regulargroupid, $this->post['id']); $this->message($this->view->lang['regularEditSuccess'], 'index.php?admin_regular'); }
public static function progress($current, $total, $cells = 10, $cell = '#') { $current = str_pad($current, string::length($total), '0', STR_PAD_LEFT); $total = str_pad($total, string::length($total), '0', STR_PAD_LEFT); $percent = round($current / $total * 100, 2); $passed = ceil($percent / (100 / $cells)); $progress = str_repeat($cell, $passed); $progressbar = '[' . str_pad($progress, $cells, ' ', STR_PAD_RIGHT) . ']'; static::write('(' . $current . '/' . $total . ') ' . $progressbar . ' ' . str_pad($percent, 5, ' ', STR_PAD_LEFT) . '%', false, true); }
function __construct($request, $zen2han = array()) { // モードを取得 $this->mode = $request['mode']; // リクエストデータを取得 $this->request = string::removeEscape($request); // メニューマスタに登録されているファイル名 // メニューから直接アクセスしない画面でこの変数を使用する場合は適宜書き換えが必要!! $this->menu_script_name = basename($_SERVER['SCRIPT_NAME']); }
function row() { $data = func_get_args(); self::$row++; $count = count($data); for ($i = 0; $i < $count; $i++) { $cell = string::utf2win($data[$i]); self::writeCell($cell, self::$row, $i); } }
/** * @brief Creates a new rule * * @param String $selector The CSS selector * @param Array $attributes The attributes to assign */ function __construct($selector, $attributes) { $this->selector = $selector; $attrarr = array(); foreach ((array) $attributes as $attr => $val) { $newattr = string::strip($attr, string::CHS_ALPHA); $attrarr[$attr] = $val; } $this->attributes = $attrarr; }
/** * @return Array * @param unknown $value * @param unknown $current * @param unknown $displayvalue * @desc pairs of select box values and display values packaged into an array with a true/false for a match to the current value */ function select_createpackage($value, $current, $displayvalue) { $resultpackage['value'] = $value; if (!is_array($current)) { $resultpackage['match'] = string::match($value, $current, ''); } else { $resultpackage['match'] = arrays::member($value, $current); } $resultpackage['displayvalue'] = $displayvalue; return $resultpackage; }
function image($srcfile, $targetfile, $settingnew = '') { $watermarks = is_array($settingnew) ? $settingnew : unserialize($this->base->setting['watermark']); foreach ($watermarks as $key => $value) { $this->{$key} = $value; } if ($this->watermarktype == 2 && WIKI_CHARSET == 'GBK') { $this->watermarktext['text'] = string::hiconv($this->watermarktext['text'], 'utf-8', 'gbk'); } if ($this->watermarkstatus == '0') { return false; } $this->imageimpath = $this->formaturl(urldecode($this->imageimpath)); $this->watermarktext['fontpath'] = './style/default/' . $this->watermarktext['fontpath']; $this->srcfile = strpos($srcfile, HDWIKI_ROOT) !== false ? realpath(HDWIKI_ROOT . $srcfile) : $srcfile; $this->targetfile = strpos($targetfile, HDWIKI_ROOT) !== false ? realpath(HDWIKI_ROOT . $targetfile) : $targetfile; $this->attachinfo = @getimagesize($this->srcfile); $this->attach['size'] = @filesize($this->srcfile); if (!$this->imagelib || !$this->imageimpath) { //gd库 switch ($this->attachinfo['mime']) { case 'image/jpeg': $this->imagecreatefromfunc = function_exists('imagecreatefromjpeg') ? 'imagecreatefromjpeg' : ''; $this->imagefunc = function_exists('imagejpeg') ? 'imagejpeg' : ''; break; case 'image/gif': $this->imagecreatefromfunc = function_exists('imagecreatefromgif') ? 'imagecreatefromgif' : ''; $this->imagefunc = function_exists('imagegif') ? 'imagegif' : ''; break; case 'image/png': $this->imagecreatefromfunc = function_exists('imagecreatefrompng') ? 'imagecreatefrompng' : ''; $this->imagefunc = function_exists('imagepng') ? 'imagepng' : ''; break; } } else { //imagemagick $this->imagecreatefromfunc = $this->imagefunc = TRUE; } if ($this->attachinfo['mime'] == 'image/gif') { if ($this->imagecreatefromfunc && !@imagecreatefromgif($srcfile)) { //imagemagick并且返回gif图片失败 return FALSE; } $fp = fopen($srcfile, 'rb'); $targetfilecontent = fread($fp, $this->attach['size']); fclose($fp); $this->animatedgif = strpos($targetfilecontent, 'NETSCAPE2.0') === FALSE ? 0 : 1; //判断是静态还是动态 } if ($this->watermarkminwidth && $this->attachinfo[0] <= $this->watermarkminwidth && $this->watermarkminheight && $this->attachinfo[1] <= $this->watermarkminheight || $this->watermarktype == 2 && (!file_exists($this->watermarktext['fontpath']) || !is_file($this->watermarktext['fontpath']))) { return false; } return $this->imagelib && $this->imageimpath ? $this->Watermark_IM() : $this->Watermark_GD(); }
function checkInputdata() { $vpn_id = @$this->request['vpn_id']; // 名称 if (!$this->oMgr->checkEmpty($this->request['vpn_name'])) { // エラーメッセージをセット $this->oMgr->setErr('E001', "ネットワークポリシー名"); } else { if ($this->oMgr->existsVpnName($this->request['vpn_name'], $vpn_id)) { $this->oMgr->setErr('E017', "ネットワークポリシー名"); } } // グループ名 if (!$this->oMgr->checkEmpty($this->request['group_name'])) { // エラーメッセージをセット $this->oMgr->setErr('E001', "グループ/プロジェクト名"); } else { if ($this->oMgr->existsGroupName($this->request['group_name'], $vpn_id)) { $this->oMgr->setErr('E017', "グループ/プロジェクト名"); } } // グループコード $this->request['group_code'] = string::zen2han($this->request['group_code']); if (!$this->oMgr->checkEmpty($this->request['group_code'])) { // $this->oMgr->setErr('E001', "グループコード"); } else { if (!ereg("^[A-Z]{2}\$", $this->request['group_code'])) { // エラーメッセージをセット $param = array(); $param[0] = "グループコード"; $param[1] = "英字大文字2文字"; $this->oMgr->setErr('E004', $param); } else { if ($this->oMgr->existsGroupCode($this->request['group_code'], $vpn_id)) { $this->oMgr->setErr('E017', "グループコード"); } } } // 管理者 if (!is_array($this->request['admin_id']) || count($this->request['admin_id']) == 0) { // エラーメッセージをセット $this->oMgr->setErr('E007', "管理者"); } // エラーなし if (sizeof($this->oMgr->aryErrMsg) == 0) { return true; } // エラー発生 $this->errMsg = $this->oMgr->getErrMsg(); return false; }
function existsGroupCode($group_code, $vpn_id = "") { $args = array(); $args[0] = $group_code; $args['COND'] = ""; if ($vpn_id != "") { $args['COND'] = " AND vpn_id != " . string::replaceSql($vpn_id); } $sql = $this->getQuery('EXISTS_GROUP_CODE', $args); $id = $this->oDb->getOne($sql); if ($id != "") { return true; } return false; }
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'); }
function dodefault() { $did = intval($this->post['did']); if ($did) { $marker['title'] = string::substring(strip_tags($this->post['title']), 0, 14); $marker['description'] = string::substring(strip_tags($this->post['description']), 0, 60); $marker['lat'] = floatval($this->post['lat']); $marker['lng'] = floatval($this->post['lng']); $marker['zoom'] = intval($this->post['zoom']); $marker['did'] = $did; $_ENV['googlemap']->edit_marker($did, $marker); $marker['title'] = stripslashes($marker['title']); $marker['description'] = stripslashes($marker['description']); echo json_encode($marker); } }
function dojs() { if (!isset($this->get['2'])) { $datastr = $this->view->lang['parameterError']; return false; } $datastr = $_ENV['datacall']->call($this->get['2'], 2); if (empty($datastr)) { $datastr = $this->view->lang['noDate']; } header("content-type:text/html; charset=" . WIKI_CHARSET); $datastr = nl2br($datastr); $datastr = str_replace("\n", "", $datastr); $datastr = str_replace("\r", "", $datastr); $datastr = string::haddslashes($datastr, 1); echo "document.write('" . $datastr . "')"; }