Exemple #1
0
 public function delete()
 {
     $hash_Str = $this->input->get('hash');
     $pagerid_Num = $this->input->get('pagerid');
     $pagerid_Arr = $this->input->post('pagerid_Arr[]');
     if (empty($pagerid_Arr) && empty($pagerid_Num)) {
         $this->load->model('Message');
         $this->Message->show(['message' => '未選擇要刪除的動態頁面', 'url' => 'admin/base/pager/pager/tablelist']);
     }
     //CSRF過濾
     if ($hash_Str == $this->security->get_csrf_hash()) {
         if (!empty($pagerid_Num)) {
             $Pager = new Pager(['pagerid_Num' => $pagerid_Num]);
             $Pager->delete();
         }
         if (!empty($pagerid_Arr)) {
             foreach ($pagerid_Arr as $key => $value_pager) {
                 $Pager = new Pager(['pagerid_Num' => $value_pager]);
                 $Pager->delete();
             }
         }
         $this->load->model('Message');
         $this->Message->show(['message' => '刪除成功', 'url' => 'admin/base/pager/pager/tablelist']);
     } else {
         $this->load->model('Message');
         $this->Message->show(['message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/pager/pager/tablelist']);
     }
 }
along with Affiliates For All.  If not, see
<http://www.gnu.org/licenses/>.
*/
$admin_required = TRUE;
require_once '../lib/bootstrap.php';
Template::check_ajax_key();
$pager = new Pager('affiliates', Database::$affiliate_short_fields, Database::$affiliate_short_headings, Database::$affiliate_fields);
$pager->set_admin_mode();
$pager->set_editable();
$pager->set_order_by('local_username');
$pager->disable_date_restriction();
if ($_GET['format'] == 'json') {
    $pager->json($_GET['page']);
} else {
    if ($_GET['format'] == 'write') {
        // Don't let people lock themselves out of the administration screens:
        if ($_GET['key'] == 1) {
            $_GET['administrator'] = 1;
        }
        $pager->write($_GET);
    } else {
        if ($_GET['format'] == 'delete') {
            // Don't let people delete the Admin account:
            if ($_GET['key'] != 1) {
                $pager->delete($_GET['key']);
            }
        } else {
            $pager->json_single($_GET['key']);
        }
    }
}