/** * debug center start * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Modules * @author Henry Ruhs */ function debug_center_start() { /* collect output */ if (FIRST_PARAMETER == 'debug') { $error_log = file_get_contents('logs/error.log'); file_put_contents('logs/error.log', ''); /* if error log */ if ($error_log) { $output = '<div class="box_note note_warning">' . break_up($error_log) . '</div>'; } else { $output = '<div class="box_note note_error">' . l('file_permission_grant') . l('colon') . ' logs/error.log' . l('point') . '</div>'; } echo $output; } }
/** * comment post * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Comments * @author Henry Ruhs */ function comment_post() { $emailValidator = new Redaxscript\Validator\Email(); $captchaValidator = new Redaxscript\Validator\Captcha(); $urlValidator = new Redaxscript\Validator\Url(); /* clean post */ if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/comment'] == 'visited') { $author = $r['author'] = clean($_POST['author'], 0); $email = $r['email'] = clean($_POST['email'], 3); $url = $r['url'] = clean($_POST['url'], 4); $text = break_up($_POST['text']); $text = $r['text'] = clean($text, 1); $r['language'] = clean($_POST['language'], 0); $r['date'] = clean($_POST['date'], 5); $article = $r['article'] = clean($_POST['article'], 0); $r['rank'] = Redaxscript\Db::forTablePrefix('comments')->max('rank') + 1; $r['access'] = Redaxscript\Db::forTablePrefix('articles')->whereIdIs($article)->access; if ($r['access'] == '') { $r['access'] = null; } $task = $_POST['task']; $solution = $_POST['solution']; $route = build_route('articles', $article); } /* validate post */ if ($author == '') { $error = l('author_empty'); } else { if ($email == '') { $error = l('email_empty'); } else { if ($text == '') { $error = l('comment_empty'); } else { if ($emailValidator->validate($email) == Redaxscript\Validator\ValidatorInterface::FAILED) { $error = l('email_incorrect'); } else { if ($url && $urlValidator->validate($url) == Redaxscript\Validator\ValidatorInterface::FAILED) { $error = l('url_incorrect'); } else { if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\ValidatorInterface::FAILED) { $error = l('captcha_incorrect'); } else { if (COMMENTS_NEW == 0 && s('moderation') == 1) { $r['status'] = 0; $success = l('comment_moderation'); } else { $r['status'] = 1; $success = l('comment_sent'); } /* send comment notification */ if (s('notification') == 1) { /* prepare body parts */ $emailLink = anchor_element('email', '', '', $email); if ($url) { $urlLink = anchor_element('external', '', '', $url); } $articleRoute = ROOT . '/' . REWRITE_ROUTE . $route; $articleLink = anchor_element('external', '', '', $articleRoute, $articleRoute); /* prepare mail inputs */ $toArray = array(s('author') => s('email')); $fromArray = array($author => $email); $subject = l('comment_new'); $bodyArray = array('<strong>' . l('author') . l('colon') . '</strong> ' . $author, '<br />', '<strong>' . l('email') . l('colon') . '</strong> ' . $emailLink, '<br />', '<strong>' . l('url') . l('colon') . '</strong> ' . $urlLink, '<br />', '<strong>' . l('article') . l('colon') . '</strong> ' . $articleLink, '<br />', '<br />', '<strong>' . l('comment') . l('colon') . '</strong> ' . $text); /* mailer object */ $mailer = new Redaxscript\Mailer(); $mailer->init($toArray, $fromArray, $subject, $bodyArray); $mailer->send(); } /* create comment */ Redaxscript\Db::forTablePrefix('comments')->create()->set($r)->save(); } } } } } } /* handle error */ if ($error) { if (s('blocker') == 1) { $_SESSION[ROOT . '/attack_blocked']++; } notification(l('error_occurred'), $error, l('back'), $route); } else { notification(l('operation_completed'), $success, l('continue'), $route); } $_SESSION[ROOT . '/comment'] = ''; }
/** * contact post * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Modules * @author Henry Ruhs */ function contact_post() { $emailValidator = new Redaxscript\Validator\Email(); $captchaValidator = new Redaxscript\Validator\Captcha(); $urlValidator = new Redaxscript\Validator\Url(); /* clean post */ if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/contact'] == 'visited') { $author = clean($_POST['author'], 0); $email = clean($_POST['email'], 3); $url = clean($_POST['url'], 4); $text = break_up($_POST['text']); $text = clean($text, 1); $task = $_POST['task']; $solution = $_POST['solution']; } /* validate post */ if ($author == '') { $error = l('author_empty'); } else { if ($email == '') { $error = l('email_empty'); } else { if ($text == '') { $error = l('message_empty'); } else { if ($emailValidator->validate($email) == Redaxscript\Validator\ValidatorInterface::FAILED) { $error = l('email_incorrect'); } else { if ($url && $urlValidator->validate($url) == Redaxscript\Validator\ValidatorInterface::FAILED) { $error = l('url_incorrect'); } else { if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\ValidatorInterface::FAILED) { $error = l('captcha_incorrect'); } else { /* prepare body parts */ $emailLink = anchor_element('email', '', '', $email, $email); if ($url) { $urlLink = anchor_element('external', '', '', $url, $url); } /* prepare mail inputs */ $toArray = array(s('author') => s('email')); $fromArray = array($author => $email); $subject = l('contact'); $bodyArray = array('<strong>' . l('author') . l('colon') . '</strong> ' . $author, '<br />', '<strong>' . l('email') . l('colon') . '</strong> ' . $emailLink, '<br />', '<strong>' . l('url') . l('colon') . '</strong> ' . $urlLink, '<br />', '<br />', '<strong>' . l('message') . l('colon') . '</strong> ' . $text); /* mailer object */ $mailer = new Redaxscript\Mailer(); $mailer->init($toArray, $fromArray, $subject, $bodyArray); $mailer->send(); } } } } } } /* handle error */ if ($error) { if (s('blocker') == 1) { $_SESSION[ROOT . '/attack_blocked']++; } notification(l('error_occurred'), $error, l('home'), ROOT); } else { notification(l('operation_completed'), l('message_sent', '_contact'), l('home'), ROOT); } $_SESSION[ROOT . '/contact'] = ''; }
/** * comment post * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Comments * @author Henry Ruhs */ function comment_post() { $emailValidator = new Redaxscript\Validator\Email(); $captchaValidator = new Redaxscript\Validator\Captcha(); $urlValidator = new Redaxscript\Validator\Url(); /* clean post */ if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/comment'] == 'visited') { $author = $r['author'] = clean($_POST['author'], 0); $email = $r['email'] = clean($_POST['email'], 3); $url = $r['url'] = clean($_POST['url'], 4); $text = break_up($_POST['text']); $text = $r['text'] = clean($text, 1); $r['language'] = clean($_POST['language'], 0); $r['date'] = clean($_POST['date'], 1); $article = $r['article'] = clean($_POST['article'], 0); $r['rank'] = query_plumb('rank', 'comments', 'max') + 1; $r['access'] = clean($_POST['access'], 0); if ($r['access'] == '') { $r['access'] = 0; } $task = $_POST['task']; $solution = $_POST['solution']; $route = build_route('articles', $article); } /* validate post */ if ($author == '') { $error = l('author_empty'); } else { if ($email == '') { $error = l('email_empty'); } else { if ($text == '') { $error = l('comment_empty'); } else { if ($emailValidator->validate($email) == Redaxscript\Validator\Validator::FAILED) { $error = l('email_incorrect'); } else { if ($url && $urlValidator->validate($url) == Redaxscript\Validator\Validator::FAILED) { $error = l('url_incorrect'); } else { if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\Validator::FAILED) { $error = l('captcha_incorrect'); } else { if (COMMENTS_NEW == 0 && s('moderation') == 1) { $r['status'] = 0; $success = l('comment_moderation'); } else { $r['status'] = 1; $success = l('comment_sent'); } /* send comment notification */ if (s('notification') == 1) { /* prepare body parts */ $emailLink = anchor_element('email', '', '', $email); if ($url) { $urlLink = anchor_element('external', '', '', $url); } $articleRoute = ROOT . '/' . REWRITE_ROUTE . $route; $articleLink = anchor_element('external', '', '', $articleRoute, $articleRoute); /* prepare mail inputs */ $toArray = array(s('author') => s('email')); $fromArray = array($author => $email); $subject = l('comment_new'); $bodyArray = array('<strong>' . l('author') . l('colon') . '</strong> ' . $author . ' (' . MY_IP . ')', '<strong>' . l('email') . l('colon') . '</strong> ' . $emailLink, '<strong>' . l('url') . l('colon') . '</strong> ' . $urlLink, '<br />', '<strong>' . l('comment') . l('colon') . '</strong> ' . $text, '<br />', '<strong>' . l('article') . l('colon') . '</strong> ' . $articleLink); /* mailer object */ $mailer = new Redaxscript\Mailer($toArray, $fromArray, $subject, $bodyArray); $mailer->send(); } /* build key and value strings */ $r_keys = array_keys($r); $last = end($r_keys); foreach ($r as $key => $value) { $key_string .= $key; $value_string .= '\'' . $value . '\''; if ($last != $key) { $key_string .= ', '; $value_string .= ', '; } } /* insert comment */ $query = 'INSERT INTO ' . PREFIX . 'comments (' . $key_string . ') VALUES (' . $value_string . ')'; mysql_query($query); } } } } } } /* handle error */ if ($error) { if (s('blocker') == 1) { $_SESSION[ROOT . '/attack_blocked']++; } notification(l('error_occurred'), $error, l('back'), $route); } else { notification(l('operation_completed'), $success, l('continue'), $route); } $_SESSION[ROOT . '/comment'] = ''; }