本文整理汇总了PHP中iACP::callback方法的典型用法代码示例。如果您正苦于以下问题:PHP iACP::callback方法的具体用法?PHP iACP::callback怎么用?PHP iACP::callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iACP
的用法示例。
在下文中一共展示了iACP::callback方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_save
function do_save()
{
$id = (int) $_POST['id'];
$uid = (int) $_POST['uid'];
$rootid = (int) $_POST['rootid'];
$cid = implode(',', (array) $_POST['cid']);
$tcid = implode(',', (array) $_POST['tcid']);
$pid = implode(',', (array) $_POST['pid']);
$_cid = iS::escapeStr($_POST['_cid']);
$_tcid = iS::escapeStr($_POST['_tcid']);
$_pid = iS::escapeStr($_POST['_pid']);
$name = iS::escapeStr($_POST['name']);
$subtitle = iS::escapeStr($_POST['subtitle']);
$tkey = iS::escapeStr($_POST['tkey']);
$seotitle = iS::escapeStr($_POST['seotitle']);
$keywords = iS::escapeStr($_POST['keywords']);
$pic = iS::escapeStr($_POST['pic']);
$bpic = iS::escapeStr($_POST['bpic']);
$mpic = iS::escapeStr($_POST['mpic']);
$spic = iS::escapeStr($_POST['spic']);
$description = iS::escapeStr($_POST['description']);
$url = iS::escapeStr($_POST['url']);
$related = iS::escapeStr($_POST['related']);
$tpl = iS::escapeStr($_POST['tpl']);
$weight = _int($_POST['weight']);
$ordernum = _int($_POST['ordernum']);
$status = (int) $_POST['status'];
$haspic = $pic ? '1' : '0';
$pubdate = time();
$metadata = $_POST['metadata'];
$uid or $uid = iMember::$userid;
if ($callback) {
if (empty($name)) {
echo '标签名称不能为空!';
return false;
}
}
$name or iPHP::alert('标签名称不能为空!');
$cid or iPHP::alert('请选择标签所属栏目!');
if ($metadata) {
if ($metadata['key']) {
$md = array();
foreach ($metadata['key'] as $_mk => $_mval) {
!preg_match("/[a-zA-Z0-9_\\-]/", $_mval) && iPHP::alert($this->name_text . '附加属性名称只能由英文字母、数字或_-组成(不支持中文)');
$md[$_mval] = $metadata['value'][$_mk];
}
} else {
$md = $metadata;
}
$metadata = addslashes(json_encode($md));
}
if (empty($id)) {
$hasNameId = iDB::value("SELECT `id` FROM `#iCMS@__tags` where `name` = '{$name}'");
if ($hasNameId) {
if (isset($_POST['spider_update'])) {
$id = $hasNameId;
} else {
iPHP::alert('该标签已经存在!请检查是否重复');
}
}
}
if (empty($tkey) && $url) {
$tkey = substr(md5($url), 8, 16);
$hasTkey = iDB::value("SELECT `id` FROM `#iCMS@__tags` where `tkey` = '{$tkey}'");
if ($hasTkey) {
if (isset($_POST['spider_check_tkey'])) {
echo '该自定义链接已经存在!请检查是否重复';
return false;
} else {
iPHP::alert('该自定义链接已经存在!请检查是否重复');
}
}
}
$tkey or $tkey = strtolower(pinyin($name));
iFS::$forceExt = "jpg";
iFS::checkHttp($pic) && ($pic = iFS::http($pic));
iFS::checkHttp($bpic) && ($bpic = iFS::http($bpic));
iFS::checkHttp($mpic) && ($mpic = iFS::http($mpic));
iFS::checkHttp($spic) && ($spic = iFS::http($spic));
iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
$fields = array('uid', 'rootid', 'cid', 'tcid', 'pid', 'tkey', 'name', 'seotitle', 'subtitle', 'keywords', 'description', 'metadata', 'haspic', 'pic', 'bpic', 'mpic', 'spic', 'url', 'related', 'count', 'weight', 'tpl', 'ordernum', 'pubdate', 'status');
$data = compact($fields);
if (empty($id)) {
$data['postime'] = $pubdate;
$data['count'] = '0';
$data['comments'] = '0';
$id = iDB::insert('tags', $data);
tag::cache($id, 'id');
map::init('prop', $this->appid);
$pid && map::add($pid, $id);
map::init('category', $this->appid);
map::add($cid, $id);
$tcid && map::add($tcid, $id);
$msg = '标签添加完成';
} else {
if (isset($_POST['spider_update'])) {
// $data = array();
$hasTag = iDB::row("SELECT * FROM `#iCMS@__tags` where `id` = '{$id}'", ARRAY_A);
$this->check_spider_data($data, $hasTag, 'subtitle', $subtitle);
$this->check_spider_data($data, $hasTag, 'description', $description);
//.........这里部分代码省略.........
示例2: article_data
function article_data($bodyArray, $aid = 0, $haspic = 0)
{
if (isset($_POST['ischapter']) || is_array($_POST['adid'])) {
$adidArray = $_POST['adid'];
$chaptertitle = $_POST['chaptertitle'];
$chapter = count($bodyArray);
foreach ($bodyArray as $key => $body) {
$adid = (int) $adidArray[$key];
$subtitle = iS::escapeStr($chaptertitle[$key]);
$this->body($body, $subtitle, $aid, $adid, $haspic);
}
articleTable::update(compact('chapter'), array('id' => $aid));
} else {
$adid = (int) $_POST['adid'];
$subtitle = iS::escapeStr($_POST['subtitle']);
$body = implode('#--iCMS.PageBreak--#', $bodyArray);
$this->body($body, $subtitle, $aid, $adid, $haspic);
}
iACP::callback($aid, $this, 'data');
}
示例3: do_save
function do_save()
{
$id = (int) $_POST['id'];
$cid = (int) $_POST['cid'];
$_cid = (int) $_POST['_cid'];
$userid = (int) $_POST['userid'];
$pid = (int) $_POST['pid'];
$editor = iS::escapeStr($_POST['editor']);
$ordernum = _int($_POST['ordernum']);
$addtime = iPHP::str2time($_POST['addtime']);
$title = iS::escapeStr($_POST['title']);
$pic = $this->getpic($_POST['pic']);
$description = iS::escapeStr($_POST['description']);
$url = iS::escapeStr($_POST['url']);
$title2 = iS::escapeStr($_POST['title2']);
$pic2 = $this->getpic($_POST['pic2']);
$description2 = iS::escapeStr($_POST['description2']);
$url2 = iS::escapeStr($_POST['url2']);
$title3 = iS::escapeStr($_POST['title3']);
$pic3 = $this->getpic($_POST['pic3']);
$description3 = iS::escapeStr($_POST['description3']);
$url3 = iS::escapeStr($_POST['url3']);
$metadata = iS::escapeStr($_POST['metadata']);
$metadata = $metadata ? addslashes(serialize($metadata)) : '';
empty($userid) && ($userid = iMember::$userid);
empty($title) && iPHP::alert('1.标题必填');
empty($cid) && iPHP::alert('请选择所属栏目');
$haspic = empty($pic) ? 0 : 1;
$status = 1;
$fields = array('cid', 'rootid', 'pid', 'haspic', 'editor', 'userid', 'title', 'pic', 'url', 'description', 'title2', 'pic2', 'url2', 'description2', 'title3', 'pic3', 'url3', 'description3', 'ordernum', 'metadata', 'addtime', 'hits', 'status');
$data = compact($fields);
if (empty($id)) {
iDB::insert('push', $data);
iDB::query("UPDATE `#iCMS@__category` SET `count` = count+1 WHERE `cid` ='{$cid}' LIMIT 1 ");
$msg = '推送完成';
} else {
iDB::update('push', $data, array('id' => $id));
if ($_cid != $cid) {
iDB::query("UPDATE `#iCMS@__category` SET `count` = count-1 WHERE `cid` ='{$_cid}' and `count`>0 LIMIT 1 ");
iDB::query("UPDATE `#iCMS@__category` SET `count` = count+1 WHERE `cid` ='{$cid}' LIMIT 1 ");
}
$msg = '编辑完成!';
}
iACP::callback($id, $this);
if ($this->callback['code']) {
return array("code" => $this->callback['code'], 'indexid' => $id);
}
iPHP::success($msg, 'url:' . APP_URI);
}
示例4: article_data
function article_data($bodyArray, $aid = 0, $haspic = 0)
{
$id = (int) $_POST['adid'];
$subtitle = iS::escapeStr($_POST['subtitle']);
$body = implode('#--iCMS.PageBreak--#', $bodyArray);
$body = preg_replace(array('/<script.+?<\\/script>/is', '/<form.+?<\\/form>/is'), '', $body);
isset($_POST['dellink']) && ($body = preg_replace("/<a[^>].*?>(.*?)<\\/a>/si", "\\1", $body));
if (isset($_POST['markdown'])) {
$body = '#--iCMS.Markdown--#' . $body;
} else {
iCMS::$config['publish']['autoformat'] && ($body = addslashes(autoformat($body)));
}
articleTable::$ID = $aid;
$fields = articleTable::data_fields($id);
$data = compact($fields);
if ($id) {
articleTable::data_update($data, compact('id'));
} else {
$id = articleTable::data_insert($data);
}
iACP::callback($aid, $this, 'data');
$_POST['isredirect'] && (iFS::$redirect = true);
$_POST['iswatermark'] && (iFS::$watermark = false);
if (isset($_POST['remote'])) {
$body = $this->remotepic($body, true, $aid);
$body = $this->remotepic($body, true, $aid);
$body = $this->remotepic($body, true, $aid);
if ($body && $id) {
articleTable::data_update(array('body' => $body), compact('id'));
}
}
if (isset($_POST['autopic']) && empty($haspic)) {
$picurl = $this->remotepic($body, 'autopic', $aid);
$this->pic($picurl, $aid);
}
$this->pic_indexid($body, $aid);
}
示例5: do_save
//.........这里部分代码省略.........
$contentprop = iS::escapeStr($_POST['contentprop']);
$body = $_POST['body'];
$hasbody = (int) $_POST['hasbody'];
$hasbody or $hasbody = $body ? 1 : 0;
if ($_rootid_hash) {
$_rootid = authcode($_rootid_hash);
if ($rootid != $_rootid) {
iPHP::alert('非法数据提交!');
} else {
iACP::CP($_rootid, 'a', 'alert');
exit;
}
}
$cid && $cid == $rootid && iPHP::alert('不能以自身做为上级' . $this->category_name);
empty($name) && iPHP::alert($this->category_name . '名称不能为空!');
if ($metadata) {
$md = array();
if (is_array($metadata['key'])) {
foreach ($metadata['key'] as $_mk => $_mval) {
!preg_match("/[a-zA-Z0-9_\\-]/", $_mval) && iPHP::alert($this->category_name . '附加属性名称只能由英文字母、数字或_-组成(不支持中文)');
$md[$_mval] = $metadata['value'][$_mk];
}
} else {
if (is_array($metadata)) {
$md = $metadata;
}
}
$metadata = addslashes(serialize($md));
}
if ($contentprop) {
$ca = array();
foreach ($contentprop['key'] as $_cak => $_caval) {
$_caval or $_caval = strtolower(pinyin($contentprop['name'][$_cak]));
!preg_match("/[a-zA-Z0-9_\\-]/", $_caval) && iPHP::alert('内容附加属性字段只能由英文字母、数字或_-组成(不支持中文)');
$ca[$_caval] = $contentprop['name'][$_cak];
}
$contentprop = addslashes(serialize($ca));
}
if ($mode == "2") {
if (strpos($categoryRule, '{CDIR}') === FALSE && strpos($categoryRule, '{CID}') === FALSE && strpos($categoryRule, '{0xCID}') === FALSE) {
iPHP::alert('伪静态模式下版块URL规则<hr />必需要有<br />{CDIR}版块目录<br />或者<br />{CID},{0xCID}版块ID');
}
if (strpos($contentRule, '{ID}') === FALSE && strpos($contentRule, '{0xID}') === FALSE && strpos($contentRule, '{LINK}') === FALSE) {
iPHP::alert('伪静态模式下内容URL规则<hr />必需要有<br />{ID}' . $this->_app_name . 'ID <br />或者<br />{0xID}' . $this->_app_name . 'ID补零<br />或者<br />{LINK}' . $this->_app_name . '自定义链接');
}
}
iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
map::init('prop', iCMS_APP_CATEGORY);
$fields = array('rootid', 'appid', 'ordernum', 'name', 'subname', 'password', 'title', 'keywords', 'description', 'dir', 'mode', 'domain', 'url', 'pic', 'mpic', 'spic', 'htmlext', 'categoryURI', 'categoryRule', 'contentRule', 'urlRule', 'indexTPL', 'listTPL', 'contentTPL', 'metadata', 'contentprop', 'hasbody', 'pid', 'isexamine', 'issend', 'isucshow', 'status');
$data = compact($fields);
if (empty($cid)) {
iACP::CP($rootid, 'a', 'alert');
$nameArray = explode("\n", $name);
$_count = count($nameArray);
foreach ($nameArray as $nkey => $_name) {
$_name = trim($_name);
if (empty($_name)) {
continue;
}
if ($_count == "1") {
if (empty($dir) && empty($url)) {
$dir = strtolower(pinyin($_name));
}
} else {
empty($url) && ($dir = strtolower(pinyin($_name)));
}
$this->check_dir($dir, $appid, $url);
$data['name'] = $_name;
$data['dir'] = $dir;
$data['userid'] = iMember::$userid;
$data['creator'] = iMember::$nickname;
$data['createtime'] = time();
$data['count'] = '0';
$data['comments'] = '0';
$data['ordernum'] = $nkey;
$cid = iDB::insert('category', $data);
$pid && map::add($pid, $cid);
$this->cache(false, $this->appid);
$this->cahce_one($cid);
}
$msg = $this->category_name . "添加完成!";
} else {
if (empty($dir) && empty($url)) {
$dir = strtolower(pinyin($name));
}
iACP::CP($cid, 'e', 'alert');
$this->check_dir($dir, $appid, $url, $cid);
$data['dir'] = $dir;
iDB::update('category', $data, array('cid' => $cid));
map::diff($pid, $_pid, $cid);
$this->cahce_one($cid);
$msg = $this->category_name . "编辑完成!";
}
$hasbody && iCache::set('iCMS/category/' . $cid . '.body', $body, 0);
iACP::callback($cid, $this);
if ($this->callback['code']) {
return array("code" => $this->callback['code'], 'indexid' => $cid);
}
iPHP::success($msg, 'url:' . $this->category_uri);
}