Exemplo n.º 1
0
 /**
  * @param $data
  * @throws Exception
  */
 public function report($data)
 {
     $reporting = new Reporting();
     if (!is_array($data)) {
         throw new Exception('Bad Request');
     }
     $reporting->setReport($data);
     $reporting->save();
     $this->show('Generate report file: ' . $reporting->getReportName() . PHP_EOL);
 }
Exemplo n.º 2
0
 public static function displayErrorPage($type, $msg = "")
 {
     $page = new Page(PageManager::$smarty, "pages/bigMessage.tpl");
     switch ($type) {
         case "access":
             $page->assign("page", "Access denied");
             $page->assign("message", Reporting::error("You dont have access to display this page."));
             break;
         case "error":
             $page->assign("page", "An error occured.");
             $page->assign("message", Reporting::error($msg));
             break;
         case "404":
             $page->assign("page", "Page not found");
             $page->assign("message", Reporting::error("The requests page you are looking for, wasn't found in our System. Sorry :("));
             break;
         default:
             $page->assign("page", "Error Occured");
             $page->assign("message", Reporting::error("And undefined error occured. Please try to reload the page or contact the system administrator."));
             break;
     }
     if (isset($_SERVER['HTTP_REFERER'])) {
         $page->assign("referrer", $_SERVER['HTTP_REFERER']);
     }
     $page->display();
 }
Exemplo n.º 3
0
 function __construct()
 {
     $this->checkRights();
     if (Funcs::$uri[2] == '') {
         $data['list'] = Reporting::getList();
         View::plugin('list', $data);
     } elseif (Funcs::$uri[2] == 'export') {
         Reporting::export();
     }
 }
Exemplo n.º 4
0
 public function salesThisWeek()
 {
     $dayOfWeek = date('w');
     $statsData = array();
     for ($d = 1; $d < $dayOfWeek + 1; $d++) {
         $date = date("Y-m-d", strtotime($d . " day ago midnight"));
         $statsData[$d - 1] = parent::salesByDate($date);
     }
     $statsData = array_reverse($statsData);
     for ($d; $d < 8; $d++) {
         $statsData[$d] = 0;
     }
 }
Exemplo n.º 5
0
 public static function getEventData($startDate, $endDate, $piwikLabel, $eventName, $scenario)
 {
     try {
         // this token is used to authenticate your API request.
         // You can get the token on the API page inside your Piwik interface
         $piwikToken = '2f0c833e9c37cd00f7aa8df52bc02413';
         // we call the REST API
         $url = "http://54.76.107.164/piwik/index.php";
         $url .= "?module=API&method=Events.getCategory";
         $url .= "&idSite=1&period=day&date={$startDate},{$endDate}";
         $url .= "&format=JSON&filter_limit=30&expanded=1";
         $url .= "&token_auth={$piwikToken}";
         $url .= "&label[]={$piwikLabel}";
         echo $url . '<br><br>';
         $response = file_get_contents($url);
         $data = json_decode($response, true);
         foreach ($data as $date => $row) {
             // get event count
             $count = $row[0]['nb_events'];
             // check if record exist for this specific date, event name and scenario
             $model = Reporting::model()->findByAttributes(array('reportingdate' => $date, 'eventname' => $eventName, 'scenario' => $scenario));
             if ($model === null) {
                 // record doesn't exist, create a new one
                 $model = new Reporting();
                 $model->eventname = $eventName;
                 $model->scenario = $scenario;
                 $model->reportingdate = $date;
             } else {
                 // record exists - set update timestamp
                 $model->updated = new CDbExpression('NOW()');
             }
             // set the event count and save record
             $model->count = $count;
             $model->save();
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Exemplo n.º 6
0
 public function __construct($input)
 {
     if (filter_var($input, FILTER_VALIDATE_URL) || is_file($input)) {
         $this->data = file_get_contents($input);
         $this->source["source"] = $input;
         $this->source["info"] = pathinfo($input);
         $this->source["info"]["size"] = strlen($this->data);
         $this->mode = $this->data != "false" ? "read" : "write";
         if (MODE === "dev") {
             Reporting::notify($input . "|" . strlen($this->data), "info");
             Reporting::dump($this->data, "info");
         }
     }
 }
Exemplo n.º 7
0
 public function send($message)
 {
     $this->message = '<html><body>';
     $this->message .= '<div>' . $message . '</div>';
     $this->message .= "</body></html>";
     if (!empty($this->message) && $this->status == 1) {
         mail($this->to, $this->subject, $this->message, $this->headers);
         if (MODE === "dev") {
             Reporting::notify("Mail sent to {$this->to}!", "success");
         }
     } else {
         if (MODE === "dev") {
             Reporting::notify("Please add an message!", "error");
         }
     }
 }
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
include "assets/classes/PhysicalServerManager.class.php";
include "assets/classes/PhysicalServer.class.php";
include "assets/classes/TemplateManager.class.php";
include "assets/classes/Template.class.php";
$page = new Page($smarty, "modals/TemplateInstallOnServer.tpl");
if (empty($_GET['templateid'])) {
    $page->assign("t_Report", Reporting::error("No template id given."));
} else {
    if (!TemplateManager::existsById($_GET['templateid'])) {
        $page->assign("t_Report", Reporting::error("The given template id doesn't exist."));
    } else {
        $page->assign("template", new Template($_GET['templateid']));
    }
}
$sc = PhysicalServerManager::getCount();
if ($sc == 0) {
    $page->assign("t_Report", Reporting::info("There are no servers yet. Try <a href='" . Core::GetConfig("dirRoot") . "Server'>adding one</a>."));
} else {
    $page->assign("serverArrayData", PhysicalServerManager::getAllPhysicalServer());
}
$page->display();
Exemplo n.º 9
0
    $error = array();
    if (!UserManager::checkValidEmail($email)) {
        $error[] = "Ungültige E-Mail Adresse.";
    }
    if (!UserManager::checkValidPassword($pass)) {
        $error[] = "Ungültiges Passwort.";
    }
    if (count($error) == 0 && !UserManager::tryLogin($email, $pass)) {
        $error[] = "Es wurde kein Nutzer mit den angegeben Login-Daten gefunden.";
    }
    if (count($error) == 0) {
        if (isset($_POST['keepLoggedIn'])) {
            setcookie("username", $email, time() + 60 * 60 * 24 * 30 * 12 * 4);
            setcookie("password", $pass, time() + 60 * 60 * 24 * 30 * 12 * 4);
        }
        $page->assign("t_Report", Reporting::success("Sie wurden erfolgreich eingeloggt!<br />Sie werden in Kürze weitergeleitet."));
        $page->assign("t_Redirect", array("seconds" => 2, "link" => Core::GetConfig("dirRoot") . "Dashboard"));
    } else {
        $msg = "Es sind Fehler aufgetreten!<ul>";
        foreach ($error as $e) {
            $msg .= "<li>" . $e . "</li>";
        }
        $msg .= "</ul>";
        $page->assign("t_Report", Reporting::error($msg));
        $page->assign("error", 1);
    }
}
if (is_dir("install")) {
    $page->assign("t_StaticInformation", Reporting::info("<br />Standard Werte für den Admin Nutzer: <br />E-Mail: admin@admin.de<br />Passwort: admin<br />Um diese Nachricht auszublenden, lösche das Verzeichnis 'install'"));
}
$page->display();
Exemplo n.º 10
0
 /**
  * Set user criteria and display report
  */
 function view($VAR)
 {
     # validation
     if (empty($VAR['report_module']) || empty($VAR['report_template'])) {
         return false;
     }
     $module = $VAR['report_module'];
     $report = $VAR['report_template'];
     $format = $VAR['report_format'];
     # include reporting classess
     require_once PATH_MODULES . 'report/class.Report.php';
     require_once PATH_MODULES . 'report/class.Level.php';
     require_once PATH_MODULES . 'report/class.ReportParser.php';
     set_time_limit(0);
     if ($format == 'text') {
         $f = new TXT_ReportFormatter();
     } elseif ($format == 'html') {
         $f = new HTML_ReportFormatter();
     } elseif ($format == 'pdf') {
         $f = new PDF_ReportFormatter();
     }
     # Tell the formatter where to save the output
     $dir = md5(tempnam(PATH_FILES, "s"));
     $path = PATH_FILES . 'reports/' . $dir;
     @unlink($path);
     mkdir($path, 0775);
     $f->setOutputDirectory($path);
     # set report construct file to use
     $r = new Reporting($f, true);
     $p = new ReportParser($r);
     $result = $p->setInputFile(PATH_AGILE . 'reports/' . $module . '/' . $report);
     # Get user criteria
     $arr = $p->getUserCriteria();
     # Set the user criteria
     if (!empty($VAR['report']['conditions']) && is_array($VAR['report']['conditions'])) {
         foreach ($VAR['report']['conditions'] as $arr) {
             $exp = $arr['exp'];
             $col = $arr['col'];
             $val = $arr['value'];
             $type = $arr['type'];
             foreach ($col as $i => $name) {
                 if ($type[$i] == 'date_year_month') {
                     $val[$i] = array('month' => $val['month'][$i], 'year' => $val['year'][$i]);
                 }
                 $this->setSQLCondition($p, $col[$i], $exp[$i], $val[$i], $type[$i]);
             }
         }
     }
     #echo '<pre>'.print_r($p,true).'</pre>'; exit;
     $result = $p->parse();
     #echo '<pre>'.print_r($p,true).'</pre>'; exit;
     $r->display();
     if ($format == 'text') {
         header('Content-type: text/txt');
         header('Content-Disposition: inline; filename="report.txt"');
         echo file_get_contents($f->getOutput());
         @unlink($f->getOutput());
     } elseif ($format == 'html') {
         $f->getOutput();
         $url = URL . 'includes/files/reports/' . $dir . '/report.html';
         echo "<script>document.location='{$url}';</script>";
     } elseif ($format == 'pdf') {
         header('Content-type: application/pdf');
         header('Content-Disposition: inline; filename="report.pdf"');
         readfile($f->getOutput());
         @unlink($f->getOutput());
     }
 }
<?php

/* 
 * WolfPanel (c) 2015 by Fursystems.de (Marcel Kallen)
 * 
 * WolfPanel is licensed under a
 * Creative Commons Attribution-NonCommercial 4.0 International License.
 * 
 * You should have received a copy of the license along with this
 * work. If not, see <http://creativecommons.org/licenses/by-nc/4.0/>. 
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
$page = new Page($smarty, "modals/AdminGameserverControl.tpl");
$gsID = isset($_GET['gameserver']) ? $_GET['gameserver'] : null;
if (GameserverManager::existsById($gsID)) {
    $gs = new Gameserver($gsID);
    $page->assign("gs", $gs);
    $page->assign("controllable", $gs->isControlable());
    if (!$gs->isControlable()) {
        $page->assign("t_Report", Reporting::error("This Gameserver is not availabe for control at the moment."));
    }
} else {
    $page->assign("t_Report", Reporting::error("This Gameserver isnt available."));
}
$page->display();
Exemplo n.º 12
0
# these three files make up the reporting system
include 'class.Report.php';
include 'class.Level.php';
include 'class.ReportParser.php';
/* Good idea, reports can be a beast */
set_time_limit(0);
/* Uncomment one of the output formater lines below */
#$f = new TXT_ReportFormatter;
$f = new HTML_ReportFormatter();
#$f = new PDF_ReportFormatter;
# Tell the formatter where to save the output
$dir = tempnam(PATH_FILES, "s");
@unlink($dir);
mkdir($dir, 0775);
$f->setOutputDirectory($dir);
# This creates the report class, specifying the ReportFormatter to use and whether or not to paginate the title
$r = new Reporting($f, true);
# This creates the report XML parser, specify the report class object to use in building the report
$p = new ReportParser($r);
# This sets the XML report definition file
#$result = $p->setInputFile(PATH_MODULES.'report/year_month_sales_by_sku.xml');
$result = $p->setInputFile(PATH_AGILE . 'reports/invoice/sales_report.xml');
# set criteria
$p->setUserCriteria('yearmonth', '>=', mktime(0, 0, 0, 1, 1, 2005));
# Parse that puppy!
$result = $p->parse();
/* COULD INSERT CODE TO DO SMARTY JUNK HERE - then skip the display call */
/* COULD ALSO call back into $p to assign some SQL statement criteria changes from the UI/Smarty's POST/GET */
# Render my report, now!
$r->display();
echo $f->getOutput();
Exemplo n.º 13
0
<?php

/* 
 * WolfPanel (c) 2015 by Fursystems.de (Marcel Kallen)
 * 
 * WolfPanel is licensed under a
 * Creative Commons Attribution-NonCommercial 4.0 International License.
 * 
 * You should have received a copy of the license along with this
 * work. If not, see <http://creativecommons.org/licenses/by-nc/4.0/>. 
 */
include "assets/core.php";
$smarty->assign("page", "Logout");
$smarty->assign("t_CSS", "login.css");
$page = new Page($smarty, "pages/bigMessage.tpl");
$page->assign("message", Reporting::success("Sie wurden erfolgreich ausgeloggt. <br />Sie werden nun weitergeleitet."));
$page->assign("t_Redirect", array("seconds" => 2, "link" => Core::GetConfig("dirRoot") . "Login"));
session_destroy();
setcookie("username", "", time() - 3600);
setcookie("password", "", time() - 3600);
$page->display();
 * WolfPanel (c) 2015 by Fursystems.de (Marcel Kallen)
 * 
 * WolfPanel is licensed under a
 * Creative Commons Attribution-NonCommercial 4.0 International License.
 * 
 * You should have received a copy of the license along with this
 * work. If not, see <http://creativecommons.org/licenses/by-nc/4.0/>. 
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
if (isset($_GET["userid"])) {
    if (UserManager::existsById($_GET['userid'])) {
        $gs = GameserverManager::getAllByUserID($_GET['userid']);
        if ($gs !== false) {
            $smarty->assign("Gameservers", $gs);
        }
    } else {
        $smarty->assign("t_Report", Reporting::error("The given user doesnt exist."));
    }
} else {
    $gs = GameserverManager::getAll();
    if ($gs !== false) {
        $smarty->assign("Gameservers", $gs);
    }
}
$smarty->display("ajax/getAdminGameserverList.tpl");
Exemplo n.º 15
0
/* ============================
  CONSTANTS
  ============================== */
define("ROOT", getcwd() . "/");
define("CFG", ROOT . "config/");
define("MODE", "dev");
// dev | prod
/* ============================
  LOCALE SETTINGS
  ============================== */
date_default_timezone_set('Europe/Brussels');
setlocale(LC_ALL, 'nl_NL');
/* ============================
  PHP SETTINGS
  ============================== */
set_time_limit(0);
error_reporting(E_ALL);
ini_set("display_errors", true);
/* ============================
  INCLUDES
  ============================== */
include 'includes/Strings.php';
include 'includes/Reporting.php';
include 'includes/data/database.php';
include 'includes/data/base.php';
include 'includes/data/json.php';
include 'includes/Mail.php';
include 'music/bootstrap.php';
Reporting::notify("Init succesful", "success");
Exemplo n.º 16
0
<?php

//date_default_timezone_set('Asia/Jerusalem');
$_googUrl = $_POST['url'];
//$_googUrl  = 'http://www.google.com/search?q=blah';
if (!$_googUrl) {
    die("error in request");
}
include_once 'Reporting.php';
Reporting::LogIncommingRequest($_googUrl);
include_once 'Position.php';
include_once 'RequestManager.php';
include_once 'GoogleProxyMongo.php';
$_cacheLookup = GoogleProxyMongo::findUrl($_googUrl);
if ($_cacheLookup) {
    Reporting::LogCacheHit($_googUrl);
    exit($_cacheLookup);
} else {
    $_req = new ReqestsManager();
    $_pos = new Position();
    //$_req->getPositionInLine($_pos);
    zzzWhileObjectFunctionFalse($_req, 'getPositionInLine', $_pos);
    zzzWhileObjectFunctionFalse($_req, "okToSendRequest", $_pos);
    $_googleResponse = file_get_contents($_googUrl, 0, null, null);
    GoogleProxyMongo::storeUrl($_googUrl, $_googleResponse);
    exit($_googleResponse);
}
Exemplo n.º 17
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
$userid = isset($_GET['userid']) ? $_GET['userid'] : null;
if ($userid != null) {
    if (UserManager::existsById($userid)) {
        $user = new User($userid);
        $page = new Page($smarty, "modals/CustomerRemove.tpl");
        if ($user->getData("gameServerCount") == 0) {
            $page->assign("u", $user);
        } else {
            $page->assign("t_Report", Reporting::Error("This customer cannot be deleted because still has gameservers. They have to be deleted manually."));
        }
        $page->display();
    } else {
        $p = new Page($smarty, "modals/DefaultError.tpl");
        $p->display();
    }
} else {
    $p = new Page($smarty, "modals/DefaultError.tpl");
    $p->display();
}
Exemplo n.º 18
0
<?php

/* ============================
  CONSTANTS
  ============================== */
/* ============================
  INCLUDES
  ============================== */
include 'notes.php';
include 'chord.php';
include 'scale.php';
include 'harmony.php';
Reporting::notify("Music package init succesful", "success");
Exemplo n.º 19
0
<?php

$_reqUrl = $_POST['url'];
//$_reqUrl  = 'http://gis.eyezeek.atlasct.com/gis/geocoder?q=;city|תaaaל אביב;neighborhood|לב העיר;street|לונץ;&lang=heb&countrycode=isr&key=Gu5rdksS86zC39Sa&output=KML&api=3.0&projection=latlong&ie=utf-8';
if (!$_reqUrl) {
    die("error in request");
}
include_once 'Reporting.php';
Reporting::LogIncommingRequest($_reqUrl);
function cleanUrlAddress($gq)
{
    $params = array();
    parse_str($gq, $params);
    return http_build_query($params);
}
$_fixedUrlFragments = array(parse_url($_reqUrl, PHP_URL_SCHEME), '://', parse_url($_reqUrl, PHP_URL_HOST), parse_url($_reqUrl, PHP_URL_PATH), '?', str_replace('%5C%5C%5C%5C%5C%5C%5C', '', cleanUrlAddress(parse_url($_reqUrl, PHP_URL_QUERY))));
$_reqUrl = implode('', $_fixedUrlFragments);
include_once 'GoogleProxyMongo.php';
$_cacheLookup = GoogleProxyMongo::findUrl($_reqUrl);
if ($_cacheLookup) {
    Reporting::LogCacheHit($_reqUrl);
    die($_cacheLookup);
} else {
    $_googleResponse = file_get_contents($_reqUrl, 0, null, null);
    GoogleProxyMongo::storeUrl($_reqUrl, $_googleResponse);
    die($_googleResponse);
}
Exemplo n.º 20
0
$smarty->assign("pageActive", "userservercontrol");
$lU = UserManager::GetLocalUser();
if ($lU->getSelectedGameserver() != null) {
    $gs = $lU->getSelectedGameserver();
    $page = new Page($smarty, "pages/userServerControl.tpl");
    if (isset($_GET['do']) || isset($_POST['do'])) {
        $do = isset($_GET['do']) ? $_GET['do'] : $_POST['do'];
    } else {
        $do = "nothing";
    }
    // Controllable
    $page->assign("controllable", $gs->isControlable());
    if (!$gs->isControlable()) {
        $page->assign("t_Report", Reporting::error("This Gameserver is not availabe for control at the moment."));
    } else {
        if ("Start" == $do) {
            $page->assign("t_Report", Reporting::success("The gameserver will be started soon."));
            $gs->scheduleStart();
        } else {
            if ("Stop" == $do) {
                $page->assign("t_Report", Reporting::success("The gameserver will be stopped soon."));
                $gs->scheduleStop();
            }
        }
    }
    $page->display();
} else {
    $page = new Page($smarty, "pages/bigmessage.tpl");
    $page->assign("t_Report", Reporting::Error("You havent selected any gameserver yet."));
    $page->display();
}
Exemplo n.º 21
0
                            $errors[] = "Es wurde keine Server-ID angegeben.";
                        } else {
                            if (!is_numeric($sid)) {
                                $errors[] = "Es wurde eine ungültige Server-ID angegeben.";
                            } else {
                                if (!PhysicalServerManager::existsById($sid)) {
                                    $errors[] = "Die angegebene Server-ID existiert nicht.";
                                }
                            }
                        }
                        if (count($errors) == 0) {
                            $server = new PhysicalServer($sid);
                            $page->assign("t_Report", Reporting::success("Der Server \"" . $server->getData("name") . "\" wird demnächst aktualisiert. (Task geplant)"));
                            $server->addTask(TASK_SERVER_UPDATE);
                            //header("Location: " . Core::GetConfig("dirRoot") . "Server");
                        } else {
                            $page->assign("t_Report", Reporting::error(Utils::buildErrorString($errors)));
                        }
                    }
                }
            }
        }
    }
}
$sc = PhysicalServerManager::getCount();
$smarty->assign("servercount", $sc);
$smarty->assign("physicalServerStates", $physicalServerStates);
if ($sc != 0) {
    $smarty->assign("serverArrayData", PhysicalServerManager::getAllPhysicalServer());
}
$page->display();
Exemplo n.º 22
0
<?php

include "bootstrap.php";
$harmony = new Harmony("C", "minor");
foreach ($harmony->chords as $chord) {
    Reporting::notify($chord->name);
    Reporting::dump($chord->notes);
}