Пример #1
0
if ($render_mode == "modal") {
    $response .= "<div id='{$box_id}' class='modal fade'>\n        <div class='modal-dialog'>\n            <div class='modal-content'>\n                <div class='modal-header'>\n                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                    <h4 class='modal-title'>{$box_title}</h4>\n                </div>\n                <div class='modal-body'>\n                    <form method='post' action='{$target}'>";
} else {
    if ($render_mode == "panel") {
        $response .= "<div class='panel panel-primary'>\n        <div class='panel-heading'>\n            <h2 class='panel-title pull-left'>{$box_title}</h2>\n            <div class='clearfix'></div>\n            </div>\n            <div class='panel-body'>\n                <form method='post' action='{$target}'>";
    } else {
        echo "Invalid render mode.";
        exit;
    }
}
// Load CSRF token
$csrf_token = $loggedInUser->csrf_token;
$response .= "<input type='hidden' name='csrf_token' value='{$csrf_token}'/>";
$response .= "\n<div class='dialog-alert'>\n</div>\n<div class='row'>\n    <div class='col-sm-12'>\n        <h5>Group Name</h5>\n        <div class='input-group'>\n            <span class='input-group-addon'><i class='fa fa-edit'></i></span>\n            <input type='text' class='form-control' name='group_name' autocomplete='off' value='{$group_name}' data-validate='{\"minLength\": 1, \"maxLength\": 50, \"label\": \"Group name\" }'>\n        </div>\n    </div>\n</div>";
// Attempt to load all pages (note that this function is not RESTful)
$pages = loadSitePages();
$response .= "\n<div class='row'>\n    <div class='col-sm-12'>\n        <h5>Home Page</h5>\n        <div class='form-group'>\n          <select class='form-control' name='home_page_id' data-validate='{\"selected\": 1, \"label\": \"Home page\" }'><option value=\"\"></option>";
foreach ($pages as $page) {
    $name = $page['page'];
    $id = $page['id'];
    if ($id == $home_page_id) {
        $response .= "<option value=\"{$id}\" selected>{$name}</option>";
    } else {
        $response .= "<option value=\"{$id}\">{$name}</option>";
    }
}
$response .= "\n          </select>\n        </div>\n    </div>\n</div>";
// Buttons
$response .= "\n<br><div class='row'>\n";
if ($button_submit) {
    $response .= "<div class='col-xs-8'><div class='vert-pad'><button type='submit' data-loading-text='Please wait...' class='btn btn-lg btn-success'>{$button_submit_text}</button></div></div>";
Based on the UserCake user management system, v2.0.2.
Copyright (c) 2009-2012
UserFrosting, like UserCake, is 100% free and open-source.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// Request method: GET
require_once "../models/config.php";
set_error_handler('logAllErrors');
// Request method: GET
$ajax = checkRequestMode("get");
// User must be logged in
checkLoggedInUser($ajax);
if (!($allPages = loadSitePages())) {
    apiReturnError($ajax, getReferralPage());
}
restore_error_handler();
echo json_encode($allPages);