本文整理汇总了PHP中news::submit_item方法的典型用法代码示例。如果您正苦于以下问题:PHP news::submit_item方法的具体用法?PHP news::submit_item怎么用?PHP news::submit_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::submit_item方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: news
function _observe_submit_item($sub_action, $id)
{
// ##### Format and submit item to DB
$ix = new news();
$_POST['news_start'] = vartrue(e107::getDate()->convert($_POST['news_start'], 'inputdatetime'), 0);
if ($_POST['news_start']) {
// $_POST['news_start'] = e107::getDate()->convert($_POST['news_start']);
} else {
// $_POST['news_start'] = 0;
}
if ($_POST['news_end']) {
$_POST['news_end'] = e107::getDate()->convert($_POST['news_end'], 'inputdatetime');
} else {
$_POST['news_end'] = 0;
}
if ($_POST['news_datestamp']) {
$_POST['news_datestamp'] = e107::getDate()->convert($_POST['news_datestamp'], 'inputdatetime');
} else {
$_POST['news_datestamp'] = time();
}
/*
$matches = array();
if(preg_match('#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#', $_POST['news_datestamp'], $matches))
{
$_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
}
else
{
$_POST['news_datestamp'] = time();
}
if($_POST['update_datestamp'])
{
$_POST['news_datestamp'] = time();
}
*/
if ($id && $sub_action != "sn" && $sub_action != "upload") {
$_POST['news_id'] = $id;
} else {
e107::getDb()->db_Update('submitnews', "submitnews_auth=1 WHERE submitnews_id ={$id}");
e107::getAdminLog()->log_event('NEWS_07', $id, E_LOG_INFORMATIVE, '');
}
if (!isset($_POST['cat_id'])) {
$_POST['cat_id'] = 0;
}
$_POST['news_category'] = $_POST['cat_id'];
if (!isset($this->news_categories[$_POST['news_category']])) {
$this->noPermissions();
}
/*if(isset($_POST['news_thumbnail']))
{
$_POST['news_thumbnail'] = urldecode(basename($_POST['news_thumbnail']));
}*/
$_POST['news_render_type'] = implode(",", $_POST['news_render_type']);
// print_a($_POST);
// exit;
$tmp = explode(chr(35), $_POST['news_author']);
$_POST['news_author'] = $tmp[0];
$ret = $ix->submit_item($_POST, !vartrue($_POST['create_edit_stay']));
if ($ret['error']) {
e107::getMessage()->mergeWithSession()->add($id ? LAN_UPDATED_FAILED : LAN_CREATED_FAILED, E_MESSAGE_ERROR);
$_POST['news_sef'] = $ret['data']['news_sef'];
return false;
}
$this->clear_cache();
if (isset($_POST['create_edit_stay']) && !empty($_POST['create_edit_stay'])) {
if ($this->getSubAction() != 'edit') {
session_write_close();
$rurl = e_SELF . (varsettrue($ret['id']) ? "?create.edit." . $ret['id'] : '');
header('Location:' . ($rurl ? $rurl : e_SELF));
exit;
}
} else {
session_write_close();
header('Location:' . e_SELF);
exit;
}
}