コード例 #1
0
function ShiftTypes_list_view($shifttypes)
{
    foreach ($shifttypes as &$shifttype) {
        $shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>';
        $shifttype['actions'] = table_buttons([button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'btn-xs'), button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs')]);
    }
    return page_with_title(shifttypes_title(), [msg(), buttons([button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add')]), table(['name' => _('Name'), 'actions' => ''], $shifttypes)]);
}
コード例 #2
0
ファイル: Shifts_view.php プロジェクト: Grreg/engelsystem
function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up)
{
    $parsedown = new Parsedown();
    $angeltypes = [];
    foreach ($angeltypes_source as $angeltype) {
        $angeltypes[$angeltype['id']] = $angeltype;
    }
    $needed_angels = '';
    foreach ($shift['NeedAngels'] as $needed_angeltype) {
        $class = 'progress-bar-warning';
        if ($needed_angeltype['taken'] == 0) {
            $class = 'progress-bar-danger';
        }
        if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
            $class = 'progress-bar-success';
        }
        $needed_angels .= '<div class="list-group-item">';
        $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '</div>';
        $needed_angels .= '<h3>' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '</h3>';
        $needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
        $angels = [];
        foreach ($shift['ShiftEntry'] as $shift_entry) {
            if ($shift_entry['TID'] == $needed_angeltype['TID']) {
                $entry = User_Nick_render(User($shift_entry['UID']));
                if ($shift_entry['freeloaded']) {
                    $entry = '<strike>' . $entry . '</strike>';
                }
                if ($user_shift_admin) {
                    $entry .= ' <div class="btn-group">';
                    $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
                    $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
                    $entry .= '</div>';
                }
                $angels[] = $entry;
            }
        }
        $needed_angels .= join(', ', $angels);
        $needed_angels .= '</div>';
    }
    $shiftManagers = getShiftManagers($shift['SID']);
    return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [msg(), Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '', $signed_up ? info(_('You are signed up for this shift.'), true) : '', $shift_admin || $admin_shifttypes || $admin_rooms ? buttons([$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '']) : '', div('row', [div('col-sm-3 col-xs-6', ['<h4>' . _('Title') . '</h4>', '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Start') . '</h4>', '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['start']), '<br />', glyph('time') . date('H:i', $shift['start']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('End') . '</h4>', '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['end']), '<br />', glyph('time') . date('H:i', $shift['end']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Location') . '</h4>', '<p class="lead">' . glyph('map-marker') . $room['Name'] . '</p>'])]), div('row', [div('col-sm-6', ['<h2>' . _('Needed angels') . '</h2>', '<div class="list-group">' . $needed_angels . '</div>']), div('col-sm-6', [!empty($shiftManagers) ? '<h2>' . _('Shift Manager') . '</h2>' : '', !empty($shiftManagers) ? implode('<br>', array_map(function ($manager) {
        return $manager['Vorname'] . ' ' . $manager['Name'];
    }, $shiftManagers)) : '', '<h2>' . _('Description') . '</h2>', $parsedown->parse($shifttype['description'])])]), $shift_admin ? Shift_editor_info_render($shift) : '']);
}
コード例 #3
0
/**
 * Edit a user's driving license information.
 * @param User $user_source
 * @param bool $wants_to_drive
 * @param bool $has_car
 * @param bool $has_license_car
 * @param bool $has_license_3_5t_transporter
 * @param bool $has_license_7_5t_truck
 * @param bool $has_license_12_5t_truck
 * @param bool $has_license_forklift
 */
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift)
{
    return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [buttons([button(user_link($user_source), _("Back to profile"), 'back')]), msg(), form([form_info(_("Privacy"), _("Your driving license information is only visible for coordinators and admins.")), form_checkbox('wants_to_drive', _("I am willing to operate cars for the PL"), $wants_to_drive), div('panel panel-default', [div('panel-body', [form_checkbox('has_car', _("I have my own car with me and am willing to use it for the PL (You'll get reimbursed for fuel)"), $has_car), heading(_("Driver license"), 3), form_checkbox('has_license_car', _("Car"), $has_license_car), form_checkbox('has_license_3_5t_transporter', _("Transporter 3,5t"), $has_license_3_5t_transporter), form_checkbox('has_license_7_5t_truck', _("Truck 7,5t"), $has_license_7_5t_truck), form_checkbox('has_license_12_5t_truck', _("Truck 12,5t"), $has_license_12_5t_truck), form_checkbox('has_license_forklift', _("Forklift"), $has_license_forklift)])], 'driving_license'), form_submit('submit', _("Save"))]), '<script type="text/javascript">
        $(function() {
          if($("#wants_to_drive").is(":checked"))
            $("#driving_license").show();
          else
            $("#driving_license").hide();
        
          $("#wants_to_drive").click(
            function(e) {
              if($("#wants_to_drive").is(":checked"))
                $("#driving_license").show();
              else
                $("#driving_license").hide();
            }
          );
        });
      </script>']);
}
コード例 #4
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)));
}
コード例 #5
0
} else {
    if (profile_screening()) {
        $query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " limit 20";
    } else {
        $query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " and uotd_time is null " . " and expavg_credit>1 " . " and (response1 <> '' or response2 <> '') " . " order by recommend desc limit 20";
    }
}
$result = _mysql_query($query);
$n = 0;
echo "<form action=profile_screen_action.php>\n";
start_table();
$found = false;
while ($profile = _mysql_fetch_object($result)) {
    $found = true;
    echo "<tr><td valign=top>";
    buttons($n);
    echo "\n        <br>Name: {$profile->name}\n        <br>recommends: {$profile->recommend}\n        <br>rejects: {$profile->reject}\n        <br>RAC: {$profile->expavg_credit}\n        <br>\n    ";
    echo "</td><td><table border=2> ";
    show_profile($profile, $g_logged_in_user, true);
    echo "</table></td></tr>\n";
    echo "<input type=\"hidden\" name=\"userid{$n}\" value=\"{$profile->userid}\">\n";
    $n++;
}
end_table();
if ($found) {
    echo "\n        <input type=\"hidden\" name=\"n\" value=\"{$n}\">\n        <input type=\"submit\" value=\"OK\">\n    ";
} else {
    echo "No more profiles to screen.";
}
echo "\n    </form>\n";
admin_page_tail();
コード例 #6
0
ファイル: user_shifts.php プロジェクト: Bartzi/engelsystem
function make_select($items, $selected, $name, $title = null)
{
    $html_items = array();
    if (isset($title)) {
        $html_items[] = '<h4>' . $title . '</h4>' . "\n";
    }
    foreach ($items as $i) {
        $html_items[] = '<div class="checkbox"><label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '"' . (in_array($i['id'], $selected) ? ' checked="checked"' : '') . '> ' . $i['name'] . '</label>' . (!isset($i['enabled']) || $i['enabled'] ? '' : glyph("lock")) . '</div><br />';
    }
    $html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
    $html .= implode("\n", $html_items);
    $html .= buttons(array(button("javascript: check_all('selection_" . $name . "')", _("All"), ""), button("javascript: uncheck_all('selection_" . $name . "')", _("None"), "")));
    $html .= '</div>' . "\n";
    return $html;
}
コード例 #7
0
ファイル: eventlist.php プロジェクト: antirek/prestige-pbx
                if ($flds[$i] != "") {
                    echo $tdnowrap . htmlentities($flds[$i]) . "</td>";
                } else {
                    echo $tdnowrap . "&nbsp;</td>";
                }
            } else {
                echo $tdnowrap . "&nbsp;</td>";
            }
        }
        if ($c > 4) {
            echo $tdnowrap;
            for ($i = 4; $i < $c; ++$i) {
                if ($flds[$i] != "") {
                    echo htmlentities($flds[$i]) . "  ";
                } else {
                    echo "&nbsp; ";
                }
            }
            echo "</td>";
        } else {
            echo $tdnowrap . "&nbsp</td>";
        }
        echo "</tr>";
        $rows++;
    }
    echo "</table>\n";
}
buttons($pattern);
echo "</center>\n</body>\n</html>\n";
mysql_close($mylink);
exit;
コード例 #8
0
function guest_login()
{
    global $user, $privileges;
    $nick = "";
    unset($_SESSION['uid']);
    if (isset($_REQUEST['submit'])) {
        $ok = true;
        if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 0) {
            $nick = User_validate_Nick($_REQUEST['nick']);
            $login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "'");
            if (count($login_user) > 0) {
                $login_user = $login_user[0];
                if (isset($_REQUEST['password'])) {
                    if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
                        $ok = false;
                        error(_("Your password is incorrect.  Please try it again."));
                    }
                } else {
                    $ok = false;
                    error(_("Please enter a password."));
                }
            } else {
                $ok = false;
                error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask an Dispatcher."));
            }
        } else {
            $ok = false;
            error(_("Please enter a nickname."));
        }
        if ($ok) {
            $_SESSION['uid'] = $login_user['UID'];
            $_SESSION['locale'] = $login_user['Sprache'];
            redirect(page_link_to('news'));
        }
    }
    if (in_array('register', $privileges)) {
        $register_hint = join('', array('<p>' . _("Please sign up, if you want to help us!") . '</p>', buttons(array(button(page_link_to('register'), register_title() . ' &raquo;')))));
    } else {
        $register_hint = join('', array(error(_('Registration is disabled.'), true)));
    }
    return page_with_title(login_title(), array(msg(), '<div class="row"><div class="col-md-6">', form(array(form_text('nick', _("Nick"), $nick), form_password('password', _("Password")), form_submit('submit', _("Login")), buttons(array(button(page_link_to('user_password_recovery'), _("I forgot my password")))), info(_("Please note: You have to activate cookies!"), true))), '</div>', '<div class="col-md-6">', '<h2>' . register_title() . '</h2>', $register_hint, '<h2>' . _("What can I do?") . '</h2>', '<p>' . _("Please read about the jobs you can do to help us.") . '</p>', buttons(array(button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;'))), '</div></div>'));
}
コード例 #9
0
ファイル: guest_login.php プロジェクト: kekru/engelsystem
function guest_login()
{
    global $user, $privileges;
    $nick = "";
    unset($_SESSION['uid']);
    if (isset($_REQUEST['submit'])) {
        $ok = true;
        if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 0) {
            $nick = User_validate_Nick($_REQUEST['nick']);
            $login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "'");
            if (count($login_user) > 0) {
                $login_user = $login_user[0];
                if (isset($_REQUEST['password'])) {
                    if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
                        $ok = false;
                        error(_("Your password is incorrect.  Please try it again."));
                    } else {
                        //password is okay, check confirmaiton
                        if ($login_user['user_account_approved'] !== '1') {
                            $ok = false;
                            error(_("Your account is not confirmed yet. Please click the link in the mail we sent you. If you didn't get an eMail, ask a dispatcher."));
                        }
                    }
                } else {
                    $ok = false;
                    error(_("Please enter a password."));
                }
            } else {
                $ok = false;
                error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask an Dispatcher."));
            }
        } else {
            $ok = false;
            error(_("Please enter a nickname."));
        }
        if ($ok) {
            $_SESSION['uid'] = $login_user['UID'];
            $_SESSION['locale'] = $login_user['Sprache'];
            redirect(page_link_to('shifts'));
        }
    }
    if (in_array('register', $privileges)) {
        $register_hint = join('', array('<p>' . _("Please sign up, if you want to help us!") . '</p>', buttons(array(button(page_link_to('register'), register_title() . ' &raquo;')))));
    } else {
        $register_hint = join('', array(error(_('Registration is disabled.'), true)));
    }
    return page_with_title(login_title(), array(msg(), '<div class="row"><div class="col-md-6">', form(array(form_text('nick', _("Nick"), $nick), form_password('password', _("Password")), form_submit('submit', _("Login")), buttons(array(button(page_link_to('user_password_recovery'), _("I forgot my password")))), info(_("Please note: You have to activate cookies!"), true))), '</div></div>'));
}
コード例 #10
0
ファイル: admin_rooms.php プロジェクト: Grreg/engelsystem
function admin_rooms()
{
    global $user;
    global $user, $enable_frab_import;
    $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'))));
    }
    if (isset($_REQUEST['show'])) {
        $msg = "";
        $name = "";
        $location = "";
        $lat = "";
        $long = "";
        $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'];
                $location = $room[0]['Location'];
                $lat = $room[0]['Lat'];
                $long = $room[0]['Long'];
                $from_pentabarf = $room[0]['FromPentabarf'];
                $public = $room[0]['show'];
                $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');
                } else {
                    $ok = false;
                    $msg .= error(_("Please enter a name."), true);
                }
                if (isset($_REQUEST['location']) && strlen(strip_request_item('location')) > 0) {
                    $location = strip_request_item('location');
                } else {
                    $ok = false;
                    $msg .= error(_("Please enter a location."));
                }
                if (isset($_REQUEST['Lat']) && isset($_REQUEST['Long'])) {
                    $lat = $_REQUEST['Lat'];
                    $long = $_REQUEST['Long'];
                } else {
                    $ok = false;
                    $msg .= error(_("Please enter a location - no lat long values found."));
                }
                $from_pentabarf = isset($_REQUEST['from_pentabarf']) ? 'Y' : '';
                $public = isset($_REQUEST['public']) ? 'Y' : '';
                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(sprintf("UPDATE `Room` SET `Name`='%s', `FromPentabarf`='%s', `show`='%s', `Number`='%s', `location` = '%s', `lat` = '%s', `long` = '%s' WHERE `RID`='%s' LIMIT 1", sql_escape($name), sql_escape($from_pentabarf), sql_escape($public), sql_escape($number), sql_escape($location), sql_escape($lat), sql_escape($long), sql_escape($id)));
                        engelsystem_log("Location updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
                    } else {
                        $id = Room_create($name, $from_pentabarf, $public, $location, $lat, $long);
                        if ($id === false) {
                            engelsystem_error("Unable to create location.");
                        }
                        engelsystem_log("Location 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(sprintf("INSERT INTO `NeededAngelTypes` SET `room_id`='%s', `angel_type_id`='%s', `count`='%s'", sql_escape($id), sql_escape($angeltype_id), sql_escape($angeltype_count)));
                            $needed_angeltype_info[] = $angeltype['name'] . ": " . $angeltype_count;
                        }
                    }
                    engelsystem_log("Set needed angeltypes of location " . $name . " to: " . join(", ", $needed_angeltype_info));
                    success(_("Location 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])));
            }
            $form_elements = [];
            $form_elements[] = form_text('name', _("Name"), $name);
            $form_elements[] = form_text('location', _("Location"), $location);
            $form_elements[] = form_text('Lat', _("Latitude"), $lat, false, false);
            $form_elements[] = form_text('Long', _("Longitude"), $long, false, false);
            if ($enable_frab_import) {
                $form_elements[] = form_checkbox('from_pentabarf', _("Frab import"), $from_pentabarf);
            }
            $form_elements[] = form_checkbox('public', _("Public"), $public);
            $form_elements[] = form_text('number', _("Room number"), $number);
            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', $form_elements), div('col-md-6', array(div('row', array(div('col-md-12', array(form_info(_("Needed angels:")))), join($angeltypes_count_form))))), script("\n                            jQuery(function (\$) {\n                                var input = \$(\"input[id='form_location']\");\n                                var inputElement = document.getElementById(input.attr('id'));\n                                var searchBox = new google.maps.places.SearchBox(inputElement);\n                                searchBox.addListener('places_changed', function() {\n                                    var places = searchBox.getPlaces();\n                                    if (places.length == 0) {\n                                      return;\n                                    }\n\n                                    var place = places.pop();\n                                    var lat = place.geometry.location.lat();\n                                    var long = place.geometry.location.lng();\n\n                                    \$(\"input[id='form_lat']\").val(lat);\n                                    \$(\"input[id='form_long']\").val(long);\n                                });\n\n                                // suppress form submit on enter\n                                input.keypress(function (event) {\n                                    if (event.keyCode === 13) {\n                                        return false;\n                                    }\n                                });\n                            });\n                        "))), form_submit('submit', _("Save"))))));
        } elseif ($_REQUEST['show'] == 'delete') {
            if (isset($_REQUEST['ack'])) {
                sql_query("DELETE FROM `Room` WHERE `RID`='" . sql_escape($id) . "' LIMIT 1");
                sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "' LIMIT 1");
                engelsystem_log("Location deleted: " . $name);
                success(sprintf(_("Location %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 location %s?"), $name), buttons(array(button(page_link_to('admin_rooms') . '&show=delete&id=' . $id . '&ack', _("Delete"), 'delete')))));
        }
    }
    $table_columns = array('name' => _("Name"), 'from_pentabarf' => _("Frab import"), 'public' => _("Public"), 'actions' => "");
    if (!$enable_frab_import) {
        unset($table_columns['from_pentabarf']);
    }
    return page_with_title(admin_rooms_title(), array(buttons(array(button(page_link_to('admin_rooms') . '&show=edit', _("add")))), msg(), table($table_columns, $rooms)));
}
コード例 #11
0
ファイル: snews.php プロジェクト: retrofox/PCC
function form_articles($contents)
{
    if (is_numeric($_GET['id']) && !is_null($_GET['id'])) {
        $id = $_GET['id'];
        $query = mysql_query('SELECT * FROM ' . _PRE . 'articles' . ' WHERE id=' . $id);
        $r = mysql_fetch_array($query);
        $article_category = $r['category'];
        $edit_option = $r['position'] == 0 ? 1 : $r['position'];
        $edit_page = $r['page_extra'];
        $extraid = $r['extraid'];
        switch ($edit_option) {
            case 1:
                $frm_fieldset = l('edit') . ' ' . l('article');
                $toggle_div = 'show';
                $frm_position1 = 'selected="selected"';
                break;
            case 2:
                $frm_fieldset = l('edit') . ' ' . l('extra_contents');
                $toggle_div = 'show';
                $frm_position2 = 'selected="selected"';
                break;
            case 3:
                $frm_fieldset = l('edit') . ' ' . l('page');
                $toggle_div = 'show';
                $frm_position3 = 'selected="selected"';
                break;
        }
        $frm_action = _SITE . '?action=process&amp;task=admin_article&amp;id=' . $id;
        $frm_title = $_SESSION[_SITE . 'temp']['title'] ? $_SESSION[_SITE . 'temp']['title'] : $r['title'];
        $frm_sef_title = $_SESSION[_SITE . 'temp']['seftitle'] ? cleanSEF($_SESSION[_SITE . 'temp']['seftitle']) : $r['seftitle'];
        $frm_text = str_replace('&', '&amp;', $_SESSION[_SITE . 'temp']['text'] ? $_SESSION[_SITE . 'temp']['text'] : $r['text']);
        $frm_meta_desc = $_SESSION[_SITE . 'temp']['description_meta'] ? cleanSEF($_SESSION[_SITE . 'temp']['description_meta']) : $r['description_meta'];
        $frm_meta_key = $_SESSION[_SITE . 'temp']['keywords_meta'] ? cleanSEF($_SESSION[_SITE . 'temp']['keywords_meta']) : $r['keywords_meta'];
        $frm_display_title = $r['displaytitle'] == 'YES' ? 'ok' : '';
        $frm_display_info = $r['displayinfo'] == 'YES' ? 'ok' : '';
        $frm_publish = $r['published'] == 1 ? 'ok' : '';
        $show_in_subcats = $r['show_in_subcats'] == 'YES' ? 'ok' : '';
        $frm_showonhome = $r['show_on_home'] == 'YES' ? 'ok' : '';
        $frm_commentable = $r['commentable'] == 'YES' || $r['commentable'] == 'FREEZ' ? 'ok' : '';
        $frm_task = 'edit_article';
        $frm_submit = l('edit');
    } else {
        switch ($contents) {
            case 'article_new':
                $frm_fieldset = l('article_new');
                $toggle_div = '';
                $pos = 1;
                $frm_position1 = 'selected="selected"';
                break;
            case 'extra_new':
                $frm_fieldset = l('extra_new');
                $toggle_div = '';
                $pos = 2;
                $frm_position2 = 'selected="selected"';
                break;
            case 'page_new':
                $frm_fieldset = l('page_new');
                $toggle_div = '';
                $pos = 3;
                $frm_position3 = 'selected="selected"';
                break;
        }
        if (empty($frm_fieldset)) {
            $frm_fieldset = l('article_new');
        }
        $frm_action = _SITE . '?action=process&amp;task=admin_article';
        $frm_title = $_SESSION[_SITE . 'temp']['title'];
        $frm_sef_title = cleanSEF($_SESSION[_SITE . 'temp']['seftitle']);
        $frm_text = $_SESSION[_SITE . 'temp']['text'];
        $frm_meta_desc = cleanSEF($_SESSION[_SITE . 'temp']['description_meta']);
        $frm_meta_key = cleanSEF($_SESSION[_SITE . 'temp']['keywords_meta']);
        $frm_display_title = 'ok';
        $frm_display_info = $contents == 'extra_new' ? '' : 'ok';
        $frm_publish = 'ok';
        $show_in_subcats = 'ok';
        $frm_showonhome = s('display_new_on_home') == 'on' ? 'ok' : '';
        $frm_commentable = $contents == 'extra_new' || $contents == 'page_new' || s('enable_comments') != 'YES' ? '' : 'ok';
        $frm_task = 'add_article';
        $frm_submit = l('submit');
    }
    $catnum = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as catnum FROM " . _PRE . 'categories' . ""));
    if ($contents == 'article_new' && $catnum['catnum'] < 1) {
        echo l('create_cat');
    } else {
        echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', $frm_action, '');
        echo '<div class="adminpanel">';
        if ($toggle_div == 'show') {
            echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', '<a title="' . $frm_fieldset . '" onclick="toggle(\'edit_article\')" style="cursor: pointer;">' . $frm_fieldset . '</a>');
            echo '<div id="edit_article" style="display: none;">';
        } else {
            echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', $frm_fieldset);
        }
        echo html_input('text', 'title', 'at', $frm_title, l('title'), '', 'onchange="genSEF(this,document.forms[\'post\'].seftitle)"', 'onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"', '', '', '', '', '', '', '');
        if ($contents == 'extra_new' || $edit_option == 2) {
            echo '<div style="display: none;">';
            echo html_input('text', 'seftitle', 'as', $frm_sef_title, l('sef_title'), '', '', '', '', '', '', '', '', '', '');
            echo '</div>';
        } else {
            echo html_input('text', 'seftitle', 'as', $frm_sef_title, l('sef_title'), '', '', '', '', '', '', '', '', '', '');
        }
        echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
        buttons();
        if ($contents != 'page_new' && $edit_option != 3) {
            echo '<p><label for="cat">';
            echo $contents == 'extra_new' || $edit_option == 2 ? l('appear_category') : l('category');
            if ($contents == 'extra_new' || $edit_option == 2) {
                echo ':</label><br /><select name="define_category" id="cat" onchange="dependancy(\'extra\');">';
                echo '<option value="-1"' . ($article_category == -1 ? ' selected="selected"' : '') . '>' . l('all') . '</option>';
                echo '<option value="-3"' . ($article_category == -3 ? ' selected="selected"' : '') . '>' . l('page_only') . '</option>';
            } else {
                echo ':</label><br /><select name="define_category" id="cat" onchange="dependancy(\'snews_articles\');">';
            }
            $category_query = 'SELECT id,name,subcat FROM ' . _PRE . 'categories' . '
			WHERE published = \'YES\' AND subcat = 0 ORDER BY catorder,id ASC';
            $category_result = mysql_query($category_query);
            while ($cat = mysql_fetch_array($category_result)) {
                echo '<option value="' . $cat['id'] . '"';
                if ($article_category == $cat['id']) {
                    echo ' selected="selected"';
                }
                echo '>' . $cat['name'] . '</option>';
                $subquery = 'SELECT id,name,subcat FROM ' . _PRE . 'categories' . '
				WHERE subcat = ' . $cat['id'] . ' ORDER BY catorder,id ASC';
                $subresult = mysql_query($subquery);
                while ($s = mysql_fetch_array($subresult)) {
                    echo '<option value="' . $s['id'] . '"';
                    if ($article_category == $s['id']) {
                        echo ' selected="selected"';
                    }
                    echo '>--' . $s['name'] . '</option>';
                }
            }
            echo '</select></p>';
            if ($contents == 'extra_new' || $edit_option == 2) {
                $none_display = $article_category == -1 ? 'none' : 'inline';
                echo '<div id="def_page" style="display:' . $none_display . ';"><p><label for="dp">' . l('appear_page') . ':</label>
				<br /><select name="define_page" id="dp">';
                echo '<option value="0"' . ($edit_option != '2' ? ' selected="selected"' : '') . '>' . l('all') . '</option>';
                $query = 'SELECT id,title FROM ' . _PRE . 'articles' . ' WHERE position = 3 ORDER BY id ASC';
                $result = mysql_query($query);
                while ($r = mysql_fetch_array($result)) {
                    echo '<option value="' . $r['id'] . '"';
                    if ($edit_page == $r['id']) {
                        echo ' selected="selected"';
                    }
                    echo '>' . $r['title'] . '</option>';
                }
                echo '</select><br />' . html_input('checkbox', 'show_in_subcats', 'asc', 'YES', l('show_in_subcats'), '', '', '', '', $show_in_subcats, '', '', '', '', '') . '</p></div>';
            }
        }
        if ($contents == 'article_new' || $edit_option == 1) {
            echo html_input('checkbox', 'show_on_home', 'sho', 'YES', l('show_on_home'), '', '', '', '', $frm_showonhome, '', '', '', '', '');
        }
        echo html_input('checkbox', 'publish_article', 'pu', 'YES', l('publish_article'), '', '', '', '', $frm_publish, '', '', '', '', '');
        if ($toggle_div == 'show') {
            echo '</div>';
        }
        echo '</fieldset></div><div class="adminpanel">';
        echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', '<a title="' . l('preview') . '" onclick="toggle(\'preview\')" style="cursor: pointer;">' . l('preview') . '</a>');
        echo '<div id="preview" style="display: none;"></div></fieldset></div><div class="adminpanel">';
        echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', '<a title="' . l('customize') . '" onclick="toggle(\'customize\')" style="cursor: pointer;">' . l('customize') . '</a>');
        echo '<div id="customize" style="display: none;">';
        if ($contents == 'extra_new' || $edit_option == 2) {
            if (s('enable_extras') == 'YES') {
                echo '<p><label for="ext">' . l('define_extra') . '</label><br />';
                echo '<select name="define_extra" id="ext">';
                $extra_query = 'SELECT id,name FROM ' . _PRE . 'extras' . ' ORDER BY id ASC';
                $extra_result = mysql_query($extra_query);
                while ($ex = mysql_fetch_array($extra_result)) {
                    echo '<option value="' . $ex['id'] . '"';
                    if ($extraid == $ex['id']) {
                        echo ' selected="selected"';
                    }
                    echo '>' . $ex['name'] . '</option>';
                }
                echo '</select></p>';
            } else {
                echo html_input('hidden', 'define_extra', 'ext', 1, '', '', '', '', '', '', '', '', '', '', '');
            }
        }
        if (!empty($id)) {
            echo '<p><label for="pos">' . l('position') . ':</label>
			<br /><select name="position" id="pos">';
            echo '<option value="1"' . $frm_position1 . '>' . l('center') . '</option>';
            echo '<option value="2"' . $frm_position2 . '>' . l('side') . '</option>';
            echo '<option value="3"' . $frm_position3 . '>' . l('display_page') . '</option>';
            echo '</select></p>';
        } else {
            echo html_input('hidden', 'position', 'position', $pos, '', '', '', '', '', '', '', '', '', '', '');
        }
        if ($contents != 'extra_new' && $edit_option != '2') {
            echo html_input('text', 'description_meta', 'dm', $frm_meta_desc, l('description_meta'), '', '', '', '', '', '', '', '', '', '');
            echo html_input('text', 'keywords_meta', 'km', $frm_meta_key, l('keywords_meta'), '', '', '', '', '', '', '', '', '', '');
        }
        echo html_input('checkbox', 'display_title', 'dti', 'YES', l('display_title'), '', '', '', '', $frm_display_title, '', '', '', '', '');
        if ($contents != 'extra_new' && $edit_option != '2') {
            echo html_input('checkbox', 'display_info', 'di', 'YES', l('display_info'), '', '', '', '', $frm_display_info, '', '', '', '', '');
            echo html_input('checkbox', 'commentable', 'ca', 'YES', l('enable_commenting'), '', '', '', '', $frm_commentable, '', '', '', '', '');
            if (!empty($id)) {
                echo '<p><input name="freeze" type="checkbox" id="fc"';
                if ($r['commentable'] == 'FREEZ') {
                    echo ' checked="checked" />';
                } else {
                    if ($r['commentable'] == 'YES') {
                        echo ' />';
                    } else {
                        echo ' />';
                    }
                }
                echo ' <label for="fc"> ' . l('freeze_comments') . '</label></p>';
            }
        }
        echo '</div></fieldset></div>';
        if ($contents == 'article_new' || $edit_option == 1) {
            echo '<div class="adminpanel">';
            echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', '<a title="' . l('publish_date') . '" onclick="toggle(\'admin_publish_date\')" style="cursor: pointer;">' . l('publish_date') . '</a>');
            echo '<div id="admin_publish_date" style="display: none;">';
            echo html_input('checkbox', 'fposting', 'fp', 'YES', l('enable'), '', '', '', '', '', '', '', '', '', '');
            echo '<p>' . l('server_time') . ': ' . date('d.m.Y. H:i:s') . '</p>';
            echo '<p>' . l('article_date') . '</p>';
            !empty($id) ? posting_time($r['date']) : posting_time();
            echo '</div></fieldset></div>';
        }
        echo '<p>';
        echo html_input('hidden', 'task', 'task', 'admin_article', '', '', '', '', '', '', '', '', '', '', '');
        echo html_input('submit', $frm_task, $frm_task, $frm_submit, '', 'button', '', '', '', '', '', '', '', '', '');
        if (!empty($id)) {
            echo html_input('hidden', 'article_category', 'article_category', $article_category, '', '', '', '', '', '', '', '', '', '', '');
            echo html_input('hidden', 'id', 'id', $id, '', '', '', '', '', '', '', '', '', '', '');
            echo html_input('submit', 'delete_article', 'delete_article', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', '');
        }
        echo '</p></form>';
    }
}
コード例 #12
0
ファイル: cdr_list.php プロジェクト: antirek/prestige-pbx
    } else {
        echo "<tr bgcolor=#D3D3D3>";
    }
    for ($c = 0; $c < $len; ++$c) {
        echo $tdnowrap;
        $e[$c] = trim($e[$c], "\r\n \"");
        if ($c == 4) {
            $e[$c] = str_replace("\"", "", $e[$c]);
        }
        if ($e[$c] == "") {
            echo "&nbsp;";
        } else {
            echo htmlspecialchars($e[$c]);
        }
        echo "</td>";
    }
    while ($c < 17) {
        echo "<td>&nbsp;</td>";
        ++$c;
    }
    echo "</tr>\n";
    flush();
    ++$d;
}
echo "</table>";
echo "<br><br>";
echo "Total Record Count: {$recs}";
echo "<br>";
buttons("");
fclose($fd);
echo "</center></body></html>";
コード例 #13
0
ファイル: admin_user.php プロジェクト: bjelline/engelsystem
function admin_user()
{
    global $user, $privileges, $tshirt_sizes, $privileges;
    $html = '';
    if (!isset($_REQUEST['id'])) {
        redirect(users_link());
    }
    $id = $_REQUEST['id'];
    if (!isset($_REQUEST['action'])) {
        $user_source = User($id);
        if ($user_source === false) {
            engelsystem_error('Unable to load user.');
        }
        if ($user_source == null) {
            error(_('This user does not exist.'));
            redirect(users_link());
        }
        $html .= "Hallo,<br />" . "hier kannst du den Eintrag &auml;ndern. Unter dem Punkt 'Gekommen' " . "wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, " . "dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. " . "Wenn T-Shirt ein 'Ja' enth&auml;lt, bedeutet dies, dass der Engel " . "bereits sein T-Shirt erhalten hat.<br /><br />\n";
        $html .= "<form action=\"" . page_link_to("admin_user") . "&action=save&id={$id}\" method=\"post\">\n";
        $html .= "<table border=\"0\">\n";
        $html .= "<input type=\"hidden\" name=\"Type\" value=\"Normal\">\n";
        $html .= "<tr><td>\n";
        $html .= "<table>\n";
        $html .= "  <tr><td>Nick</td><td>" . "<input type=\"text\" size=\"40\" name=\"eNick\" value=\"" . $user_source['Nick'] . "\"></td></tr>\n";
        $html .= "  <tr><td>lastLogIn</td><td>" . date("Y-m-d H:i", $user_source['lastLogIn']) . "</td></tr>\n";
        $html .= "  <tr><td>Name</td><td>" . "<input type=\"text\" size=\"40\" name=\"eName\" value=\"" . $user_source['Name'] . "\"></td></tr>\n";
        $html .= "  <tr><td>Vorname</td><td>" . "<input type=\"text\" size=\"40\" name=\"eVorname\" value=\"" . $user_source['Vorname'] . "\"></td></tr>\n";
        $html .= "  <tr><td>Alter</td><td>" . "<input type=\"text\" size=\"5\" name=\"eAlter\" value=\"" . $user_source['Alter'] . "\"></td></tr>\n";
        $html .= "  <tr><td>Telefon</td><td>" . "<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"" . $user_source['Telefon'] . "\"></td></tr>\n";
        $html .= "  <tr><td>Handy</td><td>" . "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" . $user_source['Handy'] . "\"></td></tr>\n";
        $html .= "  <tr><td>DECT</td><td>" . "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" . $user_source['DECT'] . "\"></td></tr>\n";
        $html .= "  <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></td></tr>\n";
        $html .= "<tr><td>" . form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $user_source['email_shiftinfo']) . "</td></tr>\n";
        $html .= "  <tr><td>jabber</td><td>" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . $user_source['jabber'] . "\"></td></tr>\n";
        $html .= "  <tr><td>Size</td><td>" . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . "</td></tr>\n";
        $options = array('1' => "Yes", '0' => "No");
        // Gekommen?
        $html .= "  <tr><td>Gekommen</td><td>\n";
        $html .= html_options('eGekommen', $options, $user_source['Gekommen']) . "</td></tr>\n";
        // Aktiv?
        $html .= "  <tr><td>Aktiv</td><td>\n";
        $html .= html_options('eAktiv', $options, $user_source['Aktiv']) . "</td></tr>\n";
        // Aktiv erzwingen
        if (in_array('admin_active', $privileges)) {
            $html .= "  <tr><td>" . _("Force active") . "</td><td>\n";
            $html .= html_options('force_active', $options, $user_source['force_active']) . "</td></tr>\n";
        }
        // T-Shirt bekommen?
        $html .= "  <tr><td>T-Shirt</td><td>\n";
        $html .= html_options('eTshirt', $options, $user_source['Tshirt']) . "</td></tr>\n";
        $html .= "  <tr><td>Hometown</td><td>" . "<input type=\"text\" size=\"40\" name=\"Hometown\" value=\"" . $user_source['Hometown'] . "\"></td></tr>\n";
        $html .= "</table>\n</td><td valign=\"top\"></td></tr>";
        $html .= "</td></tr>\n";
        $html .= "</table>\n<br />\n";
        $html .= "<input type=\"submit\" value=\"Speichern\">\n";
        $html .= "</form>";
        $html .= "<hr />";
        $html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
        $html .= "Hier kannst Du das Passwort dieses Engels neu setzen:<form action=\"" . page_link_to("admin_user") . "&action=change_pw&id={$id}\" method=\"post\">\n";
        $html .= "<table>\n";
        $html .= "  <tr><td>Passwort</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw\" value=\"\"></td></tr>\n";
        $html .= "  <tr><td>Wiederholung</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw2\" value=\"\"></td></tr>\n";
        $html .= "</table>";
        $html .= "<input type=\"submit\" value=\"Speichern\">\n";
        $html .= "</form>";
        $html .= "<hr />";
        $my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id` LIMIT 1");
        if (count($my_highest_group) > 0) {
            $my_highest_group = $my_highest_group[0]['group_id'];
        }
        $his_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($id) . "' ORDER BY `group_id` LIMIT 1");
        if (count($his_highest_group) > 0) {
            $his_highest_group = $his_highest_group[0]['group_id'];
        }
        if ($id != $user['UID'] && $my_highest_group <= $his_highest_group) {
            $html .= "Hier kannst Du die Benutzergruppen des Engels festlegen:<form action=\"" . page_link_to("admin_user") . "&action=save_groups&id=" . $id . "\" method=\"post\">\n";
            $html .= '<table>';
            $groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group) . "' ORDER BY `Groups`.`Name`");
            foreach ($groups as $group) {
                $html .= '<tr><td><input type="checkbox" name="groups[]" value="' . $group['UID'] . '"' . ($group['group_id'] != "" ? ' checked="checked"' : '') . ' /></td><td>' . $group['Name'] . '</td></tr>';
            }
            $html .= '</table>';
            $html .= "<input type=\"submit\" value=\"Speichern\">\n";
            $html .= "</form>";
            $html .= "<hr />";
        }
        $html .= buttons([button(user_delete_link($user_source), glyph('lock') . _("delete"), 'btn-danger')]);
        $html .= "<hr />";
    } else {
        switch ($_REQUEST['action']) {
            case 'save_groups':
                if ($id != $user['UID']) {
                    $my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id`");
                    $his_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($id) . "' ORDER BY `group_id`");
                    if (count($my_highest_group) > 0 && (count($his_highest_group) == 0 || $my_highest_group[0]['group_id'] <= $his_highest_group[0]['group_id'])) {
                        $groups_source = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group[0]['group_id']) . "' ORDER BY `Groups`.`Name`");
                        $groups = array();
                        $grouplist = array();
                        foreach ($groups_source as $group) {
                            $groups[$group['UID']] = $group;
                            $grouplist[] = $group['UID'];
                        }
                        if (!is_array($_REQUEST['groups'])) {
                            $_REQUEST['groups'] = array();
                        }
                        sql_query("DELETE FROM `UserGroups` WHERE `uid`='" . sql_escape($id) . "'");
                        $user_groups_info = array();
                        foreach ($_REQUEST['groups'] as $group) {
                            if (in_array($group, $grouplist)) {
                                sql_query("INSERT INTO `UserGroups` SET `uid`='" . sql_escape($id) . "', `group_id`='" . sql_escape($group) . "'");
                                $user_groups_info[] = $groups[$group]['Name'];
                            }
                        }
                        $user_source = User($id);
                        engelsystem_log("Set groups of " . User_Nick_render($user_source) . " to: " . join(", ", $user_groups_info));
                        $html .= success("Benutzergruppen gespeichert.", true);
                    } else {
                        $html .= error("Du kannst keine Engel mit mehr Rechten bearbeiten.", true);
                    }
                } else {
                    $html .= error("Du kannst Deine eigenen Rechte nicht bearbeiten.", true);
                }
                break;
            case 'save':
                $force_active = $user['force_active'];
                if (in_array('admin_active', $privileges)) {
                    $force_active = $_REQUEST['force_active'];
                }
                $SQL = "UPDATE `User` SET \n              `Nick` = '" . sql_escape($_POST["eNick"]) . "', \n              `Name` = '" . sql_escape($_POST["eName"]) . "', \n              `Vorname` = '" . sql_escape($_POST["eVorname"]) . "', \n              `Telefon` = '" . sql_escape($_POST["eTelefon"]) . "', \n              `Handy` = '" . sql_escape($_POST["eHandy"]) . "', \n              `Alter` = '" . sql_escape($_POST["eAlter"]) . "', \n              `DECT` = '" . sql_escape($_POST["eDECT"]) . "', \n              `email` = '" . sql_escape($_POST["eemail"]) . "', \n              `email_shiftinfo` = " . sql_bool(isset($_REQUEST['email_shiftinfo'])) . ", \n              `jabber` = '" . sql_escape($_POST["ejabber"]) . "', \n              `Size` = '" . sql_escape($_POST["eSize"]) . "', \n              `Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "', \n              `Aktiv`= '" . sql_escape($_POST["eAktiv"]) . "', \n              `force_active`= " . sql_escape($force_active) . ", \n              `Tshirt` = '" . sql_escape($_POST["eTshirt"]) . "', \n              `Hometown` = '" . sql_escape($_POST["Hometown"]) . "' \n              WHERE `UID` = '" . sql_escape($id) . "' \n              LIMIT 1";
                sql_query($SQL);
                engelsystem_log("Updated user: "******"eNick"] . ", " . $_POST["eSize"] . ", arrived: " . $_POST["eGekommen"] . ", active: " . $_POST["eAktiv"] . ", tshirt: " . $_POST["eTshirt"]);
                $html .= success("Änderung wurde gespeichert...\n", true);
                break;
            case 'change_pw':
                if ($_REQUEST['new_pw'] != "" && $_REQUEST['new_pw'] == $_REQUEST['new_pw2']) {
                    set_password($id, $_REQUEST['new_pw']);
                    $user_source = User($id);
                    engelsystem_log("Set new password for " . User_Nick_render($user_source));
                    $html .= success("Passwort neu gesetzt.", true);
                } else {
                    $html .= error("Die Eingaben müssen übereinstimmen und dürfen nicht leer sein!", true);
                }
                break;
        }
    }
    return page_with_title(_('Edit user'), array($html));
}
コード例 #14
0
function UserAngelType_join_view($user, $angeltype)
{
    return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), array(msg(), info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true), buttons(array(button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'), button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed', _("save"), 'ok')))));
}
コード例 #15
0
 *	String, path to directory
 *
 * @return: array
 */
function sounds($path)
{
    return preg_grep('/^([^.])/', scandir($path));
}
/*
 * Function takes in a list of file names and creates an html string of buttons.
 *
 * @params: $list
 *	array of filesnames
 *
 * @return: html string
 */
function buttons($list)
{
    $colors = array('default', 'primary', 'success', 'info', 'warning', 'danger');
    $buttons = '';
    foreach ($list as $key => $value) {
        $soundname = substr($value, 0, strpos($value, '.'));
        $buttons .= '<button id="' . $soundname . '" type="button" class="staley btn btn-' . $colors[$key % sizeof($colors)] . '">' . $soundname . '</button>';
    }
    return $buttons;
}
if (isset($_POST['type']) && $_POST['type'] == 'sounds') {
    $dir = $_POST['path'];
    $filenames = sounds($dir);
    echo buttons($filenames);
}
コード例 #16
0
    print $forms;
}
?>
</td>
</tr>
<tr>
	<td valign="top"><strong><?php 
print T_("Word usage in this synset:");
?>
</strong></td>
	<td valign="top">
		<?php 
if ($auth->auth["uid"] == "nobody") {
    printUsage();
} else {
    buttons();
}
?>
	</td>
</tr>
<tr>
	<td valign="top"><strong><?php 
print T_("Antonym:");
?>
</strong></td>
	<td>
	<?php 
$antonym_array = getAntonym($db, uservar('wmid'));
$antonym_word = "";
if (is_array($antonym_array)) {
    list($antonym_mid, $antonym_word, $antonym_wmid) = $antonym_array;
コード例 #17
0
ファイル: User_view.php プロジェクト: d120/engelsystem
function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me)
{
    global $LETZTES_AUSTRAGEN, $privileges;
    $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
    $myshifts_table = array();
    $html = "";
    $timesum = 0;
    foreach ($shifts as $shift) {
        $shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';
        if ($shift['title']) {
            $shift_info .= '<br /><a href="' . shift_link($shift) . '">' . $shift['title'] . '</a>';
        }
        foreach ($shift['needed_angeltypes'] as $needed_angel_type) {
            $shift_info .= '<br><b>' . $needed_angel_type['name'] . ':</b> ';
            $shift_entries = array();
            foreach ($needed_angel_type['users'] as $user_shift) {
                $member = User_Nick_render($user_shift);
                if ($user_shift['freeloaded']) {
                    $member = '<strike>' . $member . '</strike>';
                }
                $shift_entries[] = $member;
            }
            $shift_info .= join(", ", $shift_entries);
        }
        $myshift = array('date' => date("Y-m-d", $shift['start']), 'time' => date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']), 'room' => $shift['Name'], 'shift_info' => $shift_info, 'comment' => $shift['Comment']);
        if ($shift['freeloaded']) {
            if (in_array("user_shifts_admin", $privileges)) {
                $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . ': ' . $shift['freeload_comment'] . '</p>';
            } else {
                $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . '</p>';
            }
        }
        $myshift['actions'] = [button(shift_link($shift), glyph('eye-open') . _('view'), 'btn-xs')];
        if ($its_me || in_array('user_shifts_admin', $privileges)) {
            $myshift['actions'][] = button(page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'], glyph('edit') . _('edit'), 'btn-xs');
        }
        if ($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600 || in_array('user_shifts_admin', $privileges)) {
            $myshift['actions'][] = button(page_link_to('user_myshifts') . (!$its_me ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'], glyph('trash') . _('sign off'), 'btn-xs');
        }
        $myshift['actions'] = table_buttons($myshift['actions']);
        if ($shift['freeloaded']) {
            $timesum += -2 * ($shift['end'] - $shift['start']);
        } else {
            $timesum += $shift['end'] - $shift['start'];
        }
        $myshifts_table[] = $myshift;
    }
    if (count($myshifts_table) > 0) {
        $myshifts_table[] = array('date' => '<b>' . _("Sum:") . '</b>', 'time' => "<b>" . round($timesum / 3600, 1) . " h</b>", 'room' => "", 'shift_info' => "", 'comment' => "", 'actions' => "");
    }
    return page_with_title('<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>', array(msg(), div('row', array(div('col-md-3', array('<h1>', '<span class="glyphicon glyphicon-phone"></span>', $user_source['Handy'], '</h1>')), div('col-md-3', array('<h4>' . _("User state") . '</h4>', $admin_user_privilege && $freeloader ? '<span class="text-danger"><span class="glyphicon glyphicon-exclamation-sign"></span> ' . _("Freeloader") . '</span><br />' : '', $user_source['Gekommen'] ? User_shift_state_render($user_source) . '<br />' : '', $admin_user_privilege || $its_me ? $user_source['Gekommen'] ? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> ' . sprintf(_("Arrived at %s"), date('Y-m-d', $user_source['arrival_date'])) . '</span>' : '<span class="text-danger">' . sprintf(_("Not arrived (Planned: %s)"), date('Y-m-d', $user_source['planned_arrival_date'])) . '</span>' : ($user_source['Gekommen'] ? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> ' . _("Arrived") . '</span>' : '<span class="text-danger">' . _("Not arrived") . '</span>'), $admin_user_privilege ? $user_source['got_voucher'] > 0 ? '<br /><span class="text-success">' . glyph('cutlery') . sprintf(ngettext("Got %s voucher", "Got %s vouchers", $user_source['got_voucher']), $user_source['got_voucher']) . '</span><br />' : '<br /><span class="text-danger">' . _("Got no vouchers") . '</span><br />' : '', $user_source['Gekommen'] && $admin_user_privilege && $user_source['Aktiv'] ? ' <span class="text-success">' . _("Active") . '</span>' : '', $user_source['Gekommen'] && $admin_user_privilege && $user_source['Tshirt'] ? ' <span class="text-success">' . _("T-Shirt") . '</span>' : '')), div('col-md-3', array('<h4>' . _("Angeltypes") . '</h4>', User_angeltypes_render($user_angeltypes))), div('col-md-3', array('<h4>' . _("Rights") . '</h4>', User_groups_render($user_groups))))), div('row space-top', array(div('col-md-12', array(buttons(array($admin_user_privilege ? button(page_link_to('admin_user') . '&id=' . $user_source['UID'], glyph("edit") . _("edit")) : '', $admin_user_privilege && !$user_source['Gekommen'] ? button(page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'], _("arrived")) : '', $admin_user_privilege ? button(page_link_to('users') . '&action=edit_vouchers&user_id=' . $user_source['UID'], glyph('cutlery') . _('Edit vouchers')) : '', $its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _("Settings")) : '', $its_me ? button(page_link_to('ical') . '&key=' . $user_source['api_key'], glyph('calendar') . _("iCal Export")) : '', $its_me ? button(page_link_to('shifts_json_export') . '&key=' . $user_source['api_key'], glyph('export') . _("JSON Export")) : '', $its_me ? button(page_link_to('user_myshifts') . '&reset', glyph('repeat') . _('Reset API key')) : '')))))), $its_me || $admin_user_privilege ? '<h2>' . _("Shifts") . '</h2>' : '', $its_me || $admin_user_privilege ? table(array('date' => _("Day"), 'time' => _("Time"), 'room' => _("Location"), 'shift_info' => _("Name &amp; workmates"), 'comment' => _("Comment"), 'actions' => _("Action")), $myshifts_table) : '', $its_me && count($shifts) == 0 ? error(sprintf(_("Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some shifts."), page_link_to('user_shifts')), true) : ''));
}
コード例 #18
0
function AngelTypes_about_view($angeltypes, $user_logged_in)
{
    global $faq_url;
    $content = array(buttons(array(!$user_logged_in ? button(page_link_to('register'), register_title()) : '', !$user_logged_in ? button(page_link_to('login'), login_title()) : '', $user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '', button($faq_url, _("FAQ"), "btn-primary"))), '<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>', '<hr />');
    $parsedown = new Parsedown();
    foreach ($angeltypes as $angeltype) {
        $content[] = '<h2>' . $angeltype['name'] . '</h2>';
        if (isset($angeltype['user_angeltype_id'])) {
            $buttons = array();
            if ($angeltype['user_angeltype_id'] != null) {
                $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel');
            } else {
                $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
            }
            $content[] = buttons($buttons);
        }
        if ($angeltype['restricted']) {
            $content[] = info(_("This angeltype is restricted by double-opt-in by a team coordinator. Please show up at the according introduction meetings."), true);
        }
        if ($angeltype['description'] != "") {
            $content[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
        }
        $content[] = '<hr />';
    }
    return page_with_title(_("Teams/Job description"), $content);
}