本文整理汇总了PHP中form_select_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP form_select_tree函数的具体用法?PHP form_select_tree怎么用?PHP form_select_tree使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_select_tree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
if (isset($_GET['submitted']) && $_GET['submitted'] == "d") {
echo "<div class='well text-center'><p><strong>" . $locale['download_0042'] . "</strong></p>";
echo "<p><a href='submit.php?stype=d'>" . $locale['download_0043'] . "</a></p>";
echo "<p><a href='index.php'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['download_0039']) . "</a></p>\n";
echo "</div>\n";
} else {
/**
* The form
*/
// must have category
if (dbcount("(download_cat_id)", DB_DOWNLOAD_CATS, multilang_table("DL") ? "download_cat_language='" . LANGUAGE . "'" : "")) {
echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
echo "<div class='alert alert-info m-b-20 submission-guidelines'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['download_0044']) . "</div>\n";
echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=d", array('enctype' => TRUE));
echo form_text('download_title', $locale['download_0200'], $criteriaArray['download_title'], array('required' => TRUE, "inline" => TRUE, 'error_text' => $locale['download_0110']));
echo form_select_tree("download_cat", $locale['download_0207'], $criteriaArray['download_cat'], array("inline" => TRUE, "no_root" => TRUE, "placeholder" => $locale['choose'], "query" => multilang_table("DL") ? "WHERE download_cat_language='" . LANGUAGE . "'" : ""), DB_DOWNLOAD_CATS, "download_cat_name", "download_cat_id", "download_cat_parent");
echo form_select('download_keywords', $locale['download_0203'], $criteriaArray['download_keywords'], array("placeholder" => $locale['download_0203a'], 'max_length' => 320, "inline" => TRUE, 'width' => '100%', 'tags' => 1, 'multiple' => 1));
echo form_textarea('download_description_short', $locale['download_0202'], $criteriaArray['download_description_short'], array('bbcode' => 1, 'required' => TRUE, "autosize" => TRUE, "inline" => TRUE, 'error_text' => $locale['download_0112'], 'form_name' => 'submit_form'));
echo form_textarea('download_description', $locale['download_0202a'], $criteriaArray['download_description'], array("required" => $dl_settings['download_extended_required'] ? TRUE : FALSE, "inline" => TRUE, "bbcode" => TRUE, "autosize" => TRUE, "placeholder" => $locale['download_0201'], 'form_name' => 'submit_form'));
echo "<div class='row m-l-0 m-r-0 m-b-20'>\n";
echo "<div class='col-xs-12 col-sm-3 p-l-0'>\n ";
echo "</div>\n";
echo "<div class='col-xs-12 col-sm-9 p-r-0'>\n";
$tab_title['title'][] = "1 -" . $locale['download_0214'];
$tab_title['id'][] = 'dlf';
$tab_title['icon'][] = 'fa fa-file-zip-o fa-fw';
$tab_title['title'][] = "2 -" . $locale['download_0215'];
$tab_title['id'][] = 'dll';
$tab_title['icon'][] = 'fa fa-plug fa-fw';
$tab_active = tab_active($tab_title, 0);
echo "<div class='list-group-item'>\n";
示例2: mod_move_posts
/**
* Moving Posts
*/
private function mod_move_posts()
{
global $locale;
if (isset($_POST['move_posts']) && iMOD) {
$remove_first_post = FALSE;
$f_post_blo = FALSE;
if (isset($_POST['delete_post']) && !empty($_POST['delete_post'])) {
$first_post = dbarray(dbquery("SELECT post_id FROM " . DB_FORUM_POSTS . " WHERE thread_id='" . intval($this->thread_id) . "' ORDER BY post_datestamp ASC LIMIT 1"));
/**
* Scan for Posts
*/
$move_posts = "";
$array_post = array();
$first_post_found = FALSE;
foreach ($_POST['delete_post'] as $move_post_id) {
if (isnum($move_post_id)) {
$move_posts .= ($move_posts ? "," : "") . $move_post_id;
$array_post[] = $move_post_id;
if ($move_post_id == $first_post['post_id']) {
$first_post_found = TRUE;
}
}
}
// triggered move post
if ($move_posts) {
// validate whether the selected post exists
$move_result = dbquery("SELECT forum_id, thread_id, COUNT(post_id) 'num_posts'\n\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . "\n\t\t\t\t\t\t\t\t\tWHERE post_id IN (" . $move_posts . ")\n\t\t\t\t\t\t\t\t\tAND thread_id='" . intval($this->thread_id) . "'\n\t\t\t\t\t\t\t\t\tGROUP BY thread_id");
if (dbrows($move_result) > 0) {
$pdata = dbarray($move_result);
$post_count = dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "'");
ob_start();
echo openmodal('forum0300', $locale['forum_0300'], array('class' => 'modal-md'));
if ($first_post_found) {
// there is a first post.
echo "<div id='close-message'><div class='admin-message alert alert-info m-t-10'>";
if ($pdata['num_posts'] != $post_count) {
$remove_first_post = TRUE;
echo $locale['forum_0305'] . "<br />\n";
// trying to remove first post with other post in the thread
} else {
echo $locale['forum_0306'] . "<br />\n";
// confirm ok to remove first post.
}
if ($remove_first_post && count($array_post) == 1) {
echo "<br /><strong>" . $locale['forum_0307'] . "</strong><br /><br />\n";
// no post to move.
echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "&rowstart=" . $_GET['rowstart'] . "'>" . $locale['forum_0309'] . "</a>";
$f_post_blo = TRUE;
}
echo "</div></div>\n";
}
if (!isset($_POST['new_forum_id']) && !$f_post_blo) {
$fl_result = dbquery("\n\t\t\t\t\t\t\t\t\t\tSELECT f.forum_id, f.forum_name, f.forum_type, f2.forum_name 'forum_cat_name',\n\t\t\t\t\t\t\t\t\t\t(\tSELECT COUNT(thread_id) FROM " . DB_FORUM_THREADS . " th WHERE f.forum_id=th.forum_id AND th.thread_id !='" . intval($this->thread_id) . "'\n\t\t\t\t\t\t\t\t\t\t\tGROUP BY th.forum_id\n\t\t\t\t\t\t\t\t\t\t) AS threadcount\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n\t\t\t\t\t\t\t\t\t\tWHERE " . groupaccess('f.forum_access') . "\n\t\t\t\t\t\t\t\t\t\tORDER BY f2.forum_order ASC, f.forum_order ASC\n\t\t\t\t\t\t\t\t\t\t");
if (dbrows($fl_result) > 0) {
$exclude_opts = array();
while ($data = dbarray($fl_result)) {
if (empty($data['threadcount']) || $data['forum_type'] == '1') {
$exclude_opts[] = $data['forum_id'];
}
}
echo openform('modopts', 'post', $this->form_action);
echo form_select_tree('new_forum_id', $locale['forum_0301'], '', array('disable_opts' => $exclude_opts, 'no_root' => 1, 'inline' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat');
foreach ($array_post as $value) {
echo form_hidden("delete_post[]", "", $value, array("input_id" => "delete_post[{$value}]"));
}
echo form_hidden('move_posts', '', 1);
echo "<div class='clearfix'>\n<div class='col-xs-12 col-md-offset-3 col-lg-offset-3'>\n";
echo form_button($locale['forum_0302'], $locale['forum_0208'], $locale['forum_0208'], array('inline' => 1, 'class' => 'btn-primary'));
echo "</div>\n</div>\n";
echo closeform();
} else {
echo "<div class='well'>\n";
echo "<strong>" . $locale['forum_0310'] . "</strong><br /><br />\n";
echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "&rowstart=" . $_GET['rowstart'] . "'>" . $locale['forum_0309'] . "</a><br /><br />\n";
echo "</div>\n";
}
} elseif (isset($_POST['new_forum_id']) && isnum($_POST['new_forum_id']) && !isset($_POST['new_thread_id']) && !$f_post_blo) {
// Select Threads in Selected Forum.
// build the list.
$tl_result = dbquery("\n\t\t\t\t\t\t\tSELECT thread_id, thread_subject\n\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . "\n\t\t\t\t\t\t\tWHERE forum_id='" . intval($_POST['new_forum_id']) . "' AND thread_id !='" . intval($pdata['thread_id']) . "' AND thread_hidden='0'\n\t\t\t\t\t\t\tORDER BY thread_subject ASC\n\t\t\t\t\t\t\t");
if (dbrows($tl_result) > 0) {
$forum_list = array();
while ($tl_data = dbarray($tl_result)) {
$forum_list[$tl_data['thread_id']] = $tl_data['thread_subject'];
}
echo openform('modopts', 'post', $this->form_action . "&sv", array('max_tokens' => 1, 'downtime' => 1));
echo form_hidden('new_forum_id', '', $_POST['new_forum_id']);
echo form_select('new_thread_id', $locale['forum_0303'], '', array('options' => $forum_list, 'inline' => 1));
foreach ($array_post as $value) {
echo form_hidden("delete_post[]", "", $value, array("input_id" => "delete_post[{$value}]"));
}
echo form_hidden('move_posts', '', 1);
echo form_button($locale['forum_0304'], $locale['forum_0208'], $locale['forum_0208'], array('class' => 'btn-primary btn-sm'));
} else {
echo $locale['forum_0308'] . "<br /><br />\n";
echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "'>" . $locale['forum_0309'] . "</a>\n";
}
//.........这里部分代码省略.........
示例3: nl2br
echo $locale['news_0203'] . " " . nl2br(parseubb($news_snippet)) . "<br /><br />";
echo $locale['news_0204'] . " " . nl2br(parseubb($news_body));
closetable();
}
add_to_title($locale['global_200'] . $locale['news_0400']);
echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
echo "<div class='alert alert-info m-b-20 submission-guidelines'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['news_0703']) . "</div>\n";
echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=n", array("enctype" => $news_settings['news_allow_submission_files'] ? TRUE : FALSE));
echo form_text('news_subject', $locale['news_0200'], $criteriaArray['news_subject'], array("required" => TRUE, "inline" => TRUE));
if (multilang_table("NS")) {
echo form_select('news_language', $locale['global_ML100'], $criteriaArray['news_language'], array("options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose'], "width" => "250px", "inline" => TRUE));
} else {
echo form_hidden('news_language', '', $criteriaArray['news_language']);
}
echo form_select('news_keywords', $locale['news_0205'], $criteriaArray['news_keywords'], array("max_length" => 320, "inline" => TRUE, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
echo form_select_tree("news_cat", $locale['news_0201'], $criteriaArray['news_cat'], array("width" => "250px", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
if ($news_settings['news_allow_submission_files']) {
$file_input_options = array('upload_path' => IMAGES_N, 'max_width' => $news_settings['news_photo_max_w'], 'max_height' => $news_settings['news_photo_max_h'], 'max_byte' => $news_settings['news_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $news_settings['news_thumb_w'], 'thumbnail_h' => $news_settings['news_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $news_settings['news_photo_w'], 'thumbnail2_h' => $news_settings['news_photo_h'], 'type' => 'image', "inline" => TRUE);
echo form_fileinput("news_image", $locale['news_0216'], "", $file_input_options);
echo "<div class='small col-sm-offset-3 m-b-10'><span class='p-l-15'>" . sprintf($locale['news_0217'], parsebytesize($news_settings['news_photo_max_b'])) . "</span></div>\n";
$alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
echo form_select('news_ialign', $locale['news_0218'], $criteriaArray['news_ialign'], array("options" => $alignOptions, "inline" => TRUE));
}
echo form_textarea('news_news', $locale['news_0203'], $criteriaArray['news_snippet'], array("required" => TRUE, "html" => TRUE, "form_name" => "submit_form", "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE));
echo form_textarea('news_body', $locale['news_0203b'], $criteriaArray['news_body'], array("required" => $news_settings['news_extended_required'] ? TRUE : FALSE, "html" => TRUE, "form_name" => "submit_form", "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE));
echo fusion_get_settings("site_seo") ? "" : form_button('preview_news', $locale['news_0240'], $locale['news_0240'], array('class' => 'btn-primary m-r-10'));
echo form_button('submit_news', $locale['news_0700'], $locale['news_0700'], array('class' => 'btn-primary'));
echo closeform();
echo "</div>\n</div>\n";
}
} else {
示例4: quantum_module_form
/** Add Modules Plugin Form */
private function quantum_module_form()
{
global $aidlink, $defender, $locale;
$form_action = FUSION_SELF . $aidlink;
if (isset($_GET['action']) && $_GET['action'] == 'module_edit' && isset($_GET['module_id']) && isnum($_GET['module_id'])) {
$form_action .= "&action=" . $_GET['action'] . "&module_id=" . $_GET['module_id'];
$result = dbquery("SELECT * FROM " . $this->field_db . " WHERE field_id='" . $_GET['module_id'] . "'");
if (dbrows($result) > 0) {
$this->field_data = dbarray($result);
if ($this->debug) {
print_p('Old Data');
print_p($this->field_data);
}
} else {
if (!$this->debug) {
addNotice('warning', $locale['field_0205']);
redirect(FUSION_SELF . $aidlink);
}
}
}
$this->field_data['add_module'] = isset($_POST['add_module']) ? form_sanitizer($_POST['add_module']) : $this->field_data['field_name'];
$user_field_name = '';
$user_field_api_version = '';
$user_field_desc = '';
$user_field_dbname = '';
$user_field_dbinfo = '';
if (file_exists($this->plugin_locale_folder . stripinput($this->field_data['add_module']) . ".php") && file_exists($this->plugin_folder . stripinput($this->field_data['add_module']) . "_include_var.php")) {
include $this->plugin_locale_folder . stripinput($this->field_data['add_module']) . ".php";
include $this->plugin_folder . stripinput($this->field_data['add_module']) . "_include_var.php";
$this->user_field_dbinfo = $user_field_dbinfo;
if (!isset($user_field_dbinfo)) {
addNotice('warning', $locale['fields_0602']);
}
} else {
$defender->stop();
addNotice('danger', $locale['fields_0109']);
}
// Script Execution
if (isset($_POST['enable'])) {
$this->field_data = array('add_module' => isset($_POST['add_module']) ? form_sanitizer($_POST['add_module']) : $this->field_data['field_name'], 'field_type' => 'file', 'field_id' => isset($_POST['field_id']) ? form_sanitizer($_POST['field_id'], '', 'field_id') : isset($_GET['module_id']) && isnum($_GET['module_id']) ? $_GET['module_id'] : 0, 'field_title' => form_sanitizer($_POST['field_title'], '', 'field_title'), 'field_name' => form_sanitizer($_POST['field_name'], '', 'field_name'), 'field_cat' => form_sanitizer($_POST['field_cat'], '', 'field_cat'), 'field_default' => form_sanitizer($_POST['field_default'], '', 'field_default'), 'field_error' => form_sanitizer($_POST['field_error'], '', 'field_error'), 'field_required' => isset($_POST['field_required']) ? 1 : 0, 'field_registration' => isset($_POST['field_registration']) ? 1 : 0, 'field_log' => isset($_POST['field_log']) ? 1 : 0, 'field_order' => form_sanitizer($_POST['field_order'], '0', 'field_order'));
$this->field_data['field_name'] = str_replace(' ', '_', $this->field_data['field_name']);
// make sure no space.
$this->create_fields($this->field_data, 'module');
}
echo "<div class='m-t-20'>\n";
echo openform('fieldform', 'post', $form_action, array('max_tokens' => 1));
echo "<p class='strong text-dark'>" . $user_field_name . "</p>\n";
echo "<div class='well'>\n";
echo "<p class='strong'>" . $locale['fields_0400'] . "</p>\n";
echo "<span class='text-dark strong'>" . $locale['fields_0401'] . "</span> " . ($user_field_api_version ? $user_field_api_version : $locale['fields_0402']) . "<br/>\n";
echo "<span class='text-dark strong'>" . $locale['fields_0403'] . "</span>" . ($user_field_dbname ? "<br/>" . $user_field_dbname : '<br/>' . $locale['fields_0404']) . "<br/>\n";
echo "<span class='text-dark strong'>" . $locale['fields_0405'] . "</span>" . ($user_field_dbinfo ? "<br/>" . $user_field_dbinfo : '<br/>' . $locale['fields_0406']) . "<br/>\n";
echo "<span class='text-dark strong'>" . $locale['fields_0407'] . "</span>" . ($user_field_desc ? "<br/>" . $user_field_desc : '') . "<br/>\n";
echo "</div>\n";
echo "<hr/>\n";
// start form.
$disable_opts = array();
foreach ($this->page_list as $index => $v) {
$disable_opts[] = $index;
}
echo form_select_tree('field_cat', $locale['fields_0410'], $this->field_data['field_cat'], array('no_root' => 1, 'disable_opts' => $disable_opts), $this->category_db, 'field_cat_name', 'field_cat_id', 'field_parent');
if ($user_field_dbinfo != "") {
if (version_compare($user_field_api_version, "1.01.00", ">=")) {
echo form_checkbox('field_required', $locale['fields_0411'], $this->field_data['field_required']);
} else {
echo "<p>\n" . $locale['428'] . "</p>\n";
}
}
if ($user_field_dbinfo != "") {
if (version_compare($user_field_api_version, "1.01.00", ">=")) {
echo form_checkbox('field_log', $locale['fields_0412'], $this->field_data['field_log']);
} else {
echo "<p>\n" . $locale['429a'] . "</p>\n";
}
}
if ($user_field_dbinfo != "") {
echo form_checkbox('field_registration', $locale['fields_0413'], $this->field_data['field_registration']);
}
echo form_text('field_order', $locale['fields_0414'], $this->field_data['field_order']);
echo form_hidden('add_module', '', $this->field_data['add_module']);
echo form_hidden('field_name', '', $user_field_dbname);
echo form_hidden('field_title', '', $user_field_name);
// new api introduced
echo form_hidden('field_default', '', isset($user_field_default) ? $user_field_default : '');
echo form_hidden('field_options', '', isset($user_field_options) ? $user_field_options : '');
echo form_hidden('field_error', '', isset($user_field_error) ? $user_field_error : '');
echo form_hidden('field_config', '', isset($user_field_config) ? $user_field_config : '');
echo form_hidden('field_id', '', $this->field_data['field_id']);
echo form_button('enable', $this->field_data['field_id'] ? $locale['fields_0415'] : $locale['fields_0416'], $this->field_data['field_id'] ? $locale['fields_0415'] : $locale['fields_0416'], array('class' => 'btn-primary btn-sm'));
echo closeform();
echo "</div>\n";
}
示例5: openside
echo "</div>\n";
echo "</div>\n";
// end package
openside();
if (fusion_get_settings('comments_enabled') == "0" || fusion_get_settings('ratings_enabled') == "0") {
$sys = "";
if (fusion_get_settings('comments_enabled') == "0" && fusion_get_settings('ratings_enabled') == "0") {
$sys = $locale['comments_ratings'];
} elseif (fusion_get_settings('comments_enabled') == "0") {
$sys = $locale['comments'];
} else {
$sys = $locale['ratings'];
}
echo "<div class='well'>" . sprintf($locale['download_0256'], $sys) . "</div>\n";
}
echo form_select_tree("download_cat", $locale['download_0207'], $callback_data['download_cat'], array("no_root" => 1, "placeholder" => $locale['choose'], 'width' => '100%', "query" => multilang_table("DL") ? "WHERE download_cat_language='" . LANGUAGE . "'" : ""), DB_DOWNLOAD_CATS, "download_cat_name", "download_cat_id", "download_cat_parent");
echo form_select('download_visibility', $locale['download_0205'], $callback_data['download_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%'));
echo form_button('publish', $locale['download_0061'], $locale['download_0061'], array('class' => 'btn-primary m-r-10'));
closeside();
openside('');
echo form_checkbox('download_allow_comments', $locale['download_0223'], $callback_data['download_allow_comments'], array('class' => 'm-b-0'));
echo form_checkbox('download_allow_ratings', $locale['download_0224'], $callback_data['download_allow_ratings'], array('class' => 'm-b-0'));
if (isset($_GET['action']) && $_GET['action'] == "edit") {
echo form_checkbox('update_datestamp', $locale['download_0213'], '', array('class' => 'm-b-0'));
}
closeside();
openside();
echo form_text('download_license', $locale['download_0208'], $callback_data['download_license'], array('inline' => 1));
echo form_text('download_copyright', $locale['download_0222'], $callback_data['download_copyright'], array('inline' => 1));
echo form_text('download_os', $locale['download_0209'], $callback_data['download_os'], array('inline' => 1));
echo form_text('download_version', $locale['download_0210'], $callback_data['download_version'], array('inline' => 1));
示例6: openform
echo openform('inputform', 'post', $formaction, array('enctype' => 1, 'max_tokens' => 1));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
echo form_hidden("blog_id", "", $data['blog_id']);
echo form_hidden("blog_datestamp", "", $data['blog_datestamp']);
echo form_text('blog_subject', $locale['blog_0422'], $data['blog_subject'], array('required' => TRUE, 'max_length' => 200, 'error_text' => $locale['blog_0450']));
// move keywords here because it's required
echo form_select('blog_keywords', $locale['blog_0443'], $data['blog_keywords'], array("max_length" => 320, "placeholder" => $locale['blog_0444'], "width" => "100%", "error_text" => $locale['blog_0457'], "tags" => TRUE, "multiple" => TRUE));
echo "<div class='pull-left m-r-10 display-inline-block'>\n";
echo form_datepicker('blog_start', $locale['blog_0427'], $data['blog_start'], array("placeholder" => $locale['blog_0429'], "join_to_id" => "blog_end"));
echo "</div>\n<div class='pull-left m-r-10 display-inline-block'>\n";
echo form_datepicker('blog_end', $locale['blog_0428'], $data['blog_end'], array("placeholder" => $locale['blog_0429'], "join_from_id" => "blog_start"));
echo "</div>\n";
echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
openside('');
echo form_select_tree("blog_cat[]", $locale['blog_0423'], $data['blog_cat'], array("width" => "100%", "delimiter" => ".", "inline" => TRUE, "no_root" => TRUE, "tags" => TRUE, "multiple" => TRUE, "query" => multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : ""), DB_BLOG_CATS, "blog_cat_name", "blog_cat_id", "blog_cat_parent");
echo form_select('blog_visibility', $locale['blog_0430'], $data['blog_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
if (multilang_table("BL")) {
echo form_select('blog_language', $locale['global_ML100'], $data['blog_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
} else {
echo form_hidden('blog_language', '', $data['blog_language']);
}
echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
echo form_button('save', $locale['blog_0437'], $locale['blog_0437'], array('class' => 'btn-success', 'icon' => 'fa fa-square-check-o'));
closeside();
echo "</div>\n</div>\n";
$snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['blog_0425a'], "form_name" => "inputform");
if (fusion_get_settings("tinymce_enabled")) {
$snippetSettings = array("required" => TRUE, "type" => "tinymce", "tinymce" => "advanced");
}
echo form_textarea('blog_blog', $locale['blog_0425'], $data['blog_blog'], $snippetSettings);
示例7: display_sitelinks_form
/**
* Site Links Form
*/
private function display_sitelinks_form()
{
$locale = fusion_get_locale();
fusion_confirm_exit();
if (isset($_POST['savelink'])) {
$this->data = array("link_id" => form_sanitizer($_POST['link_id'], 0, 'link_id'), "link_cat" => form_sanitizer($_POST['link_cat'], 0, 'link_cat'), "link_name" => form_sanitizer($_POST['link_name'], '', 'link_name'), "link_url" => form_sanitizer($_POST['link_url'], '', 'link_url'), "link_icon" => form_sanitizer($_POST['link_icon'], '', 'link_icon'), "link_language" => form_sanitizer($_POST['link_language'], '', 'link_language'), "link_visibility" => form_sanitizer($_POST['link_visibility'], '', 'link_visibility'), "link_position" => form_sanitizer($_POST['link_position'], '', 'link_position'), "link_order" => form_sanitizer($_POST['link_order'], '', 'link_order'), "link_window" => form_sanitizer(isset($_POST['link_window']) && $_POST['link_window'] == 1 ? 1 : 0, 0, 'link_window'));
if ($this->data['link_position'] > 3) {
$this->data['link_position'] = form_sanitizer($_POST['link_position_id'], 3, 'link_position_id');
}
if (empty($this->data['link_order'])) {
$max_order_query = "SELECT MAX(link_order) 'link_order' FROM " . DB_SITE_LINKS . "\n " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . "\n link_cat='" . $this->data['link_cat'] . "'";
$this->data['link_order'] = dbresult(dbquery($max_order_query), 0) + 1;
}
if (\defender::safe()) {
if (!empty($this->data['link_id'])) {
dbquery_order(DB_SITE_LINKS, $this->data['link_order'], "link_order", $this->data['link_id'], "link_id", $this->data['link_cat'], "link_cat", multilang_table("SL"), "link_language", "update");
dbquery_insert(DB_SITE_LINKS, $this->data, 'update');
addNotice("success", $locale['SL_0016']);
} else {
dbquery_order(DB_SITE_LINKS, $this->data['link_order'], "link_order", $this->data['link_id'], "link_id", $this->data['link_cat'], "link_cat", multilang_table("SL"), "link_language", "save");
dbquery_insert(DB_SITE_LINKS, $this->data, 'save');
addNotice("success", $locale['SL_0015']);
}
redirect(clean_request("link_cat=" . $this->data['link_cat'], array('ref'), FALSE));
}
}
echo "<div class='m-t-20'>\n";
echo openform('link_administration_frm', 'post', FUSION_REQUEST);
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-8 col-lg-8'>\n";
echo form_hidden('link_id', '', $this->data['link_id']);
echo form_textarea('link_name', $locale['SL_0020'], $this->data['link_name'], array('max_length' => 100, 'required' => TRUE, 'error_text' => $locale['SL_0085'], 'form_name' => 'linkform', 'type' => 'bbcode', 'inline' => TRUE));
echo form_text('link_icon', 'Link Icon', $this->data['link_icon'], array('max_length' => 100, 'inline' => TRUE));
echo form_text('link_url', $locale['SL_0021'], $this->data['link_url'], array('required' => TRUE, 'error_text' => $locale['SL_0086'], 'inline' => TRUE));
echo form_text('link_order', $locale['SL_0023'], $this->data['link_order'], array('class' => 'pull-left', 'inline' => TRUE, 'width' => '250px', 'type' => 'number'));
// There will be a trick to manipulate the situation here
if ($this->data['link_position'] > 3) {
$this->data['link_position_id'] = $this->data['link_position'];
$this->data['link_position'] = 4;
}
echo form_select('link_position', $locale['SL_0024'], $this->data['link_position'], array('options' => $this->position_opts, 'inline' => TRUE, 'stacked' => form_text('link_position_id', '', $this->data['link_position_id'], array('required' => true, 'placeholder' => 'ID', 'type' => 'number', 'type' => 'number', 'width' => '150px'))));
add_to_jquery("\n checkLinkPosition( " . $this->data['link_position'] . " );\n \$('#link_position').bind('change', function(e) {\n checkLinkPosition( \$(this).val() );\n });\n ");
echo "</div>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-4 col-lg-4'>\n";
echo form_select_tree("link_cat", $locale['SL_0029'], $this->data['link_cat'], array('input_id' => 'link_categorys', "parent_value" => $locale['parent'], 'width' => '100%', 'query' => multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "'" : '', 'disable_opts' => $this->data['link_id'], 'hide_disabled' => 1), DB_SITE_LINKS, "link_name", "link_id", "link_cat");
echo form_select('link_language', $locale['global_ML100'], $this->data['link_language'], array('options' => $this->language_opts, 'placeholder' => $locale['choose'], 'width' => '100%'));
echo form_select('link_visibility', $locale['SL_0022'], $this->data['link_visibility'], array('options' => self::get_LinkVisibility(), 'placeholder' => $locale['choose'], 'width' => '100%'));
echo form_checkbox('link_window', $locale['SL_0028'], $this->data['link_window']);
echo "</div>\n";
echo "</div>\n";
echo form_button('savelink', $locale['SL_0040'], $locale['SL_0040'], array('class' => 'btn-primary m-r-10', 'input_id' => 'savelink_2'));
echo form_button("cancel", $locale['cancel'], "cancel", array('input_id' => 'cancel2'));
echo closeform();
echo "</div>\n";
}
示例8: opentabbody
echo opentabbody($articleCatTab['title'][0], $articleCatTab['id'][0], $tab_active);
echo "<table class='table table-responsive table-hover table-striped'>\n";
if (dbcount("(article_cat_id)", DB_ARTICLE_CATS, multilang_table("AR") ? "article_cat_language='" . LANGUAGE . "'" : "")) {
showcatlist();
} else {
echo "<tr><td align='center' class='tbl1' colspan='2'>" . $locale['articles_0342'] . "</td></tr>\n";
}
echo "</table>\n";
echo closetabbody();
echo opentabbody($articleCatTab['title'][1], $articleCatTab['id'][1], $tab_active);
echo openform('addcat', 'post', FUSION_REQUEST, array('class' => "m-t-20"));
echo form_hidden("cat_id", "", $cat_id);
echo form_text('cat_name', $locale['articles_0300'], $cat_name, array("inline" => true, "required" => true, 'error_text' => $locale['articles_0351']));
$textArea_opts = array("required" => TRUE, "type" => fusion_get_settings("tinymce_enabled") ? "tinymce" : "html", "tinymce" => fusion_get_settings("tinymce_enabled") && iADMIN ? "advanced" : "", "autosize" => TRUE, "inline" => TRUE, "preview" => TRUE, "form_name" => "addcat");
echo form_textarea('cat_description', $locale['articles_0301'], $cat_description, $textArea_opts);
echo form_select_tree("cat_parent", $locale['articles_0308'], $cat_parent, array("inline" => true, "disable_opts" => $cat_hidden, "hide_disabled" => TRUE), DB_ARTICLE_CATS, "article_cat_name", "article_cat_id", "article_cat_parent");
if (multilang_table("AR")) {
echo form_select('cat_language', $locale['global_ML100'], $cat_language, array("inline" => true, 'options' => $language_opts, 'placeholder' => $locale['choose']));
} else {
echo form_hidden('cat_language', '', $cat_language);
}
echo "<div class='row m-0'>\n";
echo "<label class='label-control col-xs-12 col-sm-3 p-l-0'>" . $locale['articles_0302'] . "</label>\n";
echo "<div class='col-xs-12 col-sm-3 p-l-0'>\n";
echo form_select('cat_sort_by', "", $cat_sort_by, array("inline" => TRUE, "width" => "100%", 'options' => array('1' => $locale['articles_0303'], '2' => $locale['articles_0304'], '3' => $locale['articles_0305']), 'class' => 'pull-left m-r-10'));
echo "</div>\n";
echo "<div class='col-xs-12 col-sm-2'>\n";
echo form_select('cat_sort_order', '', $cat_sort_order, array("inline" => true, "width" => "100%", 'options' => array('ASC' => $locale['articles_0306'], 'DESC' => $locale['articles_0307']), 'placeholder' => $locale['choose']));
echo "</div>\n";
echo "</div>\n";
echo form_button('save_cat', $locale['articles_0309'], $locale['articles_0309'], array('class' => 'btn-primary', 'inline' => 1));
示例9: dbarray
if (dbrows($result)) {
$data = dbarray($result);
$data['news_cat_hidden'] = array($data['news_cat_id']);
$formTitle = $locale['news_0021'];
} else {
// FUSION_REQUEST without the "action" gets
redirect(clean_request("", array("action"), FALSE));
}
}
add_breadcrumb(array('link' => "", 'title' => $formTitle));
opentable($formTitle);
echo openform("addcat", "post", $formAction);
openside("");
echo form_hidden("news_cat_id", "", $data['news_cat_id']);
echo form_text("news_cat_name", $locale['news_0300'], $data['news_cat_name'], array("required" => TRUE, "inline" => TRUE, "error_text" => $locale['news_0351']));
echo form_select_tree("news_cat_parent", $locale['news_0305'], $data['news_cat_parent'], array("inline" => TRUE, "disable_opts" => $data['news_cat_hidden'], "hide_disabled" => TRUE, "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
if (multilang_table("NS")) {
echo form_select("news_cat_language", $locale['global_ML100'], $data['news_cat_language'], array("inline" => TRUE, "options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose']));
} else {
echo form_hidden("news_cat_language", "", $data['news_cat_language']);
}
echo form_select("news_cat_image", $locale['news_0301'], $data['news_cat_image'], array("inline" => TRUE, "options" => newsCatImageOpts()));
echo form_button("save_cat", $locale['news_0302'], $locale['news_0302'], array("class" => "btn-success"));
closeside();
openside($locale['news_0020']);
$result = dbquery("SELECT news_cat_id, news_cat_name FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY news_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
$counter = 0;
$columns = 4;
echo "<div class='row'>\n";
示例10: dbquery
}
// update current forum
dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . time() . "', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='" . $post_data['post_author'] . "' WHERE forum_id='" . $post_data['forum_id'] . "'");
// update current thread
dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . time() . "', thread_lastpostid='" . $post_data['post_id'] . "', thread_lastuser='" . $post_data['post_author'] . "' WHERE thread_id='" . $post_data['thread_id'] . "'");
// set notify
if ($forum_settings['thread_notify'] && isset($_POST['notify_me']) && $post_data['thread_id']) {
if (!dbcount("(thread_id)", DB_FORUM_THREAD_NOTIFY, "thread_id='" . $post_data['thread_id'] . "' AND notify_user='" . $post_data['post_author'] . "'")) {
dbquery("INSERT INTO " . DB_FORUM_THREAD_NOTIFY . " (thread_id, notify_datestamp, notify_user, notify_status) VALUES('" . $post_data['thread_id'] . "', '" . time() . "', '" . $post_data['post_author'] . "', '1')");
}
}
if ($defender->safe()) {
redirect(INFUSIONS . "forum/postify.php?post=new&error=0&forum_id=" . intval($post_data['forum_id']) . "&parent_id=" . intval($post_data['forum_cat']) . "&thread_id=" . intval($post_data['thread_id'] . ""));
}
} else {
addNotice("danger", $locale['forum_0186']);
}
} else {
addNotice("danger", $locale['forum_0187']);
redirect(INFUSIONS . "forum/index.php");
}
}
}
$form_action = INFUSIONS . "forum/newthread.php";
$info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', $form_action, array('enctype' => FALSE)), 'closeform' => closeform(), 'forum_id_field' => '', 'thread_id_field' => '', 'forum_field' => form_select_tree("forum_id", $locale['forum_0395'], $thread_data['forum_id'], array("required" => true, "width" => "320px", "no_root" => TRUE, "query" => multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "'" : ""), DB_FORUMS, "forum_name", "forum_id", "forum_cat"), 'subject_field' => form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => 1, 'placeholder' => $locale['forum_2001'], 'error_text' => '', 'class' => 'm-t-20 m-b-20')), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => 1, 'error_text' => '', 'autosize' => 1, 'no_resize' => 1, 'preview' => 1, 'form_name' => 'input_form', 'bbcode' => 1)), 'attachment_field' => "", 'poll_form' => "", 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0')), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0')) : '', 'sticky_field' => iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0')) : '', 'lock_field' => iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0')) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0')) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
postform($info);
}
} else {
redirect(INFUSIONS . 'forum/index.php');
}
require_once THEMES . "templates/footer.php";
示例11: opentabbody
echo opentabbody($tab_title['title'][0], $tab_title['id'][0], $tab_active);
echo openform('addcat', 'post', FUSION_REQUEST, array('class' => 'm-t-20'));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-8'>\n";
openside('');
echo form_hidden("download_cat_id", "", $data['download_cat_id']);
echo form_text('download_cat_name', $locale['download_0300'], $data['download_cat_name'], array('required' => TRUE, 'error_text' => $locale['download_0351']));
echo form_textarea('download_cat_description', $locale['download_0301'], $data['download_cat_description'], array('resize' => 0, 'autosize' => TRUE));
echo "<div class='clearfix'>\n";
echo form_select('download_cat_sort_by', $locale['download_0302'], $data['download_cat_sort_by'], array('options' => array('1' => $locale['download_0303'], '2' => $locale['download_0304'], '3' => $locale['download_0305']), 'class' => 'pull-left m-r-10', 'width' => '200px'));
echo form_select('download_cat_sort_order', '', $data['download_cat_sort_order'], array('options' => array('ASC' => $locale['download_0306'], 'DESC' => $locale['download_0307']), 'class' => 'pull-left', 'width' => '200px'));
echo "</div>\n";
closeside();
echo "</div>\n<div class='col-xs-12 col-sm-4'>\n";
openside('');
echo form_select_tree("download_cat_parent", $locale['download_0308'], $data['download_cat_parent'], array("disable_opts" => $data['download_cat_hidden'], "hide_disabled" => TRUE, 'width' => '100%'), DB_DOWNLOAD_CATS, "download_cat_name", "download_cat_id", "download_cat_parent");
if (multilang_table("DL")) {
echo form_select('download_cat_language', $locale['global_ML100'], $data['download_cat_language'], array('options' => $language_opts, 'placeholder' => $locale['choose'], 'width' => '100%'));
} else {
echo form_hidden('download_cat_language', '', $data['download_cat_language']);
}
closeside();
echo "</div>\n</div>\n";
echo form_button('save_cat', $locale['download_0309'], $locale['download_0309'], array('class' => 'btn-success btn-sm m-t-10', 'icon' => 'fa fa-check-square-o'));
echo closeform();
echo closetabbody();
echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active);
$row_num = 0;
showcatlist();
if ($row_num == 0) {
echo "<div class='well text-center'>" . $locale['download_0313'] . "</div>\n";
示例12: form_select_tree
/**
* Select2 hierarchy
* Returns a full hierarchy nested dropdown.
* @param $input_name
* @param string $label
* @param bool $input_value
* @param array $options
* @param $db - your db
* @param $name_col - the option text to show
* @param $id_col - unique id
* @param $cat_col - parent id
* ## The rest of the Params are used by the function itself -- no need to handle ##
* @param bool $self_id - not required
* @param bool $id - not required
* @param bool $level - not required
* @param bool $index - not required
* @param bool $data - not required
* @return string
*/
function form_select_tree($input_name, $label = "", $input_value = FALSE, array $options = array(), $db, $name_col, $id_col, $cat_col, $self_id = FALSE, $id = FALSE, $level = FALSE, $index = FALSE, $data = FALSE)
{
global $defender, $locale;
if (!defined("SELECT2")) {
define("SELECT2", TRUE);
add_to_footer("<script src='" . DYNAMICS . "assets/select2/select2.min.js' /></script>\n");
add_to_head("<link href='" . DYNAMICS . "assets/select2/select2.css' rel='stylesheet' />\n");
}
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$default_options = array('required' => FALSE, 'regex' => '', 'input_id' => $input_name, 'placeholder' => $locale['choose'], 'deactivate' => FALSE, 'safemode' => FALSE, 'allowclear' => FALSE, 'multiple' => FALSE, 'width' => '250px', 'keyflip' => FALSE, 'tags' => FALSE, 'jsonmode' => FALSE, 'chainable' => FALSE, 'maxselect' => FALSE, 'error_text' => $locale['error_input_default'], 'class' => '', 'inline' => FALSE, 'tip' => '', 'delimiter' => ',', 'callback_check' => '', 'file' => '', 'parent_value' => $locale['root'], 'add_parent_opts' => FALSE, 'disable_opts' => '', 'hide_disabled' => FALSE, 'no_root' => FALSE, 'show_current' => FALSE, 'query' => '');
$options += $default_options;
$options['input_id'] = trim($options['input_id'], "[]");
if ($options['multiple']) {
if ($input_value) {
$input_value = construct_array($input_value, 0, $options['delimiter']);
} else {
$input_value = array();
}
}
if (!$options['width']) {
$options['width'] = $default_options['width'];
}
$allowclear = $options['placeholder'] && $options['multiple'] || $options['allowclear'] ? "allowClear:true" : '';
$disable_opts = '';
if ($options['disable_opts']) {
$disable_opts = is_array($options['disable_opts']) ? $options['disable_opts'] : explode(',', $options['disable_opts']);
}
/* Child patern */
$opt_pattern = str_repeat("—", $level);
if (!$level) {
$level = 0;
if (!isset($index[$id])) {
$index[$id] = array('0' => $locale['no_opts']);
}
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
$new_error_text = $defender->getErrorText($input_name);
if (!empty($new_error_text)) {
$options['error_text'] = $new_error_text;
}
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
$html = "<div id='" . $options['input_id'] . "-field' class='form-group " . $error_class . $options['class'] . "' " . ($options['inline'] && $options['width'] && !$label ? "style='width: " . $options['width'] . "'" : '') . ">\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 p-l-0" : 'col-xs-12 p-l-0') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] == TRUE ? "<span class='required'>*</span>" : '') . " " . ($options['tip'] ? "<i class='pointer fa fa-question-circle' label=\"" . $options['tip'] . "\"></i>" : '') . "</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 " . ($label ? "col-sm-9 col-md-9 col-lg-9" : "col-sm-12") . "'>\n" : "";
}
if ($level == 0) {
$html =& $html;
add_to_jquery("\n\t\t\$('#" . $options['input_id'] . "').select2({\n\t\tplaceholder: '" . $options['placeholder'] . "',\n\t\t{$allowclear}\n\t\t});\n\t\t");
if (is_array($input_value) && $options['multiple']) {
// stores as value;
$vals = '';
foreach ($input_value as $arr => $val) {
$vals .= $arr == count($input_value) - 1 ? "'{$val}'" : "'{$val}',";
}
add_to_jquery("\$('#" . $options['input_id'] . "').select2('val', [{$vals}]);");
}
$html .= "<select name='{$input_name}' id='" . $options['input_id'] . "' style='width: " . ($options['width'] ? $options['width'] : $default_options['width']) . "' " . ($options['deactivate'] ? " disabled" : "") . ($options['multiple'] ? " multiple" : "") . ">";
$html .= $options['allowclear'] ? "<option value=''></option>" : '';
if ($options['no_root'] == FALSE) {
// api options to remove root from selector. used in items creation.
$this_select = '';
if ($input_value !== NULL) {
if ($input_value !== '') {
$this_select = 'selected';
}
}
$html .= $options['add_parent_opts'] == TRUE ? "<option value='0' " . $this_select . ">{$opt_pattern} " . $locale['parent'] . "</option>\n" : "<option value='0' " . $this_select . " >{$opt_pattern} " . $options['parent_value'] . "</option>\n";
}
$index = dbquery_tree($db, $id_col, $cat_col, $options['query']);
$data = dbquery_tree_data($db, $id_col, $cat_col, $options['query']);
}
if (!$id) {
$id = 0;
}
if (isset($index[$id])) {
foreach ($index[$id] as $key => $value) {
//$hide = $disable_branch && $value == $self_id ? 1 : 0;
//.........这里部分代码省略.........
示例13: _delete_category
//.........这里部分代码省略.........
dbquery($field_del_sql);
}
// drop a column
if (!empty($target_database)) {
self::drop_column($target_database, $data['field_name']);
}
}
}
}
addNotice('success', $this->locale['field_0200']);
redirect(FUSION_SELF . $aidlink);
}
} elseif (!isset($_POST['delete_field']) && isset($_POST['move_field']) && $_POST['move_field'] > 0) {
$rows = dbcount("(field_id)", $this->field_db, "field_cat='" . intval($_GET['cat_id']) . "'");
if ($rows) {
$new_parent = form_sanitizer($_POST['move_field'], 0, 'move_field');
dbquery("UPDATE " . $this->field_db . " SET field_cat='" . intval($new_parent) . "' WHERE field_cat='" . intval($_GET['cat_id']) . "'");
}
}
// Delete the current category
$delete_cat_sql = "DELETE FROM " . $this->category_db . " WHERE field_cat_id='" . intval($_GET['cat_id']) . "'";
if ($this->debug) {
print_p($delete_cat_sql);
} else {
dbquery($delete_cat_sql);
addNotice('success', $this->locale['field_0200']);
redirect(FUSION_SELF . $aidlink);
}
} else {
// show interior form
$field_list = array();
$form_action = FUSION_SELF . $aidlink . "&action=cat_delete&cat_id=" . $_GET['cat_id'];
$result = dbquery("SELECT * FROM " . $this->category_db . " WHERE field_cat_id='" . $_GET['cat_id'] . "' OR field_cat_id='" . get_hkey($this->category_db, "field_cat_id", "field_parent", $_GET['cat_id']) . "'");
if (dbrows($result) > 0) {
$data += dbarray($result);
// get field list - populate child fields of a category.
$result = dbquery("SELECT field_id, field_name, field_cat FROM " . $this->field_db . " WHERE field_cat='" . intval($_GET['cat_id']) . "'");
if (dbrows($result) > 0) {
// get field list.
while ($data = dbarray($result)) {
$field_list[$data['field_cat']][$data['field_id']] = $data['field_name'];
}
}
if (isset($this->page[$data['field_parent']]) or !empty($field_list) && $field_list[$_GET['cat_id']] > 0) {
ob_start();
echo openmodal("delete", $this->locale['fields_0313'], array('class' => 'modal-lg modal-center', 'static' => TRUE));
echo openform('delete_cat_form', 'post', $form_action);
if (isset($this->page[$_GET['cat_id']])) {
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-6'>\n<span class='strong'>" . sprintf($this->locale['fields_0600'], count($this->page[$_GET['cat_id']])) . "</span><br/>\n";
echo "<div class='alert alert-info m-t-10'>\n";
echo "<ol style='list-style:inherit !important; margin-bottom:0;'>\n";
foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
echo "<li style='list-style-type:decimal;'>" . self::parse_label($field_category['field_cat_name']) . "</li>\n";
}
echo "</ol>\n";
echo "</div>\n";
echo "</div>\n<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n";
$page_list = $this->page_list;
unset($page_list[$_GET['cat_id']]);
if (count($page_list) > 0) {
echo form_select('move_subcat', $this->locale['fields_0314'], '', array("options" => $page_list));
}
echo form_checkbox('delete_subcat', $this->locale['fields_0315'], count($page_list) < 1 ? TRUE : FALSE);
echo "</div></div>";
}
if (isset($field_list[$_GET['cat_id']])) {
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n<span class='strong'>" . sprintf($this->locale['fields_0601'], count($field_list[$_GET['cat_id']])) . "</span><br/>\n";
echo "<div class='well strong m-t-10'>\n";
foreach ($field_list[$_GET['cat_id']] as $arr => $field) {
echo "- " . $field . "<br/>\n";
}
echo "</div>\n";
echo "</div>\n<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n";
$exclude_list[] = $_GET['cat_id'];
foreach ($this->page_list as $page_id => $page_name) {
$exclude_list[] = $page_id;
}
echo form_select_tree('move_field', $this->locale['fields_0316'], '', array('no_root' => 1, 'disable_opts' => $exclude_list), $this->category_db, 'field_cat_name', 'field_cat_id', 'field_parent');
echo form_checkbox('delete_field', $this->locale['fields_0317'], '');
echo "</div></div>";
}
echo form_button('delete_cat', $this->locale['fields_0313'], $this->locale['fields_0313'], array('class' => 'btn-danger btn-sm'));
echo form_button('cancel', $this->locale['cancel'], $this->locale['cancel'], array('class' => 'btn-default m-l-10 btn-sm'));
echo closeform();
echo closemodal();
add_to_footer(ob_get_contents());
ob_end_clean();
}
} else {
if ($this->debug) {
notify('Cat ID was not found. Please check again.', 'Category ID was not found. Please check again.');
} else {
redirect(FUSION_SELF . $aidlink);
}
}
}
}
}
示例14: display_news_form
//.........这里部分代码省略.........
}
}
} elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_POST['news_id']) && isnum($_POST['news_id'])) || isset($_GET['news_id']) && isnum($_GET['news_id'])) {
$result = dbquery("SELECT * FROM " . DB_NEWS . " WHERE news_id='" . (isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id']) . "'");
if (dbrows($result)) {
$data = dbarray($result);
} else {
redirect(FUSION_SELF . $aidlink);
}
}
$result = dbquery("SELECT news_cat_id, news_cat_name FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY news_cat_name");
$news_cat_opts = array();
$news_cat_opts['0'] = $locale['news_0202'];
if (dbrows($result)) {
while ($odata = dbarray($result)) {
$news_cat_opts[$odata['news_cat_id']] = $odata['news_cat_name'];
}
}
echo "<div class='m-t-20'>\n";
$news_settings = get_settings("news");
echo openform('news_form', 'post', $formaction, array('enctype' => 1));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
echo form_hidden('news_id', "", $data['news_id']);
echo form_text('news_subject', $locale['news_0200'], $data['news_subject'], array('required' => 1, 'max_length' => 200, 'error_text' => $locale['news_0250']));
echo form_select('news_keywords', $locale['news_0205'], $data['news_keywords'], array("max_length" => 320, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
echo "<div class='pull-left m-r-10 display-inline-block'>\n";
echo form_datepicker('news_start', $locale['news_0206'], $data['news_start'], array('placeholder' => $locale['news_0208'], "join_to_id" => "news_end"));
echo "</div>\n<div class='pull-left m-r-10 display-inline-block'>\n";
echo form_datepicker('news_end', $locale['news_0207'], $data['news_end'], array('placeholder' => $locale['news_0208'], "join_from_id" => "news_start"));
echo "</div>\n";
echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
openside('');
echo form_select_tree("news_cat", $locale['news_0201'], $data['news_cat'], array("width" => "100%", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
echo form_select('news_visibility', $locale['news_0209'], $data['news_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
if (multilang_table("NS")) {
echo form_select('news_language', $locale['global_ML100'], $data['news_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
} else {
echo form_hidden('news_language', '', $data['news_language']);
}
echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
closeside();
echo "</div>\n</div>\n";
$snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203a'], "form_name" => "news_form");
if (fusion_get_settings("tinymce_enabled")) {
$snippetSettings = array("required" => TRUE, "type" => "tinymce", "tinymce" => "advanced");
}
echo form_textarea('news_news', $locale['news_0203'], $data['news_news'], $snippetSettings);
if (!fusion_get_settings("tinymce_enabled")) {
$extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203b'], "form_name" => "news_form");
} else {
$extendedSettings = array("type" => "tinymce", "tinymce" => "advanced");
}
echo form_textarea('news_extended', $locale['news_0204'], $data['news_extended'], $extendedSettings);
// second row
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
openside('');
if ($data['news_image'] != "" && $data['news_image_t1'] != "") {
$image_thumb = get_news_image_path($data['news_image'], $data['news_image_t1'], $data['news_image_t2']);
if (!$image_thumb) {
$image_thumb = IMAGES . "imagenotfound70.jpg";
}
echo "<div class='row'>\n";
示例15: display_news_cat_form
/**
* Displays News Category Form
*/
function display_news_cat_form()
{
global $aidlink;
$locale = fusion_get_locale();
if (isset($_POST['cancel'])) {
redirect(FUSION_SELF . $aidlink . "§ion=news_category");
}
/**
* Delete category images
*/
if (isset($_GET['action']) && $_GET['action'] == "delete" && (isset($_GET['cat_id']) && isnum($_GET['cat_id']))) {
$result = dbcount("(news_cat)", DB_NEWS, "news_cat='" . $_GET['cat_id'] . "'") || dbcount("(news_cat_id)", DB_NEWS_CATS, "news_cat_parent='" . $_GET['cat_id'] . "'");
if (!empty($result)) {
addNotice("success", $locale['news_0152'] . $locale['news_0153']);
} else {
$result = dbquery("DELETE FROM " . DB_NEWS_CATS . " WHERE news_cat_id='" . $_GET['cat_id'] . "'");
addNotice("success", $locale['news_0154']);
}
// FUSION_REQUEST without the "action" gets
redirect(clean_request("", array("action"), FALSE));
}
$data = array("news_cat_id" => 0, "news_cat_name" => "", "news_cat_hidden" => array(), "news_cat_parent" => 0, "news_cat_image" => "", "news_cat_draft" => FALSE, "news_cat_visibility" => iGUEST, "news_cat_sticky" => FALSE, "news_cat_featured" => FALSE, "news_cat_language" => LANGUAGE);
$formAction = FUSION_REQUEST;
$formTitle = $locale['news_0022'];
// if edit, override $data
if (isset($_POST['save_cat']) or isset($_POST['save_cat_and_close'])) {
$inputArray = array("news_cat_id" => form_sanitizer($_POST['news_cat_id'], "", "news_cat_id"), "news_cat_name" => form_sanitizer($_POST['news_cat_name'], "", "news_cat_name"), "news_cat_parent" => form_sanitizer($_POST['news_cat_parent'], 0, "news_cat_parent"), "news_cat_visibility" => form_sanitizer($_POST['news_cat_visibility'], 0, "news_cat_visibility"), "news_cat_draft" => isset($_POST['news_cat_draft']) ? 1 : 0, "news_cat_sticky" => isset($_POST['news_cat_sticky']) ? 1 : 0, "news_cat_image" => form_sanitizer($_POST['news_cat_image'], "", "news_cat_image"), "news_cat_language" => form_sanitizer($_POST['news_cat_language'], LANGUAGE, "news_cat_language"));
$categoryNameCheck = array("when_updating" => "news_cat_name='" . $inputArray['news_cat_name'] . "' and news_cat_id !='" . $inputArray['news_cat_id'] . "' " . (multilang_table("NS") ? "and news_cat_language = '" . LANGUAGE . "'" : ""), "when_saving" => "news_cat_name='" . $inputArray['news_cat_name'] . "' " . (multilang_table("NS") ? "and news_cat_language = '" . LANGUAGE . "'" : ""));
if (defender::safe()) {
// check category name is unique when updating
if (dbcount("(news_cat_id)", DB_NEWS_CATS, "news_cat_id='" . $inputArray['news_cat_id'] . "'")) {
if (!dbcount("(news_cat_id)", DB_NEWS_CATS, $categoryNameCheck['when_updating'])) {
dbquery_insert(DB_NEWS_CATS, $inputArray, "update");
addNotice("success", $locale['news_0151']);
if (isset($_POST['save_cat_and_close'])) {
redirect(clean_request("", array("action", "ref"), FALSE));
} else {
redirect(FUSION_REQUEST);
}
} else {
addNotice('danger', $locale['news_0352']);
}
} else {
// check category name is unique when saving new
if (!dbcount("(news_cat_id)", DB_NEWS_CATS, $categoryNameCheck['when_saving'])) {
dbquery_insert(DB_NEWS_CATS, $inputArray, "save");
addNotice("success", $locale['news_0150']);
if (isset($_POST['save_cat_and_close'])) {
redirect(clean_request("", array("action", "ref"), FALSE));
} else {
redirect(FUSION_REQUEST);
}
} else {
addNotice('danger', $locale['news_0352']);
}
}
}
} elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_GET['cat_id']) && isnum($_GET['cat_id']))) {
$result = dbquery("SELECT * FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " news_cat_id='" . $_GET['cat_id'] . "'");
if (dbrows($result)) {
$data = dbarray($result);
$data['news_cat_hidden'] = array($data['news_cat_id']);
$formTitle = $locale['news_0021'];
} else {
// FUSION_REQUEST without the "action" gets
redirect(clean_request("", array("action"), FALSE));
}
}
add_breadcrumb(array('link' => "", 'title' => $formTitle));
echo "<div class='m-t-20 m-b-20'>\n";
echo openform("addcat", "post", $formAction);
?>
<div class="row">
<div class="col-xs-12 col-sm-8">
<?php
echo form_hidden("news_cat_id", "", $data['news_cat_id']);
echo form_text("news_cat_name", $locale['news_0300'], $data['news_cat_name'], array("required" => TRUE, "inline" => TRUE, "error_text" => $locale['news_0351']));
echo form_select_tree("news_cat_parent", $locale['news_0305'], $data['news_cat_parent'], array("inline" => TRUE, "disable_opts" => $data['news_cat_hidden'], "hide_disabled" => TRUE, "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
echo form_select("news_cat_image", $locale['news_0301'], $data['news_cat_image'], array("inline" => TRUE, "options" => newsCatImageOpts()));
echo form_select('news_cat_visibility', $locale['news_0209'], $data['news_cat_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], "inline" => TRUE));
?>
</div>
<div class="col-xs-12 col-sm-4">
<?php
if (multilang_table("NS")) {
echo form_select("news_cat_language", $locale['global_ML100'], $data['news_cat_language'], array("inline" => TRUE, "options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose']));
} else {
echo form_hidden("news_cat_language", "", $data['news_cat_language']);
}
openside("");
echo form_checkbox("news_cat_draft", "Save Category as Draft", $data['news_cat_draft'], array("reverse_label" => TRUE));
echo form_checkbox("news_cat_sticky", "Make this Category Sticky", $data['news_cat_sticky'], array("reverse_label" => TRUE));
echo form_button("cancel", $locale['cancel'], $locale['cancel'], array("class" => "btn-default"));
echo form_button("save_cat", $locale['news_0302'], $locale['news_0302'], array("class" => "btn-success m-l-10"));
echo form_button("save_cat_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
closeside();
?>
//.........这里部分代码省略.........