예제 #1
0
 public static function queryUserInfo($keyword, $user_id = null)
 {
     $user_records = Watchdog::getUserRecords($user_id);
     $user_queues = Analytics::getUserQueues($user_id);
     $user_data = array_merge($user_records, $user_queues);
     $values = [];
     foreach ($user_data as $data) {
         if ($keyword === 'geolocation' && isset($data['latitude'])) {
             $values[] = $data['latitude'] . ', ' . $data['longitude'];
         } else {
             if ($keyword === 'broadcast' && isset($data['business_id'])) {
                 try {
                     $values[] = Business::name($data['business_id']);
                 } catch (Exception $e) {
                     $values[] = 'Deleted Businesses';
                 }
             } else {
                 if (isset($data[$keyword])) {
                     $values[] = $data[$keyword];
                 }
             }
         }
     }
     $numbers = array_count_values($values);
     return $numbers;
 }
예제 #2
0
 public function getFullPath($filename = NULL)
 {
     if ($filename === NULL) {
         return $this->path;
     } else {
         return $this->path . '/' . Watchdog::safeFilename($this->prefix . $filename . $this->suffix);
     }
 }
예제 #3
0
function realpath_exists($path, $safe = true)
{
    if ($safe) {
        return Watchdog::kurogoPath($path);
    } else {
        return realpath($path) && file_exists($path);
    }
}
예제 #4
0
 /**
  * Destructor for the class
  */
 function __destruct()
 {
     if ($this->error == 0) {
         $this->watchdog->stopBacktrace(0);
     } else {
         $this->watchdog->stopBacktrace(1);
     }
     $this->media = null;
 }
예제 #5
0
 /**
  * Sends an HTML Mail
  *
  * @returns bool
  */
 function sendHtmlMail()
 {
     $this->headers .= 'MIME-Version: 1.0' . "\r\n";
     $this->headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
     if (mail($this->to, $this->subject, $this->content, $this->headers) == FALSE) {
         $this->watchdog->logError("Sending of HTML Mail failed", 101, __FILE__);
         return false;
     }
     return true;
 }
예제 #6
0
function _outputFile($_file)
{
    Kurogo::log(LOG_DEBUG, "Output file {$_file}", 'kurogo');
    if ($file = Watchdog::safePath($_file)) {
        CacheHeaders($file);
        header('Content-type: ' . mime_type($file));
        readfile($file);
        exit;
    }
    _404();
}
예제 #7
0
function buildFileList($checkFiles)
{
    $foundFiles = array();
    foreach ($checkFiles['files'] as $entry) {
        if (is_array($entry)) {
            $foundFiles = array_merge($foundFiles, buildFileList($entry));
        } else {
            if ($entry && Watchdog::safePath($entry)) {
                $foundFiles[] = $entry;
            }
        }
        if ($checkFiles['include'] == 'any' && count($foundFiles)) {
            break;
        }
    }
    return $foundFiles;
}
예제 #8
0
 protected static function sharedInstance()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
     }
     return self::$_instance;
 }
예제 #9
0
 public function getFullPath($key)
 {
     $return = $this->getCacheFolder($this->cacheGroup) . DIRECTORY_SEPARATOR . Watchdog::safeFilename($key);
     return $return;
 }
예제 #10
0
/**
 * Simulate PHP 5.3 behavior on 5.2
 */
function realpath_exists($path)
{
    return Watchdog::kurogoPath($path);
}
 public function getUserdata($keyword, $user_id = null)
 {
     return json_encode(['data' => Watchdog::queryUserInfo($keyword, $user_id)]);
 }
 /**
  * @author Aunne
  * @param $facebook_id
  * @param int $limit
  * @return JSON containing the industries view/searched by user
  */
 public function getUserIndustryInfo($facebook_id, $limit = 10)
 {
     try {
         $user_id = User::getUserIdByFbId($facebook_id);
     } catch (Exception $e) {
         $user_id = null;
     }
     if ($user_id) {
         $industry_data = Watchdog::queryUserInfo('industry', $user_id);
         unset($industry_data['Industry']);
         //remove industry index since this is useless data caused by searching without industry parameter
         arsort($industry_data);
         $industry_data = array_slice($industry_data, 0, $limit);
         return json_encode(['industries' => $industry_data]);
     } else {
         return json_encode(['error' => 'You are not registered to FeatherQ.']);
     }
 }
예제 #13
0
    }
    public function getOutput()
    {
        return $this->output;
    }
    public function getStatus()
    {
        return $this->status;
    }
    public function getLastRunTime()
    {
        return $this->lastRunTime;
    }
}
// Run
$medor = new Watchdog($data, false);
echo "Running ... ";
for ($i = 1; $i < 5; $i++) {
    $medor->addOutput("<br /><br /><strong>Starting run #" . $i . "</strong><br /><br />");
    $medor->run();
    if ($medor->getStatus() == true) {
        break;
    }
}
if ($medor->getStatus() != true) {
    echo "FAILED.";
    // Send mail
    $message = sprintf("Last failed watchdog run took %d seconds.\r\n\r\n", $medor->getLastRunTime());
    $message .= $medor->getOutput();
    // Envoi
    $status = MailerHelper::sendWatchdogMail($message);
예제 #14
0
파일: config.php 프로젝트: buecklers/search
        break;
    default:
        //Baramundi-Server
        $baramundiserver = "fwsds05";
        //Usersettings: Beta or live
        $usersettingsdir = "usersettingsbeta";
        //OM-Server
        $omserver = "fadom01";
        $omdbserver = "fadom01";
        $database = "ntadm2";
        //Domain without \\
        $domain = "FACTORYXP";
        //log level
        $loglevel = 'info';
}
// Logger
$configlogger = array('rootLogger' => array('appenders' => array('default'), 'level' => $loglevel), 'appenders' => array('default' => array('class' => 'LoggerAppenderDailyFile', 'layout' => array('class' => 'LoggerLayoutPattern', 'params' => array('conversionPattern' => '%date{d.m.Y H:i:s,u} - %-5level - %message%newline')), 'params' => array('datePattern' => 'Y-m-d', 'file' => dirname(__FILE__) . '/../log/search-%s.log', 'append' => true))));
Logger::configure($configlogger);
$log = Logger::getLogger('SearchLogger');
//Watchdog
$usermappingConfig = array('type' => 'file', 'property' => 'age', 'location' => 'data/usermapping.json', 'threshold' => '1440');
$sensor = Sensor::getSensor('Usermapping');
$sensor->configure($usermappingConfig);
//Hier werden die Zeitfenster eingestellt, zu denen dich die Tests nicht interessieren.
//Ein Eintrag pro Tag (1 = Montag, 7=Sonntag) oder 0 für täglich.
//Für Zeitfenster über Mitternacht müssen zwei Einträge gemacht werden.
$exc = array('0 1650 1800');
$watchdog = Watchdog::getWatchdog();
//$watchdog->addExceptions($exc);
$watchdog->addSensor($sensor);
/*  */