本文整理汇总了PHP中anchor_element函数的典型用法代码示例。如果您正苦于以下问题:PHP anchor_element函数的具体用法?PHP anchor_element怎么用?PHP anchor_element使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了anchor_element函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reminder_post
/**
* reminder post
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Reminder
* @author Henry Ruhs
*/
function reminder_post()
{
$emailValidator = new Redaxscript\Validator\Email();
$captchaValidator = new Redaxscript\Validator\Captcha();
/* clean post */
if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/reminder'] == 'visited') {
$email = clean($_POST['email'], 3);
$task = $_POST['task'];
$solution = $_POST['solution'];
}
/* validate post */
if ($email == '') {
$error = l('email_empty');
} else {
if ($emailValidator->validate($email) == Redaxscript\Validator\Validator::FAILED) {
$error = l('email_incorrect');
} else {
if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\Validator::FAILED) {
$error = l('captcha_incorrect');
} else {
if (retrieve('id', 'users', 'email', $email) == '') {
$error = l('email_unknown');
} else {
/* query users */
$query = 'SELECT id, user, password FROM ' . PREFIX . 'users WHERE email = \'' . $email . '\' && status = 1';
$result = mysql_query($query);
if ($result) {
while ($r = mysql_fetch_assoc($result)) {
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
/* send reminder information */
$passwordResetRoute = ROOT . '/' . REWRITE_ROUTE . 'password_reset/' . $id . '/' . $password;
$passwordResetLink = anchor_element('external', '', '', $passwordResetRoute, $passwordResetRoute);
$toArray = array(s('author') => s('email'));
$fromArray = array($name => $email);
$subject = l('reminder');
$bodyArray = array('<strong>' . l('user') . l('colon') . '</strong> ' . $user, '<br />', '<strong>' . l('password_reset') . l('colon') . '</strong> ' . $passwordResetLink);
/* mailer object */
$mailer = new Redaxscript\Mailer($toArray, $fromArray, $subject, $bodyArray);
$mailer->send();
}
}
}
}
}
}
/* handle error */
if ($error) {
if (s('blocker') == 1) {
$_SESSION[ROOT . '/attack_blocked']++;
}
notification(l('error_occurred'), $error, l('back'), 'reminder');
} else {
notification(l('operation_completed'), l('reminder_sent'), l('login'), 'login');
}
$_SESSION[ROOT . '/reminder'] = '';
}
示例2: reminder_post
/**
* reminder post
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Reminder
* @author Henry Ruhs
*/
function reminder_post()
{
$emailValidator = new Redaxscript\Validator\Email();
$captchaValidator = new Redaxscript\Validator\Captcha();
/* clean post */
if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/reminder'] == 'visited') {
$email = clean($_POST['email'], 3);
$task = $_POST['task'];
$solution = $_POST['solution'];
}
/* validate post */
if ($email == '') {
$error = l('email_empty');
} else {
if ($emailValidator->validate($email) == Redaxscript\Validator\ValidatorInterface::FAILED) {
$error = l('email_incorrect');
} else {
if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\ValidatorInterface::FAILED) {
$error = l('captcha_incorrect');
} else {
if (Redaxscript\Db::forTablePrefix('users')->where('email', $email)->findOne()->id == '') {
$error = l('email_unknown');
} else {
/* query users */
$result = Redaxscript\Db::forTablePrefix('users')->where(array('email' => $email, 'status' => 1))->findArray();
if ($result) {
foreach ($result as $r) {
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
/* send reminder information */
$passwordResetRoute = ROOT . '/' . REWRITE_ROUTE . 'password_reset/' . $id . '/' . $password;
$passwordResetLink = anchor_element('external', '', '', $passwordResetRoute, $passwordResetRoute);
$toArray = array(s('author') => s('email'));
$fromArray = array($name => $email);
$subject = l('reminder');
$bodyArray = array('<strong>' . l('user') . l('colon') . '</strong> ' . $user, '<br />', '<strong>' . l('password_reset') . l('colon') . '</strong> ' . $passwordResetLink);
/* 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('back'), 'reminder');
} else {
notification(l('operation_completed'), l('reminder_sent'), l('login'), 'login');
}
$_SESSION[ROOT . '/reminder'] = '';
}
示例3: db_backup_admin_panel_list_modules
/**
* db backup admin panel panel list modules
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*
* @return string
*/
function db_backup_admin_panel_list_modules()
{
$output = '<li>' . anchor_element('internal', '', '', l('database_backup', 'db_backup')) . '<ul class="js_list_panel_children_admin list_panel_children_admin">';
$output .= '<li>' . anchor_element('internal', '', '', l('download', 'db_backup'), 'admin/db-backup/download') . '</li>';
$output .= '<li>' . anchor_element('internal', '', '', l('send_email', 'db_backup'), 'admin/db-backup/send') . '</li>';
$output .= '</ul></li>';
return $output;
}
示例4: share_this
/**
* share this
*
* @since 2.0.2
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*
* @return string
*/
function share_this($route = '')
{
$code = 'target="_blank" rel="nofollow"';
$networks = array('facebook' => array('url' => 'http://facebook.com/sharer.php?u='), 'googleplusone' => array('url' => 'http://plusone.google.com/_/+1/confirm?url='), 'twitter' => array('url' => 'http://twitter.com/share?url=', 'code' => ' data-height="340"'), 'pinterest' => array('url' => 'http://pinterest.com/pin/create/button/?url='), 'linkedin' => array('url' => 'http://linkedin.com/shareArticle?url=', 'code' => ' data-height="490" data-width="850"'), 'stumbleupon' => array('url' => 'http://stumbleupon.com/submit?url='), 'delicious' => array('url' => 'http://del.icio.us/post?url=', 'code' => ' data-height="580"'));
/* collect output */
if ($route) {
$output = '<ul class="list_share_this clearfix">';
/* handle each network */
foreach ($networks as $key => $value) {
$output .= '<li>' . anchor_element('external', '', 'js_link_share_this link_share_this link_' . $key, ucfirst($key), $value['url'] . $route, '', $code . ' data-type="' . $key . '"' . $value['code']) . '</li>';
}
$output .= '</ul>';
return $output;
}
}
示例5: recent_view
/**
* recent view
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*
* @param integer $limit
* @return string
*/
function recent_view($limit = '')
{
$recent_view_log = recent_view_logger();
if ($recent_view_log) {
$output = '<ul class="list_recent_view">';
foreach ($recent_view_log as $value) {
/* break if limit reached */
if (++$counter > $limit && $limit) {
break;
}
$output .= '<li>' . anchor_element('internal', '', '', $value, $value) . '</li>';
}
$output .= '</ul>';
}
return $output;
}
示例6: feed_list
/**
* feed list
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*/
function feed_list()
{
$articles_total = query_total('articles', 'access', 0);
$comments_total = query_total('comments', 'access', 0);
/* collect output */
if ($articles_total > 0) {
$output = '<li>' . anchor_element('internal', '', '', l('feed_articles', 'feed_generator'), 'feed/articles', '', 'rel="nofollow"') . '</li>';
}
if ($comments_total > 0) {
$output .= '<li>' . anchor_element('internal', '', '', l('feed_comments', 'feed_generator'), 'feed/comments', '', 'rel="nofollow"') . '</li>';
}
if ($articles_total > 0 || $comments_total > 0) {
$output = '<ul class="list_feed">' . $output . '</ul>';
}
echo $output;
}
示例7: login_form
/**
* login form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Login
* @author Henry Ruhs
*/
function login_form()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* disable fields if attack blocked */
if (ATTACK_BLOCKED > 9) {
$code_disabled = ' disabled="disabled"';
}
/* captcha object */
if (s('captcha') > 0) {
$captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
$captcha->init();
}
/* reminder question */
if (s('reminder') == 1) {
$legend = anchor_element('internal', '', 'link_legend', l('reminder_question') . l('question_mark'), 'reminder', '', 'rel="nofollow"');
} else {
$legend = l('fields_limited') . l('point');
}
/* collect output */
$output .= '<h2 class="title_content">' . l('login') . '</h2>';
$output .= form_element('form', 'form_login', 'js_validate_form form_default form_login', '', '', '', 'action="' . REWRITE_ROUTE . 'login" method="post"');
$output .= form_element('fieldset', '', 'set_login', '', '', $legend) . '<ul>';
$output .= '<li>' . form_element('text', 'user', 'field_text field_note', 'user', '', l('user'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_disabled) . '</li>';
$output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text field_note', 'password', '', l('password'), 'maxlength="50" required="required" autocomplete="off"' . $code_disabled) . '</li>';
/* collect captcha task output */
if (LOGGED_IN != TOKEN && s('captcha') > 0) {
$output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>';
}
$output .= '</ul></fieldset>';
/* collect captcha solution output */
if (s('captcha') > 0) {
$captchaHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
$captchaHash->init($captcha->getSolution());
if (LOGGED_IN == TOKEN) {
$output .= form_element('hidden', '', '', 'task', $captchaHash->getRaw());
}
$output .= form_element('hidden', '', '', 'solution', $captchaHash->getHash());
}
/* collect hidden and button output */
$output .= form_element('hidden', '', '', 'token', TOKEN);
$output .= form_element('button', '', 'js_submit button_default', 'login_post', l('submit'), '', $code_disabled);
$output .= '</form>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
$_SESSION[ROOT . '/login'] = 'visited';
echo $output;
}
示例8: install
/**
* install
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Install
* @author Henry Ruhs
*/
function install()
{
global $name, $user, $password, $email;
/* installer */
$installer = new Redaxscript\Installer();
$installer->init(Redaxscript\Config::getInstance());
$installer->rawDrop();
$installer->rawCreate();
$installer->insertData(array('adminName' => $name, 'adminUser' => $user, 'adminPassword' => $password, 'adminEmail' => $email));
/* send login information */
$urlLink = anchor_element('external', '', '', ROOT, ROOT);
$toArray = $fromArray = array($name => $email);
$subject = l('installation');
$bodyArray = array('<strong>' . l('user') . l('colon') . '</strong> ' . $user, '<br />', '<strong>' . l('password') . l('colon') . '</strong> ' . $password, '<br />', '<strong>' . l('url') . l('colon') . '</strong> ' . $urlLink);
/* mailer object */
$mailer = new Redaxscript\Mailer();
$mailer->init($toArray, $fromArray, $subject, $bodyArray);
$mailer->send();
}
示例9: notification
/**
* notification
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Contents
* @author Henry Ruhs
*
* @param string $title
* @param string $text
* @param string $action
* @param string $route
*/
function notification($title = '', $text = '', $action = '', $route = '')
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* detect needed mode */
if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin') {
$suffix = '_admin';
} else {
$suffix = '_default';
}
/* collect output */
if ($title) {
$output .= '<h2 class="title_content title_notification">' . $title . '</h2>';
}
$output .= '<div class="box_content box_notification">';
/* collect text output */
if (is_string($text)) {
$text = array($text);
}
foreach ($text as $value) {
if ($value) {
$output .= '<p class="text_notification">' . $value . l('point') . '</p>';
}
}
/* collect button output */
if ($action && $route) {
$output .= anchor_element('internal', '', 'js_forward_notification button' . $suffix, $action, $route);
}
$output .= '</div>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
echo $output;
}
示例10: admin_users_form
/**
* admin users form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Admin
* @author Henry Ruhs
*/
function admin_users_form()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* define fields for existing user */
if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
/* query user */
$result = Redaxscript\Db::forTablePrefix('users')->where('id', ID_PARAMETER)->findArray();
$r = $result[0];
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
$wording_headline = $name;
$wording_submit = l('save');
$route = 'admin/process/users/' . $id;
} else {
if (ADMIN_PARAMETER == 'new') {
$status = 1;
$groups = 0;
$wording_headline = l('user_new');
$wording_submit = l('create');
$route = 'admin/process/users';
$code_required = ' required="required"';
}
}
/* collect output */
$output .= '<h2 class="title_content">' . $wording_headline . '</h2>';
$output .= form_element('form', 'form_admin', 'js_validate_form js_tab form_admin hidden_legend', '', '', '', 'action="' . REWRITE_ROUTE . $route . '" method="post"');
/* collect tab list output */
$output .= '<ul class="js_list_tab list_tab list_tab_admin">';
$output .= '<li class="js_item_active item_first item_active">' . anchor_element('internal', '', '', l('user'), FULL_ROUTE . '#tab-1') . '</li>';
$output .= '<li class="item_second">' . anchor_element('internal', '', '', l('customize'), FULL_ROUTE . '#tab-2') . '</li></ul>';
/* collect tab box output */
$output .= '<div class="js_box_tab box_tab box_tab_admin">';
/* collect user set */
$output .= form_element('fieldset', 'tab-1', 'js_set_tab js_set_active set_tab set_tab_admin set_active', '', '', l('user')) . '<ul>';
$output .= '<li>' . form_element('text', 'name', 'field_text_admin field_note', 'name', $name, l('name'), 'maxlength="50" required="required" autofocus="autofocus"') . '</li>';
if ($id == '') {
$output .= '<li>' . form_element('text', 'user', 'field_text_admin field_note', 'user', $user, l('user'), 'maxlength="50" required="required"') . '</li>';
}
$output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text_admin field_note', 'password', '', l('password'), 'maxlength="50" autocomplete="off"' . $code_required) . '</li>';
$output .= '<li>' . form_element('password', 'password_confirm', 'js_unmask_password field_text_admin field_note', 'password_confirm', '', l('password_confirm'), 'maxlength="50" autocomplete="off"' . $code_required) . '</li>';
$output .= '<li>' . form_element('email', 'email', 'field_text_admin field_note', 'email', $email, l('email'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small', 'description', $description, l('description'), 'rows="1" cols="15"') . '</li>';
$output .= '</ul></fieldset>';
/* collect customize set */
$output .= form_element('fieldset', 'tab-2', 'js_set_tab set_tab set_tab_admin', '', '', l('customize')) . '<ul>';
/* languages directory object */
$languages_directory = new Redaxscript\Directory();
$languages_directory->init('languages');
$languages_directory_array = $languages_directory->getArray();
/* build languages select */
$language_array[l('select')] = '';
foreach ($languages_directory_array as $value) {
$value = substr($value, 0, 2);
$language_array[l($value, '_index')] = $value;
}
$output .= '<li>' . select_element('language', 'field_select_admin', 'language', $language_array, $language, l('language')) . '</li>';
if ($id == '' || $id > 1) {
$output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('enable') => 1, l('disable') => 0), $status, l('status')) . '</li>';
/* build groups select */
if (GROUPS_EDIT == 1 && USERS_EDIT == 1) {
$groups_result = Redaxscript\Db::forTablePrefix('groups')->orderByAsc('name')->findArray();
if ($groups_result) {
foreach ($groups_result as $g) {
$groups_array[$g['name']] = $g['id'];
}
}
$output .= '<li>' . select_element('groups', 'field_select_admin', 'groups', $groups_array, $groups, l('groups'), 'multiple="multiple"') . '</li>';
}
}
$output .= '</ul></fieldset></div>';
/* collect hidden output */
$output .= form_element('hidden', '', '', 'token', TOKEN);
/* collect button output */
if (USERS_EDIT == 1 || USERS_DELETE == 1) {
$cancel_route = 'admin/view/users';
} else {
$cancel_route = 'admin';
}
$output .= anchor_element('internal', '', 'js_cancel button_admin button_large button_cancel_admin', l('cancel'), $cancel_route);
/* delete button */
if ((USERS_DELETE == 1 || USERS_EXCEPTION == 1) && $id > 1) {
$output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large button_delete_admin', l('delete'), 'admin/delete/users/' . $id . '/' . TOKEN);
}
/* submit button */
if (USERS_NEW == 1 || USERS_EDIT == 1 || USERS_EXCEPTION == 1) {
$output .= form_element('button', '', 'js_submit button_admin button_large button_submit_admin', ADMIN_PARAMETER, $wording_submit);
}
//.........这里部分代码省略.........
示例11: comment_post
/**
* 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'] = '';
}
示例12: templates_list
/**
* templates list
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Navigation
* @author Henry Ruhs
*
* @param array $options
*/
function templates_list($options = '')
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* define option variables */
if (is_array($options)) {
foreach ($options as $key => $value) {
$key = 'option_' . $key;
${$key} = $value;
}
}
/* templates directory object */
$templates_directory = new Redaxscript\Directory();
$templates_directory->init('templates', array('admin', 'install'));
$templates_directory_array = $templates_directory->getArray();
/* collect templates output */
foreach ($templates_directory_array as $value) {
$class_string = ' class="template_' . $value;
if ($value == Redaxscript\Registry::get('template')) {
$class_string .= ' item_active';
}
$class_string .= '"';
$output .= '<li' . $class_string . '>' . anchor_element('internal', '', '', $value, FULL_ROUTE . TEMPLATE_ROUTE . $value, '', 'rel="nofollow"') . '</li>';
}
/* build id string */
if ($option_id) {
$id_string = ' id="' . $option_id . '"';
}
/* build class string */
if ($option_class) {
$class_string = ' class="' . $option_class . '"';
} else {
$class_string = ' class="list_templates"';
}
/* collect list output */
if ($output) {
$output = '<ul' . $id_string . $class_string . '>' . $output . '</ul>';
}
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
echo $output;
}
示例13: password_reset_post
/**
* password reset post
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Password
* @author Henry Ruhs
*/
function password_reset_post()
{
$captchaValidator = new Redaxscript\Validator\Captcha();
/* clean post */
if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/password_reset'] == 'visited') {
$post_id = clean($_POST['id'], 0);
$post_password = clean($_POST['password'], 0);
$password = substr(sha1(uniqid()), 0, 10);
$task = $_POST['task'];
$solution = $_POST['solution'];
}
/* query user information */
if ($post_id && $post_password) {
$users_result = Redaxscript\Db::forTablePrefix('users')->where(array('id' => $post_id, 'status' => 1))->findArray();
foreach ($users_result as $r) {
foreach ($r as $key => $value) {
$key = 'my_' . $key;
${$key} = stripslashes($value);
}
}
}
/* validate post */
if ($post_id == '' || $post_password == '') {
$error = l('input_incorrect');
} else {
if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\ValidatorInterface::FAILED) {
$error = l('captcha_incorrect');
} else {
if ($my_id == '' || sha1($my_password) != $post_password) {
$error = l('access_no');
} else {
/* send new password */
$loginRoute = ROOT . '/' . REWRITE_ROUTE . 'login';
$loginLink = anchor_element('external', '', '', $loginRoute, $loginRoute);
$toArray = array($my_name => $my_email);
$fromArray = array(s('author') => s('email'));
$subject = l('password_new');
$bodyArray = array('<strong>' . l('password_new') . l('colon') . '</strong> ' . $password, '<br />', '<strong>' . l('login') . l('colon') . '</strong> ' . $loginLink);
/* mailer object */
$mailer = new Redaxscript\Mailer();
$mailer->init($toArray, $fromArray, $subject, $bodyArray);
$mailer->send();
/* update password */
$passwordHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
$passwordHash->init($password);
Redaxscript\Db::forTablePrefix('users')->where(array('id' => $post_id, 'status' => 1))->findOne()->set('password', $passwordHash->getHash())->save();
}
}
}
/* handle error */
if ($error) {
if (s('blocker') == 1) {
$_SESSION[ROOT . '/attack_blocked']++;
}
if ($post_id && $post_password) {
$back_route = 'password_reset/' . $post_id . '/' . $post_password;
} else {
$back_route = 'reminder';
}
notification(l('error_occurred'), $error, l('back'), $back_route);
} else {
notification(l('operation_completed'), l('password_sent'), l('login'), 'login');
}
$_SESSION[ROOT . '/password_reset'] = '';
}
示例14: login_list
/**
* login list
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Navigation
* @author Henry Ruhs
*/
function login_list()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
$output .= '<li class="item_logout">' . anchor_element('internal', '', '', l('logout'), 'logout', '', 'rel="nofollow"') . '</li>';
$output .= '<li class="item_administration">' . anchor_element('internal', '', '', l('administration'), 'admin', '', 'rel="nofollow"') . '</li>';
} else {
$output .= '<li class="item_login">' . anchor_element('internal', '', '', l('login'), 'login', '', 'rel="nofollow"') . '</li>';
if (s('reminder') == 1) {
$output .= '<li class="item_reminder">' . anchor_element('internal', '', '', l('reminder'), 'reminder', '', 'rel="nofollow"') . '</li>';
}
if (s('registration') == 1) {
$output .= '<li class="item_registration">' . anchor_element('internal', '', '', l('registration'), 'registration', '', 'rel="nofollow"') . '</li>';
}
}
$output = '<ul class="list_login">' . $output . '</ul>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
echo $output;
}
示例15: github_tracker
/**
* github tracker
*
* @since 2.1.0
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*
* @param string $type
* @param array $options
*/
function github_tracker($type = '', $options = '')
{
/* define option variables */
if (is_array($options)) {
foreach ($options as $key => $value) {
$key = 'option_' . $key;
${$key} = $value;
}
}
/* fallback */
if ($option_limit_milestones == '') {
$option_limit_milestones = s('limit');
}
if ($option_limit_issues == '') {
$option_limit_issues = s('limit');
}
/* get contents */
$contents = github_tracker_get_contents($type);
/* decode contents */
if ($contents) {
$contents = json_decode($contents);
$data = $contents;
}
/* collect milestones output */
if ($data && $type == 'milestones') {
foreach ($data as $value) {
/* break if limit reached */
if (++$milestones_counter > $option_limit_milestones) {
break;
}
$total_issues = $value->closed_issues + $value->open_issues;
/* collect milestones output */
$output .= '<ul class="list_github_tracker_milestones">';
$output .= '<li><h3 class="title_github_tracker_milestones">' . $value->title . '</h3></li>';
$output .= '<li><span class="text_github_tracker_milestones_description">' . $value->description . '</span></li>';
$output .= '<li><progress class="progress_github_tracker_milestones" value="' . $value->closed_issues . '" max="' . $total_issues . '"></progress></li>';
$output .= '<li><span class="text_github_tracker_milestones_status">' . $value->closed_issues . ' ' . l('closed_issues', 'github_tracker') . s('divider') . $value->open_issues . ' ' . l('open_issues', 'github_tracker') . '</span></li>';
$output .= '</ul>';
}
}
/* collect issues output */
if ($data && $type == 'issues') {
$output = '<div class="wrapper_table_default"><table class="table table_default table_github_tracker_milestones">';
$output .= '<thead><tr><th class="s3o6 column_first">' . l('issues', 'github_tracker') . '</th><th class="column_second">' . l('created', 'github_tracker') . '</th><th class="column_third">' . l('updated', 'github_tracker') . '</th><th class="column_last">' . l('milestones', 'github_tracker') . '</th></tr></thead>';
$output .= '<tfoot><tr><td class="column_first">' . l('issues', 'github_tracker') . '</td><td class="column_second">' . l('created', 'github_tracker') . '</td><td class="column_third">' . l('updated', 'github_tracker') . '</td><td class="column_last">' . l('milestones', 'github_tracker') . '</td></tr></tfoot>';
foreach ($data as $value) {
/* break if limit reached */
if (++$issues_counter > $option_limit_issues) {
break;
}
/* collect issues output */
$output .= '<tr>';
$output .= '<td class="column_first">' . anchor_element('external', '', 'js_confirm link_github_tracker_issues', $value->title, $value->html_url) . '</td>';
$output .= '<td class="column_second">' . date(s('date'), strtotime($value->created_at)) . '</td>';
$output .= '<td class="column_third">' . date(s('date'), strtotime($value->updated_at)) . '</td>';
$output .= '<td class="column_last">' . $value->milestone->title . '</td>';
$output .= '</tr>';
}
$output .= '</tbody></table></div>';
}
echo $output;
}