static function checkAuth()
 {
     $current_cwd = getcwd();
     if (!self::$authenticated) {
         define('BOLMER_API_MODE', true);
         define('IN_MANAGER_MODE', true);
         $init = realpath(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . "/index.php");
         include_once $init;
         $type = getService('user', true)->getLoginUserType();
         if ($type == 'manager') {
             self::$authenticated = true;
             if (!isset($_SESSION['KCFINDER'])) {
                 $_SESSION['KCFINDER'] = array();
             }
             if (!isset($_SESSION['KCFINDER']['disabled'])) {
                 $_SESSION['KCFINDER']['disabled'] = false;
             }
             $_SESSION['KCFINDER']['_check4htaccess'] = false;
             $_SESSION['KCFINDER']['uploadURL'] = '/assets/';
             $_SESSION['KCFINDER']['uploadDir'] = BOLMER_BASE_PATH . 'assets/';
             $_SESSION['KCFINDER']['theme'] = 'default';
         }
     }
     chdir($current_cwd);
     return self::$authenticated;
 }
$gaprofile = new gaprofiles();
$profile = $gaprofile::makezine;
$yesterday = date("Y-m-d", strtotime("yesterday"));
$current_time = date("Y-m-d H:i:s", time());
printf("\ncurrent time: %s. script for: %s\n", $current_time, $yesterday);
$dbconnection = new mysqlconnect();
$dbconnection->connect($dbName);
$mysqli = $dbconnection->connection;
$insertquery = "insert into mz_sessioncount(record_date, metric) values (?, ?) on duplicate key update \n    record_date=values(record_date), metric=values(metric)";
if ($stmt = $mysqli->prepare($insertquery)) {
    $stmt->bind_param("si", $datetime, $metric);
    $mysqli->query("start");
} else {
    printf("error: %s\n", $mysqli->error);
}
$analytics = getService();
//$profile = getFirstProfileId($analytics);
$profile = '8515';
$sessioncount = getResults($analytics, $profile);
if (count($sessioncount->getRows()) > 0) {
    $rowCount = count($sessioncount->getRows());
    $rows = $sessioncount->getRows();
    //print_r($rows);
    for ($i = 0; $i < $rowCount; $i++) {
        $datetime = date('Y-m-d', strtotime($rows[$i][0]));
        $metric = $rows[$i][1];
        $stmt->execute();
        printf("date: %s, counts: %d.\n", $datetime, $metric);
    }
}
$stmt->close();
isset($INFO['INF_DIRECTION']) ? $direction = $INFO['INF_DIRECTION'] : ($direction = '');
isset($INFO['INF_SERVICE']) ? $service = $INFO['INF_SERVICE'] : ($service = '');
isset($INFO['INF_PAYS']) ? $pays = $INFO['INF_PAYS'] : ($pays = '');
isset($INFO['INF_VILLE']) ? $ville = $INFO['INF_VILLE'] : ($ville = '');
isset($INFO['INF_DEVISE']) ? $devise = $INFO['INF_DEVISE'] : ($devise = '');
$dateacq == '0000-00-00' ? $dateacq = '' : ($dateacq = frFormat2($dateacq));
isset($INFO['INF_SIGNATEUR1']) ? $magasinier = $INFO['INF_SIGNATEUR1'] : ($magasinier = '');
isset($INFO['INF_SIGNATEUR2']) ? $chef = $INFO['INF_SIGNATEUR2'] : ($chef = '');
isset($INFO['INF_NOMSIGNATEUR2']) ? $nomchef = $INFO['INF_NOMSIGNATEUR2'] : ($nomchef = '');
isset($INFO['INF_NOMSIGNATEUR3']) ? $directeur = $INFO['INF_SIGNATEUR3'] : ($directeur = '');
isset($INFO['INF_NOMSIGNATEUR3']) ? $nomdirecteur = $INFO['INF_NOMSIGNATEUR3'] : ($nomdirecteur = '');
isset($INFO['INF_SIGNATEUR3']) ? $gestionnaire = $INFO['INF_SIGNATEUR3'] : ($gestionnaire = '');
isset($INFO['INF_SIGNATEUR4']) ? $daf = $INFO['INF_SIGNATEUR4'] : ($daf = '');
isset($_SESSION['DATA_TRS']['exercice']) ? $exercice = $_SESSION['DATA_TRS']['exercice'] : ($exercice = '');
isset($_SESSION['DATA_TRS']['nbreLigne']) ? $nbreLigne = $_SESSION['DATA_TRS']['nbreLigne'] : ($nbreLigne = '');
isset($_SESSION['DATA_TRS']['service_srce']) ? $serviceemetteur = getService($_SESSION['DATA_TRS']['service_srce']) : ($serviceemetteur = '');
isset($_SESSION['DATA_TRS']['magasin_srce']) ? $magsource = getmagasinName($_SESSION['DATA_TRS']['magasin_srce']) : ($magsource = '');
isset($_SESSION['DATA_TRS']['magasin_dest']) ? $magdest = getmagasinName($_SESSION['DATA_TRS']['magasin_dest']) : ($magdest = '');
isset($_SESSION['DATA_TRS']['libelleetat']) && $_SESSION['DATA_TRS']['libelleetat'] != '' ? $libelle = $_SESSION['DATA_TRS']['libelleetat'] : ($libelle = $libel . ' : ' . $magsource . ' -> ' . $magdest);
isset($_SESSION['DATA_TRS']['codetransfert']) ? $code = $_SESSION['DATA_TRS']['codetransfert'] : ($code = '');
isset($_SESSION['DATA_TRS']['datetransfert']) ? $date = $_SESSION['DATA_TRS']['datetransfert'] : ($date = '');
isset($_SESSION['DATA_TRS']['camion']) ? $camion = $_SESSION['DATA_TRS']['camion'] : ($camion = '');
isset($_SESSION['DATA_TRS']['ligne']) ? $data = $_SESSION['DATA_TRS']['ligne'] : ($data = array());
//Ligne
$ligne = ligneEtatTransfert($nbreLigne, $data);
?>
<!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" lang="fr" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="refresh" CONTENT="" >
Exemple #4
0
function GetPage($res = '')
{
    $data = '
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>

	    	<table class="dialog-form-table">
	           <tr>
					<td style="width: 170px;"><label for="user">მომსახურების ცენტრი</label></td>
					<td>
						<select id="service_center_id">' . getService($res['service_center_id']) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="user">იუზერი</label></td>
					<td>
						<input type="text" id="user" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['user'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="password">პაროლი</label></td>
					<td>
						<input type="text" id="password" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['password'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="link">ლინკი</label></td>
					<td>
						<input type="text" id="link" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['link'] . '" />
					</td>
				</tr>

			</table>
			<!-- ID -->
			<input type="hidden" id="department_id" value="' . $res['id'] . '" />
        </fieldset>
    </div>
    ';
    return $data;
}
<?php

include "../include/common.php";
include "../config.php";
include "../include/session.php";
include "../include/dbconnect.php";
include "../include/account.php";
include "../include/auth.php";
if (isset($_SESSION['account_id']) && isset($_REQUEST['id'])) {
    $service_id = $_REQUEST['id'];
    if (getServiceOwner($service_id) == $_SESSION['account_id']) {
        $service_info = getService($service_id);
        $_SESSION['is_' . $service_id . '_' . $service_info['type']] = true;
        //check if we need to redirect to a slave uxpanel instance
        $slaveRedirect = getServiceParam($service_id, "slave");
        if (!$config['slave_enabled'] && $slaveRedirect != false) {
            //ok, register stuff into database and redirect to the other instance
            $ip = $_SERVER['REMOTE_ADDR'];
            $token = authRemoteRegister($_SESSION['account_id'], $service_id, $ip);
            header("Location: " . $slaveRedirect . "remote_login.php?user_id={$_SESSION['account_id']}&service_id={$service_id}&ip=" . urlencode($ip) . "&token={$token}");
        } else {
            header("Location: ../{$service_info['type']}/?id={$service_id}");
        }
    }
} else {
    header("Location: ../");
}
Exemple #6
0
function startUp2($sw)
{
    $clientP12 = 'client_secrets.p12';
    //GA 3A317413
    $email = '*****@*****.**';
    //GA 3A317413
    //$clientP12 = 'client_secrets1.p12';// primary credentials
    //$email = '*****@*****.**'; // primary credentials
    $analytics = getService($clientP12, $email);
    $profile = getFirstprofileId($analytics);
    //
    switch ($sw) {
        case "ace":
            $dat = getLocT($analytics, $profile);
            $ace = HandleUsr($dat);
            //0
            return $ace;
            break;
            //
        //
        case "deuce":
            $avg = getLod($analytics, $profile);
            $deuce = HandleUsr($avg);
            //1
            return $deuce;
            break;
            //
        //
        case "tiors":
            $dev = getDev($analytics, $profile);
            $tiors = HandleUsr($dev);
            //2
            return $tiors;
            break;
            //
        //
        case "quat":
            $brw = getBrw($analytics, $profile);
            $quat = HandleUsr($brw);
            //3
            return $quat;
            break;
            //
        //
        case "quint":
            $loc = getLoc($analytics, $profile);
            $quint = HandleUr($loc);
            //4
            return $quint;
            break;
            //
        //
        case "sees":
            $lodm = getLodM($analytics, $profile);
            $sees = HandleUsr($lodm);
            //5
            return $sees;
            break;
            //
        //
        case "user":
            $usr = getUsr($analytics, $profile);
            // RealTime? User Data Query
            $user = HandleUsr($usr);
            //6
            return $user;
            break;
            //
        //
        case "server":
            $srv = getSrv($analytics, $profile);
            $server = HandleUsr($srv);
            //7
            return $server;
            break;
            //
        //
        case "load":
            $lod = getLod($analytics, $profile);
            $load = HandleUsr($lod);
            //8
            return $load;
            break;
            //
        //
        case "mobile":
            $mob = getMob($analytics, $profile);
            $mobile = HandleUsr($mob);
            //9
            return $mobile;
            break;
        default:
    }
}
    // Create and configure a new client object.
    $client = new Google_Client();
    $client->setApplicationName('Google Analytics Dashboard');
    $analytics = new Google_Service_Analytics($client);
    // Read the generated client_secrets.p12 key.
    $cred = new Google_Auth_AssertionCredentials($service_account_email, array(Google_Service_Analytics::ANALYTICS_READONLY), $key);
    $client->setAssertionCredentials($cred);
    if ($client->getAuth()->isAccessTokenExpired()) {
        $client->getAuth()->refreshTokenWithAssertion($cred);
    }
    return $analytics;
}
/**
 * Get Analytics API instance
 */
$analytics = getService($google_account['email'], $google_account['key']);
/**
 * Gets objects from the site table
 */
$site_details = Sites::getAll();
$site_details_length = sizeof($site_details);
if ($site_details_length <= 0) {
    trigger_error('Size of site_details_length must be greater than zero', E_USER_NOTICE);
    error_log($today . "The sites tables has return zero sites from the database \n", 3, __DIR__ . "/../../log/error.log");
    exit;
}
echo "*******************" . "\n";
echo "* total sites : " . $site_details_length . " *" . "\n";
echo "*******************" . "\n";
/**
 * Query the Analytics data.
Exemple #8
0
                    include "../include/ghost.php";
                    $db_settings = databaseSettings($_POST['db_id']);
                    if ($db_settings !== false) {
                        ghostSetDatabase($_REQUEST['id'], $db_settings);
                        $message = "Database settings should be set properly.";
                    } else {
                        $message = "Failed to find database settings for the specified database service.";
                    }
                } else {
                    if ($_POST['action'] == "channeldb" && isset($_POST['db_id'])) {
                        include "../include/database.php";
                        include "../include/channel.php";
                        $db_settings = databaseSettings($_POST['db_id']);
                        if ($db_settings !== false) {
                            channelSetDatabase($_REQUEST['id'], $db_settings);
                            $message = "Database settings should be set properly.";
                        } else {
                            $message = "Failed to find database settings for the specified database service.";
                        }
                    }
                }
            }
        }
        header("Location: service.php?id={$service_id}&message=" . urlencode($message));
    }
    $service = getService($service_id);
    $parameters = getServiceParams($service_id);
    get_page("service", "admin", array('id' => $service_id, 'service' => $service, 'parameters' => $parameters, 'message' => $message));
} else {
    header("Location: ./");
}
Exemple #9
0
        fputcsv($fp, $row, $delimiter);
    }
    fclose($fp);
    return true;
}
function saveJSON($filename, $outputDirectory, $content)
{
    $fp = fopen($outputDirectory . '/' . $filename, 'w');
    fwrite($fp, $content);
    fclose($fp);
    return true;
}
$cliArgs = parseArgs($argc, $argv);
$configFile = $cliArgs['config'];
$config = parseConfig($configFile);
$analytics = getService($config['emailAddress'], $config['keyFileLocation']);
$profile = getFirstProfileId($analytics);
$events = getTotalEvents($analytics, $profile, $config);
$profileName = $events->getProfileInfo()->getProfileName();
$dateFetching = date('Y-m-d H:i:s');
echo info("VIEW: " . $profileName . "\n");
echo info("OUTPUT: " . $config['outputFormat'] . "\n");
$headers = array();
foreach ($events->getColumnHeaders() as $header) {
    $headers[] = $header['name'];
}
$rows = $events->getRows();
if (!count($rows)) {
    echo error("No data found\n");
    exit;
}
function getSourceRepartitionYear($conn, $date_from, $date_to)
{
    $result = getSourceLocalSSIYear($conn, $date_from, $date_to);
    foreach ($result as $ligne) {
        $destinationnet = getService($conn, $ligne['source']);
        if (!$destinationnet) {
            if (!$tab[getIP2Country($conn, $ligne["source"])]) {
                $tab[getIP2Country($conn, $ligne["source"])] = 0;
            }
            $tab[getIP2Country($conn, $ligne["source"])] = $tab[getIP2Country($conn, $ligne["source"])] + $ligne["volume"];
        }
    }
    if (is_array($tab)) {
        arsort($tab);
        reset($tab);
        return $tab;
    } else {
        return NULL;
    }
}
function ligneAnalyseJournal($nbre = 1, $data = array())
{
    $returnHTML = '';
    $i = 0;
    foreach ($data as $key => $row) {
        $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
        if ($row['MVT_VALID'] == '0') {
            $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">';
        } elseif ($row['MVT_VALID'] == '2') {
            $imgCl = '<img src="../images/cancel.png" title="Annulée" width="16" height="16">';
        } else {
            $imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">';
        }
        $returnHTML .= '
				<tr align="left" valign="middle" class="' . $col . '">
		        	<td height="22" class="text" align="center">' . $imgCl . '</td>
		        	<td height="22" class="text" align="center">' . stripslashes($row['CODE_PRODUIT']) . '</td>
	            	<td class="text" >' . stripslashes(getConditionnement($row['CODE_PRODUIT'])) . '</td>
	            	<td class="text" align="left">' . stripslashes($row['MVT_NATURE']) . '</td>
					<td class="text" align="left">' . stripslashes($row['ID_SOURCE']) . '</td>
					<td class="text" align="left">' . stripslashes(getService($row['CODE_MAGASIN'])) . '</td>
	            	<td class="text" align="center">' . stripslashes(frFormat2($row['MVT_DATE'])) . '</td>
	            	<td class="text" align="center">' . stripslashes($row['MVT_TIME']) . '</td>
	            	<td class="text" align="center">' . stripslashes($row['MVT_QUANTITE']) . '</td>
	            	<td class="text" align="center">' . stripslashes($row['MVT_UNITE']) . '</td>
	       		</tr>';
        $i++;
    }
    return $returnHTML;
}