本文整理汇总了PHP中util::getimagesnum方法的典型用法代码示例。如果您正苦于以下问题:PHP util::getimagesnum方法的具体用法?PHP util::getimagesnum怎么用?PHP util::getimagesnum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util
的用法示例。
在下文中一共展示了util::getimagesnum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doimport
function doimport()
{
$title = string::hiconv($this->post['title']);
$data = $_ENV['doc']->get_doc_by_title($title);
$page = $this->cache->getcache('systemdata');
if (empty($page)) {
$page = 1;
}
$_ENV['hdapi']->roll_docs($page, 10);
$this->cache->writecache('systemdata', ++$page);
if ($data) {
$this->message(0, '', 2);
}
$doc['content'] = $_ENV['hdapi']->get_content_import($title, 2, true);
$doc['tags'] = array($title);
$doc['search_tags'] = $title;
if ($doc['content'] && is_string($doc['content'])) {
$doc['category'] = $this->post['cid'];
$doc['title'] = $title;
$doc['letter'] = string::getfirstletter($title);
$doc['content'] = mysql_real_escape_string($doc['content']);
$doc['content'] = str_replace('\\r\\n', "\r\n", $doc['content']);
$doc['tags'] = $_ENV['doc']->jointags($doc['tags']);
$doc['summary'] = trim(string::convercharacter(strip_tags($doc['content'])));
$doc['images'] = util::getimagesnum($doc['content']);
$doc['time'] = $this->time;
$doc['words'] = string::hstrlen($doc['content']);
$doc['visible'] = '1';
//$this->setting['verify_doc']?'0':'1';
$did = $_ENV['doc']->add_doc($doc);
$_ENV['doc']->add_searchindex($did, $doc['title'], $doc['search_tags'], $doc['content']);
$_ENV['user']->add_credit($this->user['uid'], 'doc-create', $this->setting['credit_create']);
$_ENV['user']->update_field('creates', $this->user['creates'] + 1, $this->user['uid']);
$_ENV['category']->update_category_docs($this->post['category']);
//$data = array('did'=>$did, 'name'=>'互动百科 '.$title, 'url'=>'http://www.hudong.com/wiki/'.urlencode($this->post['title']));
//$_ENV['reference']->add($data);
$this->message(1, '', 2);
} else {
if ($doc['content'] && is_array($doc['content'])) {
$this->message($doc['content']['return_type'] . '_' . $doc['content']['return_info'], '', 2);
} else {
$this->message(2, '', 2);
}
}
}
示例2: edit_doc
function edit_doc($doc, $edittype = '1', $increase_edition = true)
{
if ($this->base->setting['base_createdoc'] == 1) {
$edition = $doc;
} else {
$edition = $this->db->fetch_first("SELECT * FROM " . DB_TABLEPRE . "doc WHERE did=" . $doc['did']);
$edition = string::haddslashes($edition, 1);
}
$edition_sql = $increase_edition ? 'edits=edits+1,editions=editions+1,' : '';
$this->db->query("UPDATE " . DB_TABLEPRE . "doc SET\r\n\t\ttag='" . $doc['tags'] . "' ,summary='" . $doc['summary'] . "' ,content='" . $doc['content'] . "',lastedit='" . $doc['time'] . "',\r\n\t\tlasteditor='" . $this->base->user['username'] . "',lasteditorid='" . $this->base->user['uid'] . "',{$edition_sql}visible='" . $doc['visible'] . "' WHERE did=" . $doc['did']);
$words = string::hstrlen($edition['content']);
$images = util::getimagesnum($edition['content']);
if ($this->base->setting['db_storage'] == 'txt') {
$content = stripslashes($edition['content']);
$edition['content'] = '';
}
if ($increase_edition == true) {
$this->db->query("INSERT INTO " . DB_TABLEPRE . "edition\r\n\t\t\t(did,author,authorid,time,ip,title,tag,summary,content,words,images,reason,`type`)\r\n\t\t\tVALUES ('" . $edition['did'] . "','" . $this->base->user['username'] . "','" . $this->base->user['uid'] . "','" . $edition['lastedit'] . "','" . $this->base->ip . "','" . $edition['title'] . "','" . $edition['tags'] . "','" . $edition['summary'] . "','" . $edition['content'] . "','{$words}','{$images}','" . $doc['reason'] . "','{$edittype}')");
$eid = $this->db->insert_id();
} else {
$last_edition = $this->db->fetch_first("SELECT * FROM " . DB_TABLEPRE . "edition WHERE did = {$doc['did']} AND authorid = {$this->base->user['uid']} ORDER BY eid DESC LIMIT 1");
if (isset($last_edition['eid'])) {
$eid = $last_edition['eid'];
$sql = "UPDATE " . DB_TABLEPRE . "edition SET `time`='" . $edition['lastedit'] . "',";
$sql .= "ip='" . $this->base->ip . "',";
$sql .= "title='" . $edition['title'] . "',";
$sql .= "tag='" . $edition['tags'] . "',";
$sql .= "summary='" . $edition['summary'] . "',";
$sql .= "content='" . $edition['content'] . "',";
$sql .= "words='" . $words . "',";
$sql .= "images='" . $images . "',";
$sql .= "reason='" . $doc['reason'] . "',";
$sql .= "`type`='" . $edittype . "' where eid = {$eid}";
$this->db->query($sql);
} else {
$eid = 0;
}
}
if ($this->base->setting['db_storage'] == 'txt') {
file::forcemkdir($this->get_edition_fileinfo($eid, 'path'));
file::writetofile($this->get_edition_fileinfo($eid, 'file'), $content);
}
}
示例3: doimport
function doimport()
{
//global $wmdb;
if (file_exists($this->configfile) && file_exists($this->sumfile)) {
include $this->configfile;
include $this->sumfile;
} else {
$this->message('5|0', '', 2);
}
$this->wmdb = new hddb(WDB_HOST, WDB_USER, WDB_PW, WDB_NAME, WDB_CHARSET, WDB_CONNECT);
//$wmdb = $this->wmdb;
//判断做到哪一步了.
if (file_exists($this->processfile)) {
include $this->processfile;
list($type, $i) = explode('|', $process);
if ($type >= 5) {
$this->message('5|0', '', 2);
}
} else {
list($type, $i) = array(1, 0);
}
$totalnum = array(1 => $catsum, 2 => $usersum, 3 => $docsum, 4 => $clinksum);
$totalnum = $totalnum[$type];
$j = 10;
for (; $i < $totalnum; $i += $j) {
$msg = $type . '|' . (($n = $i + $j) >= $totalnum ? $totalnum : $n);
if ($type == 1 || $type == 2 || $type == 4) {
//导入分类和用户。
$hdsql = $_ENV['mwimport']->get_sql($this->wmdb, $type, $i, $j);
if (!$hdsql || $this->db->query($hdsql)) {
$_ENV['mwimport']->writefile($this->processfile, '<?php $process = "' . $msg . '"; ?>');
} else {
$this->message('5|0', '', 2);
}
} elseif ($type == 3) {
include HDWIKI_ROOT . '/plugins/mwimport/text/Mediawiki.php';
$parser = 'Mediawiki';
$text_wiki = new Text_Wiki_Mediawiki();
$sql = "SELECT a.page_id, a.page_title, b.old_text, b.old_flags, b.old_id FROM " . WDB_TABLEPRE . "page a, " . WDB_TABLEPRE . "text b WHERE a.page_namespace = 0 AND a.page_latest = b.old_id limit " . $i . ",{$j}";
$query = $this->wmdb->query($sql);
while ($doc = $this->wmdb->fetch_array($query)) {
if ($_ENV['doc']->get_doc_by_title($doc['page_title'])) {
continue;
}
$doc['did'] = $doc['page_id'];
$doc['title'] = $doc['page_title'];
$doc['letter'] = string::getfirstletter($doc['page_title']);
$wiki = $text_wiki->singleton($parser);
$result = $wiki->transform($source);
$doc['old_text'] = $wiki->transform($doc['old_text']);
//加入对内容的处理和过滤。
$doc['old_text'] = mysql_real_escape_string($doc['old_text']);
$doc['tags'] = '';
$doc['summary'] = trim(string::convercharacter(string::substring(strip_tags($doc['old_text']), 0, 100)));
$doc['images'] = util::getimagesnum($doc['old_text']);
$doc['time'] = $this->time;
$doc['words'] = string::hstrlen($doc['old_text']);
$doc['visible'] = '1';
$doc['cid'] = $_ENV['mwimport']->get_cid($this->wmdb, '', $doc['did']);
$sql = "SELECT rev_user,rev_user_text FROM " . WDB_TABLEPRE . "revision WHERE rev_page = " . $doc['page_id'] . " ORDER BY rev_id ";
$user = $this->wmdb->fetch_first($sql);
$this->db->query("REPLACE INTO " . DB_TABLEPRE . "doc\r\n\t\t\t (did,cid,letter,title,tag ,summary ,content,author,authorid,time,lastedit,lasteditor,lasteditorid,visible,editions)\r\n\t\t\t VALUES (" . $doc['did'] . "," . $doc['cid'] . ",'" . $doc['letter'] . "','" . $doc['title'] . "','" . $doc['tags'] . "','" . $doc['summary'] . "','" . $doc['old_text'] . "',\r\n\t\t\t '" . $user['rev_user_text'] . "','" . $user['rev_user'] . "',\r\n\t\t\t " . $doc['time'] . "," . $doc['time'] . ",'" . $user['rev_user_text'] . "','" . $user['rev_user'] . "','" . $doc['visible'] . "',1)");
}
$_ENV['mwimport']->writefile($this->processfile, '<?php $process = "' . $msg . '"; ?>');
}
$this->message($msg, '', 2);
}
$msg = $type + 1 . '|0';
$_ENV['mwimport']->writefile($this->processfile, '<?php $process = "' . $msg . '"; ?>');
$this->message($msg, '', 2);
}
示例4: doeditsection
function doeditsection()
{
$this->_anti_copy();
if (4 != $this->user['groupid'] && $this->time - $this->user['regtime'] < $this->setting['forbidden_edit_time'] * 60) {
$this->message($this->view->lang['editTimeLimit1'] . $this->setting['forbidden_edit_time'] . $this->view->lang['editTimeLimit2'], 'BACK', 0);
}
if ('0' === $this->user['checkup']) {
$this->message($this->view->lang['createDocTip17'], 'BACK', 0);
}
@($did = isset($this->get[2]) ? $this->get[2] : $this->post['did']);
@($id = isset($this->get[3]) ? $this->get[3] : $this->post['section_id']);
if (!is_numeric($did) || !is_numeric($id)) {
$this->message($this->view->lang['parameterError'], 'index.php', 0);
}
$doc = $this->db->fetch_by_field('doc', 'did', $did);
//eval($this->plugin['hdapi']['hooks']['readcontent']);
$this->load("hdapi");
if ($this->setting['site_nick'] && $this->setting["hdapi_bklm"]) {
if ($_ENV["hdapi"]->islock($doc["title"])) {
$doc["locked"] = 1;
$this->message("该词条正在被百科联盟网站锁定编辑中", "BACK", 0);
} else {
$_ENV["hdapi"]->lock($doc["title"]);
$content = $_ENV["hdapi"]->get_content($doc["title"]);
if (is_string($content) && !empty($content)) {
$doc["content"] = $content;
}
}
}
if (!(bool) $doc) {
$this->message($this->view->lang['docNotExist'], 'index.php', 0);
}
if ($doc['visible'] == '0' && !$this->checkable('admin_doc-audit')) {
$this->message($this->view->lang['viewDocTip4'], 'index.php', 0);
}
if (!isset($this->post['publishsubmit'])) {
$editlockuid = $_ENV['doc']->iseditlocked($did);
if ($editlockuid != 0 && $editlockuid != $this->user['uid']) {
$this->message($this->view->lang['viewDocTip5'] . $this->view->lang['viewDocTip6'], 'BACK', 0);
}
if ($doc['locked']) {
$this->header("doc-view-" . $doc['did'] . "-locked");
}
$array_section = $_ENV['doc']->splithtml($doc['content']);
if (!isset($array_section[$id + 1]['value'])) {
$this->header('doc-edit-' . $did);
}
//$doc['tag']=$_ENV['doc']->spilttags($doc['tag']);
$doc['content'] = $array_section[$id + 1]['value'];
$this->view->assign("savetime", 60000);
$ramus = isset($this->get[4]) ? $this->get[4] : '';
$autosave = $_ENV['doc']->is_autosave($this->user['uid'], $doc['did']);
if ((bool) $autosave) {
if ($ramus) {
$doc['content'] = $autosave['content'];
} else {
$autosave['content'] = str_replace(array("\r\n", "\r", "\n"), "", addslashes($autosave['content']));
$autosave['showtime'] = $this->date($autosave['time']);
$this->view->assign("autosave", $autosave);
}
}
$doc['content'] = $this->setting['auto_picture'] ? $_ENV['doc']->auto_picture($doc['content'], $did) : $doc['content'];
$doc['title'] = $doc['title'] . "-" . $array_section[$id]['value'];
$doc['section_id'] = $id;
$this->view->assign('navtitle', $doc['title'] . '-' . $this->view->lang['editionEdit'] . '-');
$this->view->assign("page_action", "editsection");
$doc = str_replace("&", "&", $doc);
$doc['title'] = htmlspecialchars(stripslashes($doc['title']));
$this->view->assign("doc", $doc);
$this->view->assign("doc_verification_edit_code", $this->setting['checkcode'] != 3 && $this->setting['doc_verification_edit_code']);
$this->view->assign('g_img_big', $this->setting['img_width_big']);
$this->view->assign('g_img_small', $this->setting['img_width_small']);
//$this->view->display("editor");
$_ENV['block']->view('editor');
} else {
if ($this->setting['checkcode'] != 3 && $this->setting['doc_verification_edit_code'] && strtolower($this->post['code']) != $_ENV['user']->get_code()) {
$this->message($this->view->lang['codeError'], 'BACK', 0);
}
if (trim($this->post['content']) == "") {
$this->message($this->view->lang['contentIsNull'], 'BACK', 0);
}
$tem = $_ENV['doc']->splithtml($doc['content']);
$tem[$id + 1]['value'] = $_ENV['doc']->replace_danger_word(stripcslashes($this->post['content']));
$doc['content'] = string::haddslashes(string::stripscript($_ENV['doc']->joinhtml($tem)), 1);
//$doc['tags']=$_ENV['doc']->jointags($this->post['tags']);
$doc['tags'] = $this->post['tags'];
$doc['tags'] = $_ENV['doc']->replace_danger_word($doc['tags']);
$doc['summary'] = trim(strip_tags($_ENV['doc']->replace_danger_word($this->post['summary'])));
$doc['summary'] = (bool) $doc['summary'] ? $doc['summary'] : $doc['content'];
$doc['summary'] = trim(string::convercharacter(string::substring(strip_tags($doc['summary']), 0, 100)));
$doc['images'] = util::getimagesnum($doc['content']);
$doc['time'] = $this->time;
$doc['visible'] = $this->setting['verify_doc'] ? '0' : '1';
$doc['words'] = string::hstrlen($doc['content']);
$doc['reason'] = htmlspecialchars(trim(implode(',', $this->post['editreason']), ' \\t\\n,'));
/*foreach($this->post['tags'] as $search_tags){
$doc['search_tags'] .=string::convert_to_unicode($search_tags).";";
} */
if (!$_ENV['doc']->check_submit_interval($this->user['uid'])) {
if ($this->setting['save_spam']) {
//.........这里部分代码省略.........