Esempio n. 1
0
function intSetReport(&$smarty)
{
    $do_empty = TRUE;
    $smarty->assign("show_report", TRUE);
    $conds = collectConditions();
    $report_helper = new ReportHelper();
    $req = new GetCreditChanges($conds, $report_helper->getFrom(), $report_helper->getTo(), $report_helper->getOrderBy(), $report_helper->getDesc());
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        $result = $resp->getResult();
        $report = $result["report"];
        $total_rows = $result["total_rows"];
        $total_per_user_credit = $result["total_per_user_credit"];
        $total_admin_credit = $result["total_admin_credit"];
        $do_empty = FALSE;
    } else {
        $resp->setErrorInSmarty($smarty);
    }
    if ($do_empty) {
        $report = array();
        $total_rows = 0;
        $total_per_user_credit = 0;
        $total_admin_credit = 0;
    }
    $smarty->assign_by_ref("report", $report);
    $smarty->assign("total_rows", $total_rows);
    $smarty->assign("total_per_user_credit", $total_per_user_credit);
    $smarty->assign("total_admin_credit", $total_admin_credit);
}
Esempio n. 2
0
function intDoSearch(&$smarty)
{
    $user_search_helper = new ReportCollector();
    $report_helper = new ReportHelper();
    intSetConditions($smarty, $user_search_helper);
    list($count, $user_ids, $user_infos) = searchUser($smarty, $user_search_helper->getConds(), $report_helper->getFrom(), $report_helper->getTo(), $report_helper->getOrderBy(), $report_helper->getDesc());
    $smarty->assign_by_ref("user_infos", $user_infos);
    $smarty->assign_by_ref("user_ids", $user_ids);
    $smarty->assign("result_count", $count);
    $smarty->assign("show_results", TRUE);
    intShowUserSearch($smarty);
}
Esempio n. 3
0
function intShowOnlineUsers(&$smarty)
{
    $report_helper = new ReportHelper();
    $req = new GetOnlineUsers($report_helper->getOrderBy(), $report_helper->getDesc());
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        $onlines = $resp->getResult();
    } else {
        $resp->setErrorInSmarty($smarty);
        $onlines = array();
    }
    intShowOnlinesByType($smarty, $onlines);
}
function intSetReport(&$smarty)
{
    $do_empty = TRUE;
    if (isInRequest("show")) {
        $conds = collectConditions();
        $report_helper = new ReportHelper(0, 30, "add_date", TRUE);
        $req = new SearchAddUserSaves($conds, $report_helper->getFrom(), $report_helper->getTo(), $report_helper->getOrderBy(), $report_helper->getDesc());
        $resp = $req->sendAndRecv();
        if ($resp->isSuccessful()) {
            $result = $resp->getResult();
            $report = $result["result"];
            $total_rows = $result["total_rows"];
            $do_empty = FALSE;
        } else {
            $resp->setErrorInSmarty($smarty);
        }
    }
    if ($do_empty) {
        $report = array();
        $total_rows = 0;
    }
    $smarty->assign_by_ref("results", $report);
    $smarty->assign("total_rows", $total_rows);
}
Esempio n. 5
0
define('DIRECT_ACCESS_CHECK', true);
define('BASE_PATH', '../../');
require_once '../updatehelper.php';
require_once BASE_PATH . 'includes/reporthelper.class.php';
$mUpdateHelper = new UpdateHelper();
$mUpdateHelper->begin();
$mUpdateHelper->applySQLUpdateFile();
$mUpdateHelper->exitOnError();
$mUpdateHelper->printStartNextStepMsg("Start updating issues table");
$succeeded = true;
$packages = DbHelper::selectRows(TBL_REPORTS, null, REPORT_PACKAGE_NAME, REPORT_ISSUE . ', ' . REPORT_PACKAGE_NAME, REPORT_ISSUE, null, false);
foreach ($packages as $package) {
    $issueId = $package[0];
    $packageName = $package[1];
    // skip empty package name
    if (strlen($packageName) == 0) {
        $mUpdateHelper->printStepMsg("Found empty package name !", true, false);
        continue;
    }
    $appId = DbHelper::fetchOrInsertApplication($packageName, ReportHelper::formatPackageName($packageName, true));
    if ($appId == -1) {
        $succeeded = false;
    }
    $mUpdateHelper->printStepMsg("Inserted application " . $packageName . ", id is " . $appId, $appId == -1, false);
    $mUpdateHelper->printStepMsg('Update issued #' . $issueId . ' with application id #' . $appId, false, false);
    DbHelper::exec('UPDATE ' . TBL_ISSUES . ' SET ' . ISSUE_APP_ID . '=' . $appId . ' WHERE ' . ISSUE_ID . '=' . $issueId, false);
}
$mUpdateHelper->printEndStepMsg($succeeded, null, false);
$mUpdateHelper->printEndStepMsg(true, null, true);
$mUpdateHelper->end();
Esempio n. 6
0
 public function getFormattedAvailMemSize()
 {
     return ReportHelper::formatMemSize($this->available_mem_size);
 }
Esempio n. 7
0
 $message = 'OK';
 $chartId = $_GET['chartId'];
 switch ($chartId) {
     case REPORTS_PER_ANDROID_VERSION_PIE_CHART_ID:
         $arr = DBHelper::selectRows(TBL_REPORTS, null, null, REPORT_ANDROID_VERSION . ', COUNT(*)', REPORT_ANDROID_VERSION, null, false);
         if ($arr != null) {
             $data = ChartHelper::convertMySQLArrToPieChartJSON($arr);
         } else {
             $message = 'No data yet recorded.|';
         }
         break;
     case REPORTS_PER_APPLICATION_PIE_CHART_ID:
         $arr = DBHelper::selectRows(TBL_REPORTS, null, null, REPORT_PACKAGE_NAME . ',COUNT(*)', REPORT_PACKAGE_NAME, null, false);
         if ($arr != null) {
             for ($i = 0; $i < sizeof($arr); ++$i) {
                 $arr[$i][0] = ReportHelper::formatPackageName($arr[$i][0], true);
             }
             $data = ChartHelper::convertMySQLArrToPieChartJSON($arr);
         } else {
             $message = 'No data yet recorded.|';
         }
         break;
     case REPORTS_EVOLUTION_LINE_CHART_ID:
         $projection = 'DATE(NOW()-INTERVAL ' . INC_VALUE . ' DAY) date, ' . 'DATE_FORMAT(DATE(NOW()-INTERVAL ' . INC_VALUE . ' DAY),"%m-%d") formatted_date, ' . '(SELECT COUNT(*) FROM ' . TBL_REPORTS . ' WHERE DATE(user_crash_date)=date) reports,' . '(SELECT COUNT(*) FROM ' . TBL_ISSUES . ' WHERE DATE(issue_datetime)=date) issues, ' . '(SELECT count(*)/DAYOFYEAR(DATE_FORMAT(' . REPORT_CRASH_DATE . ', "%Y-%m-%d")) FROM ' . TBL_REPORTS . ' WHERE DATE_FORMAT(' . REPORT_CRASH_DATE . ',"%Y")=\'' . date('Y') . '\') avg_per_day_current_year';
         $orderby = 'inc ASC LIMIT 15';
         $arr = DBHelper::selectRows(TBL_INCREMENTS, null, $orderby, $projection, null, null, true);
         if ($arr != null && count($arr) > 0) {
             $data = ChartHelper::convertMySQLArrToReportsEvolChartJSON($arr);
         } else {
             $message = 'No data yet recorded.|';
         }
Esempio n. 8
0
  			<dt>Settings System</dt><dd><br/><?php 
echo ReportHelper::displayObjectValuesToHTMLArray($r->settings_system, FORMAT_SETTINGS_KEY);
?>
</dd>
  			<dt>Settings Secure</dt><dd><br/><?php 
echo ReportHelper::displayObjectValuesToHTMLArray($r->settings_secure, FORMAT_SETTINGS_KEY);
?>
</dd>
  		</dl>
  	</div>
  	
  	<div class="tab-pane" id="report-environments" >
  		<dl>
  			<dt>Environments</dt>
  			<dd><br/><?php 
echo ReportHelper::displayObjectValuesToHTMLArray($r->environment, FORMAT_ENV_KEY);
?>
</dd>
  		</dl>
  	</div>
  	
  	<div class="tab-pane" id="report-stacktrace" ><?php 
echo $r->getFormattedStackTrace();
?>
</div>
  	<div class="tab-pane" id="report-logcat" ><?php 
echo $r->getFormattedLogCat();
?>
</div>
  	<div class="tab-pane" id="report-eventslog" ><?php 
echo $r->getFormattedEventsLog();
Esempio n. 9
0
            break;
        }
    }
}
// if data not empty then store into DB
if (!empty($data)) {
    Debug::logi("Seems to be a valid request... Try to decode JSON and save to DB.", 'REPORT');
    $json = json_decode($data, true);
    // check if device is in exception list
    if (isset($json['device_id']) && !empty($json['device_id']) && $cfg->isInReportExceptionDevices($json['device_id'])) {
        Debug::logi("Report ignored, device " . $json['device_id'] . " is in exception list.");
        exit;
    }
    // open db connection
    DBHelper::open();
    $values = ReportHelper::buildMySQLValuesArr($json);
    $result = DBHelper::insertReport($values);
    if (!$result) {
        Debug::loge('Inserting report data failed ! ' . DBHelper::getLastError(), 'REPORT');
        Debug::loge('Report content ' . print_r($values, true), 'REPORT');
    } else {
        Debug::logi('Report inserted with success !', 'REPORT');
    }
    if ($cfg->sendMailOnReportReceived()) {
        $package = explode('.', $json['PACKAGE_NAME']);
        MailHelper::sendMail($cfg->getReportMailRecipients(), '[MABL] New ' . (isset($json['IS_SILENT']) && $json['IS_SILENT'] > 0 ? 'SILENT ' : '') . 'report received for ' . $package[count($package) - 1] . ' !', ReportHelper::createMailContent(!$result, $package, $json));
    }
    DBHelper::close();
} else {
    Debug::loge('Invalid report request data ! ' . print_r($_REQUEST, true), 'REPORT');
}
Esempio n. 10
0
 public static function insertSale($values)
 {
     $error = null;
     $packageName = $values[SALE_PRODUCT_ID];
     $appId = DbHelper::fetchOrInsertApplication($packageName, ReportHelper::formatPackageName($packageName, true));
     Debug::logd('Application id #' . $appId, 'INSERT SALE');
     if ($appId > 0) {
         $values[SALE_APP_ID] = $appId;
         $error = self::exec('REPLACE INTO ' . TBL_SALES . ' ' . self::convertArrToInsertValues($values));
         if ($error != null) {
             if (self::countRows(TBL_SALES, SALE_ORDER_NUMBER . '=' . $values[SALE_ORDER_NUMBER]) == 0) {
                 $error = 'Row insertion check failed !';
             }
         }
     } else {
         $error = 'Retreive or insert application failed !';
     }
     return $error;
 }
Esempio n. 11
0
 * * Copyright (c) 2010 University of Notre Dame
 * *
 * * This file is part of CORAL.
 * *
 * * CORAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 * *
 * * CORAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * *
 * * You should have received a copy of the GNU General Public License along with CORAL. If not, see <http://www.gnu.org/licenses/>.
 * *
 * *************************************************************************************************************************
 */
session_start();
ob_start();
include_once 'directory.php';
$reportHelper = new ReportHelper();
if ($reportHelper->outputType === 'web') {
    $pageTitle = $reportHelper->report->getName();
    include 'templates/header.php';
} else {
    if ($reportHelper->outputType === 'print') {
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CORAL Usage Statistics Reporting - <?php 
        echo $reportHelper->report->getName();
        ?>
</title>
<link rel="stylesheet" href="css/print.css" type="text/css"
Esempio n. 12
0
     if (!empty($reportId)) {
         if (isset($_POST['issueFormat'])) {
             require_once 'pages/issue_details_dialog_report_details.php';
         } else {
             require_once 'pages/report_details_dialog.php';
         }
     } else {
         echo 'Report id is not valid !';
     }
     break;
     //////// UPDATE ISSUES STATE
 //////// UPDATE ISSUES STATE
 case 'setissuesstate':
     $issueIds = @$_POST['issueIds'];
     $state = @$_POST['state'];
     if (ReportHelper::checkState($state)) {
         if (!empty($issueIds)) {
             if (DBHelper::updateIssuesState(explode(',', $issueIds), $state)) {
                 echo 'O:';
                 $state = new IssueState($state);
                 $priority = new IssuePriority();
                 $label = $state->getLabel(true);
                 $issueIds = explode(',', $issueIds);
                 $sep = '';
                 foreach ($issueIds as $issueId) {
                     $res = DbHelper::selectRow(TBL_ISSUES, ISSUE_ID . '=' . $issueId, ISSUE_PRIORITY);
                     $priority->setPriority($res[0][0]);
                     echo $sep, $label, '|', IssueHelper::getHiliteBgColorClass($state, $priority), '|', strtolower($state->getName());
                     $sep = '||';
                 }
             } else {