Esempio n. 1
0
function get_sql_order_limit()
{
    $sort = getparam("sort") ? get_sql_field(getparam("sort")) : 1;
    $dir = getparam("dir") ? getparam("dir") : 'DESC';
    return get_filter() . " ORDER BY " . $sort . " " . $dir . get_sql_limit(getparam("start"), getparam("size"));
}
Esempio n. 2
0
 *  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
 *  version (version 3 as well).
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 */
$table_name = get_sql_field(next(explode('_', $action, 2)));
if (!$id_name) {
    $id_name = 'id';
}
foreach ($rows as $row) {
    $updates = array();
    $id = null;
    foreach ($row as $key => $value) {
        if ($key == 'id') {
            $id = $value;
        } else {
            $updates[] = get_sql_field($key) . " = {$value}";
        }
    }
    if ($id && $updates) {
        $sql = sprintf("UPDATE %s SET %s WHERE %s=%s", $table_name, implode(', ', $updates), $id_name, $id);
        query($sql);
        if ($db_type_sql == "mysql") {
            $sql = "INSERT INTO actionlogs (date, performer, query, ip) VALUES (" . time() . ",\"{$_SESSION['user']}\",\"{$sql}\", \"{$_SERVER['REMOTE_ADDR']}\")";
            query($sql);
        }
    }
}
if (!isset($need_out)) {
    $out = array("success" => true);
    echo out($out);
} else {
Esempio n. 3
0
 *    THIS FILE is an integral part of the project "Komunikator"
 *    "Komunikator" project site: http://komunikator.ru/
 *    "Komunikator" technical support e-mail: support@komunikator.ru
 *    The project "Komunikator" are used:
 *      the source code of "YATE" project, http://yate.null.ro/pmwiki/
 *      the source code of "FREESENTRAL" project, http://www.freesentral.com/
 *      "Sencha Ext JS" project libraries, http://www.sencha.com/products/extjs
 *    "Komunikator" web application is a free/libre and open-source software. Therefore it grants user rights
 *  for distribution and (or) modification (including other rights) of this programming solution according
 *  to GNU General Public License terms and conditions published by Free Software Foundation in version 3.
 *    In case the file "License" that describes GNU General Public License terms and conditions,
 *  version 3, is missing (initially goes with software source code), you can visit the official site
 *  http://www.gnu.org/licenses/ and find terms specified in appropriate GNU General Public License
 *  version (version 3 as well).
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 */
$table_name = get_sql_field(next(explode('_', $action, 2)));
foreach ($rows as $row) {
    $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $table_name, implode(', ', array_map($conn->escapeSimple, array_map('get_sql_field', array_keys($row)))), implode(', ', array_map($conn->escapeSimple, $row)));
    query($sql);
    if ($db_type_sql == "mysql") {
        $sql = "INSERT INTO actionlogs (date, performer, query, ip) VALUES (" . time() . ", \"{$_SESSION['user']}\", \"{$sql}\", \"{$_SERVER['REMOTE_ADDR']}\")";
        query($sql);
    }
}
if (!isset($need_out)) {
    $out = array("success" => true);
    echo out($out);
} else {
    unset($need_out);
}