コード例 #1
0
ファイル: optimize_database.php プロジェクト: robertpop/NS
function getTables()
{
    $query = "SHOW TABLES";
    $q = new DbMySql($query);
    $tables = array();
    while ($q->nextRecord()) {
        $tables[] = $q->f('Tables_in_' . $q->database);
    }
    return $tables;
}
コード例 #2
0
 /**
  * @param Account $account
  * @param Array $arrayEmails
  * @return bool
  */
 function UpdateSuggestTable(&$account, $arrayEmailsWithFName)
 {
     $arrayEmails = array_keys($arrayEmailsWithFName);
     $DBEmails = $this->SelectExistEmails($account, $arrayEmails);
     if ($DBEmails === false) {
         return false;
     }
     $arrayEmails = array_unique($arrayEmails);
     $DBEmails = array_unique($DBEmails);
     $NewEmails = array_diff($arrayEmails, $DBEmails);
     $UpdateEmails = $arrayEmails;
     if (count($UpdateEmails) > 0) {
         if (!$this->_dbConnection->Execute($this->_commandCreator->UpdateContactFrequencyByEmail($account, $UpdateEmails))) {
             return false;
         }
     }
     if (count($NewEmails) > 0) {
         foreach ($NewEmails as $key) {
             if (strlen($key) > 0) {
                 //$arrayEmailsWithFName[$key]
                 if (!$this->_dbConnection->Execute($this->_commandCreator->InsertAutoCreateContact($account, $key, $arrayEmailsWithFName[$key]))) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
コード例 #3
0
ファイル: dbstorage.php プロジェクト: JDevelopers/Mail
 function DeleteSubAdminsByIds($subAdminsIds)
 {
     if (is_array($subAdminsIds) && count($subAdminsIds) > 0) {
         foreach ($subAdminsIds as $subAdminId) {
             $this->_connector->Execute($this->_commandCreator->ClearSubAdminDomains($subAdminId));
             $this->_connector->Execute($this->_commandCreator->DeleteSubAdminById($subAdminId));
         }
         return true;
     }
     return false;
 }
コード例 #4
0
ファイル: dbstorage.php プロジェクト: JDevelopers/Mail
 /**
  * @param	string	$pref
  * @return	bool
  */
 function CreateTables($pref)
 {
     $tableArray = GetTablesArray($pref);
     $original = GetTablesArray('');
     foreach ($tableArray as $key => $tname) {
         $sql = trim($this->_commandCreator->CreateTable($original[$key], $pref));
         if ($sql === '') {
             return false;
         }
         if (!$this->_connector->Execute($sql)) {
             return $tname;
         }
     }
     return true;
 }
コード例 #5
0
ファイル: getPointsAndVipUsed.php プロジェクト: robertpop/NS
while ($db->nextRecord()) {
    $fieldValue = $db->f('free_widgets');
    $resWidgets[$db->f('ord_date')]['free_widgets'] = isset($resWidgets[$db->f('ord_date')]['free_widgets']) ? $resWidgets[$db->f('ord_date')]['free_widgets'] + $fieldValue : $fieldValue;
    $resWidgets[$db->f('ord_date')]['total_widgets'] = isset($resWidgets[$db->f('ord_date')]['total_widgets']) ? $resWidgets[$db->f('ord_date')]['free_widgets'] + $fieldValue : $fieldValue;
}
#points
$query = "SELECT COUNT(`id`) AS `points_widgets`, DATE_FORMAT(`date_premium`, '{$dateFormatSQL}') as `ord_date` FROM `quizzes`\n\t\tWHERE  DATE_FORMAT(`date_premium`, '%Y-%m-%d') >= '{$_POST['date_from']}' \n\t\tAND DATE_FORMAT(`date_premium`, '%Y-%m-%d') <= '{$_POST['date_to']}' AND `flags` & " . Quiz::FLAG_PREMIUM . "  AND  `premium_type` = 'points'  \n\t\tGROUP BY `ord_date` ";
$db = new DbMySql($query);
while ($db->nextRecord()) {
    $fieldValue = $db->f('points_widgets');
    $resWidgets[$db->f('ord_date')]['points_widgets'] = isset($resWidgets[$db->f('ord_date')]['points_widgets']) ? $resWidgets[$db->f('ord_date')]['points_widgets'] + $fieldValue : $fieldValue;
    $resWidgets[$db->f('ord_date')]['total_widgets'] = isset($resWidgets[$db->f('ord_date')]['total_widgets']) ? $resWidgets[$db->f('ord_date')]['total_widgets'] + $fieldValue : $fieldValue;
}
#vip
$query = "SELECT COUNT(`id`) AS `vip_widgets`, DATE_FORMAT(`date_premium`, '{$dateFormatSQL}') as `ord_date` FROM `quizzes`\n\t\tWHERE  DATE_FORMAT(`date_premium`, '%Y-%m-%d') >= '{$_POST['date_from']}' \n\t\tAND DATE_FORMAT(`date_premium`, '%Y-%m-%d') <= '{$_POST['date_to']}' AND  `flags` & " . Quiz::FLAG_PREMIUM . "  AND  `premium_type` = 'subscription'  \n\t\tGROUP BY `ord_date` ";
$db = new DbMySql($query);
while ($db->nextRecord()) {
    $fieldValue = $db->f('vip_widgets');
    $resWidgets[$db->f('ord_date')]['vip_widgets'] = isset($resWidgets[$db->f('ord_date')]['vip_widgets']) ? $resWidgets[$db->f('ord_date')]['vip_widgets'] + $fieldValue : $fieldValue;
    $resWidgets[$db->f('ord_date')]['total_widgets'] = isset($resWidgets[$db->f('ord_date')]['total_widgets']) ? $resWidgets[$db->f('ord_date')]['total_widgets'] + $fieldValue : $fieldValue;
}
$xml = new XmlBuilder();
$xml->Push('response');
$xml->Element('code', 200);
$xml->Element('status', ServMessages::getMessage(20));
foreach ($resPoints as $date => $result) {
    $xml->Push('results_points');
    $xml->Element('date', $date);
    $xml->Element('used_points', isset($result['used_points']) ? $result['used_points'] : 0);
    $xml->Element('vip_used_points', isset($result['vip_used_points']) ? $result['vip_used_points'] : 0);
    $xml->Element('total_used_points', isset($result['total_used_points']) ? $result['total_used_points'] : 0);
コード例 #6
0
ファイル: class_dbstorage.php プロジェクト: JDevelopers/Mail
 function SessionGC($time)
 {
     return $this->_dbConnection->Execute($this->_commandCreator->SessionGC($time));
 }
コード例 #7
0
ファイル: load_table.php プロジェクト: robertpop/NS
        if ($ii == 1) {
            $name = $fieldValue;
            //					$name .= "  (". $fieldValue. ")";
        }
        if ($ii == 2) {
            //					$name .= $fieldValue;
            $name .= "  (" . $fieldValue . ")";
            $res_all[$name]['templateName'] = $name;
        }
        if ($ii > 2) {
            $res_all[$name][$fieldName] = $fieldValue;
        }
    }
}
//		deg($res_all);
$db = new DbMySql($query_sum);
while ($db->nextRecord()) {
    $record = $db->getRecord();
    $ii = 0;
    foreach ($record as $fieldName => $fieldValue) {
        $ii++;
        if ($ii == 2) {
            $name = 'TOTAL';
        }
        if ($ii == 3) {
            $res_total[$name][$fieldName] = '';
        }
        if ($ii > 3) {
            $res_total[$name][$fieldName] = $fieldValue;
        }
    }
コード例 #8
0
<?php

include "common/header.php";
function formatDate($pDate)
{
    if (!$pDate) {
        return '';
    }
    return substr($pDate, 6, 2) . '.' . substr($pDate, 4, 2) . '.' . substr($pDate, 2, 2);
}
require_once "db/DbMySQL.cls.php";
$pastDate = getdate(strtotime("-30 day"));
$last30 = sprintf("%04d%02d%02d000000", $pastDate['year'], $pastDate['mon'], $pastDate['mday']);
$db = new DbMySql();
$query = "SELECT" . " substr( DATE_INSERT, 1, 8 ) AS date," . " FILE as file ," . " count( DISTINCT REMOTE_ADDRESS ) as count" . " FROM" . " DOWNLOAD_LOG" . " WHERE" . " TYPE = 'F'" . " and DATE_INSERT >= '" . $last30 . "'" . " GROUP BY" . " date," . " file" . " ORDER BY 1 desc,2";
$data = $db->getAllObjectsFor($query);
echo '<h1>Download Statistics</h1>';
echo '<table class="data" style="border-collapse:collapse;">';
echo '<tr><th>Date</th><th>File</th><th>Count</th></tr>';
foreach ($data as $row) {
    echo '<tr><td>' . formatDate($row->date) . '</td><td>' . $row->file . '</td><td>' . $row->count . '</td></tr>';
}
echo '</table>';
include "common/footer.php";
コード例 #9
0
ファイル: load_graph.php プロジェクト: robertpop/NS
        $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_JSON_SAVED;
//	$orderAlbums = isset($_SESSION['admin_filters_quizz']['order']) ? $_SESSION['admin_filters_quizz']['order'] : null;
$append .= " GROUP BY DATE_FORMAT(`date_created`, '{$dateFormatSQL}')\n\t\t\t\t\tORDER BY DATE_FORMAT(`date_created`, '{$dateFormatSQL}') ASC ";
$query .= $append;
$db = new DbMySql($query);
while ($db->nextRecord()) {
    $record = $db->getRecord();
    foreach ($record as $fieldName => $fieldValue) {
        $res_all[$db->f('ord_date')][$fieldName] = $fieldValue;
        if ($filters['filter_chart_y_axis'] == 'procentual') {
            if (!isset($max[$fieldName]) || $max[$fieldName] < $fieldValue) {
                $max[$fieldName] = $fieldValue;
            }
        }
    }
}
$resValoric = $res_all;
if ($filters['filter_chart_y_axis'] == 'procentual') {
    foreach ($res_all as &$row) {
        foreach ($row as $v => &$r) {
コード例 #10
0
ファイル: download.php プロジェクト: nrkkalyan/eclipsesql
header('ETag: "' . md5($mtime . $fileName) . '"');
// output last modified header using the last modified date of the file.
header('Last-Modified: ' . $gmt_mtime);
// this resource expires one month from now.
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $cacheTime) . ' GMT');
// tell all caches that this resource is publically cacheable.
header('Cache-Control: public,max-age=' . $cacheTime);
readfile($fileName);
// dump server params for debug purposes
/*
$dump = "------------------------------------\n";
foreach($_SERVER as $key => $value)
{
	$dump .= $key .": " . $value . "\n";
}
echo $dump;
*/
// try to log the download
$db = new DbMySql();
$remoteIp = isset($_SERVER["HTTP_X_REMOTE_ADDR"]) ? $_SERVER["HTTP_X_REMOTE_ADDR"] : (isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : '???');
$userAgent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : '???';
$type = $file_extension == "xml" ? "x" : "?";
list($msec, $sec) = explode(" ", microtime());
$micro = sprintf("%03d", (double) $msec * 1000);
$now = strftime("%Y%m%d%H%M%S") . $micro;
if ($type == "?") {
    $type = substr($page, 0, 1);
}
$query = "insert into DOWNLOAD_LOG(DATE_INSERT,TYPE,FILE,REMOTE_ADDRESS,USER_AGENT) values(" . "'" . $now . "'," . "'" . $type . "'," . "'" . $page . "'," . "'" . $remoteIp . "'," . "'" . $userAgent . "')";
$db->execQuery($query);
return;