Пример #1
0
$filters = isset($_SESSION['admin_filters_stats']['filters']) ? $_SESSION['admin_filters_stats']['filters'] : array();
if (isset($filters['categories']) && $filters['categories'] == '') {
    $filters['subcategories'] = '';
}
$pp = 1;
if (isset($_GET['p'])) {
    $pp = $_GET['p'];
}
$append = " WHERE params_vals.param_id = params.id ";
if (isset($_SESSION['admin_filters_stats']['filters']['name']) && !empty($_SESSION['admin_filters_stats']['filters']['name'])) {
    $_SESSION['admin_filters_stats']['filters']['name'] = trim($_SESSION['admin_filters_stats']['filters']['name']);
    $name = realEscapeString($_SESSION['admin_filters_stats']['filters']['name']);
    $append .= " AND params.name LIKE '%{$name}%' ";
}
if (isset($_SESSION['admin_filters_stats']['filters']['param_value']) && $_SESSION['admin_filters_stats']['filters']['param_value'] != '') {
    $param_value = realEscapeString($_SESSION['admin_filters_stats']['filters']['param_value']);
    $append .= " AND params_vals.value = '{$param_value}' ";
}
$append .= " AND ( 0  ";
if (isset($_SESSION['admin_filters_stats']['filters']['template_hash']) && $_SESSION['admin_filters_stats']['filters']['template_hash'] != '') {
    $templateHash = $_SESSION['admin_filters_stats']['filters']['template_hash'];
    foreach ($templateHash as $temp) {
        if ($temp != "") {
            $append .= " OR params.tpl_hash = '{$temp}' ";
            $arr[] = $temp;
        }
    }
}
$append .= " ) ";
/////////////////////////// -- START -- ///////  cat - subcat from template with defaults
if (!isset($arr)) {
Пример #2
0
if (isset($filters['user_id']) && !empty($filters['user_id'])) {
    $users = explode(',', $filters['user_id']);
    $uquery = '';
    foreach ($users as $uid) {
        $uquery .= "'" . intval($uid) . "',";
    }
    $uquery = "(" . rtrim($uquery, ',') . ")";
    $append .= " AND `user_id` IN " . $uquery;
} else {
    $sapp = '';
    if (isset($filters['email']) && !empty($filters['email'])) {
        $email = realEscapeString($filters['email']);
        $sapp .= "AND `email` LIKE '%{$email}%' ";
    }
    if (isset($filters['screename']) && !empty($filters['screename'])) {
        $screenName = realEscapeString($filters['screename']);
        $sapp .= "AND `screenname` LIKE '%{$screenName}%' ";
    }
    if (!empty($sapp)) {
        $sapp = ' WHERE ' . ltrim($sapp, 'AND');
        $request = new SnacktoolsRequest('get_users_for_admin');
        $request->addParam('query', $sapp);
        $response = $request->request();
        $responseQuery = $response->data['query'];
        $append .= " AND `user_id` IN " . $responseQuery;
    }
}
//$append .= " AND flags & " . Notify::FLAG_NOTIF_DATA_SAVED;
$orderAlbums = isset($_SESSION['admin_filters_quizz']['order']) ? $_SESSION['admin_filters_quizz']['order'] : null;
if (isset($orderAlbums->orderBy)) {
    $append .= ' ORDER BY `' . $orderAlbums->orderBy . '` ' . $orderAlbums->orderType . ' ';
Пример #3
0
<?php

$smarty->assign('action', $action);
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$template = new Templates($id);
switch ($action) {
    case 'list':
    default:
        $type = isset($_GET['type']) ? $_GET['type'] : null;
        $obj = new Templates();
        $append = "";
        if (!empty($type)) {
            $append = "WHERE type = '" . realEscapeString($type) . "' ";
        }
        $smarty->assign('obj', $obj->getAll($append . " ORDER BY `display_order` "));
        $smarty->assign('CONTENT', 'templates/list.tpl');
        $smarty->assign('type', $type);
        break;
    case 'status':
        if (!isset($_GET['id'])) {
            jump('index.php?page=templates');
        }
        $obj = new Templates((int) $_GET['id']);
        $obj->status = $obj->status == 0 ? 1 : 0;
        $obj->save();
        Messages::addNotice('Status changed');
        jump('index.php?page=templates');
        break;
    case 'default':
        if (!isset($_GET['id'])) {
            jump('index.php?page=templates');
Пример #4
0
        $screenName = realEscapeString($filters['screename']);
        $sapp .= "AND `screenname` LIKE '%{$screenName}%' ";
    }
    $sapp = ' WHERE ' . ltrim($sapp, 'AND');
    $request = new SnacktoolsRequest('get_users_for_admin');
    $request->addParam('query', $sapp);
    $response = $request->request();
    $responseQuery = $response->data['query'];
    if ($responseQuery) {
        $query .= " AND `user_id` IN " . $responseQuery;
    }
}
if (isset($filters['quiztypes'])) {
    $qtypesApp = '';
    foreach ($filters['quiztypes'] as $qtype) {
        $qtypeEscaped = realEscapeString($qtype);
        $qtypesApp .= '`notifications`.`type` = \'' . $qtypeEscaped . '\' OR';
    }
    if (!empty($qtypesApp)) {
        $qtypesApp = rtrim($qtypesApp, 'OR');
        $query .= "AND (" . $qtypesApp . ') ';
    }
}
$query .= " AND (0 " . (!empty($filters['type_editable']) ? " OR (`notifications`.`status` = 'EDITABLE' ) " : '') . (!empty($filters['type_published_free']) ? " OR (`notifications`.`status`='PUBLISHED' AND NOT (`notifications`.`flags` & " . Notify::FLAG_PREMIUM . ")) " : '') . (!empty($filters['type_no_watermark']) ? " OR (`notifications`.`status`='PUBLISHED' AND `notifications`.`flags` & " . Notify::FLAG_PREMIUM . ")" : '') . ")";
$query_sum = $query;
// to calculate the sum for all (ungrouped)
$query .= '  GROUP BY  `templates`.`id` ORDER BY `templates`.`name` ';
$db = new DbMySql($query);
while ($db->nextRecord()) {
    $record = $db->getRecord();
    $ii = 0;
Пример #5
0
<?php

$hash = realEscapeString($_GET['hash']);
$mode = realEscapeString($_GET['mode']);
$res = array();
$notify = new Notify();
$notify = $notify->getByHash($hash);
if ($mode == 'custom' && !empty($_GET['date1']) && !empty($_GET['date2'])) {
    $res['date1'] = date('Y-m-d', strtotime($_GET['date1']));
    $res['date2'] = date('Y-m-d', strtotime($_GET['date2']));
    if ($res['date1'] >= $res['date2']) {
        $res['date1'] = date('Y-m-d', strtotime('-30 days'));
        $res['date2'] = date('Y-m-d');
    }
} else {
    if ($mode == 'alltime') {
        $res['date1'] = date('Y-m-d', strtotime($notify->date_created));
        $res['date2'] = date('Y-m-d');
        if ($res['date1'] >= $res['date2']) {
            $res['date1'] = date('Y-m-d', strtotime('-1 day'));
        }
    } else {
        // last 30 days
        $res['date1'] = date('Y-m-d', strtotime('-30 days'));
        $res['date2'] = date('Y-m-d');
    }
}
$res['timestamp1'] = strtotime($res['date1']);
$res['timestamp2'] = strtotime($res['date2']);
$dateCreated = date('Y-m-d', strtotime($notify->date_created));
if ($dateCreated <= $res['date1']) {