本文整理汇总了PHP中form_element函数的典型用法代码示例。如果您正苦于以下问题:PHP form_element函数的具体用法?PHP form_element怎么用?PHP form_element使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_element函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reminder_form
/**
* reminder form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Reminder
* @author Henry Ruhs
*/
function reminder_form()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* disable fields if attack blocked */
if (ATTACK_BLOCKED > 9) {
$code_disabled = ' disabled="disabled"';
}
/* captcha object */
$captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
$captcha->init();
/* collect output */
$output .= '<h2 class="title_content">' . l('reminder') . '</h2>';
$output .= form_element('form', 'form_reminder', 'js_validate_form form_default form_reminder', '', '', '', 'action="' . REWRITE_ROUTE . 'reminder" method="post"');
$output .= form_element('fieldset', '', 'set_reminder', '', '', l('reminder_request') . l('point')) . '<ul>';
$output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', '', l('email'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_disabled) . '</li>';
/* collect captcha task output */
$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 */
$captchaHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
$captchaHash->init($captcha->getSolution());
$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', 'reminder_post', l('submit'), '', $code_disabled);
$output .= '</form>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
$_SESSION[ROOT . '/reminder'] = 'visited';
echo $output;
}
示例2: 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;
}
示例3: admin_groups_form
/**
* admin groups form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Admin
* @author Henry Ruhs
*/
function admin_groups_form()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* define fields for existing group */
if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
/* query user */
$query = 'SELECT * FROM ' . PREFIX . 'groups WHERE id = ' . ID_PARAMETER;
$result = mysql_query($query);
$r = mysql_fetch_assoc($result);
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
$wording_headline = $name;
$wording_submit = l('save');
$route = 'admin/process/groups/' . $id;
} else {
if (ADMIN_PARAMETER == 'new') {
$categories = 0;
$articles = 0;
$extras = 0;
$comments = 0;
$groups = 0;
$users = 0;
$modules = 0;
$settings = 0;
$filter = 1;
$status = 1;
$wording_headline = l('group_new');
$wording_submit = l('create');
$route = 'admin/process/groups';
}
}
$access_array = array(l('create') => 1, l('edit') => 2, l('delete') => 3);
$modules_access_array = array(l('install') => 1, l('edit') => 2, l('uninstall') => 3);
/* 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('group'), FULL_ROUTE . '#tab-1') . '</li>';
if ($id == '' || $id > 1) {
$output .= '<li class="item_second">' . anchor_element('internal', '', '', l('access'), FULL_ROUTE . '#tab-2') . '</li>';
$output .= '<li class="item_last">' . anchor_element('internal', '', '', l('customize'), FULL_ROUTE . '#tab-3') . '</li>';
}
$output .= '</ul>';
/* collect tab box output */
$output .= '<div class="js_box_tab box_tab box_tab_admin">';
/* collect group set */
$output .= form_element('fieldset', 'tab-1', 'js_set_tab js_set_active set_tab set_tab_admin set_active', '', '', l('group')) . '<ul>';
$output .= '<li>' . form_element('text', 'name', 'js_generate_alias_input field_text_admin field_note', 'name', $name, l('name'), 'maxlength="50" required="required" autofocus="autofocus"') . '</li>';
$output .= '<li>' . form_element('text', 'alias', 'js_generate_alias_output field_text_admin field_note', 'alias', $alias, l('alias'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small_admin', 'description', $description, l('description'), 'rows="1" cols="15"') . '</li>';
$output .= '</ul></fieldset>';
if ($id == '' || $id > 1) {
/* collect access set */
$output .= form_element('fieldset', 'tab-2', 'js_set_tab set_tab set_tab_admin', '', '', l('acccess')) . '<ul>';
$output .= '<li>' . select_element('categories', 'field_select_admin', 'categories', $access_array, $categories, l('categories'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('articles', 'field_select_admin', 'articles', $access_array, $articles, l('articles'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('extras', 'field_select_admin', 'extras', $access_array, $extras, l('extras'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('comments', 'field_select_admin', 'comments', $access_array, $comments, l('comments'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('groups', 'field_select_admin', 'groups', $access_array, $groups, l('groups'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('users', 'field_select_admin', 'users', $access_array, $users, l('users'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('modules', 'field_select_admin', 'modules', $modules_access_array, $modules, l('modules'), 'multiple="multiple"') . '</li>';
$output .= '<li>' . select_element('settings', 'field_select_admin', 'settings', array(l('none') => 0, l('edit') => 1), $settings, l('settings')) . '</li>';
$output .= '</ul></fieldset>';
/* collect customize set */
$output .= form_element('fieldset', 'tab-3', 'js_set_tab set_tab set_tab_admin', '', '', l('customize')) . '<ul>';
$output .= '<li>' . select_element('filter', 'field_select_admin', 'filter', array(l('enable') => 1, l('disable') => 0), $filter, l('filter')) . '</li>';
$output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('enable') => 1, l('disable') => 0), $status, l('status')) . '</li>';
$output .= '</ul></fieldset>';
}
$output .= '</div>';
/* collect hidden output */
$output .= form_element('hidden', '', '', 'token', TOKEN);
/* cancel button */
if (GROUPS_EDIT == 1 || GROUPS_DELETE == 1) {
$cancel_route = 'admin/view/groups';
} else {
$cancel_route = 'admin';
}
$output .= anchor_element('internal', '', 'js_cancel button_admin button_large_admin button_cancel_admin', l('cancel'), $cancel_route);
/* delete button */
if (GROUPS_DELETE == 1 && $id > 1) {
$output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large_admin button_delete_admin', l('delete'), 'admin/delete/groups/' . $id . '/' . TOKEN);
}
/* submit button */
if (GROUPS_NEW == 1 || GROUPS_EDIT == 1) {
$output .= form_element('button', '', 'js_submit button_admin button_large_admin button_submit_admin', ADMIN_PARAMETER, $wording_submit);
//.........这里部分代码省略.........
示例4: search_post
/**
* search post
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Search
* @author Henry Ruhs
*/
function search_post()
{
/* clean post */
if (ATTACK_BLOCKED < 10) {
$search_terms = clean($_POST['search_terms'], 1);
}
/* validate post */
if (strlen($search_terms) < 3 || $search_terms == l('search_terms')) {
$error = l('input_incorrect');
} else {
$search = array_filter(explode(' ', $search_terms));
$search_keys = array_keys($search);
$last = end($search_keys);
/* query search */
$query = 'SELECT id, title, alias, description, date, category, access FROM ' . PREFIX . 'articles WHERE (language = \'' . LANGUAGE . '\' || language = \'\') && status = 1';
if ($search) {
$query .= ' && (';
foreach ($search as $key => $value) {
$query .= 'title LIKE \'%' . $value . '%\' || description LIKE \'%' . $value . '%\' || keywords LIKE \'%' . $value . '%\' || text LIKE \'%' . $value . '%\'';
if ($last != $key) {
$query .= ' || ';
}
}
$query .= ')';
}
$query .= ' ORDER BY date DESC LIMIT 50';
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
if ($result == '' || $num_rows == '') {
$error = l('search_no');
} else {
if ($result) {
$accessValidator = new Redaxscript\Validator\Access();
$output = '<h2 class="title_content title_search_result">' . l('search') . '</h2>';
$output .= form_element('fieldset', '', 'set_search_result', '', '', '<span class="title_content_sub title_search_result_sub">' . l('articles') . '</span>') . '<ol class="list_search_result">';
while ($r = mysql_fetch_assoc($result)) {
$access = $r['access'];
$check_access = $accessValidator->validate($access, MY_GROUPS);
/* if access granted */
if ($check_access == 1) {
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
/* prepare metadata */
if ($description == '') {
$description = $title;
}
$date = date(s('date'), strtotime($date));
/* build route */
if ($category == 0) {
$route = $alias;
} else {
$route = build_route('articles', $id);
}
/* collect item output */
$output .= '<li class="item_search_result">' . anchor_element('internal', '', 'link_search_result', $title, $route, $description) . '<span class="date_search_result">' . $date . '</span></li>';
} else {
$counter++;
}
}
$output .= '</ol></fieldset>';
/* handle access */
if ($num_rows == $counter) {
$error = l('access_no');
}
}
}
}
/* handle error */
if ($error) {
notification(l('something_wrong'), $error);
} else {
echo $output;
}
}
示例5: 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);
}
//.........这里部分代码省略.........
示例6: comment_form
/**
* comment form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Comments
* @author Henry Ruhs
*
* @param integer $article
* @param string $language
*/
function comment_form($article = '', $language = '')
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* disable fields if attack blocked */
if (ATTACK_BLOCKED > 9) {
$code_readonly = $code_disabled = ' disabled="disabled"';
} else {
if (LOGGED_IN == TOKEN) {
$author = MY_USER;
$email = MY_EMAIL;
$code_readonly = ' readonly="readonly"';
}
}
/* captcha object */
if (s('captcha') > 0) {
$captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
$captcha->init();
}
/* collect output */
$output .= '<h2 class="title_content">' . l('comment_new') . '</h2>';
$output .= form_element('form', 'form_comment', 'js_validate_form form_default form_comment', '', '', '', 'method="post"');
$output .= form_element('fieldset', '', 'set_comment', '', '', l('fields_required') . l('point')) . '<ul>';
$output .= '<li>' . form_element('text', 'author', 'field_text field_note', 'author', $author, '* ' . l('author'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
$output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
$output .= '<li>' . form_element('url', 'url', 'field_text', 'url', '', l('url'), 'maxlength="50"' . $code_disabled) . '</li>';
$output .= '<li>' . form_element('textarea', 'text', 'js_auto_resize js_editor_textarea field_textarea field_note', 'text', '', '* ' . l('comment'), 'rows="5" cols="100" required="required"' . $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 hidden output */
$output .= form_element('hidden', '', '', 'language', $language);
$output .= form_element('hidden', '', '', 'date', NOW);
$output .= form_element('hidden', '', '', 'article', $article);
/* 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', 'comment_post', l('create'), '', $code_disabled);
$output .= '</form>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
$_SESSION[ROOT . '/comment'] = 'visited';
echo $output;
}
示例7: search_post
/**
* search post
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Search
* @author Henry Ruhs
*/
function search_post()
{
/* clean post */
if (ATTACK_BLOCKED < 10) {
$search_terms = clean($_POST['search_terms'], 5);
$table = clean($_POST['table']);
}
/* validate post */
if (strlen($search_terms) < 3 || $search_terms == l('search_terms')) {
$error = l('input_incorrect');
} else {
/* fetch result */
$result = Redaxscript\Db::forTablePrefix($table)->where('status', 1)->whereIn('language', array(Redaxscript\Registry::get('language'), ''))->whereLikeMany(array('title', 'description', 'keywords', 'text'), array('%' . $search_terms . '%', '%' . $search_terms . '%', '%' . $search_terms . '%', '%' . $search_terms . '%'))->orderByDesc('date')->findArray();
/* process result */
$num_rows = count($result);
if (!$result) {
$error = l('search_no');
} else {
if ($result) {
$accessValidator = new Redaxscript\Validator\Access();
$output = '<h2 class="title_content title_search_result">' . l('search') . '</h2>';
$output .= form_element('fieldset', '', 'set_search_result', '', '', '') . '<ol class="list_search_result">';
foreach ($result as $r) {
$access = $r['access'];
/* access granted */
if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
/* prepare metadata */
if ($description == '') {
$description = $title;
}
$date = date(s('date'), strtotime($date));
/* build route */
if ($table == 'categories' && $parent == 0 || $table == 'articles' && $category == 0) {
$route = $alias;
} else {
$route = build_route($table, $id);
}
/* collect item output */
$output .= '<li class="item_search_result">' . anchor_element('internal', '', 'link_search_result', $title, $route, $description) . '<span class="date_search_result">' . $date . '</span></li>';
} else {
$counter++;
}
}
$output .= '</ol></fieldset>';
/* handle access */
if ($num_rows == $counter) {
$error = l('access_no');
}
}
}
}
/* handle error */
if ($error) {
notification(l('something_wrong'), $error);
} else {
echo $output;
}
}
示例8: contact_form
/**
* contact form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*/
function contact_form()
{
/* disable fields if attack blocked */
if (ATTACK_BLOCKED > 9) {
$code_readonly = $code_disabled = ' disabled="disabled"';
} else {
if (LOGGED_IN == TOKEN) {
$author = MY_USER;
$email = MY_EMAIL;
$code_readonly = ' readonly="readonly"';
}
}
/* captcha object */
if (s('captcha') > 0) {
$captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
}
/* collect output */
$output = form_element('form', 'form_contact', 'js_validate_form form_default form_contact', '', '', '', 'method="post"');
$output .= form_element('fieldset', '', 'set_contact', '', '', l('fields_required') . l('point')) . '<ul>';
$output .= '<li>' . form_element('text', 'author', 'field_text field_note', 'author', $author, '* ' . l('author'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
$output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
$output .= '<li>' . form_element('url', 'url', 'field_text', 'url', '', l('url'), 'maxlength="50"' . $code_disabled) . '</li>';
$output .= '<li>' . form_element('textarea', 'text', 'js_auto_resize js_editor_textarea field_textarea field_note', 'text', '', '* ' . l('message'), 'rows="5" cols="100" required="required"' . $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) {
if (LOGGED_IN == TOKEN) {
$output .= form_element('hidden', '', '', 'task', $captcha->getSolution('raw'));
}
$output .= form_element('hidden', '', '', 'solution', $captcha->getSolution());
}
/* collect hidden and button output */
$output .= form_element('hidden', '', '', 'token', TOKEN);
$output .= form_element('button', '', 'js_submit button_default', 'contact_post', l('submit'), '', $code_disabled);
$output .= '</form>';
$_SESSION[ROOT . '/contact'] = 'visited';
echo $output;
}
示例9: admin_modules_form
/**
* admin modules form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Admin
* @author Henry Ruhs
*/
function admin_modules_form()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* define fields for existing user */
if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
/* query modules */
$result = Redaxscript\Db::forTablePrefix('modules')->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/modules/' . $id;
}
/* directory object */
$docs_directory = new Redaxscript\Directory();
$docs_directory->init('modules/' . $alias . '/docs');
$docs_directory_array = $docs_directory->getArray();
/* 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('module'), FULL_ROUTE . '#tab-1') . '</li>';
$output .= '<li class="item_second">' . anchor_element('internal', '', '', l('customize'), FULL_ROUTE . '#tab-2') . '</li>';
foreach ($docs_directory_array as $key => $value) {
$output .= '<li class="item_third">' . anchor_element('internal', '', '', str_replace('.phtml', '', $value), FULL_ROUTE . '#tab-' . ($key + 3)) . '</li>';
}
$output .= '</ul>';
/* collect tab box output */
$output .= '<div class="js_box_tab box_tab box_tab_admin">';
/* collect module 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>';
$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>';
$output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('enable') => 1, l('disable') => 0), $status, l('status')) . '</li>';
/* build access select */
if (GROUPS_EDIT == 1) {
$access_array[l('all')] = null;
$access_result = Redaxscript\Db::forTablePrefix('groups')->orderByAsc('name')->findArray();
if ($access_result) {
foreach ($access_result as $g) {
$access_array[$g['name']] = $g['id'];
}
}
$output .= '<li>' . select_element('access', 'field_select_admin', 'access', $access_array, $access, l('access'), 'multiple="multiple"') . '</li></ul></fieldset>';
}
/* template object */
$template = new Redaxscript\Template();
/* collect docs set */
foreach ($docs_directory_array as $key => $value) {
$output .= form_element('fieldset', 'tab-' . ($key + 3), 'js_set_tab set_tab set_tab_admin', '', '', 'docs') . '<ul>';
$output .= '<li>' . $template->partial('modules/' . $alias . '/docs/' . $value) . '</li></ul></fieldset>';
}
$output .= '</div>';
/* collect hidden output */
$output .= form_element('hidden', '', '', 'alias', $alias);
$output .= form_element('hidden', '', '', 'token', TOKEN);
/* cancel button */
if (MODULES_EDIT == 1 || MODULES_UNINSTALL == 1) {
$cancel_route = 'admin/view/modules';
} else {
$cancel_route = 'admin';
}
$output .= anchor_element('internal', '', 'js_cancel button_admin button_large button_cancel_admin', l('cancel'), $cancel_route);
/* uninstall button */
if (MODULES_UNINSTALL == 1) {
$output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large button_uninstall_admin', l('uninstall'), 'admin/uninstall/modules/' . $alias . '/' . TOKEN);
}
/* submit button */
if (MODULES_EDIT == 1) {
$output .= form_element('button', '', 'js_submit button_admin button_large button_submit_admin', ADMIN_PARAMETER, $wording_submit);
}
$output .= '</form>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
echo $output;
}
示例10: form_select
/**
* Rendert ein Formular-Auswahlfeld
*/
function form_select($name, $label, $values, $selected)
{
return form_element($label, html_select_key('form_' . $name, $name, $values, $selected), 'form_' . $name);
}
示例11: file_manager
/**
* file manager
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*
* @param string $directory
*/
function file_manager($directory = '')
{
if (!is_dir($directory)) {
mkdir($directory, 0777);
}
if (!is_dir($directory)) {
$output = '<div class="box_note note_error">' . l('directory_create', 'file_manager') . l('colon') . ' ' . $directory . l('point') . '</div>';
} else {
if (!is_writable($directory)) {
$output = '<div class="box_note note_error">' . l('directory_permission_grant', 'file_manager') . l('colon') . ' ' . $directory . l('point') . '</div>';
}
}
/* collect listing output */
$output .= '<h2 class="title_content">' . l('file_manager', 'file_manager') . '</h2>';
$output .= form_element('form', 'form_file_manager', 'js_form_file_manager form_file_manager', '', '', '', 'action="' . REWRITE_ROUTE . 'admin/file-manager/upload" method="post" enctype="multipart/form-data"');
$output .= form_element('file', '', 'js_file field_file hide_if_js', 'file', '', l('browse', 'file_manager'));
$output .= '<button type="submit" class="js_upload field_upload button_admin hide_if_js">' . l('upload', 'file_manager') . '</span></span></button>';
$output .= '</form>';
$output .= '<div class="wrapper_table_admin"><table class="table table_admin">';
/* collect thead and tfoot */
$output .= '<thead><tr><th class="s4o6 column_first">' . l('name') . '</th><th class="s1o6 column_second">' . l('file_size', 'file_manager') . '</th><th class="s1o6 column_last">' . l('date') . '</th></tr></thead>';
$output .= '<tfoot><tr><td class="column_first">' . l('name') . '</td><td class="column_second">' . l('file_size', 'file_manager') . '</td><td class="column_last">' . l('date') . '</td></tr></tfoot>';
/* file manager directory object */
$file_manager_directory = new Redaxscript\Directory($directory);
$file_manager_directory_array = $file_manager_directory->get();
/* collect directory output */
if (count($file_manager_directory_array)) {
$output .= '<tbody>';
foreach ($file_manager_directory_array as $key => $value) {
$output .= '<tr><td class="column_first">';
$path = $directory . '/' . $value;
if (function_exists('exif_imagetype') && exif_imagetype($path)) {
$output .= anchor_element('external', '', '', $value, ROOT . '/' . $path);
} else {
$output .= $value;
}
/* collect control output */
$output .= '<ul class="list_control_admin"><li class="item_delete">' . anchor_element('internal', '', 'js_confirm', l('delete'), 'admin/file-manager/delete/' . $key . '/' . TOKEN) . '</li></ul>';
/* collect filesize and filetime output */
$output .= '</td><td class="column_second">' . ceil(filesize($path) / 1024) . ' Kb</td><td class="column_last">' . date(s('date'), filectime($path)) . '</td></tr>';
}
$output .= '</tbody>';
} else {
$error = l('file_no', 'file_manager') . l('point');
}
/* handle error */
if ($error) {
$output .= '<tbody><tr><td colspan="2">' . $error . '</td></tr></tbody>';
}
$output .= '</table></div>';
echo $output;
}
示例12: install_form
function install_form()
{
global $d_host, $d_name, $d_user, $d_password, $d_prefix, $name, $user, $password, $email;
/* collect output */
$output = '<h2 class="title_content">' . l('installation') . '</h2>';
$output .= form_element('form', 'form_install', 'js_validate_form js_accordion form_default', '', '', '', 'action="' . FILE . '" method="post" autocomplete="off"');
/* collect database set */
$output .= '<fieldset class="js_set_accordion js_set_active set_accordion set_accordion_default set_active">';
$output .= '<legend class="js_title_accordion js_title_active title_accordion title_accordion_default title_active">' . l('database_setup') . '</legend>';
$output .= '<ul class="js_box_accordion js_box_active box_accordion box_accordion_default box_active">';
$output .= '<li>' . form_element('text', 'd_host', 'field_text field_note', 'd_host', $d_host, '* ' . l('host'), 'maxlength="50" required="required" autofocus="autofocus"') . '</li>';
$output .= '<li>' . form_element('text', 'd_name', 'field_text field_note', 'd_name', $d_name, '* ' . l('name'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('text', 'd_user', 'field_text field_note', 'd_user', $d_user, '* ' . l('user'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('password', 'd_password', 'js_unmask_password field_text', 'd_password', $d_password, l('password'), 'maxlength="50"') . '</li>';
$output .= '<li>' . form_element('text', 'd_prefix', 'field_text', 'd_prefix', $d_prefix, l('prefix'), 'maxlength="50"') . '</li>';
$output .= '</ul></fieldset>';
/* collect account set */
$output .= '<fieldset class="js_set_accordion js_set_accordion_last set_accordion set_accordion_default set_accordion_last">';
$output .= '<legend class="js_title_accordion title_accordion title_accordion_default">' . l('account_create') . '</legend>';
$output .= '<ul class="js_box_accordion box_accordion box_accordion_default">';
$output .= '<li>' . form_element('text', 'name', 'field_text field_note', 'name', $name, '* ' . l('name'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('text', 'user', 'field_text field_note', 'user', $user, '* ' . l('user'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text field_note', 'password', $password, '* ' . l('password'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"') . '</li>';
$output .= '</ul></fieldset>';
/* collect hidden and button output */
$output .= form_element('hidden', '', '', 'd_salt', hash_generator(40));
$output .= form_element('hidden', '', '', 'token', TOKEN);
$output .= form_element('button', '', 'js_submit button_default button_large', 'install_post', l('install'));
$output .= '</form>';
echo $output;
}
示例13: archive
/**
* archive
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Modules
* @author Henry Ruhs
*
* @return string
*/
function archive()
{
$query = 'SELECT id, title, alias, description, date, category, access FROM ' . PREFIX . 'articles WHERE (language = \'' . LANGUAGE . '\' || language = \'\') && status = 1 ORDER BY date DESC';
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
if ($result == '' || $num_rows == '') {
$error = l('article_no') . l('point');
} else {
if ($result) {
$accessValidator = new Redaxscript\Validator\Access();
$month_names = explode(', ', l('month_names'));
$last = 0;
while ($r = mysql_fetch_assoc($result)) {
/* check for access */
$access = $r['access'];
$check_access = $accessValidator->validate($access, MY_GROUPS);
/* if access granted */
if ($check_access == 1) {
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
if ($description == '') {
$description = $title;
}
$year = substr($date, 0, 4);
$month = substr($date, 5, 2) - 1;
/* build route */
if ($category == 0) {
$route = $alias;
} else {
$route = build_route('articles', $id);
}
/* collect output */
if ($last != $month + $year) {
if ($last > 0) {
$output .= '</ul></fieldset>';
}
$output .= form_element('fieldset', '', 'set_archive', '', '', '<span class="title_content_sub title_archive_sub">' . $month_names[$month] . ' ' . $year . '</span>') . '<ul class="list_default list_archive">';
}
$output .= '<li>' . anchor_element('internal', '', '', $title, $route, $description) . '</li>';
$last = $month + $year;
} else {
$counter++;
}
}
/* handle access */
if ($num_rows == $counter) {
$error = l('access_no') . l('point');
}
}
}
/* handle error */
if ($error) {
$output = form_element('fieldset', '', 'set_archive', '', '', '<span class="title_content_sub title_archive_sub">' . l('error') . '</span>') . '<ul class="list_default list_archive">';
$output .= '<li>' . $error . '</li>';
}
$output .= '</ul></fieldset>';
return $output;
}
示例14: admin_modules_form
/**
* admin modules form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Admin
* @author Henry Ruhs
*/
function admin_modules_form()
{
$output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
/* define fields for existing user */
if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
/* query modules */
$query = 'SELECT * FROM ' . PREFIX . 'modules WHERE id = ' . ID_PARAMETER;
$result = mysql_query($query);
$r = mysql_fetch_assoc($result);
if ($r) {
foreach ($r as $key => $value) {
${$key} = stripslashes($value);
}
}
$wording_headline = $name;
$wording_submit = l('save');
$route = 'admin/process/modules/' . $id;
}
$file_install = is_dir('modules/' . $alias);
/* 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('module'), 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 module 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>';
$output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small_admin', '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>';
$output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('enable') => 1, l('disable') => 0), $status, l('status')) . '</li>';
/* build access select */
if (GROUPS_EDIT == 1) {
$access_array[l('all')] = 0;
$access_query = 'SELECT * FROM ' . PREFIX . 'groups ORDER BY name ASC';
$access_result = mysql_query($access_query);
if ($access_result) {
while ($g = mysql_fetch_assoc($access_result)) {
$access_array[$g['name']] = $g['id'];
}
}
$output .= '<li>' . select_element('access', 'field_select_admin', 'access', $access_array, $access, l('access'), 'multiple="multiple"') . '</li>';
}
$output .= '</ul></fieldset></div>';
/* collect hidden output */
$output .= form_element('hidden', '', '', 'alias', $alias);
$output .= form_element('hidden', '', '', 'token', TOKEN);
/* cancel button */
if (MODULES_EDIT == 1 || MODULES_UNINSTALL == 1) {
$cancel_route = 'admin/view/modules';
} else {
$cancel_route = 'admin';
}
$output .= anchor_element('internal', '', 'js_cancel button_admin button_large_admin button_cancel_admin', l('cancel'), $cancel_route);
/* uninstall button */
if (MODULES_UNINSTALL == 1 && $file_install) {
$output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large_admin button_uninstall_admin', l('uninstall'), 'admin/uninstall/modules/' . $alias . '/' . TOKEN);
}
/* submit button */
if (MODULES_EDIT == 1) {
$output .= form_element('button', '', 'js_submit button_admin button_large_admin button_submit_admin', ADMIN_PARAMETER, $wording_submit);
}
$output .= '</form>';
$output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
echo $output;
}
示例15: install_form
/**
* install form
*
* @since 1.2.1
* @deprecated 2.0.0
*
* @package Redaxscript
* @category Install
* @author Henry Ruhs
*/
function install_form()
{
global $d_type, $d_host, $d_name, $d_user, $d_password, $d_prefix, $name, $user, $password, $email;
/* build type array */
$typeArray = array();
foreach (PDO::getAvailableDrivers() as $driver) {
if (is_dir('database/' . $driver)) {
$typeArray[$driver] = $driver;
}
}
/* collect output */
$output = '<h2 class="title_content">' . l('installation') . '</h2>';
$output .= form_element('form', 'form_install', 'js_validate_form js_accordion form_default', '', '', '', 'action="' . FILE . '" method="post" autocomplete="off"');
/* collect database set */
$output .= '<fieldset class="js_set_accordion js_set_active set_accordion set_accordion_default set_active">';
$output .= '<legend class="js_title_accordion js_title_active title_accordion title_accordion_default title_active">' . l('database_setup') . '</legend>';
$output .= '<ul class="js_box_accordion js_box_active box_accordion box_accordion_default box_active">';
if ($typeArray) {
$output .= '<li>' . select_element('type', 'field_select', 'd_type', $typeArray, $d_type, l('type')) . '</li>';
}
$output .= '<li>' . form_element('text', 'd_host', 'field_text field_note', 'd_host', $d_host, '* ' . l('host'), 'maxlength="50" required="required" autofocus="autofocus" data-default="localhost" data-sqlite="' . substr(sha1(uniqid()), 0, 10) . '.sqlite"') . '</li>';
$output .= '<li>' . form_element('text', 'd_name', 'field_text field_note', 'd_name', $d_name, '* ' . l('name'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('text', 'd_user', 'field_text field_note', 'd_user', $d_user, '* ' . l('user'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('password', 'd_password', 'js_unmask_password field_text', 'd_password', $d_password, l('password'), 'maxlength="50"') . '</li>';
$output .= '<li>' . form_element('text', 'd_prefix', 'field_text', 'd_prefix', $d_prefix, l('prefix'), 'maxlength="50"') . '</li>';
$output .= '</ul></fieldset>';
/* collect account set */
$output .= '<fieldset class="js_set_accordion js_set_accordion_last set_accordion set_accordion_default set_accordion_last">';
$output .= '<legend class="js_title_accordion title_accordion title_accordion_default">' . l('account_create') . '</legend>';
$output .= '<ul class="js_box_accordion box_accordion box_accordion_default">';
$output .= '<li>' . form_element('text', 'name', 'field_text field_note', 'name', $name, '* ' . l('name'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('text', 'user', 'field_text field_note', 'user', $user, '* ' . l('user'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text field_note', 'password', $password, '* ' . l('password'), 'maxlength="50" required="required"') . '</li>';
$output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"') . '</li>';
$output .= '</ul></fieldset>';
/* collect hidden and button output */
$output .= form_element('hidden', '', '', 'd_salt', hash_generator(40));
$output .= form_element('hidden', '', '', 'token', TOKEN);
$output .= form_element('button', '', 'js_submit button_default button_large', 'install_post', l('install'));
$output .= '</form>';
echo $output;
}