function opPost($username, $password, $post, $postid = 0) { global $_SGLOBAL; $this->authUser($username, $password); $postid = intval($postid); include_once S_ROOT . './source/function_blog.php'; $uid = $this->member['uid']; $old_post = array(); if ($postid) { $query = $this->db->query("SELECT bf.*, b.* FROM " . tname('blog') . " b LEFT JOIN " . tname('blogfield') . " bf ON bf.blogid=b.blogid WHERE b.blogid='{$postid}' AND b.uid='{$uid}'"); if (!($old_post = $this->db->fetch_array($query))) { $this->sendFault(500, 'Sorry, your entry could not be posted. Something wrong happened.'); } } $post['title'] = siconv($post['title'], $this->charset, 'UTF-8'); $post['description'] = isset($post['content']) ? $post['content'] : $post['description']; $post['description'] = siconv($post['description'], $this->charset, 'UTF-8'); $blog_post_data = array('classid' => intval($this->getClassId($uid, $post['categories'][0])), 'subject' => addslashes($post['title']), 'message' => addslashes($post['description']), 'tag' => addslashes(empty($post['tagwords']) ? '' : siconv(implode(' ', $post['tagwords']), $this->charset, 'UTF-8'))); if ($result = blog_post($blog_post_data, $old_post)) { return $result['blogid']; } else { $this->sendFault(500, 'Sorry, your entry could not be posted. Something wrong happened.'); } }
$graph[$ck] .= "<value xid='{$count}'>" . $num . "</value>"; } } } else { $graph[$type] .= "<value xid='{$count}'>" . $value[$type] . "</value>"; } $count++; } $xml = ''; $xml .= '<' . "?xml version=\"1.0\" encoding=\"utf-8\"?>"; $xml .= '<chart><xaxis>'; $xml .= $xaxis; $xml .= "</xaxis><graphs>"; $count = 0; foreach ($graph as $key => $value) { $xml .= "<graph gid='{$count}' title='" . siconv(cplang("do_stat_{$key}"), 'utf8') . "'>"; $xml .= $value; $xml .= '</graph>'; $count++; } $xml .= '</graphs></chart>'; @header("Expires: -1"); @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); @header("Content-type: application/xml; charset=utf-8"); echo $xml; exit; } $siteurl = getsiteurl(); $statuspara = "path=&settings_file=data/stat_setting.xml&data_file=" . urlencode("do.php?ac=stat&xml=1&type={$type}"); $actives = array($type => ' style="font-weight:bold;"');
function xmltoarray($xmldata) { global $_SC; $struct = array(); $__type = 0; $tmp_value = ''; $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $xmldata, $values, $indexs); xml_parser_free($parser); $loop = count($indexs['member']) / (count($indexs['struct']) / 2); for ($i = 0; $i < count($indexs['member']); $i += $loop) { $_struct = array_slice($indexs['member'], $i, $loop); $_array_pop = array_pop($_struct); $_array_shift = array_shift($_struct); $__struct = array_slice($values, $_array_shift, $_array_pop - $_array_shift + 1); $keys = array(); foreach ($__struct as $_value) { if ("complete" == $_value['type']) { if ($__type == 0) { $tmp_value = $_value['value']; $keys[] = $tmp_value; } else { if ($tmp_value == 'content' && in_array('description', $keys) || $tmp_value == 'description' && in_array('content', $keys)) { } else { $struct[$i][$tmp_value] = siconv($_value['value'], $_SC['charset'], 'UTF-8'); } } $__type == 0 ? $__type = 1 : ($__type = 0); } } } return $struct; }
} $_SGLOBAL['inajax'] = 1; $subjectenc = rawurlencode(strip_tags($_GET['subjectenc'])); $messageenc = rawurlencode(strip_tags(preg_replace("/\\[.+?\\]/U", '', $_GET['messageenc']))); $data = @implode('', file("http://keyword.discuz.com/related_kw.html?title={$subjectenc}&content={$messageenc}&ics={$_SC['charset']}&ocs={$_SC['charset']}")); if ($data) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $data, $values, $index); xml_parser_free($parser); $kws = array(); foreach ($values as $valuearray) { if ($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') { if (PHP_VERSION > '5' && $_SC['charset'] != 'utf-8') { $kws[] = siconv(trim($valuearray['value']), $_SC['charset'], 'utf-8'); //编码转换 } else { $kws[] = trim($valuearray['value']); } } } $return = ''; if ($kws) { foreach ($kws as $kw) { $kw = shtmlspecialchars($kw); $return .= $kw . ' '; } $return = trim($return); } showmessage($return);
break; } } } elseif ($_FILES && $_POST) { if ($_FILES["Filedata"]['error']) { $uploadfiles = cplang('file_is_too_big'); } else { $_FILES["Filedata"]['name'] = addslashes(siconv(urldecode($_FILES["Filedata"]['name']), $_SC['charset'], "UTF-8")); $_POST['albumid'] = addslashes(siconv(urldecode($_POST['albumid']), $_SC['charset'], "UTF-8")); $uploadfiles = pic_save($_FILES["Filedata"], $_POST['albumid'], addslashes(siconv(urldecode($_POST['title']), $_SC['charset'], "UTF-8"))); } $proid = $_POST['proid']; $uploadResponse = true; $albumid = 0; if ($uploadfiles && is_array($uploadfiles)) { $status = "success"; $albumid = $uploadfiles['albumid']; } else { $status = "failure"; } } $newalbumname = sgmdate('Ymd'); include template("do_swfupload"); $outxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $outxml .= siconv(ob_get_contents(), 'UTF-8'); obclean(); @header("Expires: -1"); @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); @header("Content-type: application/xml; charset=utf-8"); echo $outxml;