コード例 #1
0
function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id)
{
    $angeltypes_select = ['' => _('All')];
    foreach ($angeltypes as $angeltype) {
        $angeltypes_select[$angeltype['id']] = $angeltype['name'];
    }
    return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [msg(), buttons([button(page_link_to('shifttypes'), shifttypes_title(), 'back')]), form([form_text('name', _('Name'), $name), form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype_id), form_textarea('description', _('Description'), $description), form_info('', _('Please use markdown for the description.')), form_submit('submit', _('Save'))])]);
}
コード例 #2
0
ファイル: admin_log.php プロジェクト: max-weller/engelsystem
function admin_log()
{
    if (isset($_POST['keyword'])) {
        $filter = $_POST['keyword'];
        $log_entries_source = LogEntries_filter($_POST['keyword']);
    } else {
        $filter = "";
        $log_entries_source = LogEntries();
    }
    $log_entries = array();
    foreach ($log_entries_source as $log_entry) {
        $log_entry['date'] = date("d.m.Y H:i", $log_entry['timestamp']);
        $log_entries[] = $log_entry;
    }
    return page_with_title(admin_log_title(), array(msg(), form(array(form_text('keyword', _("Search"), $filter), form_submit(_("Search"), "Go"))), table(array('date' => "Time", 'nick' => "Angel", 'message' => "Log Entry"), $log_entries)));
}
コード例 #3
0
ファイル: admin_free.php プロジェクト: kekru/engelsystem
function admin_free()
{
    global $privileges;
    $search = "";
    if (isset($_REQUEST['search'])) {
        $search = strip_request_item('search');
    }
    $angeltypesearch = "";
    if (empty($_REQUEST['angeltype'])) {
        $_REQUEST['angeltype'] = '';
    } else {
        $angeltypesearch = " INNER JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id` = '" . sql_escape($_REQUEST['angeltype']) . "' AND `UserAngelTypes`.`user_id` = `User`.`UID`";
        if (isset($_REQUEST['confirmed_only'])) {
            $angeltypesearch .= " AND `UserAngelTypes`.`confirm_user_id`";
        }
        $angeltypesearch .= ") ";
    }
    $angel_types_source = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`");
    $angel_types = array('' => 'alle Typen');
    foreach ($angel_types_source as $angel_type) {
        $angel_types[$angel_type['id']] = $angel_type['name'];
    }
    $users = sql_select("\n      SELECT `User`.* \n      FROM `User` \n      {$angeltypesearch} \n      LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` \n      LEFT JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID` AND `Shifts`.`start` < '" . sql_escape(time()) . "' AND `Shifts`.`end` > '" . sql_escape(time()) . "') \n      WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL \n      GROUP BY `User`.`UID` \n      ORDER BY `Nick`");
    $free_users_table = array();
    if ($search == "") {
        $tokens = array();
    } else {
        $tokens = explode(" ", $search);
    }
    foreach ($users as $usr) {
        if (count($tokens) > 0) {
            $match = false;
            $index = join("", $usr);
            foreach ($tokens as $t) {
                if (stristr($index, trim($t))) {
                    $match = true;
                    break;
                }
            }
            if (!$match) {
                continue;
            }
        }
        $free_users_table[] = array('name' => User_Nick_render($usr), 'shift_state' => User_shift_state_render($usr), 'handy' => $usr['Handy'], 'telefon' => $usr['Telefon'], 'email' => $usr['email'], 'kommentar' => $usr['kommentar'], 'actions' => in_array('admin_user', $privileges) ? button(page_link_to('admin_user') . '&amp;id=' . $usr['UID'], _("edit"), 'btn-xs') : '');
    }
    return page_with_title(admin_free_title(), array(form(array(div('row', array(div('col-md-4', array(form_text('search', _("Search"), $search))), div('col-md-4', array(form_select('angeltype', _("Angeltype"), $angel_types, $_REQUEST['angeltype']))), div('col-md-2', array(form_checkbox('confirmed_only', _("Only confirmed"), isset($_REQUEST['confirmed_only'])))), div('col-md-2', array(form_submit('submit', _("Search")))))))), table(array('name' => _("Nick"), 'shift_state' => '', 'handy' => _("Mobile"), 'telefon' => _("Phone"), 'email' => _("E-Mail"), 'kommentar' => _("add. Info"), 'actions' => ''), $free_users_table)));
}
コード例 #4
0
ファイル: admin_news.php プロジェクト: max-weller/engelsystem
function admin_news()
{
    global $user;
    if (!isset($_GET["action"])) {
        redirect(page_link_to("news"));
    } else {
        $html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg();
        if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}\$/", $_REQUEST['id'])) {
            $id = $_REQUEST['id'];
        } else {
            return error("Incomplete call, missing News ID.", true);
        }
        $news = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($id) . "' LIMIT 1");
        if (count($news) > 0) {
            switch ($_REQUEST["action"]) {
                default:
                    redirect(page_link_to('news'));
                case 'edit':
                    list($news) = $news;
                    $user_source = User($news['UID']);
                    if ($user_source === false) {
                        engelsystem_error("Unable to load user.");
                    }
                    $html .= form(array(form_info(_("Date"), date("Y-m-d H:i", $news['Datum'])), form_info(_("Author"), User_Nick_render($user_source)), form_text('eBetreff', _("Subject"), $news['Betreff']), form_textarea('eText', _("Message"), $news['Text']), form_checkbox('eTreffen', _("Meeting"), $news['Treffen'] == 1, 1), form_submit('submit', _("Save"))), page_link_to('admin_news&action=save&id=' . $id));
                    $html .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $id) . '"><span class="glyphicon glyphicon-trash"></span> ' . _("Delete") . '</a>';
                    break;
                case 'save':
                    list($news) = $news;
                    sql_query("UPDATE `News` SET \n              `Datum`='" . sql_escape(time()) . "', \n              `Betreff`='" . sql_escape($_POST["eBetreff"]) . "', \n              `Text`='" . sql_escape($_POST["eText"]) . "', \n              `UID`='" . sql_escape($user['UID']) . "', \n              `Treffen`='" . sql_escape($_POST["eTreffen"]) . "' \n              WHERE `ID`='" . sql_escape($id) . "'");
                    engelsystem_log("News updated: " . $_POST["eBetreff"]);
                    success(_("News entry updated."));
                    redirect(page_link_to("news"));
                    break;
                case 'delete':
                    list($news) = $news;
                    sql_query("DELETE FROM `News` WHERE `ID`='" . sql_escape($id) . "' LIMIT 1");
                    engelsystem_log("News deleted: " . $news['Betreff']);
                    success(_("News entry deleted."));
                    redirect(page_link_to("news"));
                    break;
            }
        } else {
            return error("No News found.", true);
        }
    }
    return $html . '</div>';
}
コード例 #5
0
ファイル: acp_theme.php プロジェクト: knapnet/PHP-Fusion
function render_admin_login()
{
    global $locale, $aidlink, $userdata, $defender;
    // TODO: Remove this, add the required styling to acp_styles.css
    add_to_head("<link rel='stylesheet' href='" . THEMES . "templates/setup_styles.css' type='text/css' />");
    echo "<aside class='block-container'>\n";
    echo "<div class='block'>\n";
    echo "<div class='block-content clearfix' style='font-size:13px;'>\n";
    echo "<h6><strong>" . $locale['280'] . "</strong></h6>\n";
    echo "<img src='" . IMAGES . "php-fusion-icon.png' class='pf-logo position-absolute' alt='PHP-Fusion'/>";
    echo "<p class='fusion-version text-right mid-opacity text-smaller'>" . $locale['version'] . fusion_get_settings('version') . "</p>";
    echo "<div class='row m-0'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>";
    $form_action = FUSION_SELF . $aidlink == ADMIN . "index.php" . $aidlink ? FUSION_SELF . $aidlink . "&amp;pagenum=0" : FUSION_SELF . "?" . FUSION_QUERY;
    echo openform('admin-login-form', 'post', $form_action, array('max_tokens' => 1));
    openside('');
    if (!$defender->safe()) {
        setNotice('danger', $locale['global_182']);
    }
    // Get all notices
    $notices = getNotices();
    echo renderNotices($notices);
    echo "<div class='m-t-10 clearfix row'>\n";
    echo "<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3'>\n";
    echo "<div class='pull-right'>\n";
    echo display_avatar($userdata, '90px');
    echo "</div>\n";
    echo "</div>\n<div class='col-xs-9 col-sm-9 col-md-8 col-lg-7'>\n";
    echo "<div class='clearfix'>\n";
    $label = "<span class='h5 display-inline' style='color: #222'><strong>" . $locale['welcome'] . ", " . $userdata['user_name'] . "</strong><br/>" . getuserlevel($userdata['user_level']) . "</span>";
    add_to_head('<style>#admin_password-field .required {display:none}</style>');
    echo form_text('admin_password', $label, '', array('callback_check' => 'check_admin_pass', 'placeholder' => $locale['281'], 'autocomplete_off' => 1, 'type' => 'password', 'required' => 1));
    echo "</div>\n";
    echo "</div>\n";
    echo "</div>\n";
    closeside();
    echo form_button('admin_login', $locale['login'], 'Sign in', array('class' => 'btn-primary btn-block'));
    echo closeform();
    echo "</div>\n</div>\n";
    // .col-*, .row
    echo "</div>\n";
    // .block-content
    echo "</div>\n";
    // .block
    echo "<div class='copyright-note clearfix m-t-10'>" . showcopyright() . "</div>\n";
    echo "</aside>\n";
}
コード例 #6
0
ファイル: acp_theme.php プロジェクト: php-fusion/PHP-Fusion
function render_admin_login()
{
    global $locale, $aidlink, $userdata;
    echo "<section class='login-bg'>\n";
    echo "<aside class='block-container'>\n";
    echo "<div class='block'>\n";
    echo "<div class='block-content clearfix' style='font-size:13px;'>\n";
    echo "<h6><strong>" . $locale['280'] . "</strong></h6>\n";
    echo "<img src='" . IMAGES . "php-fusion-icon.png' class='pf-logo position-absolute' alt='PHP-Fusion'/>";
    echo "<p class='fusion-version text-right mid-opacity text-smaller'>" . $locale['version'] . fusion_get_settings('version') . "</p>";
    echo "<div class='row m-0'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>";
    $form_action = FUSION_SELF . $aidlink == ADMIN . "index.php" . $aidlink ? FUSION_SELF . $aidlink . "&amp;pagenum=0" : FUSION_SELF . "?" . FUSION_QUERY;
    // Get all notices
    $notices = getNotices();
    echo renderNotices($notices);
    echo openform('admin-login-form', 'post', $form_action);
    openside('');
    echo "<div class='m-t-10 clearfix row'>\n";
    echo "<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3'>\n";
    echo "<div class='pull-right'>\n";
    echo display_avatar($userdata, '90px');
    echo "</div>\n";
    echo "</div>\n<div class='col-xs-9 col-sm-9 col-md-8 col-lg-7'>\n";
    echo "<div class='clearfix'>\n";
    add_to_head('<style>#admin_password-field .required {display:none}</style>');
    echo "<h5><strong>" . $locale['welcome'] . ", " . $userdata['user_name'] . "</strong><br/>" . getuserlevel($userdata['user_level']) . "</h5>";
    echo form_text('admin_password', "", "", array('callback_check' => 'check_admin_pass', 'placeholder' => $locale['281'], 'error_text' => $locale['global_182'], 'autocomplete_off' => TRUE, 'type' => 'password', 'required' => TRUE));
    echo "</div>\n";
    echo "</div>\n";
    echo "</div>\n";
    closeside();
    echo form_button('admin_login', $locale['login'], $locale['login'], array('class' => 'btn-primary btn-block'));
    echo closeform();
    echo "</div>\n</div>\n";
    // .col-*, .row
    echo "</div>\n";
    // .block-content
    echo "</div>\n";
    // .block
    echo "<div class='copyright-note clearfix m-t-10'>" . showcopyright() . "</div>\n";
    echo "</aside>\n";
    echo "</section>\n";
}
コード例 #7
0
ファイル: object.php プロジェクト: radicaldesigns/jaguar
function show_object_edit_page($object, $key)
{
    global $DIA, $db;
    $salsa_fields = $DIA->describe($object);
    $data = $DIA->get($object, $key);
    echo '<form class="form">';
    foreach ($salsa_fields as $obj) {
        echo '<div class="row">';
        if ($obj['Type'] == 'blob' or $obj['Type'] == 'text') {
            echo form_textarea(form_clean_field_name($obj['Field']), $obj['Field'], $data[$obj['Field']]);
        } elseif ($obj['Type'] == 'tinyint(1)' or $obj['Type'] == 'bool') {
            echo form_checkbox(form_clean_field_name($obj['Field']), $obj['Field'], $data[$obj['Field']]);
        } else {
            echo form_text(form_clean_field_name($obj['Field']), $obj['Field'], $data[$obj['Field']]);
        }
        echo '</div>';
    }
    echo '</form>';
}
コード例 #8
0
ファイル: User_view.php プロジェクト: d120/engelsystem
/**
 * View for password recovery step 1: E-Mail
 */
function User_password_recovery_view()
{
    return page_with_title(user_password_recovery_title(), array(msg(), _("We will send you an e-mail with a password recovery link. Please use the email address you used for registration."), form(array(form_text('email', _("E-Mail"), ""), form_submit('submit', _("Recover"))))));
}
コード例 #9
0
ファイル: setting.php プロジェクト: xiuno/xiunobbs
$user = user_token_get('', 'bbs');
$user['gid'] != 1 and message(-1, '需要管理员权限才能设置。');
// 检测浏览器
$browser = get__browser();
check_browser($browser);
$runtime = runtime_init();
if ($method == 'GET') {
    $sphinx = kv_get('sphinx');
    !isset($sphinx['enable']) && ($sphinx['enable'] = 0);
    !isset($sphinx['sphinx_host']) && ($sphinx['sphinx_host'] = '');
    !isset($sphinx['sphinx_port']) && ($sphinx['sphinx_port'] = '');
    !isset($sphinx['sphinx_datasrc']) && ($sphinx['sphinx_datasrc'] = '');
    !isset($sphinx['sphinx_deltasrc']) && ($sphinx['sphinx_deltasrc'] = '');
    $input['enable'] = form_radio_yes_no('enable', $sphinx['enable']);
    $input['sphinx_host'] = form_text('sphinx_host', $sphinx['sphinx_host'], 300);
    $input['sphinx_port'] = form_text('sphinx_port', $sphinx['sphinx_port'], 100);
    $input['sphinx_datasrc'] = form_text('sphinx_datasrc', $sphinx['sphinx_datasrc'], 300);
    $input['sphinx_deltasrc'] = form_text('sphinx_deltasrc', $sphinx['sphinx_deltasrc'], 300);
    $header = array();
    $header['title'] = 'Sphinx 搜索服务设置';
    include './plugin/xn_sphinx/setting.htm';
} else {
    $enable = param('enable', 0);
    $sphinx_host = param('sphinx_host');
    $sphinx_port = param('sphinx_port');
    $sphinx_datasrc = param('sphinx_datasrc');
    $sphinx_deltasrc = param('sphinx_deltasrc');
    $arr = array('enable' => $enable, 'sphinx_host' => $sphinx_host, 'sphinx_port' => $sphinx_port, 'sphinx_datasrc' => $sphinx_datasrc, 'sphinx_deltasrc' => $sphinx_deltasrc);
    kv_set('sphinx', $arr);
    message(0, '设置成功!');
}
コード例 #10
0
ファイル: admin_arrive.php プロジェクト: kekru/engelsystem
function admin_arrive()
{
    $msg = "";
    $search = "";
    if (isset($_REQUEST['search'])) {
        $search = strip_request_item('search');
    }
    if (isset($_REQUEST['reset']) && preg_match("/^[0-9]*\$/", $_REQUEST['reset'])) {
        $id = $_REQUEST['reset'];
        $user_source = User($id);
        if ($user_source != null) {
            sql_query("UPDATE `User` SET `Gekommen`=0, `arrival_date` = NULL WHERE `UID`='" . sql_escape($id) . "' LIMIT 1");
            engelsystem_log("User set to not available: " . User_Nick_render($user_source));
            $msg = success(_("Reset done. Angel is not available."), true);
        } else {
            $msg = error(_("Angel not found."), true);
        }
    } elseif (isset($_REQUEST['arrived']) && preg_match("/^[0-9]*\$/", $_REQUEST['arrived'])) {
        $id = $_REQUEST['arrived'];
        $user_source = User($id);
        if ($user_source != null) {
            sql_query("UPDATE `User` SET `Gekommen`=1, `arrival_date`='" . time() . "' WHERE `UID`='" . sql_escape($id) . "' LIMIT 1");
            engelsystem_log("User is available: " . User_Nick_render($user_source));
            $msg = success(_("Angel has been marked as available."), true);
        } else {
            $msg = error(_("Angel not found."), true);
        }
    }
    $users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
    $arrival_count_at_day = [];
    $planned_arrival_count_at_day = [];
    $planned_departure_count_at_day = [];
    $table = "";
    $users_matched = [];
    if ($search == "") {
        $tokens = [];
    } else {
        $tokens = explode(" ", $search);
    }
    foreach ($users as $usr) {
        if (count($tokens) > 0) {
            $match = false;
            $index = join(" ", $usr);
            foreach ($tokens as $t) {
                if (stristr($index, trim($t))) {
                    $match = true;
                    break;
                }
            }
            if (!$match) {
                continue;
            }
        }
        $usr['nick'] = User_Nick_render($usr);
        if ($usr['planned_departure_date'] != null) {
            $usr['rendered_planned_departure_date'] = date('Y-m-d', $usr['planned_departure_date']);
        } else {
            $usr['rendered_planned_departure_date'] = '-';
        }
        $usr['rendered_planned_arrival_date'] = date('Y-m-d', $usr['planned_arrival_date']);
        $usr['rendered_arrival_date'] = $usr['arrival_date'] > 0 ? date('Y-m-d', $usr['arrival_date']) : "-";
        $usr['arrived'] = $usr['Gekommen'] == 1 ? _("yes") : "";
        $usr['actions'] = $usr['Gekommen'] == 1 ? '<a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">' . _("reset") . '</a>' : '<a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">' . _("available") . '</a>';
        if ($usr['arrival_date'] > 0) {
            $day = date('Y-m-d', $usr['arrival_date']);
            if (!isset($arrival_count_at_day[$day])) {
                $arrival_count_at_day[$day] = 0;
            }
            $arrival_count_at_day[$day]++;
        }
        if ($usr['planned_arrival_date'] != null) {
            $day = date('Y-m-d', $usr['planned_arrival_date']);
            if (!isset($planned_arrival_count_at_day[$day])) {
                $planned_arrival_count_at_day[$day] = 0;
            }
            $planned_arrival_count_at_day[$day]++;
        }
        if ($usr['planned_departure_date'] != null && $usr['Gekommen'] == 1) {
            $day = date('Y-m-d', $usr['planned_departure_date']);
            if (!isset($planned_departure_count_at_day[$day])) {
                $planned_departure_count_at_day[$day] = 0;
            }
            $planned_departure_count_at_day[$day]++;
        }
        $users_matched[] = $usr;
    }
    ksort($arrival_count_at_day);
    ksort($planned_arrival_count_at_day);
    ksort($planned_departure_count_at_day);
    $arrival_at_day = [];
    $arrival_sum = 0;
    foreach ($arrival_count_at_day as $day => $count) {
        $arrival_sum += $count;
        $arrival_at_day[$day] = ['day' => $day, 'count' => $count, 'sum' => $arrival_sum];
    }
    $planned_arrival_sum_at_day = [];
    $planned_arrival_sum = 0;
    foreach ($planned_arrival_count_at_day as $day => $count) {
        $planned_arrival_sum += $count;
        $planned_arrival_at_day[$day] = ['day' => $day, 'count' => $count, 'sum' => $planned_arrival_sum];
    }
    $planned_departure_at_day = [];
    $planned_departure_sum = 0;
    foreach ($planned_departure_count_at_day as $day => $count) {
        $planned_departure_sum += $count;
        $planned_departure_at_day[$day] = ['day' => $day, 'count' => $count, 'sum' => $planned_departure_sum];
    }
    return page_with_title(admin_arrive_title(), array(msg(), form(array(form_text('search', _("Search"), $search), form_submit('submit', _("Search")))), table(array('nick' => _("Nickname"), 'rendered_planned_arrival_date' => _("Planned start of availability"), 'arrived' => _("Available?"), 'rendered_arrival_date' => _("Start of availability"), 'rendered_planned_departure_date' => _("Planned end of availability"), 'actions' => ""), $users_matched), div('row', [div('col-md-4', [heading(_("Planned start of availability statistics"), 2), bargraph('planned_arrives', 'day', ['count' => _("available"), 'sum' => _("available sum")], ['count' => '#090', 'sum' => '#888'], $planned_arrival_at_day), table(['day' => _("Date"), 'count' => _("Count"), 'sum' => _("Sum")], $planned_arrival_at_day)]), div('col-md-4', [heading(_("Availability statistics"), 2), bargraph('arrives', 'day', ['count' => _("available"), 'sum' => _("available sum")], ['count' => '#090', 'sum' => '#888'], $arrival_at_day), table(['day' => _("Date"), 'count' => _("Count"), 'sum' => _("Sum")], $arrival_at_day)]), div('col-md-4', [heading(_("Planned end of availability statistics"), 2), bargraph('planned_departures', 'day', ['count' => _("available"), 'sum' => _("available sum")], ['count' => '#090', 'sum' => '#888'], $planned_departure_at_day), table(['day' => _("Date"), 'count' => _("Count"), 'sum' => _("Sum")], $planned_departure_at_day)])])));
}
コード例 #11
0
ファイル: settings_users.php プロジェクト: WuChEn/PHP-Fusion
echo "<td  class='tbl'><label for='calc_b'>" . $locale['1010'] . "</label></td>\n";
echo "<td  class='tbl'>\n";
function calculate_byte($download_max_b)
{
    $calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)');
    foreach ($calc_opts as $byte => $val) {
        if ($download_max_b / $byte <= 999) {
            return $byte;
        }
    }
    return 1000000;
}
$calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)');
$calc_c = calculate_byte($settings['avatar_filesize']);
$calc_b = $settings['avatar_filesize'] / $calc_c;
echo form_text('', 'calc_b', 'calc_b', $calc_b, array('required' => 1, 'number' => 1, 'error_text' => $locale['error_rate'], 'width' => '100px', 'max_length' => '3', 'class' => 'pull-left m-r-10'));
echo form_select('', 'calc_c', 'calc_c', $calc_opts, $calc_c, array('placeholder' => $locale['choose'], 'class' => 'pull-left', 'width' => '180px'));
echo "</td>\n</tr>\n<tr>\n";
echo "<td  class='tbl'>\n<label for='avatar_ratio'>" . $locale['1001'] . "</label></td>\n";
echo "<td  class='tbl'>\n";
$ratio_opts = array('0' => $locale['955'], '1' => $locale['956']);
echo form_select('', 'avatar_ratio', 'avatar_ratio', $ratio_opts, $settings['avatar_ratio']);
echo "</td>\n</tr>\n<tr>\n";
echo "<td  class='tbl'>\n<label for='userNameChange'>" . $locale['691'] . "?</label></td>\n";
echo "<td  class='tbl'>\n";
echo form_select('', 'userNameChange', 'userNameChange', $yes_no_array, $settings['userNameChange']);
echo "</td>\n</tr>\n<tr>\n";
echo "<td  class='tbl'>\n<label for='userthemes'>" . $locale['668'] . "?</label></td>\n";
echo "<td  class='tbl'>\n";
echo form_select('', 'userthemes', 'userthemes', $yes_no_array, $settings['userthemes']);
echo "</td>\n</tr>\n<tr>\n";
コード例 #12
0
ファイル: permalink.php プロジェクト: knapnet/PHP-Fusion
     ob_end_clean();
     echo "<div class='text-right display-block'>\n";
     echo form_button("pButton", $locale['help'], $locale['help'], array("input_id" => "pButton", "type" => "button"));
     echo form_button("savepermalinks", $locale['save_changes'], $locale['413'], array("class" => "m-l-10 btn-primary", "input_id" => "save_top"));
     echo "</div>\n";
     // Driver Rules Installed
     echo "<h4>\n" . $locale['409'] . "</h4>\n";
     $i = 1;
     foreach ($driver as $data) {
         echo "<div class='list-group-item m-b-20'>\n";
         $source = preg_replace("/%(.*?)%/i", "<kbd class='m-2'>%\$1%</kbd>", $data['pattern_source']);
         $target = preg_replace("/%(.*?)%/i", "<kbd class='m-2'>%\$1%</kbd>", $data['pattern_target']);
         echo "<p class='m-t-10 m-b-10'>\n                <label class='label' style='background:#ddd; color: #000; font-weight:normal; font-size: 1rem;'>\n                " . $target . "\n</label>\n";
         echo "</p>\n";
         // new text input
         echo form_text("permalink[" . $data['pattern_id'] . "]", "", $data['pattern_source'], array("prepend_value" => fusion_get_settings("siteurl"), "inline" => TRUE, "class" => "m-b-0"));
         echo "</div>\n";
         $i++;
     }
     echo form_button("savepermalinks", $locale['save_changes'], $locale['413'], array("class" => "btn-primary m-b-20"));
     echo closeform();
 } else {
     echo "<table class='table table-responsive table-hover table-striped m-t-20'>\n";
     if (!empty($permalink)) {
         echo "<tr>\n";
         echo "<th width='1%' style='white-space:nowrap'>" . $locale['402'] . "</th>\n";
         echo "<th style='white-space:nowrap'><strong>" . $locale['403'] . "</th>\n";
         echo "<th width='1%' style='white-space:nowrap'>" . $locale['404'] . "</th>\n";
         echo "</tr>\n";
         foreach ($permalink as $data) {
             echo "<tr>\n";
コード例 #13
0
ファイル: admin_rooms.php プロジェクト: tike/engelsystem
function admin_rooms()
{
    global $user;
    $rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`");
    $rooms = array();
    foreach ($rooms_source as $room) {
        $rooms[] = array('name' => $room['Name'], 'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '&#10003;' : '', 'public' => $room['show'] == 'Y' ? '&#10003;' : '', 'actions' => buttons(array(button(page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'], _("edit"), 'btn-xs'), button(page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'], _("delete"), 'btn-xs'))));
    }
    $room = null;
    if (isset($_REQUEST['show'])) {
        $msg = "";
        $name = "";
        $from_pentabarf = "";
        $public = 'Y';
        $number = "";
        $angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
        $angeltypes = array();
        $angeltypes_count = array();
        foreach ($angeltypes_source as $angeltype) {
            $angeltypes[$angeltype['id']] = $angeltype['name'];
            $angeltypes_count[$angeltype['id']] = 0;
        }
        if (test_request_int('id')) {
            $room = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($_REQUEST['id']) . "'");
            if (count($room) > 0) {
                $id = $_REQUEST['id'];
                $name = $room[0]['Name'];
                $from_pentabarf = $room[0]['FromPentabarf'];
                $public = $room[0]['show'];
                $number = $room[0]['Number'];
                $needed_angeltypes = sql_select("SELECT * FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "'");
                foreach ($needed_angeltypes as $needed_angeltype) {
                    $angeltypes_count[$needed_angeltype['angel_type_id']] = $needed_angeltype['count'];
                }
            } else {
                redirect(page_link_to('admin_rooms'));
            }
        }
        if ($_REQUEST['show'] == 'edit') {
            if (isset($_REQUEST['submit'])) {
                $ok = true;
                if (isset($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) {
                    $name = strip_request_item('name');
                    if (isset($room) && sql_num_query("SELECT * FROM `Room` WHERE `Name`='" . sql_escape($name) . "' AND NOT `RID`=" . sql_escape($id)) > 0) {
                        $ok = false;
                        $msg .= error(_("This name is already in use."), true);
                    }
                } else {
                    $ok = false;
                    $msg .= error(_("Please enter a name."), true);
                }
                if (isset($_REQUEST['from_pentabarf'])) {
                    $from_pentabarf = 'Y';
                } else {
                    $from_pentabarf = '';
                }
                if (isset($_REQUEST['public'])) {
                    $public = 'Y';
                } else {
                    $public = '';
                }
                if (isset($_REQUEST['number'])) {
                    $number = strip_request_item('number');
                } else {
                    $ok = false;
                }
                foreach ($angeltypes as $angeltype_id => $angeltype) {
                    if (isset($_REQUEST['angeltype_count_' . $angeltype_id]) && preg_match("/^[0-9]{1,4}\$/", $_REQUEST['angeltype_count_' . $angeltype_id])) {
                        $angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id];
                    } else {
                        $ok = false;
                        $msg .= error(sprintf(_("Please enter needed angels for type %s.", $angeltype)), true);
                    }
                }
                if ($ok) {
                    if (isset($id)) {
                        sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "' WHERE `RID`='" . sql_escape($id) . "' LIMIT 1");
                        engelsystem_log("Room updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
                    } else {
                        $id = Room_create($name, $from_pentabarf, $public, $number);
                        if ($id === false) {
                            engelsystem_error("Unable to create room.");
                        }
                        engelsystem_log("Room created: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
                    }
                    sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "'");
                    $needed_angeltype_info = array();
                    foreach ($angeltypes_count as $angeltype_id => $angeltype_count) {
                        $angeltype = AngelType($angeltype_id);
                        if ($angeltype === false) {
                            engelsystem_error("Unable to load angeltype.");
                        }
                        if ($angeltype != null) {
                            sql_query("INSERT INTO `NeededAngelTypes` SET `room_id`='" . sql_escape($id) . "', `angel_type_id`='" . sql_escape($angeltype_id) . "', `count`='" . sql_escape($angeltype_count) . "'");
                            $needed_angeltype_info[] = $angeltype['name'] . ": " . $angeltype_count;
                        }
                    }
                    engelsystem_log("Set needed angeltypes of room " . $name . " to: " . join(", ", $needed_angeltype_info));
                    success(_("Room saved."));
                    redirect(page_link_to("admin_rooms"));
                }
            }
            $angeltypes_count_form = array();
            foreach ($angeltypes as $angeltype_id => $angeltype) {
                $angeltypes_count_form[] = div('col-lg-4 col-md-6 col-xs-6', array(form_spinner('angeltype_count_' . $angeltype_id, $angeltype, $angeltypes_count[$angeltype_id])));
            }
            return page_with_title(admin_rooms_title(), array(buttons(array(button(page_link_to('admin_rooms'), _("back"), 'back'))), $msg, form(array(div('row', array(div('col-md-6', array(form_text('name', _("Name"), $name), form_checkbox('from_pentabarf', _("Frab import"), $from_pentabarf), form_checkbox('public', _("Public"), $public), form_text('number', _("Room number"), $number))), div('col-md-6', array(div('row', array(div('col-md-12', array(form_info(_("Needed angels:")))), join($angeltypes_count_form))))))), form_submit('submit', _("Save"))))));
        } elseif ($_REQUEST['show'] == 'delete') {
            if (isset($_REQUEST['ack'])) {
                if (!Room_delete($id)) {
                    engelsystem_error("Unable to delete room.");
                }
                engelsystem_log("Room deleted: " . $name);
                success(sprintf(_("Room %s deleted."), $name));
                redirect(page_link_to('admin_rooms'));
            }
            return page_with_title(admin_rooms_title(), array(buttons(array(button(page_link_to('admin_rooms'), _("back"), 'back'))), sprintf(_("Do you want to delete room %s?"), $name), buttons(array(button(page_link_to('admin_rooms') . '&show=delete&id=' . $id . '&ack', _("Delete"), 'delete')))));
        }
    }
    return page_with_title(admin_rooms_title(), array(buttons(array(button(page_link_to('admin_rooms') . '&show=edit', _("add")))), msg(), table(array('name' => _("Name"), 'from_pentabarf' => _("Frab import"), 'public' => _("Public"), 'actions' => ""), $rooms)));
}
コード例 #14
0
ファイル: faq_cats.php プロジェクト: knapnet/PHP-Fusion
    $result = dbquery("select * from " . DB_FAQ_CATS . " WHERE faq_cat_id='" . intval($_GET['cat_id']) . "'");
    if (dbrows($result) > 0) {
        $data = dbarray($result);
    } else {
        redirect(FUSION_SELF . $aidlink);
    }
}
if (isset($_POST['save_cat'])) {
    $data = array("faq_cat_id" => form_sanitizer($_POST['faq_cat_id'], 0, "faq_cat_id"), "faq_cat_name" => form_sanitizer($_POST['faq_cat_name'], "", "faq_cat_name"), "faq_cat_description" => form_sanitizer($_POST['faq_cat_description'], "", "faq_cat_description"), "faq_cat_language" => form_sanitizer($_POST['faq_cat_language'], "", "faq_cat_language"));
    if (defender::safe()) {
        if (dbcount("(faq_cat_id)", DB_FAQ_CATS, "faq_cat_id='" . $data['faq_cat_id'] . "'")) {
            dbquery_insert(DB_FAQ_CATS, $data, "update");
            addNotice("success", $locale['faq_0205']);
        } else {
            dbquery_insert(DB_FAQ_CATS, $data, "save");
            addNotice("success", $locale['faq_0204']);
        }
        redirect(FUSION_SELF . $aidlink);
    }
}
echo openform('faqCat_form', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
echo form_hidden('faq_cat_id', "", $data['faq_cat_id']);
echo form_text('faq_cat_name', $locale['faq_0200'], $data['faq_cat_name'], array('error_text' => $locale['faq_0201'], 'required' => 1));
echo form_text('faq_cat_description', $locale['faq_0202'], $data['faq_cat_description']);
if (multilang_table("FQ")) {
    echo form_select("faq_cat_language", $locale['global_ML100'], $data['faq_cat_language'], array('options' => fusion_get_enabled_languages()));
} else {
    echo form_hidden("faq_cat_language", '', LANGUAGE);
}
echo form_button('save_cat', $locale['faq_0203'], $locale['faq_0203'], array('class' => 'btn-primary m-t-10'));
echo closeform();
コード例 #15
0
/**
 * @param $comment_type - abbr or short ID
 * @param $comment_db - Current Application DB - DB_BLOG for example.
 * @param $comment_col - current sql primary key column - 'blog_id' for example
 * @param $comment_item_id - current sql primary key value '$_GET['blog_id']' for example
 * @param $clink - current page link 'FUSION_SELF' is ok.
 */
function showcomments($comment_type, $comment_db, $comment_col, $comment_item_id, $clink)
{
    global $settings, $locale, $userdata, $aidlink;
    $link = FUSION_SELF . (FUSION_QUERY ? "?" . FUSION_QUERY : "");
    $link = preg_replace("^(&amp;|\\?)c_action=(edit|delete)&amp;comment_id=\\d*^", "", $link);
    $_GET['comment'] = isset($_GET['comment']) && isnum($_GET['comment']) ? $_GET['comment'] : 0;
    $cpp = $settings['comments_per_page'];
    if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "delete") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) {
        if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $_GET['comment_id'] . "' AND comment_name='" . $userdata['user_id'] . "'")) {
            $result = dbquery("DELETE FROM " . DB_COMMENTS . "\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "'" . (iADMIN ? "" : "\n\t\t\t\tAND comment_name='" . $userdata['user_id'] . "'"));
        }
        redirect($clink . ($settings['comments_sorting'] == "ASC" ? "" : "&amp;c_start=0"));
    }
    if ($settings['comments_enabled'] == "1") {
        if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) {
            if (!iMEMBER && $settings['guestpost'] == 1) {
                if (!isset($_POST['comment_name'])) {
                    redirect($link);
                }
                if (isnum($_POST['comment_name'])) {
                    $_POST['comment_name'] = '';
                }
                $_CAPTCHA_IS_VALID = FALSE;
                include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_check.php";
                if (!isset($_POST['captcha_code']) || $_CAPTCHA_IS_VALID == FALSE) {
                    redirect($link);
                }
            }
            $comment_data = array('comment_id' => isset($_GET['comment_id']) && isnum($_GET['comment_id']) ? $_GET['comment_id'] : 0, 'comment_name' => iMEMBER ? $userdata['user_id'] : form_sanitizer($_POST['comment_name'], '', 'comment_name'), 'comment_message' => form_sanitizer($_POST['comment_message'], '', 'comment_message'), 'comment_datestamp' => time(), 'comment_item_id' => $comment_item_id, 'comment_type' => $comment_type, 'comment_cat' => 0, 'comment_ip' => USER_IP, 'comment_ip_type' => USER_IP_TYPE, 'comment_hidden' => 0);
            if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && $comment_data['comment_id']) {
                $comment_updated = FALSE;
                if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $comment_data['comment_id'] . "' \n\t\t\t\tAND comment_item_id='" . $comment_item_id . "'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tAND comment_type='" . $comment_type . "' \n\t\t\t\tAND comment_name='" . $userdata['user_id'] . "' \n\t\t\t\tAND comment_hidden='0'")) {
                    dbquery_insert(DB_COMMENTS, $comment_data, 'update');
                    if ($comment_data['comment_message']) {
                        $result = dbquery("UPDATE " . DB_COMMENTS . " SET comment_message='" . $comment_data['comment_message'] . "'\n  \t\t\t\t\t\t\t\t\t   WHERE comment_id='" . $_GET['comment_id'] . "' " . (iADMIN ? "" : "AND comment_name='" . $userdata['user_id'] . "'"));
                        if ($result) {
                            $comment_updated = TRUE;
                        }
                    }
                }
                if ($comment_updated) {
                    if ($settings['comments_sorting'] == "ASC") {
                        $c_operator = "<=";
                    } else {
                        $c_operator = ">=";
                    }
                    $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_id" . $c_operator . "'" . $comment_data['comment_id'] . "'\n\t\t\t\t\t\t\t\tAND comment_item_id='" . $comment_item_id . "'\n\t\t\t\t\t\t\t\tAND comment_type='" . $comment_type . "'");
                    $c_start = (ceil($c_count / $cpp) - 1) * $cpp;
                }
                redirect($clink . "&amp;c_start=" . (isset($c_start) && isnum($c_start) ? $c_start : ""));
            } else {
                if (!dbcount("(" . $comment_col . ")", $comment_db, $comment_col . "='" . $comment_item_id . "'")) {
                    redirect(BASEDIR . "index.php");
                }
                $id = 0;
                if ($comment_data['comment_name'] && $comment_data['comment_message']) {
                    require_once INCLUDES . "flood_include.php";
                    if (!flood_control("comment_datestamp", DB_COMMENTS, "comment_ip='" . USER_IP . "'")) {
                        dbquery_insert(DB_COMMENTS, $comment_data, 'save');
                        $id = dblastid();
                    }
                }
                if ($settings['comments_sorting'] == "ASC") {
                    $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "'");
                    $c_start = (ceil($c_count / $cpp) - 1) * $cpp;
                } else {
                    $c_start = 0;
                }
                //if (!$settings['site_seo']) {
                redirect($clink . "&amp;c_start=" . $c_start . "#c" . $id);
                //}
            }
        }
        $c_arr = array("c_con" => array(), "c_info" => array("c_makepagenav" => FALSE, "admin_link" => FALSE));
        $c_rows = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'");
        if (!isset($_GET['c_start']) && $c_rows > $cpp) {
            $_GET['c_start'] = (ceil($c_rows / $cpp) - 1) * $cpp;
        }
        if (!isset($_GET['c_start']) || !isnum($_GET['c_start'])) {
            $_GET['c_start'] = 0;
        }
        $result = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcm.comment_datestamp,\n\t\t\t\t\ttcu.user_id, tcu.user_name, tcu.user_avatar, tcu.user_status\n\t\t\t\t\tFROM " . DB_COMMENTS . " tcm\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n\t\t\t\t\tWHERE comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'\n\t\t\t\t\tORDER BY comment_datestamp " . $settings['comments_sorting'] . " LIMIT " . $_GET['c_start'] . "," . $cpp);
        if (dbrows($result) > 0) {
            $i = $settings['comments_sorting'] == "ASC" ? $_GET['c_start'] + 1 : $c_rows - $_GET['c_start'];
            if ($c_rows > $cpp) {
                $c_arr['c_info']['c_makepagenav'] = makepagenav($_GET['c_start'], $cpp, $c_rows, 3, $clink . "&amp;", "c_start");
            }
            while ($data = dbarray($result)) {
                $c_arr['c_con'][$i]['comment_id'] = $data['comment_id'];
                $c_arr['c_con'][$i]['edit_dell'] = FALSE;
                $c_arr['c_con'][$i]['i'] = $i;
                if ($data['user_name']) {
                    $c_arr['c_con'][$i]['comment_name'] = profile_link($data['comment_name'], $data['user_name'], $data['user_status'], 'strong text-dark');
                } else {
                    $c_arr['c_con'][$i]['comment_name'] = $data['comment_name'];
                }
                $c_arr['c_con'][$i]['user_avatar'] = display_avatar($data, '35px', '', true, 'img-rounded');
                $c_arr['c_con'][$i]['user'] = array('user_id' => $data['user_id'], 'user_name' => $data['user_name'], 'user_avatar' => $avatar = $data['user_avatar'] !== '' && file_exists(IMAGES . 'avatars/' . $data['user_avatar']) ? IMAGES . 'avatars/' . $data['user_avatar'] : IMAGES . "avatars/noavatar50.png", 'user_status' => $data['user_status']);
                $c_arr['c_con'][$i]['comment_datestamp'] = showdate('shortdate', $data['comment_datestamp']);
                $c_arr['c_con'][$i]['comment_time'] = timer($data['comment_datestamp']);
                $c_arr['c_con'][$i]['comment_message'] = "<!--comment_message-->\n" . nl2br(parseubb(parsesmileys($data['comment_message'])));
                if (iADMIN && checkrights("C") || iMEMBER && $data['comment_name'] == $userdata['user_id'] && isset($data['user_name'])) {
                    $edit_link = clean_request('c_action=edit&comment_id=' . $data['comment_id'], array('c_action', 'comment_id'), false) . "#edit_comment";
                    $delete_link = clean_request('c_action=delete&comment_id=' . $data['comment_id'], array('c_action', 'comment_id'), false);
                    $c_arr['c_con'][$i]['edit_link'] = array('link' => $edit_link, 'name' => $locale['c108']);
                    $c_arr['c_con'][$i]['delete_link'] = array('link' => $delete_link, 'name' => $locale['c109']);
                    $c_arr['c_con'][$i]['edit_dell'] = "<!--comment_actions-->\n";
                    $c_arr['c_con'][$i]['edit_dell'] .= "<div class='btn-group'>";
                    $c_arr['c_con'][$i]['edit_dell'] .= "<a class='btn btn-xs btn-default' href='" . $edit_link . "'>";
                    $c_arr['c_con'][$i]['edit_dell'] .= $locale['c108'] . "</a>\n";
                    $c_arr['c_con'][$i]['edit_dell'] .= "<a class='btn btn-xs btn-default' href='" . $delete_link . "' onclick=\"return confirm('" . $locale['c110'] . "');\">";
                    $c_arr['c_con'][$i]['edit_dell'] .= "<i class='fa fa-trash'></i> " . $locale['c109'] . "</a>";
                    $c_arr['c_con'][$i]['edit_dell'] .= "</div>\n";
                }
                $settings['comments_sorting'] == "ASC" ? $i++ : $i--;
            }
            if (iADMIN && checkrights("C")) {
                $c_arr['c_info']['admin_link'] = "<!--comment_admin-->\n";
                $c_arr['c_info']['admin_link'] .= "<a href='" . ADMIN . "comments.php" . $aidlink . "&amp;ctype=" . $comment_type . "&amp;comment_item_id=" . $comment_item_id . "'>" . $locale['c106'] . "</a>";
            }
        }
        opentable($locale['c102']);
        $comment_message = "";
        if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) {
            $eresult = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcu.user_name\n\t\t\t\tFROM " . DB_COMMENTS . " tcm\n\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "' AND comment_item_id='" . $comment_item_id . "'\n\t\t\t\tAND comment_type='" . $comment_type . "' AND comment_hidden='0'");
            if (dbrows($eresult) > 0) {
                $edata = dbarray($eresult);
                if (iADMIN && checkrights("C") || iMEMBER && $edata['comment_name'] == $userdata['user_id'] && isset($edata['user_name'])) {
                    $clink .= "&amp;c_action=edit&amp;comment_id=" . $edata['comment_id'];
                    $comment_message = $edata['comment_message'];
                }
            } else {
                $comment_message = "";
            }
        }
        if (iMEMBER || $settings['guestposts'] == "1") {
            require_once INCLUDES . "bbcode_include.php";
            echo "<a id='edit_comment' name='edit_comment'></a>\n";
            echo openform('inputform', 'post', $clink, array('class' => 'm-b-20', 'max_tokens' => 1));
            if (iGUEST) {
                echo form_text('comment_name', $locale['c104'], '', array('max_length' => 30));
            }
            echo form_textarea('comment_message', '', $comment_message, array('required' => 1, 'autosize' => 1, 'form_name' => 'inputform', 'bbcode' => 1));
            if (iGUEST && (!isset($_CAPTCHA_HIDE_INPUT) || isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT)) {
                $_CAPTCHA_HIDE_INPUT = FALSE;
                echo "<div style='width:360px; margin:10px auto;'>";
                echo $locale['global_150'] . "<br />\n";
                include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_display.php";
                if (!$_CAPTCHA_HIDE_INPUT) {
                    echo "<br />\n<label for='captcha_code'>" . $locale['global_151'] . "</label>";
                    echo "<br />\n<input type='text' id='captcha_code' name='captcha_code' class='textbox' autocomplete='off' style='width:100px' />\n";
                }
                echo "</div>\n";
            }
            echo form_button('post_comment', $comment_message ? $locale['c103'] : $locale['c102'], $comment_message ? $locale['c103'] : $locale['c102'], array('class' => 'btn-success m-t-10'));
            echo closeform();
        } else {
            echo "<div class='well'>\n";
            echo $locale['c105'] . "\n";
            echo "</div>\n";
        }
        closetable();
        echo "<a id='comments' name='comments'></a>";
        render_comments($c_arr['c_con'], $c_arr['c_info']);
    }
}
コード例 #16
0
ファイル: contact.php プロジェクト: knapnet/PHP-Fusion
        closetable();
    }
}
opentable($locale['400']);
$message = str_replace("[SITE_EMAIL]", hide_email(fusion_get_settings('siteemail')), $locale['401']);
$message = str_replace("[PM_LINK]", "<a href='messages.php?msg_send=1'>" . $locale['global_121'] . "</a>", $message);
echo $message . "<br /><br />\n";
echo "<!--contact_pre_idx-->";
echo openform('contactform', 'post', FUSION_SELF, array('max_tokens' => 1));
echo "<div class='panel panel-default tbl-border'>\n";
echo "<div class='panel-body'>\n";
echo form_text('mailname', $locale['402'], $input['mailname'], array('required' => 1, 'error_text' => $locale['420'], 'max_length' => 64));
echo form_text('email', $locale['403'], $input['email'], array('required' => 1, 'error_text' => $locale['421'], 'type' => 'email', 'max_length' => 64));
echo form_text('subject', $locale['404'], $input['subject'], array('required' => 1, 'error_text' => $locale['422'], 'max_length' => 64));
echo form_textarea('message', $locale['405'], $input['message'], array('required' => 1, 'error_text' => $locale['423'], 'max_length' => 128));
echo "<div class='panel panel-default tbl-border'>\n";
echo "<div class='panel-body clearfix'>\n";
echo "<div class='row m-0'>\n<div class='col-xs-12 col-sm-12 col-md-6 col-lg-6 p-b-20'>\n";
include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_display.php";
echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-6 col-lg-6'>\n";
if (!isset($_CAPTCHA_HIDE_INPUT) || isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT) {
    echo form_text('captcha_code', $locale['408'], '', array('required' => 1, 'autocomplete_off' => 1));
}
echo "</div>\n</div>\n";
echo "</div>\n</div>\n";
echo form_button('sendmessage', $locale['406'], $locale['406'], array('class' => 'btn-primary m-t-10'));
echo "</div>\n</div>\n";
echo closeform();
echo "<!--contact_sub_idx-->";
closetable();
require_once THEMES . "templates/footer.php";
コード例 #17
0
ファイル: Viewthread.php プロジェクト: knapnet/PHP-Fusion
 public function render_poll_form($edit = 0)
 {
     global $locale, $defender;
     $poll_field = '';
     // Build Polls Info.
     $thread_data = $this->thread_info['thread'];
     if ($edit ? $this->getThreadPermission("can_edit_poll") : $this->getThreadPermission("can_create_poll")) {
         // if permitted to create new poll.
         $data = array('thread_id' => $thread_data['thread_id'], 'forum_poll_title' => isset($_POST['forum_poll_title']) ? form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title') : '', 'forum_poll_start' => time(), 'forum_poll_length' => 2, 'forum_poll_votes' => 0);
         // counter of lengths
         $option_data[1] = "";
         $option_data[2] = "";
         // calculate poll lengths
         if (isset($_POST['poll_options'])) {
             // callback on post.
             foreach ($_POST['poll_options'] as $i => $value) {
                 $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]");
             }
             // reindex the whole array with blank values.
             if ($defender->safe()) {
                 $option_data = array_values(array_filter($option_data));
                 array_unshift($option_data, NULL);
                 unset($option_data[0]);
                 $data['forum_poll_length'] = count($option_data);
             }
         }
         // add a Blank Poll option
         if (isset($_POST['add_poll_option']) && $defender->safe()) {
             array_push($option_data, '');
         }
         if ($edit) {
             $result = dbquery("SELECT * FROM " . DB_FORUM_POLLS . " WHERE thread_id='" . $thread_data['thread_id'] . "'");
             if (dbrows($result) > 0) {
                 if (isset($_POST['update_poll']) || isset($_POST['add_poll_option'])) {
                     $load = FALSE;
                     $data += dbarray($result);
                     // append if not available.
                 } else {
                     $load = TRUE;
                     $data = dbarray($result);
                     // call
                 }
                 if (isset($_POST['update_poll'])) {
                     $data = array('thread_id' => $thread_data['thread_id'], 'forum_poll_title' => form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title'), 'forum_poll_start' => $data['forum_poll_start'], 'forum_poll_length' => $data['forum_poll_length']);
                     dbquery_insert(DB_FORUM_POLLS, $data, 'update', array('primary_key' => 'thread_id', 'no_unique' => TRUE));
                     $i = 1;
                     // populate data for matches
                     $poll_result = dbquery("SELECT forum_poll_option_id FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $thread_data['thread_id'] . "'");
                     while ($_data = dbarray($poll_result)) {
                         $_poll[$_data['forum_poll_option_id']] = $_data;
                         // Prune the emptied fields AND field is not required.
                         if (empty($option_data[$_data['forum_poll_option_id']]) && $defender->safe()) {
                             dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $thread_data['thread_id'] . "' AND forum_poll_option_id='" . $_data['forum_poll_option_id'] . "'");
                         }
                     }
                     foreach ($option_data as $option_text) {
                         if ($option_text) {
                             if ($defender->safe()) {
                                 if (isset($_poll[$i])) {
                                     // has record
                                     dbquery("UPDATE " . DB_FORUM_POLL_OPTIONS . " SET forum_poll_option_text='" . $option_text . "' WHERE thread_id='" . $thread_data['thread_id'] . "' AND forum_poll_option_id='" . $i . "'");
                                 } else {
                                     // no record - create
                                     $array = array('thread_id' => $thread_data['thread_id'], 'forum_poll_option_id' => $i, 'forum_poll_option_text' => $option_text, 'forum_poll_option_votes' => 0);
                                     dbquery_insert(DB_FORUM_POLL_OPTIONS, $array, 'save');
                                 }
                             }
                             $i++;
                         }
                     }
                     if ($defender->safe()) {
                         redirect(INFUSIONS . "forum/postify.php?post=editpoll&error=0&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']);
                     }
                 }
                 // how to make sure values containing options votes
                 $poll_field['openform'] = openform('pollform', 'post', INFUSIONS . 'forum/viewthread.php?action=editpoll&forum_id=' . $_GET['forum_id'] . '&thread_id=' . $_GET['thread_id']);
                 $poll_field['openform'] .= "<div class='text-info m-b-20 m-t-10'>" . $locale['forum_0613'] . "</div>\n";
                 $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $data['forum_poll_title'], array('max_length' => 255, 'placeholder' => $locale['forum_0604a'], 'inline' => TRUE, 'required' => TRUE));
                 if ($load == FALSE) {
                     for ($i = 1; $i <= count($option_data); $i++) {
                         $poll_field['poll_field'] .= form_text("poll_options[{$i}]", sprintf($locale['forum_0606'], $i), $option_data[$i], array('max_length' => 255, 'placeholder' => $locale['forum_0605'], 'inline' => 1, 'required' => $i <= 2 ? TRUE : FALSE));
                     }
                 } else {
                     $result = dbquery("SELECT forum_poll_option_text, forum_poll_option_votes FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $_GET['thread_id'] . "' ORDER BY forum_poll_option_id ASC");
                     $i = 1;
                     while ($_pdata = dbarray($result)) {
                         $poll_field['poll_field'] .= form_text("poll_options[{$i}]", $locale['forum_0605'] . ' ' . $i, $_pdata['forum_poll_option_text'], array('max_length' => 255, 'placeholder' => 'Poll Options', 'inline' => 1, 'required' => $i <= 2 or $_pdata['forum_poll_option_votes'] ? TRUE : FALSE));
                         $i++;
                     }
                 }
                 $poll_field['poll_field'] .= "<div class='col-xs-12 col-sm-offset-3'>\n";
                 $poll_field['poll_field'] .= form_button('add_poll_option', $locale['forum_0608'], $locale['forum_0608'], array('class' => 'btn-primary btn-sm'));
                 $poll_field['poll_field'] .= "</div>\n";
                 $poll_field['poll_button'] = form_button('update_poll', $locale['forum_2013'], $locale['forum_2013'], array('class' => 'btn-default'));
                 $poll_field['closeform'] = closeform();
             } else {
                 redirect(INFUSIONS . 'forum/index.php');
                 // redirect because the poll id is not available.
             }
         } else {
             // Save New Poll
             if (isset($_POST['add_poll'])) {
                 dbquery_insert(DB_FORUM_POLLS, $data, 'save');
                 $data['forum_poll_id'] = dblastid();
                 $i = 1;
                 foreach ($option_data as $option_text) {
                     if ($option_text) {
                         $data['forum_poll_option_id'] = $i;
                         $data['forum_poll_option_text'] = $option_text;
                         $data['forum_poll_option_votes'] = 0;
                         dbquery_insert(DB_FORUM_POLL_OPTIONS, $data, 'save');
                         $i++;
                     }
                 }
                 if ($defender->safe()) {
                     dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_poll='1' WHERE thread_id='" . $thread_data['thread_id'] . "'");
                     redirect(INFUSIONS . "forum/postify.php?post=newpoll&error=0&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']);
                 }
             }
             // blank poll - no poll on edit or new thread
             $poll_field['openform'] = openform('pollform', 'post', INFUSIONS . 'forum/viewthread.php?action=newpoll&forum_id=' . $_GET['forum_id'] . '&thread_id=' . $_GET['thread_id'], array('max_tokens' => 1));
             $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $data['forum_poll_title'], array('max_length' => 255, 'placeholder' => $locale['forum_0604a'], 'inline' => TRUE, 'required' => TRUE));
             for ($i = 1; $i <= count($option_data); $i++) {
                 $poll_field['poll_field'] .= form_text("poll_options[{$i}]", sprintf($locale['forum_0606'], $i), $option_data[$i], array('max_length' => 255, 'placeholder' => $locale['forum_0605'], 'inline' => 1, 'required' => $i <= 2 ? TRUE : FALSE));
             }
             $poll_field['poll_field'] .= "<div class='col-xs-12 col-sm-offset-3'>\n";
             $poll_field['poll_field'] .= form_button('add_poll_option', $locale['forum_0608'], $locale['forum_0608'], array('class' => 'btn-primary btn-sm'));
             $poll_field['poll_field'] .= "</div>\n";
             $poll_field['poll_button'] = form_button('add_poll', $locale['forum_2011'], $locale['forum_2011'], array('class' => 'btn-success btn-md'));
             $poll_field['closeform'] = closeform();
         }
         $info = array('title' => $locale['forum_0366'], 'description' => $locale['forum_2000'] . $thread_data['thread_subject'], 'field' => $poll_field);
         pollform($info);
     } else {
         redirect(FORUM . "index.php");
     }
 }
コード例 #18
0
ファイル: blog_cat.php プロジェクト: php-fusion/PHP-Fusion
    $result = dbquery("SELECT blog_cat_id, blog_cat_name, blog_cat_parent, blog_cat_image, blog_cat_language FROM " . DB_BLOG_CATS . " " . (multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " blog_cat_id='" . intval($_GET['cat_id']) . "'");
    if (dbrows($result)) {
        $data = dbarray($result);
        $data['blog_cat_hidden'] = array($data['blog_cat_id']);
        $formTitle = $locale['blog_0402'];
    } 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("blog_cat_id", "", $data['blog_cat_id']);
echo form_text("blog_cat_name", $locale['blog_0530'], $data['blog_cat_name'], array("required" => TRUE, "inline" => TRUE, "error_text" => $locale['blog_0560']));
echo form_select_tree("blog_cat_parent", $locale['blog_0533'], $data['blog_cat_parent'], array("inline" => TRUE, "disable_opts" => $data['blog_cat_hidden'], "hide_disabled" => TRUE, "query" => multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : ""), DB_BLOG_CATS, "blog_cat_name", "blog_cat_id", "blog_cat_parent");
if (multilang_table("BL")) {
    echo form_select("blog_cat_language", $locale['global_ML100'], $data['blog_cat_language'], array("inline" => TRUE, "options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose']));
} else {
    echo form_hidden("blog_cat_language", "", $data['blog_cat_language']);
}
echo form_select("blog_cat_image", $locale['blog_0531'], $data['blog_cat_image'], array("inline" => TRUE, "options" => blogCatImageOpts()));
echo form_button("save_cat", $locale['blog_0532'], $locale['blog_0532'], array("class" => "btn-success"));
closeside();
openside($locale['blog_0407']);
$result = dbquery("SELECT blog_cat_id, blog_cat_name FROM " . DB_BLOG_CATS . " " . (multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY blog_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
    $counter = 0;
    $columns = 4;
コード例 #19
0
ファイル: news_submit.php プロジェクト: knapnet/PHP-Fusion
     }
     $news_body = "";
     if ($_POST['news_body']) {
         $news_body = parse_textarea($_POST['news_body']);
     }
     $criteriaArray = array("news_subject" => form_sanitizer($_POST['news_subject'], "", "news_subject"), "news_language" => form_sanitizer($_POST['news_language'], "", "news_language"), "news_ialign" => form_sanitizer($_POST['news_ialign'], "", "news_ialign"), "news_keywords" => form_sanitizer($_POST['news_keywords'], "", "news_keywords"), "news_cat" => form_sanitizer($_POST['news_cat'], 0, "news_cat"), "news_snippet" => form_sanitizer($_POST['news_news'], "", "news_news"), "news_body" => form_sanitizer($_POST['news_body'], "", "news_body"));
     opentable($criteriaArray['news_subject']);
     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));
コード例 #20
0
         echo closemodal();
     }
 }
 echo openform("publish_article", "post", FUSION_REQUEST);
 echo "<div class='well clearfix'>\n";
 echo "<div class='pull-left'>\n";
 echo display_avatar($data, "30px", "", "", "");
 echo "</div>\n";
 echo "<div class='overflow-hide'>\n";
 echo $locale['articles_0052'] . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "<br/>\n";
 echo $locale['articles_0053'] . timer($data['submit_datestamp']) . " - " . showdate("shortdate", $data['submit_datestamp']);
 echo "</div>\n";
 echo "</div>\n";
 echo "<div class='container-fluid'>\n";
 echo "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-8'>";
 echo form_text("article_subject", $locale['articles_0200'], $callback_data['article_subject'], array("required" => TRUE, "inline" => FALSE));
 echo form_select('article_keywords', $locale['articles_0204'], $callback_data['article_keywords'], array("max_length" => 320, "placeholder" => $locale['articles_0204a'], "width" => "100%", "error_text" => $locale['articles_0257'], "tags" => TRUE, "multiple" => TRUE));
 $snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "form_name" => "inputform");
 if (fusion_get_settings("tinymce_enabled")) {
     $snippetSettings = array("required" => TRUE);
 }
 echo form_textarea('article_snippet', $locale['articles_0202'], $callback_data['article_snippet'], $snippetSettings);
 $extendedSettings = array();
 if (!fusion_get_settings("tinymce_enabled")) {
     $extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "form_name" => "inputform");
 }
 echo form_textarea('article_article', $locale['articles_0203'], $callback_data['article_article'], $extendedSettings);
 echo "</div>\n";
 echo "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-4'>\n";
 openside("");
 echo form_select_tree("article_cat", $locale['articles_0201'], $callback_data['article_cat'], array("width" => "100%", "inline" => TRUE, "no_root" => TRUE, "query" => multilang_table("AR") ? "WHERE article_cat_language='" . LANGUAGE . "'" : ""), DB_ARTICLE_CATS, "article_cat_name", "article_cat_id", "article_cat_parent");
コード例 #21
0
         $article_article = str_replace("src='" . str_replace("../", "", IMAGES_A), "src='" . IMAGES_A, parseubb(stripslashes($_POST['article_article'])));
         $article_article = parse_textarea($article_article);
     }
     $criteriaArray = array("article_subject" => form_sanitizer($_POST['article_subject'], "", "article_subject"), "article_cat" => form_sanitizer($_POST['article_cat'], 0, "article_cat"), "article_snippet" => form_sanitizer($article_snippet, "", "article_snippet"), "article_article" => form_sanitizer($article_article, "", "article_article"), "article_keywords" => form_sanitizer($_POST['article_keywords'], "", "article_keywords"), "article_language" => form_sanitizer($_POST['article_language'], "", "article_language"));
     $criteriaArray['article_snippet'] = parse_textarea($article_snippet);
     $criteriaArray['article_article'] = parse_textarea($article_article);
     opentable($criteriaArray['article_subject']);
     echo "<p class='text-bigger'>" . $criteriaArray['article_snippet'] . "</p>";
     echo $criteriaArray['article_article'];
     closetable();
 }
 add_to_title($locale['global_200'] . $locale['articles_0060']);
 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['articles_0063']) . "</div>\n";
 echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=a");
 echo form_text('article_subject', $locale['articles_0304'], $criteriaArray['article_subject'], array("required" => TRUE, "inline" => TRUE));
 if (multilang_table("AR")) {
     echo form_select('article_language', $locale['global_ML100'], $criteriaArray['article_language'], array("options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose'], "width" => "250px", "inline" => TRUE));
 } else {
     echo form_hidden('article_language', '', $criteriaArray['article_language']);
 }
 echo form_select('article_keywords', $locale['articles_0204'], $criteriaArray['article_keywords'], array("max_length" => 320, "inline" => TRUE, "placeholder" => $locale['articles_0204a'], "width" => "100%", "error_text" => $locale['articles_0204a'], "tags" => TRUE, "multiple" => TRUE));
 echo form_select_tree("article_cat", $locale['articles_0201'], $criteriaArray['article_cat'], array("width" => "250px", "inline" => TRUE, "no_root" => TRUE, "query" => multilang_table("AR") ? "WHERE article_cat_language='" . LANGUAGE . "'" : ""), DB_ARTICLE_CATS, "article_cat_name", "article_cat_id", "article_cat_parent");
 $textArea_opts = array("required" => TRUE, "type" => fusion_get_settings("tinymce_enabled") ? "tinymce" : "html", "tinymce" => fusion_get_settings("tinymce_enabled") && iADMIN ? "advanced" : "simple", "autosize" => TRUE, "form_name" => "submit_form");
 echo form_textarea('article_snippet', $locale['articles_0202'], $criteriaArray['article_snippet'], $textArea_opts);
 $textArea_opts['required'] = $article_settings['article_extended_required'] ? TRUE : FALSE;
 echo form_textarea('article_article', $locale['articles_0203'], $criteriaArray['article_article'], $textArea_opts);
 echo fusion_get_settings("site_seo") ? "" : form_button('preview_article', $locale['articles_0240'], $locale['articles_0240'], array('class' => 'btn-primary m-r-10'));
 echo form_button('submit_article', $locale['articles_0060'], $locale['articles_0060'], array('class' => 'btn-primary'));
 echo closeform();
 echo "</div>\n</div>\n";
コード例 #22
0
ファイル: edit.php プロジェクト: uzura8/flockbird
<div class="well">
<?php 
$label_size = 3;
echo form_open();
?>
	<?php 
echo render('member/profile/_parts/form/edit_items', array('label_size' => $label_size, 'val' => $val, 'member_public_flags' => $member_public_flags, 'profiles' => $profiles, 'member_profile_public_flags' => $member_profile_public_flags));
?>

<?php 
if ($is_regist) {
    ?>
	<?php 
    echo form_text(anchor('site/term', '利用規約', false, array(), true) . ' をお読みいただき、同意される方のみ「同意して登録する」ボタンを押してください。', null, $label_size, true);
}
?>

	<?php 
echo form_button($is_regist ? '同意して登録する' : 'form.do_edit', 'submit', 'submit', array(), $label_size);
echo form_close();
?>
</div><!-- well -->
コード例 #23
0
ファイル: user_groups.php プロジェクト: WuChEn/PHP-Fusion
echo form_text('', 'group_name', 'group_name', $group_name, array('required' => 1, 'error_text' => $locale['464']));
echo "</td>\n</tr>\n<tr>\n<td class='tbl' width='1%' style='white-space:nowrap;'><label for='group_description'>" . $locale['433'] . "</label></td>\n";
echo "<td class='tbl'>\n";
echo form_textarea('', 'group_description', 'group_description', $group_description, '');
echo "</td>\n</tr>\n<tr>\n<td align='center' colspan='2' class='tbl'><br />\n";
echo form_button($locale['434'], 'save_group', 'save_group', $locale['434'], array('class' => 'btn-primary'));
echo "</td>\n</tr>\n</tbody>\n</table>\n</form>";
closetable();
if (isset($_GET['group_id']) && isnum($_GET['group_id'])) {
    opentable($locale['440']);
    if (!isset($_POST['search_users'])) {
        // no need token for this form.
        echo "<form name='searchform' method='post' action='" . FUSION_SELF . $aidlink . "&amp;group_id=" . $_GET['group_id'] . "'>\n";
        echo "<table cellpadding='0' cellspacing='0' class='table table-responsive center'>\n";
        echo "<tr>\n<td align='center' class='tbl'><div class='well'>" . $locale['441'] . "<br />" . $locale['442'] . "</div>\n";
        echo form_text('', 'search_criteria', 'search_criteria', '');
        echo "</td>\n</tr>\n<tr>\n<td align='center' class='tbl'>\n";
        echo "<label class='m-r-10'><input type='radio' name='search_type' value='user_name' checked='checked' />&nbsp;" . $locale['444'] . "</label>\n";
        echo "<label><input type='radio' name='search_type' value='user_id' />&nbsp;" . $locale['443'] . "</label></td>\n";
        echo "</tr>\n<tr>\n<td align='center' class='tbl'>\n";
        echo form_button($locale['445'], 'search_users', 'search_users', $locale['445'], array('class' => 'btn-primary'));
        echo "</td>\n</tr>\n</table>\n</form>\n";
    }
    if (isset($_POST['search_users']) && isset($_POST['search_criteria'])) {
        $search_items = explode(",", $_POST['search_criteria']);
        $search_ids = "";
        $search_names = "";
        $mysql_search = "";
        foreach ($search_items as $item) {
            if ($_POST['search_type'] == "user_id" && isnum($item)) {
                $search_ids .= ($search_ids != "" ? "," : "") . $item;
コード例 #24
0
ファイル: user_shifts.php プロジェクト: Bartzi/engelsystem
function user_shifts()
{
    global $user, $privileges, $max_freeloadable_shifts;
    if (User_is_freeloader($user)) {
        redirect(page_link_to('user_myshifts'));
    }
    // Locations laden
    $rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
    $room_array = array();
    foreach ($rooms as $room) {
        $room_array[$room['RID']] = $room['Name'];
    }
    // Löschen einzelner Schicht-Einträge (Also Belegung einer Schicht von Engeln) durch Admins
    if (isset($_REQUEST['entry_id']) && in_array('user_shifts_admin', $privileges)) {
        if (isset($_REQUEST['entry_id']) && test_request_int('entry_id')) {
            $entry_id = $_REQUEST['entry_id'];
        } else {
            redirect(page_link_to('user_shifts'));
        }
        $shift_entry_source = sql_select("\n        SELECT `User`.`Nick`, `ShiftEntry`.`Comment`, `ShiftEntry`.`UID`, `ShiftTypes`.`name`, `Shifts`.*, `Room`.`Name`, `AngelTypes`.`name` as `angel_type` \n        FROM `ShiftEntry` \n        JOIN `User` ON (`User`.`UID`=`ShiftEntry`.`UID`) \n        JOIN `AngelTypes` ON (`ShiftEntry`.`TID` = `AngelTypes`.`id`) \n        JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) \n        JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)\n        JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) \n        WHERE `ShiftEntry`.`id`='" . sql_escape($entry_id) . "'");
        if (count($shift_entry_source) > 0) {
            $shift_entry_source = $shift_entry_source[0];
            $result = ShiftEntry_delete($entry_id);
            if ($result === false) {
                engelsystem_error('Unable to delete shift entry.');
            }
            engelsystem_log("Deleted " . User_Nick_render($shift_entry_source) . "'s shift: " . $shift_entry_source['name'] . " at " . $shift_entry_source['Name'] . " from " . date("y-m-d H:i", $shift_entry_source['start']) . " to " . date("y-m-d H:i", $shift_entry_source['end']) . " as " . $shift_entry_source['angel_type']);
            success(_("Shift entry deleted."));
        } else {
            error(_("Entry not found."));
        }
        redirect(page_link_to('user_shifts'));
    } elseif (isset($_REQUEST['edit_shift']) && in_array('admin_shifts', $privileges)) {
        $msg = "";
        $ok = true;
        if (isset($_REQUEST['edit_shift']) && test_request_int('edit_shift')) {
            $shift_id = $_REQUEST['edit_shift'];
        } else {
            redirect(page_link_to('user_shifts'));
        }
        $shift = sql_select("\n        SELECT `ShiftTypes`.`name`, `Shifts`.*, `Room`.* FROM `Shifts` \n        JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) \n        JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)\n        WHERE `SID`='" . sql_escape($shift_id) . "'");
        if (count($shift) == 0) {
            redirect(page_link_to('user_shifts'));
        }
        $shift = $shift[0];
        // Engeltypen laden
        $types = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
        $angel_types = array();
        $needed_angel_types = array();
        foreach ($types as $type) {
            $angel_types[$type['id']] = $type;
            $needed_angel_types[$type['id']] = 0;
        }
        $shifttypes_source = ShiftTypes();
        $shifttypes = [];
        foreach ($shifttypes_source as $shifttype) {
            $shifttypes[$shifttype['id']] = $shifttype['name'];
        }
        // Benötigte Engeltypen vom Raum
        $needed_angel_types_source = sql_select("SELECT `AngelTypes`.*, `NeededAngelTypes`.`count` FROM `AngelTypes` LEFT JOIN `NeededAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id` AND `NeededAngelTypes`.`room_id`='" . sql_escape($shift['RID']) . "') ORDER BY `AngelTypes`.`name`");
        foreach ($needed_angel_types_source as $type) {
            if ($type['count'] != "") {
                $needed_angel_types[$type['id']] = $type['count'];
            }
        }
        // Benötigte Engeltypen von der Schicht
        $needed_angel_types_source = sql_select("SELECT `AngelTypes`.*, `NeededAngelTypes`.`count` FROM `AngelTypes` LEFT JOIN `NeededAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id` AND `NeededAngelTypes`.`shift_id`='" . sql_escape($shift_id) . "') ORDER BY `AngelTypes`.`name`");
        foreach ($needed_angel_types_source as $type) {
            if ($type['count'] != "") {
                $needed_angel_types[$type['id']] = $type['count'];
            }
        }
        $shifttype_id = $shift['shifttype_id'];
        $title = $shift['title'];
        $rid = $shift['RID'];
        $start = $shift['start'];
        $end = $shift['end'];
        if (isset($_REQUEST['submit'])) {
            // Name/Bezeichnung der Schicht, darf leer sein
            $title = strip_request_item('title');
            // Auswahl der sichtbaren Locations für die Schichten
            if (isset($_REQUEST['rid']) && preg_match("/^[0-9]+\$/", $_REQUEST['rid']) && isset($room_array[$_REQUEST['rid']])) {
                $rid = $_REQUEST['rid'];
            } else {
                $ok = false;
                $rid = $rooms[0]['RID'];
                $msg .= error(_("Please select a room."), true);
            }
            if (isset($_REQUEST['shifttype_id']) && isset($shifttypes[$_REQUEST['shifttype_id']])) {
                $shifttype_id = $_REQUEST['shifttype_id'];
            } else {
                $ok = false;
                $msg .= error(_('Please select a shifttype.'), true);
            }
            if (isset($_REQUEST['start']) && ($tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['start'])))) {
                $start = $tmp->getTimestamp();
            } else {
                $ok = false;
                $msg .= error(_("Please enter a valid starting time for the shifts."), true);
            }
            if (isset($_REQUEST['end']) && ($tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['end'])))) {
                $end = $tmp->getTimestamp();
            } else {
                $ok = false;
                $msg .= error(_("Please enter a valid ending time for the shifts."), true);
            }
            if ($start >= $end) {
                $ok = false;
                $msg .= error(_("The ending time has to be after the starting time."), true);
            }
            foreach ($needed_angel_types_source as $type) {
                if (isset($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+\$/", trim($_REQUEST['type_' . $type['id']]))) {
                    $needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
                } else {
                    $ok = false;
                    $msg .= error(sprintf(_("Please check your input for needed angels of type %s."), $type['name']), true);
                }
            }
            if ($ok) {
                $shift['shifttype_id'] = $shifttype_id;
                $shift['title'] = $title;
                $shift['RID'] = $rid;
                $shift['start'] = $start;
                $shift['end'] = $end;
                $result = Shift_update($shift);
                if ($result === false) {
                    engelsystem_error('Unable to update shift.');
                }
                sql_query("DELETE FROM `NeededAngelTypes` WHERE `shift_id`='" . sql_escape($shift_id) . "'");
                $needed_angel_types_info = array();
                foreach ($needed_angel_types as $type_id => $count) {
                    sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`='" . sql_escape($shift_id) . "', `angel_type_id`='" . sql_escape($type_id) . "', `count`='" . sql_escape($count) . "'");
                    $needed_angel_types_info[] = $angel_types[$type_id]['name'] . ": " . $count;
                }
                engelsystem_log("Updated shift '" . $name . "' from " . date("y-m-d H:i", $start) . " to " . date("y-m-d H:i", $end) . " with angel types " . join(", ", $needed_angel_types_info));
                success(_("Shift updated."));
                redirect(shift_link(['SID' => $shift_id]));
            }
        }
        $room_select = html_select_key('rid', 'rid', $room_array, $rid);
        $angel_types = "";
        foreach ($types as $type) {
            $angel_types .= form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]);
        }
        return page_with_title(shifts_title(), array(msg(), '<noscript>' . info(_("This page is much more comfortable with javascript."), true) . '</noscript>', form(array(form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id), form_text('title', _("Title"), $title), form_select('rid', _("Room:"), $room_array, $rid), form_text('start', _("Start:"), date("Y-m-d H:i", $start)), form_text('end', _("End:"), date("Y-m-d H:i", $end)), '<h2>' . _("Needed angels") . '</h2>', $angel_types, form_submit('submit', _("Save"))))));
    } elseif (isset($_REQUEST['delete_shift']) && in_array('user_shifts_admin', $privileges)) {
        if (isset($_REQUEST['delete_shift']) && preg_match("/^[0-9]*\$/", $_REQUEST['delete_shift'])) {
            $shift_id = $_REQUEST['delete_shift'];
        } else {
            redirect(page_link_to('user_shifts'));
        }
        $shift = Shift($shift_id);
        if ($shift === false) {
            engelsystem_error('Unable to load shift.');
        }
        if ($shift == null) {
            redirect(page_link_to('user_shifts'));
        }
        // Schicht löschen bestätigt
        if (isset($_REQUEST['delete'])) {
            $result = Shift_delete($shift_id);
            if ($result === false) {
                engelsystem_error('Unable to delete shift.');
            }
            engelsystem_log("Deleted shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']));
            success(_("Shift deleted."));
            redirect(page_link_to('user_shifts'));
        }
        return page_with_title(shifts_title(), array(error(sprintf(_("Do you want to delete the shift %s from %s to %s?"), $shift['name'], date("Y-m-d H:i", $shift['start']), date("H:i", $shift['end'])), true), '<a class="button" href="?p=user_shifts&delete_shift=' . $shift_id . '&delete">' . _("delete") . '</a>'));
    } elseif (isset($_REQUEST['shift_id'])) {
        if (isset($_REQUEST['shift_id']) && preg_match("/^[0-9]*\$/", $_REQUEST['shift_id'])) {
            $shift_id = $_REQUEST['shift_id'];
        } else {
            redirect(page_link_to('user_shifts'));
        }
        $shift = Shift($shift_id);
        $room;
        $shift['Name'] = $room_array[$shift['RID']];
        if ($shift === false) {
            engelsystem_error('Unable to load shift.');
        }
        if ($shift == null) {
            redirect(page_link_to('user_shifts'));
        }
        if (isset($_REQUEST['type_id']) && preg_match("/^[0-9]*\$/", $_REQUEST['type_id'])) {
            $type_id = $_REQUEST['type_id'];
        } else {
            redirect(page_link_to('user_shifts'));
        }
        if (in_array('user_shifts_admin', $privileges)) {
            $type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($type_id) . "' LIMIT 1");
        } else {
            $type = sql_select("SELECT * FROM `UserAngelTypes` JOIN `AngelTypes` ON (`UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`) WHERE `AngelTypes`.`id` = '" . sql_escape($type_id) . "' AND (`AngelTypes`.`restricted` = 0 OR (`UserAngelTypes`.`user_id` = '" . sql_escape($user['UID']) . "' AND NOT `UserAngelTypes`.`confirm_user_id` IS NULL)) LIMIT 1");
        }
        if (count($type) == 0) {
            redirect(page_link_to('user_shifts'));
        }
        $type = $type[0];
        if (!Shift_signup_allowed($shift, $type)) {
            error(_('You are not allowed to sign up for this shift. Maybe shift is full or already running.'));
            redirect(shift_link($shift));
        }
        if (isset($_REQUEST['submit'])) {
            $selected_type_id = $type_id;
            if (in_array('user_shifts_admin', $privileges)) {
                if (isset($_REQUEST['user_id']) && preg_match("/^[0-9]*\$/", $_REQUEST['user_id'])) {
                    $user_id = $_REQUEST['user_id'];
                } else {
                    $user_id = $user['UID'];
                }
                if (sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1") == 0) {
                    redirect(page_link_to('user_shifts'));
                }
                if (isset($_REQUEST['angeltype_id']) && test_request_int('angeltype_id') && sql_num_query("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($_REQUEST['angeltype_id']) . "' LIMIT 1") > 0) {
                    $selected_type_id = $_REQUEST['angeltype_id'];
                }
            } else {
                $user_id = $user['UID'];
            }
            if (sql_num_query("SELECT * FROM `ShiftEntry` WHERE `SID`='" . sql_escape($shift['SID']) . "' AND `UID` = '" . sql_escape($user_id) . "'")) {
                return error("This angel does already have an entry for this shift.", true);
            }
            $freeloaded = $shift['freeloaded'];
            $freeload_comment = $shift['freeload_comment'];
            if (in_array("user_shifts_admin", $privileges)) {
                $freeloaded = isset($_REQUEST['freeloaded']);
                $freeload_comment = strip_request_item_nl('freeload_comment');
            }
            $comment = strip_request_item_nl('comment');
            $result = ShiftEntry_create(array('SID' => $shift_id, 'TID' => $selected_type_id, 'UID' => $user_id, 'Comment' => $comment, 'freeloaded' => $freeloaded, 'freeload_comment' => $freeload_comment));
            if ($result === false) {
                engelsystem_error('Unable to create shift entry.');
            }
            if ($type['restricted'] == 0 && sql_num_query("SELECT * FROM `UserAngelTypes` INNER JOIN `AngelTypes` ON `AngelTypes`.`id` = `UserAngelTypes`.`angeltype_id` WHERE `angeltype_id` = '" . sql_escape($selected_type_id) . "' AND `user_id` = '" . sql_escape($user_id) . "' ") == 0) {
                sql_query("INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES ('" . sql_escape($user_id) . "', '" . sql_escape($selected_type_id) . "')");
            }
            $user_source = User($user_id);
            engelsystem_log("User " . User_Nick_render($user_source) . " signed up for shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']));
            success(_("You are subscribed. Thank you!") . ' <a href="' . page_link_to('user_myshifts') . '">' . _("My shifts") . ' &raquo;</a>');
            redirect(shift_link($shift));
        }
        if (in_array('user_shifts_admin', $privileges)) {
            $users = sql_select("SELECT *, (SELECT count(*) FROM `ShiftEntry` WHERE `freeloaded`=1 AND `ShiftEntry`.`UID`=`User`.`UID`) AS `freeloaded` FROM `User` ORDER BY `Nick`");
            $users_select = array();
            foreach ($users as $usr) {
                $users_select[$usr['UID']] = $usr['Nick'] . ($usr['freeloaded'] == 0 ? "" : " (" . _("Freeloader") . ")");
            }
            $user_text = html_select_key('user_id', 'user_id', $users_select, $user['UID']);
            $angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
            $angeltypes = array();
            foreach ($angeltypes_source as $angeltype) {
                $angeltypes[$angeltype['id']] = $angeltype['name'];
            }
            $angeltyppe_select = html_select_key('angeltype_id', 'angeltype_id', $angeltypes, $type['id']);
        } else {
            $user_text = User_Nick_render($user);
            $angeltyppe_select = $type['name'];
        }
        return ShiftEntry_edit_view($user_text, date("Y-m-d H:i", $shift['start']) . ' &ndash; ' . date('Y-m-d H:i', $shift['end']) . ' (' . shift_length($shift) . ')', $shift['Name'], $shift['name'], $angeltyppe_select, "", false, null, in_array('user_shifts_admin', $privileges));
    } else {
        return view_user_shifts();
    }
}
コード例 #25
0
opentable($locale['400']);
echo openform('settingsform', 'settingsform', 'post', FUSION_SELF . $aidlink, array('downtime' => 0));
echo "<table class='table table-responsive center'>\n<tbody>\n<tr>\n";
echo "<td class='tbl2' align='center' colspan='2'><strong>" . $locale['707'] . "</strong></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl' width='50%'><label for='pm_inbox'>" . $locale['701'] . "</label><br /><span class='small2'>" . $locale['704'] . "</span></td>\n";
echo "<td class='tbl' width='50%'>\n";
echo form_text('', 'pm_inbox', 'pm_inbox', $pm_inbox, array('max_length' => 4, 'width' => '100px'));
echo "</td>\n</tr>\n<tr>\n";
echo "<td class='tbl' width='50%'><label for='pm_sentbox'>" . $locale['702'] . "</label><br /><span class='small2'>" . $locale['704'] . "</span></td>\n";
echo "<td class='tbl' width='50%'>\n";
echo form_text('', 'pm_sentbox', 'pm_sentbox', $pm_sentbox, array('max_length' => 4, 'width' => '100px'));
echo "</td>\n</tr>\n<tr>\n";
echo "<td class='tbl' width='50%'><label for='pm_savebox'>" . $locale['703'] . "</label><br /><span class='small2'>" . $locale['704'] . "</span></td>\n";
echo "<td class='tbl' width='50%'>\n";
echo form_text('', 'pm_savebox', 'pm_savebox', $pm_savebox, array('max_length' => 4, 'width' => '100px'));
echo "</td>\n</tr>\n<tr>\n";
echo "<td class='tbl2' align='center' colspan='2'><strong>" . $locale['708'] . "</strong></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl' width='50%'><label for='pm_email_notify'>" . $locale['709'] . "</label></td>\n";
echo "<td class='tbl' width='50%'>\n";
$opts = array('0' => $locale['519'], '1' => $locale['518']);
echo form_select('', 'pm_email_notify', 'pm_email_notify', $opts, $options['pm_email_notify']);
echo "</td>\n</tr>\n<tr>\n";
echo "<td class='tbl' width='50%'><label for='pm_save_sent'>" . $locale['710'] . "</label></td>\n";
echo "<td class='tbl' width='50%'>\n";
echo form_select('', 'pm_save_sent', 'pm_save_sent', $opts, $options['pm_save_sent']);
echo "</td>\n</tr>\n<tr>\n";
echo "<td align='center' colspan='2' class='tbl'><span class='small2'>" . $locale['711'] . "</span></td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' colspan='2' class='tbl'><br />\n";
コード例 #26
0
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
pageAccess("S8");
if (isset($_POST['savesettings'])) {
    $error = 0;
    $inputArray = array("article_pagination" => form_sanitizer($_POST['article_pagination'], 0, "article_pagination"), "article_allow_submission" => form_sanitizer($_POST['article_allow_submission'], 0, "article_allow_submission"), "article_extended_required" => isset($_POST['article_extended_required']) ? 1 : 0);
    if (defender::safe()) {
        foreach ($inputArray as $settings_name => $settings_value) {
            $inputSettings = array("settings_name" => $settings_name, "settings_value" => $settings_value, "settings_inf" => "article");
            dbquery_insert(DB_SETTINGS_INF, $inputSettings, "update", array("primary_key" => "settings_name"));
        }
        addNotice("success", $locale['900']);
        redirect(FUSION_REQUEST);
    } else {
        addNotice('danger', $locale['901']);
    }
}
echo "<div class='well'>" . $locale['articles_0031'] . "</div>";
echo openform('settingsform', 'post', FUSION_REQUEST);
openside('');
echo form_text("article_pagination", $locale['articles_0032'], $article_settings['article_pagination'], array("inline" => TRUE, "max_length" => 4, "width" => "150px", "type" => "number"));
echo form_select("article_allow_submission", $locale['articles_0033'], $article_settings['article_allow_submission'], array("inline" => TRUE, "options" => array($locale['disable'], $locale['enable'])));
echo form_checkbox("article_extended_required", $locale['articles_0034'], $article_settings['article_extended_required'], array("inline" => TRUE));
closeside();
echo form_button('savesettings', $locale['750'], $locale['750'], array('class' => 'btn-primary'));
echo closeform();
コード例 #27
0
ファイル: settings.php プロジェクト: php-fusion/PHP-Fusion
 public function viewSettingsAdmin()
 {
     global $aidlink;
     pageAccess('F');
     $forum_settings = $this->get_forum_settings();
     add_breadcrumb(array('link' => ADMIN . 'settings_forum.php' . $aidlink, 'title' => self::$locale['forum_settings']));
     if (isset($_POST['recount_user_post'])) {
         $result = dbquery("SELECT post_author, COUNT(post_id) as num_posts FROM " . DB_FORUM_POSTS . " GROUP BY post_author");
         if (dbrows($result)) {
             while ($data = dbarray($result)) {
                 $result2 = dbquery("UPDATE " . DB_USERS . " SET user_posts='" . $data['num_posts'] . "' WHERE user_id='" . $data['post_author'] . "'");
             }
             addNotice('success', self::$locale['forum_061']);
         }
     }
     if (isset($_POST['savesettings'])) {
         $numofthreads = form_sanitizer($_POST['numofthreads'], 20, 'numofthreads');
         $threads_num = form_sanitizer($_POST['threads_per_page'], 20, 'threads_per_page');
         $posts_num = form_sanitizer($_POST['posts_per_page'], 20, 'posts_per_page');
         $forum_ips = form_sanitizer($_POST['forum_ips'], -103, 'forum_ips');
         $attachmax = form_sanitizer($_POST['calc_b'], 1, 'calc_b') * form_sanitizer($_POST['calc_c'], 1000000, 'calc_c');
         $attachmax_count = form_sanitizer($_POST['forum_attachmax_count'], 5, 'forum_attachmax_count');
         $attachtypes = form_sanitizer($_POST['forum_attachtypes'], '.pdf,.gif,.jpg,.png,.zip,.rar,.tar,.bz2,.7z', 'forum_attachtypes');
         $thread_notify = form_sanitizer($_POST['thread_notify'], '0', 'thread_notify');
         $forum_ranks = form_sanitizer($_POST['forum_ranks'], '0', 'forum_ranks');
         $forum_rank_style = form_sanitizer($_POST['forum_rank_style'], '0', 'forum_rank_style');
         $forum_edit_lock = form_sanitizer($_POST['forum_edit_lock'], '0', 'forum_edit_lock');
         $forum_edit_timelimit = form_sanitizer($_POST['forum_edit_timelimit'], '0', 'forum_edit_timelimit');
         $popular_threads_timeframe = form_sanitizer($_POST['popular_threads_timeframe'], '604800', 'popular_threads_timeframe');
         $forum_last_posts_reply = form_sanitizer($_POST['forum_last_posts_reply'], '0', 'forum_last_posts_reply');
         $forum_last_post_avatar = form_sanitizer($_POST['forum_last_post_avatar'], '0', 'forum_last_post_avatar');
         $forum_editpost_to_lastpost = form_sanitizer($_POST['forum_editpost_to_lastpost'], '0', 'forum_editpost_to_lastpost');
         if (\defender::safe()) {
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$numofthreads}' WHERE settings_name='numofthreads' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$threads_num}' WHERE settings_name='threads_per_page' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$posts_num}' WHERE settings_name='posts_per_page'  AND settings_inf='forum'");
             //".(isnum($_POST['forum_ips']) ? $_POST['forum_ips'] : "103")."
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ips}' WHERE settings_name='forum_ips' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax}' WHERE settings_name='forum_attachmax' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax_count}' WHERE settings_name='forum_attachmax_count' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachtypes}' WHERE settings_name='forum_attachtypes' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$thread_notify}' WHERE settings_name='thread_notify' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ranks}' WHERE settings_name='forum_ranks' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_rank_style}' WHERE settings_name='forum_rank_style' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_lock}' WHERE settings_name='forum_edit_lock' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_timelimit}' WHERE settings_name='forum_edit_timelimit' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$popular_threads_timeframe}' WHERE settings_name='popular_threads_timeframe' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_posts_reply}' WHERE settings_name='forum_last_posts_reply' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_post_avatar}' WHERE settings_name='forum_last_post_avatar' AND settings_inf='forum'");
             dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_editpost_to_lastpost}' WHERE settings_name='forum_editpost_to_lastpost' AND settings_inf='forum'");
             addNotice('success', self::$locale['900']);
             redirect(FUSION_SELF . $aidlink . '&section=fs');
         }
     }
     $yes_no_array = array('1' => self::$locale['yes'], '0' => self::$locale['no']);
     echo "<div class='well'>" . self::$locale['forum_description'] . "</div>";
     echo openform('forum_settings_form', '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 "<span class='small pull-right'>* " . self::$locale['506'] . "</span><br/>\n";
     echo form_text('numofthreads', self::$locale['505'], $forum_settings['numofthreads'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number'));
     closeside();
     openside('');
     echo form_text('threads_per_page', self::$locale['forum_080'], $forum_settings['threads_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number'));
     echo form_text('posts_per_page', self::$locale['forum_081'], $forum_settings['posts_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number'));
     closeside();
     openside('');
     echo form_select('thread_notify', self::$locale['512'], $forum_settings['thread_notify'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     closeside();
     openside('');
     echo "<span class='pull-right position-absolute small' style='right:30px;'>" . self::$locale['537'] . "</span>\n";
     echo form_select('forum_edit_timelimit', self::$locale['536'], $forum_settings['forum_edit_timelimit'], array('options' => array('0', '10', '30', '45', '60'), 'max_length' => 2, 'width' => '100px', 'required' => 1, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     echo form_select('forum_ips', self::$locale['507'], $forum_settings['forum_ips'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     echo form_select('forum_ranks', self::$locale['520'], $forum_settings['forum_ranks'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     echo form_select('forum_rank_style', self::$locale['forum_064'], $forum_settings['forum_rank_style'], array('options' => array(self::$locale['forum_063'], self::$locale['forum_062']), 'error_text' => self::$locale['error_value'], 'inline' => 1));
     echo form_select('forum_last_post_avatar', self::$locale['539'], $forum_settings['forum_last_post_avatar'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     echo form_select('forum_edit_lock', self::$locale['521'], $forum_settings['forum_edit_lock'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     echo form_select('forum_editpost_to_lastpost', self::$locale['538'], $forum_settings['forum_editpost_to_lastpost'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
     closeside();
     echo "</div>\n";
     echo "<div class='col-xs-12 col-sm-4'>\n";
     openside('');
     $calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)');
     $calc_c = self::calculate_byte($forum_settings['forum_attachmax']);
     $calc_b = $forum_settings['forum_attachmax'] / $calc_c;
     require_once INCLUDES . "mimetypes_include.php";
     $mime = mimeTypes();
     $mime_opts = array();
     foreach ($mime as $m => $Mime) {
         $ext = ".{$m}";
         $mime_opts[$ext] = $ext;
     }
     sort($mime_opts);
     echo "<div class='clearfix'>\n";
     echo "<span class='pull-right small'>" . self::$locale['509'] . "</span>";
     echo "<label for='calc_c'>" . self::$locale['508'] . "</label><br />\n";
     echo form_text('calc_b', '', $calc_b, array('required' => 1, 'number' => 1, 'error_text' => self::$locale['error_rate'], 'width' => '100px', 'max_length' => '3', 'class' => 'm-r-10 pull-left'));
     echo form_select('calc_c', '', $calc_c, array('options' => $calc_opts, 'placeholder' => self::$locale['choose'], 'class' => 'pull-left', 'width' => '100%'));
     echo "</div>\n";
     echo "<div class='clearfix'>\n";
     echo "<span class='small pull-right'>" . self::$locale['535'] . "</span>\n";
     echo "<label for='attachmax_count'>" . self::$locale['534'] . "</label>\n";
     echo form_select('forum_attachmax_count', '', $forum_settings['forum_attachmax_count'], array('options' => range(1, 10), 'error_text' => self::$locale['error_value'], 'width' => '100%'));
     echo "</div>\n";
     echo "<div class='clearfix'>\n";
     echo "<span class='small pull-right'>" . self::$locale['511'] . "</span>\n";
     echo form_select('forum_attachtypes', self::$locale['510'], $forum_settings['forum_attachtypes'], array('options' => $mime_opts, 'width' => '100%', 'error_text' => self::$locale['error_type'], 'tags' => 1, 'multiple' => 1, 'placeholder' => self::$locale['choose']));
     echo "</div>\n";
     closeside();
     openside('');
     $timeframe_opts = array('604800' => self::$locale['527'], '2419200' => self::$locale['528'], '31557600' => self::$locale['529'], '0' => self::$locale['530']);
     $lastpost_opts = array('0' => self::$locale['519'], '1' => self::$locale['533']);
     for ($i = 2; $i <= 20; $i++) {
         $array_opts[$i] = sprintf(self::$locale['532'], $i);
     }
     if (isset($_GET['action']) && $_GET['action'] == "count_posts") {
         echo alert(self::$locale['524'], '', array('class' => 'warning'));
     }
     echo "<div class='clearfix'>\n";
     echo form_select('popular_threads_timeframe', self::$locale['525'], $forum_settings['popular_threads_timeframe'], array('options' => $timeframe_opts, 'error_text' => self::$locale['error_value'], 'width' => '100%'));
     echo "</div>\n";
     echo "<div class='clearfix'>\n";
     echo form_select('forum_last_posts_reply', self::$locale['531'], $forum_settings['forum_last_posts_reply'], array('options' => $lastpost_opts, 'error_text' => self::$locale['error_value'], 'width' => '100%'));
     echo "</div>\n";
     echo form_button('recount_user_post', self::$locale['523'], '1', array('class' => 'btn-primary btn-block'));
     closeside();
     echo "</div>\n";
     echo "</div>\n";
     echo form_button('savesettings', self::$locale['750'], self::$locale['750'], array('class' => 'btn-success'));
     echo closeform();
 }
コード例 #28
0
ファイル: settings_main.php プロジェクト: WuChEn/PHP-Fusion
echo "</tr>\n<tr>\n";
echo "<td valign='top' width='35%' class='tbl'><label for='description'>" . $locale['409'] . "</label></td>\n";
echo "<td width='65%' class='tbl'>\n";
echo form_textarea('', 'description', 'description', $settings2['description']);
echo "</td>\n</tr>\n<tr>\n";
echo "<td valign='top' width='35%' class='tbl'><label for='keywords'>" . $locale['410'] . "</label><br /><span class='small2'>" . $locale['411'] . "</span></td>\n";
echo "<td width='65%' class='tbl'>\n";
echo form_textarea('', 'keywords', 'keywords', $settings2['keywords']);
echo "</td>\n</tr>\n<tr>\n";
echo "<td valign='top' width='35%' class='tbl'><label for='footer'>" . $locale['412'] . "</label> <span class='required'>*</span></td>\n";
echo "<td width='65%' class='tbl'>\n";
echo form_textarea('', 'footer', 'footer', $settings2['footer'], array('required' => 1, 'error_text' => $locale['error_value']));
echo "</td>\n</tr>\n<tr>\n";
echo "<td width='35%' valign='top' class='tbl'><label for='opening_page'>" . $locale['413'] . "<label> <span class='required'>*</span></td>\n";
echo "<td width='65%' class='tbl'>\n";
echo form_text('', 'opening_page', 'opening_page', $settings2['opening_page'], array('max_length' => 100, 'required' => 1, 'error_text' => $locale['error_value']));
echo "</tr>\n<tr>\n";
echo "<td width='35%' class='tbl'><label for='theme'>" . $locale['418'] . "</label><span class='required'>*</span>";
if ($userdata['user_theme'] == "Default") {
    if ($settings2['theme'] != str_replace(THEMES, "", substr(THEME, 0, strlen(THEME) - 1))) {
        echo "<div id='close-message'><div class='admin-message alert alert-warning m-t-10'>" . $locale['global_302'] . "</div></div>\n";
    }
}
echo "</td>\n";
echo "<td width='65%' class='tbl'>\n";
$opts = array();
foreach ($theme_files as $file) {
    $opts[$file] = $file;
}
echo form_select('', 'theme', 'theme', $opts, $settings2['theme'], array("required" => 1, 'error_text' => $locale['error_value']));
echo "</td>\n</tr>\n<tr>\n";
コード例 #29
0
ファイル: articles.php プロジェクト: WuChEn/PHP-Fusion
     opentable($locale['400']);
 }
 $result = dbquery("SELECT article_cat_id, article_cat_name FROM " . DB_ARTICLE_CATS . " ORDER BY article_cat_name DESC");
 $catlist = array();
 while ($data = dbarray($result)) {
     $catlist[$data['article_cat_id']] = $data['article_cat_name'];
 }
 echo openform('input_form', 'input_form', 'post', FUSION_SELF . $aidlink, array('downtime' => 0));
 echo "<table cellpadding='0' cellspacing='0' class='table table-responsive center'>\n<tr>\n";
 echo "<td width='100' class='tbl'><label for='article_cat'>" . $locale['422'] . "</label></td>\n";
 echo "<td class='tbl'>\n";
 echo form_select('', 'article_cat', 'article_cat', $catlist, $article_cat, array('placeholder' => $locale['choose']));
 echo "</td>\n</tr>\n<tr>\n";
 echo "<td width='100' class='tbl'><label for='subject'>" . $locale['423'] . " <span class='required'>*</span></label></td>\n";
 echo "<td class='tbl'>\n";
 echo form_text('', 'subject', 'subject', $subject, array('required' => 1));
 echo "</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td valign='top' width='100' class='tbl'><label for='body'>" . $locale['424'] . "</label></td>\n";
 echo "<td class='tbl'>\n";
 echo form_textarea('', 'body', 'body', $body);
 echo "</td>\n";
 echo "</tr>\n";
 if ($settings['tinymce_enabled'] != 1) {
     echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>\n";
     echo display_html("input_form", "body", true, true, true, IMAGES_A);
     echo "</td>\n</tr>\n";
 }
 echo "<tr>\n<td valign='top' width='100' class='tbl'><label for='body2'>" . $locale['425'] . "</label></td>\n";
 echo "<td class='tbl'>\n";
 echo form_textarea('', 'body2', 'body2', $body2);
コード例 #30
0
function user_settings()
{
    global $enable_tshirt_size, $tshirt_sizes, $themes, $locales;
    global $user;
    $msg = "";
    $nick = $user['Nick'];
    $lastname = $user['Name'];
    $prename = $user['Vorname'];
    $age = $user['Alter'];
    $tel = $user['Telefon'];
    $dect = $user['DECT'];
    $mobile = $user['Handy'];
    $mail = $user['email'];
    $email_shiftinfo = $user['email_shiftinfo'];
    $jabber = $user['jabber'];
    $hometown = $user['Hometown'];
    $tshirt_size = $user['Size'];
    $password_hash = "";
    $selected_theme = $user['color'];
    $selected_language = $user['Sprache'];
    $planned_arrival_date = $user['planned_arrival_date'];
    $planned_departure_date = $user['planned_departure_date'];
    if (isset($_REQUEST['submit'])) {
        $ok = true;
        if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) {
            $mail = strip_request_item('mail');
            if (!check_email($mail)) {
                $ok = false;
                $msg .= error(_("E-mail address is not correct."), true);
            }
        } else {
            $ok = false;
            $msg .= error(_("Please enter your e-mail."), true);
        }
        $email_shiftinfo = isset($_REQUEST['email_shiftinfo']);
        if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
            $jabber = strip_request_item('jabber');
            if (!check_email($jabber)) {
                $ok = false;
                $msg .= error(_("Please check your jabber account information."), true);
            }
        }
        if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']])) {
            $tshirt_size = $_REQUEST['tshirt_size'];
        } elseif ($enable_tshirt_size) {
            $ok = false;
        }
        if (isset($_REQUEST['planned_arrival_date']) && DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))) {
            $planned_arrival_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))->getTimestamp();
        } else {
            $ok = false;
            $msg .= error(_("Please enter your planned date of arrival."), true);
        }
        if (isset($_REQUEST['planned_departure_date']) && $_REQUEST['planned_departure_date'] != '') {
            if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_departure_date']))) {
                $planned_departure_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_departure_date']))->getTimestamp();
            } else {
                $ok = false;
                $msg .= error(_("Please enter your planned date of departure."), true);
            }
        } else {
            $planned_departure_date = null;
        }
        // Trivia
        if (isset($_REQUEST['lastname'])) {
            $lastname = strip_request_item('lastname');
        }
        if (isset($_REQUEST['prename'])) {
            $prename = strip_request_item('prename');
        }
        if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}\$/", $_REQUEST['age'])) {
            $age = strip_request_item('age');
        }
        if (isset($_REQUEST['tel'])) {
            $tel = strip_request_item('tel');
        }
        if (isset($_REQUEST['dect'])) {
            $dect = strip_request_item('dect');
        }
        if (isset($_REQUEST['mobile'])) {
            $mobile = strip_request_item('mobile');
        }
        if (isset($_REQUEST['hometown'])) {
            $hometown = strip_request_item('hometown');
        }
        if ($ok) {
            sql_query("\n          UPDATE `User` SET\n          `Nick`='" . sql_escape($nick) . "',\n          `Vorname`='" . sql_escape($prename) . "',\n          `Name`='" . sql_escape($lastname) . "',\n          `Alter`='" . sql_escape($age) . "',\n          `Telefon`='" . sql_escape($tel) . "',\n          `DECT`='" . sql_escape($dect) . "',\n          `Handy`='" . sql_escape($mobile) . "',\n          `email`='" . sql_escape($mail) . "',\n          `email_shiftinfo`=" . sql_bool($email_shiftinfo) . ",\n          `jabber`='" . sql_escape($jabber) . "',\n          `Size`='" . sql_escape($tshirt_size) . "',\n          `Hometown`='" . sql_escape($hometown) . "',\n          `planned_arrival_date`='" . sql_escape($planned_arrival_date) . "',\n          `planned_departure_date`=" . sql_null($planned_departure_date) . "\n          WHERE `UID`='" . sql_escape($user['UID']) . "'");
            success(_("Settings saved."));
            redirect(page_link_to('user_settings'));
        }
    } elseif (isset($_REQUEST['submit_password'])) {
        $ok = true;
        if (!isset($_REQUEST['password']) || !verify_password($_REQUEST['password'], $user['Passwort'], $user['UID'])) {
            $msg .= error(_("-> not OK. Please try again."), true);
        } elseif (strlen($_REQUEST['new_password']) < MIN_PASSWORD_LENGTH) {
            $msg .= error(_("Your password is to short (please use at least 6 characters)."), true);
        } elseif ($_REQUEST['new_password'] != $_REQUEST['new_password2']) {
            $msg .= error(_("Your passwords don't match."), true);
        } elseif (set_password($user['UID'], $_REQUEST['new_password'])) {
            success(_("Password saved."));
        } else {
            error(_("Failed setting password."));
        }
        redirect(page_link_to('user_settings'));
    } elseif (isset($_REQUEST['submit_theme'])) {
        $ok = true;
        if (isset($_REQUEST['theme']) && isset($themes[$_REQUEST['theme']])) {
            $selected_theme = $_REQUEST['theme'];
        } else {
            $ok = false;
        }
        if ($ok) {
            sql_query("UPDATE `User` SET `color`='" . sql_escape($selected_theme) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'");
            success(_("Theme changed."));
            redirect(page_link_to('user_settings'));
        }
    } elseif (isset($_REQUEST['submit_language'])) {
        $ok = true;
        if (isset($_REQUEST['language']) && isset($locales[$_REQUEST['language']])) {
            $selected_language = $_REQUEST['language'];
        } else {
            $ok = false;
        }
        if ($ok) {
            sql_query("UPDATE `User` SET `Sprache`='" . sql_escape($selected_language) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'");
            $_SESSION['locale'] = $selected_language;
            success("Language changed.");
            redirect(page_link_to('user_settings'));
        }
    }
    return page_with_title(settings_title(), array($msg, msg(), div('row', array(div('col-md-6', array(form(array(form_info('', _("Here you can change your user details.")), form_info(entry_required() . ' = ' . _("Entry required!")), form_text('nick', _("Nick"), $nick, true), form_text('lastname', _("Last name"), $lastname), form_text('prename', _("First name"), $prename), form_date('planned_arrival_date', _("Planned date of arrival") . ' ' . entry_required(), $planned_arrival_date, time()), form_date('planned_departure_date', _("Planned date of departure"), $planned_departure_date, time()), form_text('age', _("Age"), $age), form_text('tel', _("Phone"), $tel), form_text('dect', _("DECT"), $dect), form_text('mobile', _("Mobile"), $mobile), form_text('mail', _("E-Mail") . ' ' . entry_required(), $mail), form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo), form_text('jabber', _("Jabber"), $jabber), form_text('hometown', _("Hometown"), $hometown), $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '', form_info('', _('Please visit the angeltypes page to manage your angeltypes.')), form_submit('submit', _("Save")))))), div('col-md-6', array(form(array(form_info(_("Here you can change your password.")), form_password('password', _("Old password:"******"New password:"******"Password confirmation:")), form_submit('submit_password', _("Save")))), form(array(form_info(_("Here you can choose your color settings:")), form_select('theme', _("Color settings:"), $themes, $selected_theme), form_submit('submit_theme', _("Save")))), form(array(form_info(_("Here you can choose your language:")), form_select('language', _("Language:"), $locales, $selected_language), form_submit('submit_language', _("Save"))))))))));
}