예제 #1
0
	    	if (empty($storyid)) {
				$approve = 1;
			} else {
				$approve = isset($_POST['approve']) ? intval($_POST['approve']) : 0;
			}
			if($approve) {
	    		$story->setPublished(time());
    		} else {
				$story->setPublished(0);
			}
    		$story->setExpired(0);
			$story->setTopicalign('R');
		} else {
		    $approve = 0;
		}
		$story->setApproved($approve);

		if($approve) {
			nw_updateCache();
		}

		// Increment author's posts count (only if it's a new article)
		// First case, it's not an anonyous, the story is approved and it's a new story
		if($uid && $approve && empty($storyid)) {
			$tmpuser = new xoopsUser($uid);
        	$member_handler =& xoops_gethandler('member');
        	$member_handler->updateUserByField($tmpuser, 'posts', $tmpuser->getVar('posts') + 1);
		}

		// Second case, it's not an anonymous, the story is NOT approved and it's NOT a new story (typical when someone is approving a submited story)
		if(is_object($xoopsUser) && $approve && !empty($storyid)) {