本文整理汇总了PHP中article::add方法的典型用法代码示例。如果您正苦于以下问题:PHP article::add方法的具体用法?PHP article::add怎么用?PHP article::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类article
的用法示例。
在下文中一共展示了article::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lang
$post['save_remotepic'] = $MOD['save_remotepic'] ? 1 : 0;
$post['clear_link'] = $MOD['clear_link'] ? 1 : 0;
$post['introduce_length'] = $MOD['introduce_length'] ? $MOD['introduce_length'] : 0;
$post['areaid'] = $cityid;
if ($could_color && $color && $_credit > $MOD['credit_color']) {
$post['style'] = $color;
credit_add($_username, -$MOD['credit_color']);
credit_record($_username, -$MOD['credit_color'], 'system', $L['title_color'], '[' . $MOD['name'] . ']' . $post['title']);
}
if ($FD) {
fields_check($post_fields);
}
if ($CP) {
property_check($post_ppt);
}
$do->add($post);
if ($FD) {
fields_update($post_fields, $table, $do->itemid);
}
if ($CP) {
property_update($post_ppt, $moduleid, $post['catid'], $do->itemid);
}
if ($MOD['show_html'] && $post['status'] > 2) {
$do->tohtml($do->itemid);
}
if ($fee_add) {
if ($fee_currency == 'money') {
money_add($_username, -$fee_add);
money_record($_username, -$fee_add, $L['in_site'], 'system', lang($L['credit_record_add'], array($MOD['name'])), 'ID:' . $do->itemid);
} else {
credit_add($_username, -$fee_add);
示例2: add_or_edit_article
function add_or_edit_article()
{
global $global, $smarty, $lang;
$art_id = post('art_id');
$art_title = post('art_title');
$art_cat_id = post('art_cat_id');
$art_author = post('art_author');
$att_url = post('file_path');
$art_text = post('editor', 'loose');
$art_keywords = post('art_keywords');
$art_description = post('art_description');
$art_add_time = time();
$arr = array();
$obj = new att_art();
$obj->set_where('');
$obj->set_where('att_channel_id = ' . $global['channel_id']);
$att = $obj->get_list();
for ($i = 0; $i < count($att); $i++) {
$att_value = post($att[$i]['att_code']);
if ($att_value != '') {
$arr[$att[$i]['att_id']] = $att_value;
}
}
$art_attribute = rawurlencode(json_encode($arr));
if ($art_cat_id == '') {
$art_cat_id = 0;
}
$art_text = str_replace('<p><br/></p>', '', $art_text);
$art_text = str_replace('<p><br /></p>', '', $art_text);
$art_description = cut_str($art_description, 250);
$obj = new article();
$obj->set_value('art_title', $art_title);
$obj->set_value('art_cat_id', $art_cat_id);
$obj->set_value('art_author', $art_author);
$obj->set_value('art_text', $art_text);
$obj->set_value('art_keywords', $art_keywords);
$obj->set_value('art_description', $art_description);
$obj->set_value('art_add_time', $art_add_time);
$obj->set_value('art_attribute', $art_attribute);
if ($art_id != '') {
$obj->set_where("art_id = {$art_id}");
$obj->edit();
$info_text = $lang['edit_article_success'];
} else {
$obj->set_value('art_channel_id', $global['channel_id']);
$obj->set_value('art_lang', S_LANG);
$obj->add();
$info_text = $lang['add_article_success'];
}
if (intval(get_varia('single_page_static'))) {
$page_id = $art_id;
if ($page_id == '') {
$obj->set_where("art_add_time = {$art_add_time}");
$one = $obj->get_one();
if (count($one)) {
$page_id = $one['art_id'];
}
}
if ($page_id != '') {
$domain = get_domain();
$page_url = 'http://' . $domain . S_ROOT . url(array('channel' => $global['channel'], 'id' => $page_id));
$html = file_get_contents($page_url);
}
}
$smarty->assign('info_text', $info_text);
$smarty->assign('link_text', $lang['return_list']);
$smarty->assign('link_href', url(array('channel' => $global['channel'], 'mod' => 'sheet')));
}
示例3: date
* 负责处理新发表文章的逻辑
* Createed By C860 at 2014-1-19
*/
if (!class_exists('sys')) {
include_once '../conf/config.php';
}
//需要登录
sys::needLog('../login.php');
//检测数据合法性
if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['content']) && !empty($_POST['content']) && isset($_POST['tags']) && !empty($_POST['tags'])) {
//引入相关模型类
include_once '../Models/article.php';
include_once '../Models/tag_relate_article.php';
include_once '../Models/user_info.php';
$currentTime = date('Y-m-d H:i:s');
//新增文章
if (article::add($_POST['title'], $_POST['content'], $currentTime, $_SESSION['userId'])) {
$ID = article::getId($_POST['title'], $_SESSION['userId'], $currentTime);
$tags = explode('|', $_POST['tags']);
foreach ($tags as $tag) {
tag_relate_article::add($tag, $ID);
}
user_info::increaseArticleCount($_SESSION['userId']);
sys::alert('发表成功!');
sys::redirect('../index.php');
}
} else {
//引入相关模型类
include_once 'Models/tag.php';
$taglist = tag::getAllTags();
}
示例4: do_gather_tailor
function do_gather_tailor()
{
$id = post('id');
$data_username = rawurlencode(get_varia('data_username'));
$data_password = rawurlencode(get_varia('data_password'));
$url = S_SERVER_URL . 'tailor.php?/tailor/id-' . $id . '/data_username-' . $data_username . '/data_password-' . $data_password . '/index.html';
$str = file_get_contents($url);
$result = json_decode(rawurldecode($str), true);
if (is_array($result)) {
if ($result['error'] == 'no') {
$one = $result['one'];
$local_channel_id = 0;
$local_cat_id = 0;
$obj = new varia();
$obj->set_where("var_name = 'tailor_data_cat'");
$list = $obj->get_list();
for ($i = 0; $i < count($list); $i++) {
$arr = explode('|', $list[$i]['var_value']);
if ($arr[0] == $one['art_cat_id']) {
$local_channel_id = $arr[2];
$local_cat_id = $arr[3];
break;
}
}
if ($local_channel_id != 0 && $local_cat_id != 0) {
$site_keywords = get_varia('site_keywords');
$site_description = get_varia('site_description');
$obj = new article();
$obj->set_value('art_title', $one['art_title']);
$obj->set_value('art_channel_id', $local_channel_id);
$obj->set_value('art_lang', S_LANG);
$obj->set_value('art_cat_id', $local_cat_id);
$obj->set_value('art_author', $one['art_author']);
$obj->set_value('art_text', $one['art_text']);
$obj->set_value('art_keywords', $site_keywords);
$obj->set_value('art_description', $site_description);
$obj->set_value('art_add_time', time());
$obj->add();
echo 1;
} else {
echo 2;
}
} else {
echo $result['error'];
}
} else {
echo 0;
}
}