/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2006 The Nucleus Group
+ * Copyright (C) 2002-2010 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Actions that can be called via action.php
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: ACTION.php,v 1.6 2007-01-31 10:02:58 kimitake Exp $
- * $NucleusJP: ACTION.php,v 1.5 2006/07/17 20:03:44 kimitake Exp $
+ * @copyright Copyright (C) 2002-2010 The Nucleus Group
+ * @version $Id$
+ * $NucleusJP: ACTION.php,v 1.10 2007/05/31 07:23:39 kimitake Exp $
*/
class ACTION
{
+ /**
+ * Constructor for an new ACTION object
+ */
function ACTION()
{
-
+ // do nothing
}
+ /**
+ * Calls functions that handle an action called from action.php
+ */
function doAction($action)
{
switch($action) {
}
}
+ /**
+ * Adds a new comment to an item (if IP isn't banned)
+ */
function addComment() {
global $CONF, $errormessage, $manager;
- $post['itemid'] = intPostVar('itemid');
- $post['user'] = postVar('user');
- $post['userid'] = postVar('userid');
+ $post['itemid'] = intPostVar('itemid');
+ $post['user'] = postVar('user');
+ $post['userid'] = postVar('userid');
$post['email'] = postVar('email');
- $post['body'] = postVar('body');
+ $post['body'] = postVar('body');
// set cookies when required
$remember = intPostVar('remember');
exit;
}
- // Sends a message from the current member to the member given as argument
+ /**
+ * Sends a message from the current member to the member given as argument
+ */
function sendMessage() {
global $CONF, $member;
}
redirect($url);
}
-
exit;
-
}
+ /**
+ * Checks if a mail to a member is allowed
+ * Returns a string with the error message if the mail is disallowed
+ */
function validateMessage() {
global $CONF, $member, $manager;
}
- // creates a new user account
+ /**
+ * Creates a new user account
+ */
function createAccount() {
global $CONF, $manager;
if (!$CONF['AllowMemberCreate'])
doError(_ERROR_MEMBERCREATEDISABLED);
- // even though the member can not log in, set some random initial password. One never knows.
- srand((double)microtime()*1000000);
- $initialPwd = md5(uniqid(rand(), true));
+ // evaluate content from FormExtra
+ $result = 1;
+ $data = array('type' => 'membermail', 'error' => &$result);
+ $manager->notify('ValidateForm', &$data);
- // create member (non admin/can not login/no notes/random string as password)
- $r = MEMBER::create(postVar('name'), postVar('realname'), $initialPwd, postVar('email'), postVar('url'), 0, 0, '');
+ if ($result!=1) {
+ return $result;
+ }
+ else {
- if ($r != 1)
- doError($r);
+ // even though the member can not log in, set some random initial password. One never knows.
+ srand((double)microtime()*1000000);
+ $initialPwd = md5(uniqid(rand(), true));
- // send message containing password.
- $newmem = new MEMBER();
- $newmem->readFromName(postVar('name'));
- $newmem->sendActivationLink('register');
+ // create member (non admin/can not login/no notes/random string as password)
+ $name = shorten(postVar('name'), 32, '');
+ $r = MEMBER::create($name, postVar('realname'), $initialPwd, postVar('email'), postVar('url'), 0, 0, '');
- $manager->notify('PostRegister',array('member' => &$newmem));
+ if ($r != 1) {
+ return $r;
+ }
- if (postVar('desturl')) {
- redirect(postVar('desturl'));
- } else {
- header ("Content-Type: text/html; charset="._CHARSET);
- echo _MSG_ACTIVATION_SENT;
- }
+ // send message containing password.
+ $newmem = new MEMBER();
+ $newmem->readFromName($name);
+ $newmem->sendActivationLink('register');
- exit;
+ $manager->notify('PostRegister',array('member' => &$newmem));
+
+ if (postVar('desturl')) {
+ redirect(postVar('desturl'));
+ } else {
+ // header has been already sent, so deleted the line below
+ //header ("Content-Type: text/html; charset="._CHARSET);
+ echo _MSG_ACTIVATION_SENT;
+ echo '<br /><br />Return to <a href="'.$CONF['IndexURL'].'" title="'.$CONF['SiteName'].'">'.$CONF['SiteName'].'</a>';
+ echo "\n</body>\n</html>";
+ }
+ exit;
+ }
}
- // sends a new password
+ /**
+ * Sends a new password
+ */
function forgotPassword() {
$membername = trim(postVar('name'));
doError(_ERROR_NOSUCHMEMBER);
$mem = MEMBER::createFromName($membername);
- if (!$mem->canLogin())
- doError(_ERROR_NOLOGON_NOACTIVATE);
+ /* below keeps regular users from resetting passwords using forgot password feature
+ Removing for now until clear why it is required.*/
+ /*if (!$mem->canLogin())
+ doError(_ERROR_NOLOGON_NOACTIVATE);*/
// check if e-mail address is correct
if (!($mem->getEmail() == postVar('email')))
} else {
header ("Content-Type: text/html; charset="._CHARSET);
echo _MSG_ACTIVATION_SENT;
+ echo '<br /><br />Return to <a href="'.$CONF['IndexURL'].'" title="'.$CONF['SiteName'].'">'.$CONF['SiteName'].'</a>';
}
-
exit;
}
- // handle karma votes
+ /**
+ * Handle karma votes
+ */
function doKarma($type) {
global $itemid, $member, $CONF, $manager;
break;
}
- $blogid = getBlogIDFromItemID($itemid);
+// $blogid = getBlogIDFromItemID($itemid);
$blog =& $manager->getBlog($blogid);
// send email to notification address, if any
if ($blog->getNotifyAddress() && $blog->notifyOnVote()) {
$mailto_msg = _NOTIFY_KV_MSG . ' ' . $itemid . "\n";
- $mailto_msg .= $CONF['IndexURL'] . 'index.php?itemid=' . $itemid . "\n\n";
+ $itemLink = createItemLink(intval($itemid));
+ $temp = parse_url($itemLink);
+ if (!$temp['scheme']) {
+ $itemLink = $CONF['IndexURL'] . $itemLink;
+ }
+ $mailto_msg .= $itemLink . "\n\n";
if ($member->isLoggedIn()) {
$mailto_msg .= _NOTIFY_MEMBER . ' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";
}
$refererUrl = serverVar('HTTP_REFERER');
- if ($refererUrl)
+ if ($refererUrl) {
$url = $refererUrl;
- else
- $url = $CONF['IndexURL'] . 'index.php?itemid=' . $itemid;
+ } else {
+// $url = $CONF['IndexURL'] . 'index.php?itemid=' . $itemid;
+ $url = $itemLink;
+ }
redirect($url);
exit;
}
+ /**
+ * Checks if an IP or IP range is banned
+ */
function checkban($blogid) {
// check if banned
$ban = BAN::isBanned($blogid, serverVar('REMOTE_ADDR'));
echo $manager->getNewTicket();
}
else {
- echo 'err:' . _ERROR_BADTICKET;
+ echo _ERROR . ':' . _ERROR_BADTICKET;
}
return false;
}
global $manager;
if ($manager->checkTicket()) {
$manager->loadClass('ITEM');
- $info = ITEM::CreateDraftFromRequest();
+ $info = ITEM::createDraftFromRequest();
if ($info['status'] == 'error') {
echo $info['message'];
}
}
}
else {
- echo 'err:' . _ERROR_BADTICKET;
+ echo _ERROR . ':' . _ERROR_BADTICKET;
}
return false;
}
-
-
}
-
?>
\ No newline at end of file