if (isset($_POST['id'])) {
    $article = $db->selectObject('article', 'id=' . $_POST['id']);
    if ($article != null) {
        $loc = unserialize($article->location_data);
    }
} else {
    $article->rank = $db->max('article', 'rank', 'location_data', "location_data='" . serialize($loc) . "'");
    if ($article->rank == null) {
        $article->rank = 0;
    } else {
        $article->rank += 1;
    }
}
if (pathos_permissions_check("manage", $loc)) {
    $oldcatid = $article->category_id;
    $article = article::update($_POST, $article);
    $article->location_data = serialize($loc);
    if (isset($_POST['categories'])) {
        $article->category_id = $_POST['categories'];
    }
    if (isset($article->id)) {
        $article->id = $db->updateObject($article, "article");
    } else {
        $article->id = $db->insertObject($article, "article");
    }
    articlemodule::spiderContent($article);
    if ($oldcatid != $article->category_id) {
        $db->decrement('article', 'rank', 1, "location_data='" . serialize($loc) . "' AND rank > " . $article->rank . " AND category_id=" . $article->category_id);
    }
    pathos_flow_redirect();
} else {
Beispiel #2
0
         if ($tocatid) {
             $db->query("UPDATE {$table} SET catid={$tocatid} WHERE `{$fromtype}` IN ({$fromids})");
             dmsg('移动成功', $forward);
         } else {
             msg('请选择目标分类');
         }
     } else {
         $itemid = $itemid ? implode(',', $itemid) : '';
         $menuid = 5;
         include tpl($action, $module);
     }
     break;
 case 'update':
     is_array($itemid) or msg('请选择' . $MOD['name']);
     foreach ($itemid as $v) {
         $do->update($v);
     }
     dmsg('更新成功', $forward);
     break;
 case 'tohtml':
     is_array($itemid) or msg('请选择' . $MOD['name']);
     $html_itemids = $itemid;
     foreach ($html_itemids as $itemid) {
         tohtml('show', $module);
     }
     dmsg('更新成功', $forward);
     break;
 case 'delete':
     $itemid or msg('请选择' . $MOD['name']);
     isset($recycle) ? $do->recycle($itemid) : $do->delete($itemid);
     dmsg('删除成功', $forward);
Beispiel #3
0
 isset($sid) or $sid = $fid;
 if (!isset($tid)) {
     $r = $db->get_one("SELECT max(itemid) AS tid FROM {$table} WHERE status>2 AND islink=0 {$sql}");
     $tid = $r['tid'] ? $r['tid'] : 0;
 }
 if ($update) {
     require MD_ROOT . '/article.class.php';
     $do = new article($moduleid);
 }
 isset($num) or $num = 100;
 if ($fid <= $tid) {
     $result = $db->query("SELECT itemid FROM {$table} WHERE status>2 AND islink=0 AND itemid>={$fid} {$sql} ORDER BY itemid LIMIT 0,{$num} ");
     if ($db->affected_rows($result)) {
         while ($r = $db->fetch_array($result)) {
             $itemid = $r['itemid'];
             $update ? $do->update($itemid) : tohtml('show', $module);
         }
         $itemid += 1;
     } else {
         $itemid = $fid + $num;
     }
 } else {
     if ($update) {
         $all ? msg('', '?moduleid=' . $moduleid . '&file=' . $file . '&action=index&all=1&one=' . $one) : dmsg('更新成功', $this_forward);
     } else {
         if ($one) {
             dheader('?file=html&action=back&mid=' . $moduleid);
         }
         $all ? msg($MOD['name'] . '生成成功', $this_forward) : dmsg($MOD['name'] . '生成成功', $this_forward);
     }
 }
Beispiel #4
0
<?php 
    } else {
        $article = new article();
        $article->setId(intval($_REQUEST['i']));
        if (isset($_REQUEST['published'])) {
            $_REQUEST['published'] = true;
        } else {
            $_REQUEST['published'] = false;
        }
        if (isset($_REQUEST['onhome'])) {
            $_REQUEST['onhome'] = true;
        } else {
            $_REQUEST['onhome'] = false;
        }
        $article->setContent($_REQUEST['title_1'], $_REQUEST['content_1'], $_REQUEST['title_2'], $_REQUEST['content_2'], $_REQUEST['title_3'], $_REQUEST['content_3'], $_REQUEST['title_4'], $_REQUEST['content_4'], $_REQUEST['title_5'], $_REQUEST['content_5'], $_REQUEST['title_6'], $_REQUEST['content_6'], $_REQUEST['code']);
        $article->setCategory($_REQUEST['category']);
        $article->setDateUpdate();
        $article->setPublished($_REQUEST['published']);
        $article->setonHome($_REQUEST['onhome']);
        if ($article->update()) {
            print 'sucess';
        } else {
            print 'failure';
        }
    }
} else {
    print 'error';
}
?>
</div>