本文整理汇总了PHP中news::update方法的典型用法代码示例。如果您正苦于以下问题:PHP news::update方法的具体用法?PHP news::update怎么用?PHP news::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: min
}
if (!isset($fid)) {
$r = $db->get_one("SELECT min(itemid) AS fid FROM {$DT_PRE}news");
$fid = $r['fid'] ? $r['fid'] : 0;
}
if (!isset($tid)) {
$r = $db->get_one("SELECT max(itemid) AS tid FROM {$DT_PRE}news");
$tid = $r['tid'] ? $r['tid'] : 0;
}
isset($sid) or $sid = $fid;
if ($fid <= $tid) {
$result = $db->query("SELECT itemid FROM {$DT_PRE}news WHERE itemid>={$fid} ORDER BY itemid LIMIT 0,{$num}");
if ($db->affected_rows($result)) {
while ($r = $db->fetch_array($result)) {
$itemid = $r['itemid'];
$do->update($itemid);
}
$itemid += 1;
} else {
$itemid = $fid + $num;
}
} else {
dmsg('更新成功', "?moduleid={$moduleid}&file={$file}");
}
msg('ID从' . $fid . '至' . ($itemid - 1) . '更新成功' . progress($sid, $fid, $tid), "?moduleid={$moduleid}&file={$file}&action={$action}&sid={$sid}&fid={$itemid}&tid={$tid}&num={$num}");
break;
case 'recycle':
$lists = $do->get_list('status=0' . $condition, $dorder[$order]);
include tpl('news_recycle', $module);
break;
case 'check':
示例2: convert
//.........这里部分代码省略.........
break;
case 'Summary':
$module->view = 'showall_summary';
break;
default:
$module->view = 'showall';
break;
}
//check to see if it's already pulled in (circumvent !is_original)
$ploc = $iloc;
$ploc->mod = "news";
if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
$iloc->mod = 'newsmodule';
$linked = true;
break;
}
$iloc->mod = 'newsmodule';
$newsitems = $old_db->selectArrays('newsitem', "location_data='" . serialize($iloc) . "'");
$oldconfig = $old_db->selectObject('newsmodule_config', "location_data='" . serialize($iloc) . "'");
if ($newsitems) {
$files_attached = false;
foreach ($newsitems as $ni) {
unset($ni['id']);
$news = new news($ni);
$loc = expUnserialize($ni['location_data']);
$loc->mod = "news";
$news->location_data = serialize($loc);
$news->title = !empty($ni['title']) ? $ni['title'] : gt('Untitled');
$news->body = !empty($ni['body']) ? $ni['body'] : gt('(empty)');
$news->save();
// default is to create with current time
$news->created_at = $ni['posted'];
$news->edited_at = $ni['edited'];
$news->update();
@$this->msg['migrated'][$iloc->mod]['count']++;
@($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
if (!empty($ni['file_id'])) {
$file = new expFile($ni['file_id']);
$news->attachitem($file, '');
$files_attached = true;
}
}
$newconfig = new expConfig();
if ($files_attached) {
// fudge a config to get attached files to appear
$newconfig->config = 'a:14:{s:9:"feedmaker";s:0:"";s:11:"filedisplay";s:7:"Gallery";s:6:"ffloat";s:4:"Left";s:6:"fwidth";s:3:"120";s:7:"fmargin";s:1:"5";s:7:"piwidth";s:3:"100";s:5:"thumb";s:3:"100";s:7:"spacing";s:2:"10";s:10:"floatthumb";s:8:"No Float";s:6:"tclass";s:0:"";s:5:"limit";s:0:"";s:9:"pagelinks";s:14:"Top and Bottom";s:10:"feed_title";s:0:"";s:9:"feed_desc";s:0:"";}';
}
if ($oldconfig->enable_rss == 1) {
if ($newconfig->config != null) {
$config = expUnserialize($newconfig->config);
}
$config['enable_rss'] = true;
$config['feed_title'] = $oldconfig->feed_title;
$config['feed_desc'] = $oldconfig->feed_desc;
$config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
$config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
$newconfig->config = $config;
$newrss = new expRss();
$newrss->module = $loc->mod;
$newrss->src = $loc->src;
$newrss->enable_rss = $oldconfig->enable_rss;
$newrss->feed_title = $oldconfig->feed_title;
$newrss->feed_desc = $oldconfig->feed_desc;
$newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
$newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
$newrss->save();