Author: Egor V. Derevyankin
コード例 #1
0
ファイル: wx_response.php プロジェクト: jianhua1982/wlight
 /**
  * to increase the count for different keywords
  * @param string $keyword - keyword of different function
  */
 protected function statistics($keyword)
 {
     if ($keyword == null) {
         return;
     }
     $statistics = new Statistics();
     $statistics->add($keyword);
 }
コード例 #2
0
 public function process($parameters)
 {
     $statistics = new Statistics();
     $this->head['title'] = 'Štatistiky webu';
     $this->data['usersByArticles'] = $statistics->returnUsersByArticles();
     $this->data['usersByComments'] = $statistics->returnUsersByComments();
     $this->data['articlesByVisits'] = $statistics->returnArticlesByVisits();
     $this->view = 'statistics';
 }
コード例 #3
0
 public function process($parameters)
 {
     $statistics = new Statistics();
     $validation = new Validation();
     $this->head['title'] = 'Štatistiky webu';
     $this->data['articlesByVisits'] = array();
     $articles = $statistics->returnArticlesByVisits();
     //skratenie titulkov jednotlivych clankov na 35 znakov
     foreach ($articles as $article) {
         $article['title'] = $validation->stringLimitLenght($article['title'], 35);
         $this->data['articlesByVisits'][] = $article;
     }
     $this->view = 'statistics';
 }
コード例 #4
0
ファイル: Category.class.php プロジェクト: rollmax/read2read
 public function postInsert($event)
 {
     $oStatistics = new Statistics();
     $oStatistics->setCategoryId($this->getId());
     try {
         $iPeriod = Period::getCurrentPeriod();
     } catch (sfException $e) {
         return;
     }
     if (false !== $iPeriod) {
         $oStatistics->setPeriodId($iPeriod);
         $oStatistics->save();
     }
 }
コード例 #5
0
 public function extractPage($pageID, $pageTitle, $pageSource)
 {
     $this->extractor->setPageURI($pageID);
     if (!$this->extractor->isActive()) {
         return $result = new ExtractionResult($pageID, $this->extractor->getLanguage(), $this->getExtractorID());
     }
     Timer::start($this->extractor->getExtractorID());
     $result = $this->extractor->extractPage($pageID, $pageTitle, $pageSource);
     Timer::stop($this->extractor->getExtractorID());
     Timer::start('validation');
     //$this->extractor->check();
     if (Options::getOption('validateExtractors')) {
         ValidateExtractionResult::validate($result, $this->extractor);
     }
     Timer::stop('validation');
     Statistics::increaseCount($this->extractor->getExtractorID(), 'created_Triples', count($result->getTriples()));
     Statistics::increaseCount('Total', 'created_Triples', count($result->getTriples()));
     if ($this->extractor->isGenerateOWLAxiomAnnotations()) {
         $triples = $result->getTriples();
         if (count($triples) > 0) {
             foreach ($triples as $triple) {
                 $triple->addDCModifiedAnnotation();
                 $triple->addExtractedByAnnotation($this->extractor->getExtractorID());
             }
         }
     }
     return $result;
 }
コード例 #6
0
ファイル: Statistics.php プロジェクト: ryanaverill/phpwatch
 public static function get($series)
 {
     $total = $GLOBALS['PW_DB']->executeRaw(Statistics::getSQL($series));
     $week = $GLOBALS['PW_DB']->executeRaw(Statistics::getSQL($series, ' AND `key`>' . (time() - 7 * 60 * 60 * 24)));
     $day = $GLOBALS['PW_DB']->executeRaw(Statistics::getSQL($series, ' AND `key`>' . (time() - 60 * 60 * 24)));
     return array($total[0], $week[0], $day[0]);
 }
コード例 #7
0
 public static function getInstance()
 {
     if (!isset(self::$instace)) {
         self::$instace = new Statistics();
     }
     return self::$instace;
 }
コード例 #8
0
ファイル: Distribution.php プロジェクト: dantleech/phpbench
 public function __construct(array $samples, array $stats = [])
 {
     if (count($samples) < 1) {
         throw new \LogicException('Cannot create a distribution with zero samples.');
     }
     $this->samples = $samples;
     $this->closures = ['min' => function () {
         return min($this->samples);
     }, 'max' => function () {
         return max($this->samples);
     }, 'sum' => function () {
         return array_sum($this->samples);
     }, 'stdev' => function () {
         return Statistics::stdev($this->samples);
     }, 'mean' => function () {
         return Statistics::mean($this->samples);
     }, 'mode' => function () {
         return Statistics::kdeMode($this->samples);
     }, 'variance' => function () {
         return Statistics::variance($this->samples);
     }, 'rstdev' => function () {
         $mean = $this->getMean();
         return $mean ? $this->getStdev() / $mean * 100 : 0;
     }];
     if ($diff = array_diff(array_keys($stats), array_keys($this->closures))) {
         throw new \RuntimeException(sprintf('Unknown pre-computed stat(s) encountered: "%s"', implode('", "', $diff)));
     }
     $this->stats = $stats;
 }
コード例 #9
0
ファイル: statistics.class.php プロジェクト: infi000/geek
 /**
  * 实例化对像
  * 
  * @return class
  */
 public static function factory()
 {
     if (!isset(self::$_class)) {
         $className = __CLASS__;
         self::$_class = new $className();
     }
     return self::$_class;
 }
コード例 #10
0
ファイル: Dashboard.class.php プロジェクト: jezekl/logger
 public function skate()
 {
     parent::isAllowedToAccess();
     parent::setLayout('defaultLayout');
     parent::setView('skate');
     $this->data['parameters'] = $this->parameters;
     $this->data['orders'] = Statistics::getOrdersOverview(1, '2015-12-02', '2015-12-15');
     parent::renderLayout();
 }
コード例 #11
0
 public function __construct()
 {
     parent::__construct();
     $curdate = date("Y-m-d");
     $term = 365;
     $mindate = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $term, date("y")));
     //echo $curdate . "<br>" . $expdate;
     $this->report_date_min = $mindate;
 }
コード例 #12
0
 /**
  * This method returns Statistics object to create the pie graph or the status list
  * @return Statistics
  */
 public function getStat()
 {
     $count = array();
     $size = array();
     $blks = array();
     $db_result = $this->db_request->select(null, ACCT_TABLE, array(STATUS), null);
     $stat = new Statistics();
     foreach ($db_result as $line) {
         $stname = $this->db_request->statusName($line[STATUS]);
         $count[$stname] = $line['SUM(' . COUNT . ')'];
         $size[$stname] = $line['SUM(' . SIZE . ')'];
         $blks[$stname] = $line['SUM(' . BLOCKS . ')'];
     }
     $stat->setSize($size);
     $stat->setBlocks($blks);
     $stat->setCount($count);
     return $stat;
 }
コード例 #13
0
 public function setSmarty()
 {
     $statistics = Statistics::getInstance();
     $month_info = $statistics->getCurrentMonthSalesInformation();
     $this->context->smarty->assign("operations", $month_info['operations']);
     $this->context->smarty->assign("month_sales", $month_info['total']);
     $this->context->smarty->assign("page_title", "Shop page");
     $this->context->smarty->display("shop.tpl");
 }
コード例 #14
0
 /**
  * Returns row by input data
  *
  * @param integer $iPeriodId
  * @param integer $iCategoryId: null
  * @return Statistics
  */
 public function getFullStatistics($iPeriodId, $iCategoryId = null)
 {
     $q = Doctrine_Query::create()->select('s.*')->from('Statistics s')->where('s.period_id=?', $iPeriodId)->limit(1);
     if (null !== $iCategoryId) {
         $q->andWhere('s.category_id=?', $iCategoryId);
     } else {
         $q->andWhere('s.category_id IS NULL');
     }
     $stat = $q->fetchOne();
     if (!is_object($stat)) {
         $stat = new Statistics();
         $stat->setPeriodId($iPeriodId);
         if (null !== $iCategoryId) {
             $stat->setCategoryId($iCategoryId);
         }
         $stat->save();
     }
     return $stat;
 }
コード例 #15
0
 /**
  * Displays the administration dashboard
  *
  * @access public
  * @return \Illuminate\Support\Facades\View
  */
 public function getDashboard()
 {
     // Get all stats for the last 1 month
     $duration = Site::config('general')->statsDisplay;
     $date = date('Y-m-d', strtotime($duration));
     $stats = Statistics::where('date', '>', $date)->orderBy('date')->get()->toArray();
     // Build the view data
     $data = array('users' => User::count(), 'pastes' => Paste::count(), 'php_version' => phpversion(), 'sn_version' => Config::get('app.version'), 'db_driver' => Config::get('database.default'), 'stats' => $stats);
     return View::make('admin/dashboard', $data);
 }
コード例 #16
0
 /**
  * This method returns Statistics object to create the pie graph or the user list
  * @return Statistics
  */
 public function getStat()
 {
     $count = array();
     $size = array();
     $blks = array();
     $db_result = $this->db_request->select(null, ACCT_TABLE, array(GROUP), null);
     $stat = new Statistics();
     foreach ($db_result as $line) {
         if ($line[GROUP] && $line['SUM(' . COUNT . ')'] && $line['SUM(' . SIZE . ')']) {
             $count[$line[GROUP]] = $line['SUM(' . COUNT . ')'];
             $size[$line[GROUP]] = $line['SUM(' . SIZE . ')'];
             $blks[$line[GROUP]] = $line['SUM(' . BLOCKS . ')'];
         }
     }
     $stat->setSize($size);
     $stat->setBlocks($blks);
     $stat->setCount($count);
     return $stat;
 }
コード例 #17
0
ファイル: Statistics.php プロジェクト: sunshy360/cubingchina
 public static function buildRankings($statistic, $page = 1, $limit = 100)
 {
     self::$limit = $limit;
     $cacheKey = 'results_statistics_data_' . serialize($statistic) . '_' . $page;
     $cache = Yii::app()->cache;
     if (($data = $cache->get($cacheKey)) === false) {
         $statistic = $statistic['class']::build($statistic, $page);
         $data = array('statistic' => $statistic, 'time' => time());
         $cache->set($cacheKey, $data, self::CACHE_EXPIRE);
     }
     return $data;
 }
コード例 #18
0
ファイル: Click.class.php プロジェクト: jezekl/logger
 public function defaultView()
 {
     parent::isAllowedToAccess();
     parent::setLayout('defaultLayout');
     parent::setView('default');
     $this->data['parameters'] = $this->parameters;
     $this->data['clicks'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/');
     $this->data['clicks2'] = Statistics::getClicksOverview(1, '1366x768', 'www.skate-praha.cz/');
     $this->data['clicks3'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/kosik/');
     $this->data['clicks4'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/pokladna/');
     $this->data['clicks5'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/rekapitulace/');
     parent::renderLayout();
 }
コード例 #19
0
 public function show($statType = null)
 {
     $this->view->title = 'Перегляд статистики';
     if ($statType == null) {
         $this->view->countByDay = $this->model->getCountByDay();
         $this->view->getCountMainPageUpdate = $this->model->getCountMainPageUpdate();
         $this->view->data = Statistics::getStatistics();
     } else {
         $this->view->countByDay = $this->model->getCountByDay();
         $this->view->getCountMainPageUpdate = $this->model->getCountMainPageUpdate();
         $this->view->data = Statistics::getStatistics($statType);
     }
     $this->view->render('statistics/show');
 }
コード例 #20
0
ファイル: BlockTop.php プロジェクト: agroknow/agreri
 /**
  * Return a freshly built block.
  *
  * By default, stats are computed for the preceding month. See how to swap
  * the default interpretation by changing which block is commented out.
  *
  * @return array
  *   A subject/content hash.
  */
 public function viewUncached()
 {
     $count = $this->getCount();
     $display = variable_get(static::VARDISPLAY, static::DEFDISPLAY);
     $separator = variable_get(static::VARSEP, static::DEFSEP);
     // Return Zeitgeist for the previous month.
     $ar_date = getdate();
     // Mktime() wraps months cleanly, no worry.
     $start = mktime(0, 0, 0, $ar_date['mon'] - 1, 1, $ar_date['year']);
     unset($ar_date);
     // Return Zeitgeist for the current month.
     $start = NULL;
     $statistics = Statistics::getStatistics(Span::MONTH, $start, 'node', $count);
     $ret = array('subject' => t('Top @count searches', array('@count' => $this->count)), 'content' => array('#theme' => 'zeitgeist_block_top', '#count' => $this->count, '#items' => $statistics->scores, '#nofollow' => static::isNoFollowEnabled(), '#display' => $display, '#separator' => $separator));
     return $ret;
 }
コード例 #21
0
ファイル: WcaCommand.php プロジェクト: sunshy360/cubingchina
 public function actionUpdate()
 {
     $competitions = Competition::model()->findAllByAttributes(array('type' => Competition::TYPE_WCA), array('condition' => 'date < unix_timestamp() AND date > unix_timestamp() - 86400 * 20', 'order' => 'date ASC'));
     $wcaDb = intval(file_get_contents(dirname(__DIR__) . '/config/wcaDb'));
     $sql = "UPDATE `user` `u`\r\n\t\t\t\tINNER JOIN `registration` `r` ON `u`.`id`=`r`.`user_id`\r\n\t\t\t\tLEFT JOIN `competition` `c` ON `r`.`competition_id`=`c`.`id`\r\n\t\t\t\tLEFT JOIN `wca_{$wcaDb}`.`Results` `rs`\r\n\t\t\t\t\tON `c`.`wca_competition_id`=`rs`.`competitionId`\r\n\t\t\t\t\tAND `rs`.`personName`=CASE WHEN `u`.`name_zh`='' THEN `u`.`name` ELSE CONCAT(`u`.`name`, ' (', `u`.`name_zh`, ')') END\r\n\t\t\t\tSET `u`.`wcaid`=`rs`.`personId`\r\n\t\t\t\tWHERE `u`.`wcaid`='' and `r`.`competition_id`=%id%";
     $db = Yii::app()->db;
     $num = [];
     foreach ($competitions as $competition) {
         $num[$competition->id] = $db->createCommand(str_replace('%id%', $competition->id, $sql))->execute();
     }
     echo 'updated wcaid: ', array_sum($num), PHP_EOL;
     Yii::import('application.statistics.*');
     Yii::app()->cache->flush();
     $data = Statistics::getData(true);
     echo 'set results_statistics_data: ', $data ? 1 : 0, PHP_EOL;
 }
コード例 #22
0
 public function init()
 {
     parent::init();
     //Log page views
     Statistics::collect();
     // If we've accessed the homepage as /home/, then we should redirect to /.
     if ($this->dataRecord && $this->dataRecord instanceof SiteTree && RootURLController::should_be_on_root($this->dataRecord) && !$this->urlParams['Action'] && !$_POST && !$_FILES && !Director::redirected_to()) {
         $getVars = $_GET;
         unset($getVars['url']);
         if ($getVars) {
             $url = "?" . http_build_query($getVars);
         } else {
             $url = "";
         }
         Director::redirect($url);
         return;
     }
     if ($this->dataRecord) {
         $this->dataRecord->extend('contentcontrollerInit', $this);
     } else {
         singleton('SiteTree')->extend('contentcontrollerInit', $this);
     }
     if (Director::redirected_to()) {
         return;
     }
     Director::set_site_mode('site');
     // Check page permissions
     if ($this->dataRecord && $this->URLSegment != 'Security' && !$this->dataRecord->can('View')) {
         Security::permissionFailure($this);
     }
     // Draft/Archive security check - only CMS users should be able to look at stage/archived content
     if ($this->URLSegment != 'Security' && (Versioned::current_archived_date() || Versioned::current_stage() && Versioned::current_stage() != 'Live')) {
         if (!Permission::check('CMS_ACCESS_CMSMain')) {
             $link = $this->Link();
             $message = _t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", "You must log in with your CMS password in order to view the draft or archived content.  <a href=\"%s\">Click here to go back to the published site.</a>");
             Security::permissionFailure($this, sprintf($message, "{$link}?stage=Live"));
             return;
         }
     }
 }
コード例 #23
0
ファイル: module.class.php プロジェクト: infi000/geek
 function view()
 {
     COMFilter::$_jump = false;
     $clientmac = $_COOKIE['CLIENTMAC'];
     if (!$clientmac) {
         $boxmac = new COMGetmac();
         // print 'getmac';
         $clientmac = 'M' . $boxmac->getmac();
         setcookie("CLIENTMAC", $clientmac);
     }
     // print $clientmac;
     $clientboxid = intval($_COOKIE['CLIENTBOXID']);
     if (!$clientboxid) {
         $clientbox = new Boxs();
         $one = $clientbox->getOne("mac=?", $clientmac);
         if ($one) {
             $clientboxid = $one->id;
             setcookie("CLIENTMAC", $clientmac);
         }
     }
     // print 'id:'.$clientboxid;
     //实例化模板
     $tp = PHP_Templates::factory();
     $LOGGEDUSER = $_COOKIE['LOGGEDUSER'];
     if ($LOGGEDUSER) {
         $tp->title = "后台";
         //设置模板文件
         $tp->setFiles('default_back');
     } else {
         $tp->title = "测试";
         //设置模板文件
         $tp->setFiles('default');
         //统计
         Statistics::hitscounter(intval($clientboxid), "login", "login");
     }
     //输出页面
     $tp->execute();
     //释放模板变量
     unset($tp, $dataFilter);
 }
コード例 #24
0
 public function addElementscheck($data, $data_1)
 {
     $data['name'] = addslashes(strip_tags(trim($data['name'], ' ')));
     unset($data['type']);
     $errors = null;
     $date = date("Y-m-d");
     $uploaddir = 'public/lab_documents/';
     $upfile = basename($_FILES['file']['name']);
     $last = end(explode(".", $upfile));
     $blacklist = array(".php", ".phtml", ".php3", ".php4");
     foreach ($blacklist as $item) {
         if (preg_match("/{$item}\$/i", $_FILES['file']['name'])) {
             $errors .= '<span class="glyphicon glyphicon-remove-circle"></span>&nbsp;Некоректний формат файлу <br />';
         }
     }
     $uploadfile = $uploaddir . $date . '.' . $last;
     $img_name = $this->excep($last);
     $data["date"] = $date;
     $data["file_img"] = $img_name;
     if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
         $img = $uploadfile;
         $data["file"] = $img;
     } else {
         $errors .= '<span class="glyphicon glyphicon-remove-circle"></span>&nbsp;При завантаженні сталась помилка<br />';
     }
     if (empty($data['name'])) {
         $errors .= '<span class="glyphicon glyphicon-remove-circle"></span>&nbsp;Усі поля повинні бути заповнені!<br />';
     }
     if ($errors != null) {
         return $errors;
     }
     if ($this->db->insert('lab_documents', $data) == 1) {
         $n_id = $this->db->lastInsertId('lab_documents');
         header('location: ' . URL . '?c=manageLabDoc&f=show');
         Statistics::documents(3, SC::getSession("id"), $data['name'], 1);
     } else {
         header('location: ' . URL . '?c=manageLabDoc&f=error');
     }
 }
コード例 #25
0
ファイル: index.php プロジェクト: Avantians/Textcube
function CT_Statistics_Default($target)
{
    $blogid = getBlogId();
    $stats = Statistics::getStatistics($blogid);
    $target .= '<ul class="CT_Statistics_Default">';
    $target .= '<li class="TotalCount"><h4>Total Counts</h4><div style="text-align:right; width:100%">';
    $target .= '<span style="font-size:200%">';
    $target .= number_format($stats['total']);
    $target .= '</span>';
    $target .= '</div></li>';
    $target .= '<li class="TodayCount"><h4>Today</h4><div style="text-align:right; width:100%">';
    $target .= '<span style="font-size:200%">';
    $target .= number_format($stats['today']);
    $target .= '</span>';
    $target .= '</div></li>';
    $target .= '<li class="YesterdayCount"><h4>Yesterday</h4><div style="text-align:right; width:100%">';
    $target .= '<span style="font-size:200%">';
    $target .= number_format($stats['yesterday']);
    $target .= '</span>';
    $target .= '</div></li>';
    $target .= '</ul>';
    return $target;
}
コード例 #26
0
 /**
  * Print the number of users that didn't login for a certain period of time
  */
 static function print_users_not_logged_in_stats()
 {
     $total_logins = array();
     $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
     $current_url_id = api_get_current_access_url_id();
     $total = self::count_users();
     if (api_is_multiple_url_enabled()) {
         $table_url = ", {$access_url_rel_user_table}";
         $where_url = " AND login_user_id=user_id AND access_url_id='" . $current_url_id . "'";
     } else {
         $table_url = '';
         $where_url = '';
     }
     $sql[get_lang('Thisday')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= NOW() {$where_url}";
     $sql[get_lang('Last7days')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= NOW() {$where_url}";
     $sql[get_lang('Last31days')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 31 DAY) >= NOW() {$where_url}";
     $sql[sprintf(get_lang('LastXMonths'), 6)] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= NOW() {$where_url}";
     $sql[get_lang('NeverConnected')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} WHERE 1=1 {$where_url}";
     foreach ($sql as $index => $query) {
         $res = Database::query($query);
         $obj = Database::fetch_object($res);
         $r = $total - $obj->number;
         $total_logins[$index] = $r < 0 ? 0 : $r;
     }
     Statistics::print_stats(get_lang('StatsUsersDidNotLoginInLastPeriods'), $total_logins, false);
 }
コード例 #27
0
ファイル: index.php プロジェクト: webhacking/Textcube
require ROOT . '/library/preprocessor.php';
$tabsClass['cover'] = true;
importlib('blogskin');
importlib("model.blog.sidebar");
importlib("model.blog.coverpage");
importlib("model.blog.entry");
importlib("model.blog.archive");
importlib("model.blog.tag");
importlib("model.blog.notice");
importlib("model.blog.comment");
importlib("model.blog.remoteresponse");
importlib("model.blog.link");
require ROOT . '/interface/common/owner/header.php';
$service['pagecache'] = false;
// For plugin setting update.
$stats = Statistics::getStatistics($blogid);
function correctCoverpageImage($subject)
{
    $pattern_with_src = '/(?:\\ssrc\\s*=\\s*["\']?)([^\\s^"^>^\']+)(?:[\\s">\'])/i';
    $pattern_with_background = '/(?:\\sbackground\\s*=\\s*["\']??)([^\\s^"^>^\']+)(?:[\\s">\'])/i';
    $pattern_with_url_func = '/(?:url\\s*\\(\\s*\'?)([^)]+)(?:\'?\\s*\\))/i';
    $return_val = preg_replace_callback($pattern_with_src, 'correctImagePath', $subject);
    $return_val = preg_replace_callback($pattern_with_background, 'correctImagePath', $return_val);
    $return_val = preg_replace_callback($pattern_with_url_func, 'correctImagePath', $return_val);
    return $return_val;
}
function correctImagePath($match)
{
    $context = Model_Context::getInstance();
    $pathArr = explode("/", $match[1]);
    if (false === $pathArr) {
コード例 #28
0
		<?php 
    include_once '../classes/manage/statistics.class.php';
    include_once '../classes/manage/countries.class.php';
    if ($con->getNumRows() > 1) {
        $urlGlobalActionPrefix = "index.php?a=posts&p=" . $pageNum;
        if ($isTrash) {
            $urlGlobalActionPrefix .= "&t=trash";
            $globalActionsMenu = '<input type="submit" name="restore" value="' . $lang['pRestore'] . '" /> - <input type="submit" name="delete" value="' . $lang['pDelete'] . '" /> - <input type="submit" name="ban" value="' . $lang['pBanIP'] . '" />';
        } else {
            $globalActionsMenu = '<input type="submit" name="delete" value="' . $lang['pDelete'] . '" /> - <input type="submit" name="ban" value="' . $lang['pBanIP'] . '" /> - <input type="submit" name="publish" value="' . $lang['pPublish'] . '" /> - <input type="submit" name="unpublish" value="' . $lang['pUnpublish'] . '" />';
        }
        echo "<form action=\"" . $urlActionPrefix . "\" method=\"post\"><fieldset>\n\t\t\t<table class=\"tablePosts\">\n\t\t\t\t<tr class=\"topInfosActions\">\n\t\t\t\t\t<td>" . $lang['globalActions'] . " : " . $globalActionsMenu . "\n\t\t\t\t\t</td>\n\t\t\t\t\t<td align=\"right\" width=\"10%\"><input type=\"checkbox\" onclick=\"checkAllFields('all');\" id=\"checkAll\" /></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<input type=\"hidden\" name=\"checkedItems\" id=\"checkedItems\" />\n\t\t\t</fieldset></form>";
    }
    foreach ($con->queryResult as $res) {
        // Get data, format it if necessary, and publish it
        $userAgent = new Statistics($res['useragent']);
        $countryName = new Countries();
        $messageValue = Message::formatMessage(secureVar($res['message'], 'html'), $censoredList);
        $messageValue = Message::formatSmilies($messageValue, "admin", $smiliesReplacement);
        $banIpLang = $lang['pBanIP'];
        $banIpAction = "banIP";
        if (!empty($bannedIPs) && in_array($res['ip'], $bannedIPs)) {
            $banIpLang = $lang['pUnbanIP'];
            $banIpAction = "unbanIP";
        }
        $publishLang = $lang['pUnpublish'];
        $publishAction = "unpublish";
        $topInfoStyle = "topInfosActions";
        if (!$res['publish']) {
            $publishLang = $lang['pPublish'];
            $publishAction = "publish";
コード例 #29
0
/**
 * Check if the current installation is up to date
 * The code is borrowed from phpBB and slighlty modified
 * @author The phpBB Group <*****@*****.**> (the code)
 * @author Patrick Cool <*****@*****.**>, Ghent University (the modifications)
 * @author Yannick Warnier <*****@*****.**> for the move to HTTP request
 * @copyright (C) 2001 The phpBB Group
 * @return string language string with some layout (color)
 */
function check_system_version()
{
    global $_configuration;
    $system_version = trim($_configuration['system_version']);
    // the chamilo version of your installation
    if (ini_get('allow_url_fopen') == 1) {
        // The number of courses
        $number_of_courses = Statistics::countCourses();
        // The number of users
        $number_of_users = Statistics::countUsers();
        $number_of_active_users = Statistics::countUsers(null, null, null, true);
        // The number of sessions
        $number_of_sessions = Statistics::countSessions();
        $data = array('url' => api_get_path(WEB_PATH), 'campus' => api_get_setting('platform.site_name'), 'contact' => api_get_setting('admin.administrator_email'), 'version' => $system_version, 'numberofcourses' => $number_of_courses, 'numberofusers' => $number_of_users, 'numberofactiveusers' => $number_of_active_users, 'numberofsessions' => $number_of_sessions, 'donotlistcampus' => api_get_setting('platform.donotlistcampus'), 'organisation' => api_get_setting('platform.institution'), 'language' => api_get_setting('language.platform_language'), 'adminname' => api_get_setting('admin.administrator_name') . ' ' . api_get_setting('admin.administrator_surname'), 'ip' => $_SERVER['REMOTE_ADDR']);
        $version = null;
        // version.php has been updated to include the version in an HTTP header
        // called "X-Chamilo-Version", so that we don't have to worry about
        // issues with the content not being returned by fread for some reason
        $res = _http_request('version.chamilo.org', 80, '/version.php', $data, 5, null, true);
        $lines = preg_split('/\\r\\n/', $res);
        foreach ($lines as $line) {
            $elements = preg_split('/:/', $line);
            // extract the X-Chamilo-Version header from the version.php response
            if (strcmp(trim($elements[0]), 'X-Chamilo-Version') === 0) {
                $version = trim($elements[1]);
            }
        }
        if (substr($res, 0, 5) != 'Error') {
            if (empty($version)) {
                $version_info = $res;
            } else {
                $version_info = $version;
            }
            if ($system_version != $version_info) {
                $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. ' . get_lang('LatestVersionIs') . ' <b>Chamilo ' . $version_info . '</b>. ' . get_lang('YourVersionIs') . ' <b>Chamilo ' . $system_version . '</b>. ' . str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')) . '</span>';
            } else {
                $output = '<br /><span style="color:green">' . get_lang('VersionUpToDate') . ': Chamilo ' . $version_info . '</span>';
            }
        } else {
            $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>';
        }
    } else {
        $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>';
    }
    return $output;
}
コード例 #30
0
 /**
  * Evaluates the continued fraction at the value x. (Specific to the
  * regularizedGammaQ function.)
  */
 private static function cfEvaluate($a, $x, $epsilon, $maxIterations)
 {
     $small = 1.0E-50;
     $hPrev = Statistics::getA($a, 0, $x);
     // use the value of small as epsilon criteria for zero checks
     if (abs($hPrev) <= $small) {
         $hPrev = $small;
     }
     $n = 1;
     $dPrev = 0.0;
     $cPrev = $hPrev;
     $hN = $hPrev;
     while ($n < $maxIterations) {
         $a1 = Statistics::getA($a, $n, $x);
         $b1 = Statistics::getB($a, $n);
         $dN = $a1 + $b1 * $dPrev;
         if (abs($dN) <= $small) {
             $dN = $small;
         }
         $cN = $a1 + $b1 / $cPrev;
         if (abs($cN) <= $small) {
             $cN = $small;
         }
         $dN = 1 / $dN;
         $deltaN = $cN * $dN;
         $hN = $hPrev * $deltaN;
         if (is_infinite($hN)) {
             throw new Exception("Continued fraction convergents diverged " . "to +/- infinity for value " . $x);
         }
         if (is_nan($hN)) {
             throw new Exception("Continued fraction convergents diverged " . "to NaN for value " . $x);
         }
         if (abs($deltaN - 1.0) < $epsilon) {
             break;
         }
         $dPrev = $dN;
         $cPrev = $cN;
         $hPrev = $hN;
         $n++;
     }
     if ($n >= $maxIterations) {
         throw new Exception("Statistics::cfEvaluate: max # iterations " . "reached:" . $maxIterations);
     }
     return $hN;
 }