예제 #1
1
 public function sessions($sessions)
 {
     $this->title($this('sessions'));
     $active_sessions = $this->load->library('table')->add_columns(array(array('content' => function ($data) {
         return $data['remember_me'] ? '<i class="fa fa-toggle-on text-green" data-toggle="tooltip" title="' . i18n('persistent_connection') . '"></i>' : '<i class="fa fa-toggle-off text-grey" data-toggle="tooltip" title="' . i18n('nonpersistent_connection') . '"></i>';
     }, 'size' => TRUE, 'align' => 'center'), array('content' => function ($data) {
         return user_agent($data['user_agent']);
     }, 'size' => TRUE, 'align' => 'center'), array('title' => $this('ip_address'), 'content' => function ($data) {
         return geolocalisation($data['ip_address']) . '<span data-toggle="tooltip" data-original-title="' . $data['host_name'] . '">' . $data['ip_address'] . '</span>';
     }), array('title' => $this('reference'), 'content' => function ($data, $loader) {
         return $data['referer'] ? urltolink($data['referer']) : $loader->lang('unknown');
     }), array('title' => $this('initial_session_date'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['date']) . '">' . time_span($data['date']) . '</span>';
     }), array('title' => $this('last_activity'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['last_activity']) . '">' . time_span($data['last_activity']) . '</span>';
     }), array('content' => array(function ($data) {
         if ($data['session_id'] != NeoFrag::loader()->session('session_id')) {
             return button_delete('user/sessions/delete/' . $data['session_id'] . '.html');
         }
     }))))->pagination(FALSE)->data($this->user->get_sessions())->save();
     $sessions_history = $this->table->add_columns(array(array('content' => function ($data) {
         return user_agent($data['user_agent']);
     }, 'size' => TRUE, 'align' => 'center'), array('title' => $this('ip_address'), 'content' => function ($data) {
         return geolocalisation($data['ip_address']) . '<span data-toggle="tooltip" data-original-title="' . $data['host_name'] . '">' . $data['ip_address'] . '</span>';
     }), array('title' => $this('reference'), 'content' => function ($data, $loader) {
         return $data['referer'] ? urltolink($data['referer']) : $loader->lang('unknown');
     }), array('title' => $this('initial_session_date'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['date']) . '">' . time_span($data['date']) . '</span>';
     })))->data($sessions)->no_data($this('no_historic_available'));
     return array(new Panel(array('title' => $this('my_active_sessions'), 'icon' => 'fa-shield', 'content' => $active_sessions->display())), new Panel(array('title' => $this('sessions_historic'), 'icon' => 'fa-power-off', 'content' => $sessions_history->display())), new Button_back('user.html'));
 }
예제 #2
0
 public function index()
 {
     $users = $this->title($this('dashboard'))->js('jquery.knob')->js_load('$(\'.knob\').knob();')->load->library('table')->add_columns(array(array('content' => function ($data) {
         return '<a href="mailto:' . $data['email'] . '" data-toggle="tooltip" title="' . $data['email'] . '">' . icon('fa-envelope') . '</a>';
     }), array('content' => function ($data) {
         return NeoFrag::loader()->user->link($data['user_id'], $data['username']);
     }), array('content' => function ($data, $loader) {
         return '<span data-toggle="tooltip" title="' . timetostr($loader->lang('date_time_long'), $data['registration_date']) . '">' . time_span($data['registration_date']) . '</span>';
     }, 'class' => 'text-right')))->data($this->db->from('nf_users')->where('deleted', FALSE)->order_by('user_id DESC')->limit(5)->get())->display();
     return array(new Row(new Col(new Panel_box(array('label' => $this('news', $count = $this->db->select('COUNT(*)')->from('nf_news')->where('published', TRUE)->row()), 'icon' => 'fa-newspaper-o', 'color' => 'bg-aqua', 'count' => $count, 'url' => 'admin/news.html', 'footer' => $this('manage_news') . ' ' . icon('fa-arrow-circle-right'), 'size' => 'col-md-4 col-lg-2'))), new Col(new Panel_box(array('label' => $this('members', $count = $this->db->select('COUNT(*)')->from('nf_users')->where('deleted', FALSE)->row()), 'icon' => 'fa-users', 'color' => 'bg-green', 'count' => $count, 'url' => 'admin/members.html', 'footer' => $this('manage_members') . ' ' . icon('fa-arrow-circle-right'), 'size' => 'col-md-4 col-lg-2'))), new Col(new Panel_box(array('label' => $this('events', $count = 0, $count), 'icon' => 'fa-calendar', 'color' => 'bg-blue', 'count' => $count, 'url' => 'admin/events.html', 'footer' => $this('manage_events') . ' ' . icon('fa-arrow-circle-right'), 'size' => 'col-md-4 col-lg-2'))), new Col(new Panel_box(array('label' => $this('teams', $count = $this->db->select('COUNT(*)')->from('nf_teams')->row(), $count), 'icon' => 'fa-gamepad', 'color' => 'bg-red', 'count' => $count, 'url' => 'admin/teams.html', 'footer' => $this('manage_teams') . ' ' . icon('fa-arrow-circle-right'), 'size' => 'col-md-4 col-lg-2'))), new Col(new Panel_box(array('label' => $this('messages', $count = $this->db->select('COUNT(*)')->from('nf_forum_messages')->row()), 'icon' => 'fa-comments', 'color' => 'bg-teal', 'count' => $count, 'url' => 'admin/forum.html', 'footer' => $this('manage_forum') . ' ' . icon('fa-arrow-circle-right'), 'size' => 'col-md-4 col-lg-2'))), new Col(new Panel_box(array('label' => $this('comments', $count = $this->db->select('COUNT(*)')->from('nf_comments')->row()), 'icon' => 'fa-comments-o', 'color' => 'bg-maroon', 'count' => $count, 'url' => 'admin/comments.html', 'footer' => $this('manage_comments') . ' ' . icon('fa-arrow-circle-right'), 'size' => 'col-md-4 col-lg-2')))), new Row(new Col(new Widget_view(array('widget_id' => 1)), new Panel(array('title' => '<a href="//www.neofrag.com">' . $this('nf_news') . '</a>', 'icon' => 'fa-newspaper-o', 'content' => $this->load->view('nf_news'), 'size' => 'col-md-8'))), new Col(new Panel(array('title' => $this('connected_users'), 'icon' => 'fa-globe', 'content' => $this->load->view('users_online', array('currently' => $this->db->select('COUNT(*)')->from('nf_sessions')->where('last_activity > DATE_SUB(NOW(), INTERVAL 5 MINUTE)')->where('is_crawler', FALSE)->row(), 'max' => statistics('nf_sessions_max_simultaneous'))), 'footer' => '<a href="' . url('admin/members/sessions.html') . '">' . $this('view_all_sessions') . '</a>', 'size' => 'col-md-4')), new Panel(array('title' => $this('last_registrations'), 'icon' => 'fa-users', 'content' => $users, 'size' => 'col-md-4')))));
 }
예제 #3
0
 public function index($news)
 {
     $this->title($this('news'))->load->library('table');
     $news = $this->table->add_columns(array(array('content' => function ($data, $loader) {
         return $data['published'] ? '<i class="fa fa-circle" data-toggle="tooltip" title="' . $loader->lang('published') . '" style="color: #7bbb17;"></i>' : '<i class="fa fa-circle-o" data-toggle="tooltip" title="' . $loader->lang('awaiting_publication') . '" style="color: #535353;"></i>';
     }, 'sort' => function ($data) {
         return $data['published'];
     }, 'size' => TRUE), array('title' => $this('title'), 'content' => function ($data) {
         return '<a href="' . url('news/' . $data['news_id'] . '/' . url_title($data['title']) . '.html') . '">' . $data['title'] . '</a>';
     }, 'sort' => function ($data) {
         return $data['title'];
     }, 'search' => function ($data) {
         return $data['title'];
     }), array('title' => $this('category'), 'content' => function ($data) {
         return '<a href="' . url('admin/news/categories/' . $data['category_id'] . '/' . $data['category_name'] . '.html') . '"><img src="' . path($data['category_icon']) . '" alt="" /> ' . $data['category_title'] . '</a>';
     }, 'sort' => function ($data) {
         return $data['category_title'];
     }, 'search' => function ($data) {
         return $data['category_title'];
     }), array('title' => $this('author'), 'content' => function ($data) {
         return NeoFrag::loader()->user->link($data['user_id'], $data['username']);
     }, 'sort' => function ($data) {
         return $data['username'];
     }, 'search' => function ($data) {
         return $data['username'];
     }), array('title' => $this('date'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['date']) . '">' . time_span($data['date']) . '</span>';
     }, 'sort' => function ($data) {
         return $data['date'];
     }), array('title' => '<i class="fa fa-comments-o" data-toggle="tooltip" title="' . i18n('comments') . '"></i>', 'content' => function ($data) {
         return NeoFrag::loader()->library('comments')->admin_comments('news', $data['news_id']);
     }, 'size' => TRUE), array('content' => array(function ($data) {
         return button_edit('admin/news/' . $data['news_id'] . '/' . url_title($data['title']) . '.html');
     }, function ($data) {
         return button_delete('admin/news/delete/' . $data['news_id'] . '/' . url_title($data['title']) . '.html');
     }), 'size' => TRUE)))->sort_by(5, SORT_DESC, SORT_NUMERIC)->data($news)->no_data($this('no_news'))->display();
     $categories = $this->table->add_columns(array(array('content' => function ($data) {
         return '<a href="' . url('admin/news/categories/' . $data['category_id'] . '/' . $data['name'] . '.html') . '"><img src="' . path($data['icon_id']) . '" alt="" /> ' . $data['title'] . '</a>';
     }, 'search' => function ($data) {
         return $data['title'];
     }, 'sort' => function ($data) {
         return $data['title'];
     }), array('content' => array(function ($data) {
         return button_edit('admin/news/categories/' . $data['category_id'] . '/' . $data['name'] . '.html');
     }, function ($data) {
         return button_delete('admin/news/categories/delete/' . $data['category_id'] . '/' . $data['name'] . '.html');
     }), 'size' => TRUE)))->pagination(FALSE)->data($this->model('categories')->get_categories())->no_data($this('no_category'))->display();
     return new Row(new Col(new Panel(array('title' => $this('categories'), 'icon' => 'fa-align-left', 'content' => $categories, 'footer' => button_add('admin/news/categories/add.html', $this('create_category')), 'size' => 'col-md-12 col-lg-3'))), new Col(new Panel(array('title' => $this('list_news'), 'icon' => 'fa-file-text-o', 'content' => $news, 'footer' => button_add('admin/news/add.html', $this('add_news')), 'size' => 'col-md-12 col-lg-9'))));
 }
예제 #4
0
 public function __destruct()
 {
     $this->log('Temps écoulé depuis la requète HTTP : ' . round((microtime(TRUE) - $_SERVER['REQUEST_TIME']) * 1000, 3) . ' ms', self::INFO);
     $this->log('Temps total d\'exécution : ' . round((microtime(TRUE) - NEOFRAG_TIME) * 1000, 3) . ' ms', self::INFO);
     $this->log('Espace mémoire alloué par NeoFrag : ' . round((memory_get_peak_usage(TRUE) - NEOFRAG_MEMORY) / 1024 / 1024, 3) . ' Mo', self::INFO);
     $this->log('Espace mémoire alloué par PHP : ' . round(memory_get_peak_usage(TRUE) / 1024 / 1024, 3) . ' Mo', self::INFO);
     if (!is_asset() && file_exists(NEOFRAG_CMS . '/logs/')) {
         $f = fopen(NEOFRAG_CMS . '/logs/log.php', 'a');
         foreach ($this->_log as $log) {
             fwrite($f, timetostr('%Y-%m-%d %H:%M:%S') . ' : ' . $log[0] . "\n");
         }
         fwrite($f, str_repeat('=', 150) . "\n");
         fclose($f);
     }
 }
예제 #5
0
$rules = array('username' => array('label' => '{lang username}', 'value' => $username, 'rules' => 'required', 'check' => function ($value) use($username) {
    if ($value != $username && NeoFrag::loader()->db->select('1')->from('nf_users')->where('username', $value)->row()) {
        return i18n('username_unavailable');
    }
}), 'email' => array('label' => '{lang email}', 'value' => $email, 'type' => 'email', 'rules' => 'required', 'check' => function ($value) use($email) {
    if ($value != $email && NeoFrag::loader()->db->select('1')->from('nf_users')->where('email', $value)->row()) {
        return i18n('email_unavailable');
    }
}), 'first_name' => array('label' => '{lang first_name}', 'value' => $first_name), 'last_name' => array('label' => '{lang last_name}', 'value' => $last_name), 'avatar' => array('label' => '{lang avatar}', 'value' => $avatar, 'upload' => 'members', 'type' => 'file', 'info' => i18n('file_icon', 250, file_upload_max_size() / 1024 / 1024), 'check' => function ($filename, $ext) {
    if (!in_array($ext, array('gif', 'jpeg', 'jpg', 'png'))) {
        return i18n('select_image_file');
    }
    list($w, $h) = getimagesize($filename);
    if ($w != $h) {
        return i18n('avatar_must_be_square');
    } else {
        if ($w < 250) {
            return i18n('avatar_size_error', 250);
        }
    }
}, 'post_upload' => function ($filename) {
    image_resize($filename, 250, 250);
}), 'date_of_birth' => array('label' => '{lang birth_date}', 'value' => $date_of_birth && $date_of_birth != '0000-00-00' ? timetostr(NeoFrag::loader()->lang('date_short'), strtotime($date_of_birth)) : '', 'type' => 'date', 'check' => function ($value) {
    if ($value && strtotime($value) > strtotime(date('Y-m-d'))) {
        return i18n('invalid_birth_date');
    }
}), 'sex' => array('label' => '{lang gender}', 'value' => $sex, 'values' => array('female' => icon('fa-female') . ' {lang female}', 'male' => icon('fa-male') . ' {lang male}'), 'type' => 'radio'), 'location' => array('label' => '{lang location}', 'value' => $location), 'website' => array('label' => '{lang website}', 'value' => $website, 'type' => 'url'), 'quote' => array('label' => '{lang quote}', 'value' => $quote), 'signature' => array('label' => '{lang signature}', 'value' => $signature, 'type' => 'editor'));
/*
NeoFrag Alpha 0.1.2
./neofrag/modules/members/forms/members.php
*/
예제 #6
0
    ?>
	<div class="pull-left">
		<a class="thumbnail" href="<?php 
    echo url('news/' . $data['news_id'] . '/' . url_title($data['title']) . '.html');
    ?>
"><img class="img-responsive" src="<?php 
    echo path($data['image']);
    ?>
" alt="" /></a>
	</div>
<?php 
}
?>
<p class="news-detail">
	<span><?php 
echo icon('fa-clock-o') . ' ' . timetostr('%e %b %Y', $data['date']);
?>
</span>
	<span><?php 
echo icon('fa-user') . ' ' . $NeoFrag->user->link($data['user_id'], $data['username']);
?>
</span>
	<!--<span><?php 
echo icon('fa-eye') . ' ' . $data['views'];
?>
</span>-->
	<span><a href="<?php 
echo url('news/' . $data['news_id'] . '/' . url_title($data['title']) . '.html#comments');
?>
"><?php 
echo icon('fa-comments-o') . ' ' . $NeoFrag->library('comments')->count_comments('news', $data['news_id']);
							<a href="https://plus.google.com/share?url=<?php 
    echo $_SERVER['HTTP_HOST'] . $this->config->base_url;
    ?>
news/<?php 
    echo $news['news_id'];
    ?>
/<?php 
    echo url_title($news['title']);
    ?>
.html" target="_blank"><i class="fa fa-google-plus"></i></a>
						</div>
					</div>
				</div>
				<ul class="list-inline">
					<li><i class="fa fa-calendar"></i> Date :&nbsp;&nbsp;<span class="date"><?php 
    echo timetostr('%e %b %Y', $news['date']);
    ?>
</span></li>
					<li><i class="fa fa-user"></i> Par :&nbsp;&nbsp;<?php 
    echo $NeoFrag->user->link($news['user_id'], $news['username']);
    ?>
</li>
				</ul>
			</div>
		</div>
	</div>
	<?php 
    if ($news['image']) {
        ?>
	<a class="effect-link" href="<?php 
        echo url('news/' . $news['news_id'] . '/' . url_title($news['title']) . '.html');
예제 #8
0
<?php

include_once 'connection.php';
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
//Extract the content of image
$imageProperties = getimageSize($_FILES['image']['tmp_name']);
//Extract the mime type (filetype)
session_start();
if (!empty($_SESSION['userID'])) {
    if ($_SESSION['role'] == 'local') {
        $sql = "INSERT INTO events (event_name_0, event_description, event_date, filetype, image)\n\t\t\tVALUES (:eventName, :eventDescription, :eventDate, '" . $imageProperties['mime'] . "', '" . $image . "')";
        try {
            $st = $conn->prepare($sql);
            $st->bindValue(":eventName", $_POST['event-name'], PDO::PARAM_STR);
            $st->bindValue(":eventDescription", $_POST['event-description'], PDO::PARAM_STR);
            $st->bindValue(":eventDate", timetostr($_POST["event-date"]), PDO::PARAM_STR);
            $st->execute();
        } catch (PDOException $e) {
            echo "Server Error - Try again!" . $e->getMessage();
        }
    } else {
        echo "You don't have the rights to create an event!";
    }
} else {
    echo "You shall not pass!";
}
$conn = null;
예제 #9
0
 public function _sessions($sessions)
 {
     $this->title($this('sessions'))->subtitle($this('list_active_sessions'))->icon('fa-globe')->load->library('table')->preprocessing(function ($row) {
         $user_data = unserialize($row['user_data']);
         $row['date'] = $user_data['session']['date'];
         $row['history'] = array_reverse($user_data['session']['history']);
         $row['user_agent'] = $user_data['session']['user_agent'];
         $row['referer'] = $user_data['session']['referer'];
         unset($row['user_data']);
         return $row;
     })->add_columns(array(array('content' => function ($data) {
         return $data['remember_me'] ? '<i class="fa fa-toggle-on text-green" data-toggle="tooltip" title="Connexion persistante"></i>' : '<i class="fa fa-toggle-off text-grey" data-toggle="tooltip" title="Connexion non persistante"></i>';
     }, 'size' => TRUE, 'align' => 'center'), array('title' => $this('user'), 'content' => function ($data, $loader) {
         return $data['user_id'] ? NeoFrag::loader()->user->link($data['user_id'], $data['username']) : '<i>' . $loader->lang('guest') . '</i>';
     }, 'search' => function ($data, $loader) {
         return $data['user_id'] ? $data['username'] : $loader->lang('guest');
     }, 'sort' => function ($data, $loader) {
         return $data['user_id'] ? $data['username'] : $loader->lang('guest');
     }), array('content' => function ($data) {
         return user_agent($data['user_agent']);
     }, 'size' => TRUE, 'align' => 'center', 'search' => function ($data) {
         return $data['user_agent'];
     }, 'sort' => function ($data) {
         return $data['user_agent'];
     }), array('title' => $this('ip_address'), 'content' => function ($data) {
         return geolocalisation($data['ip_address']) . '<span data-toggle="tooltip" data-original-title="' . $data['host_name'] . '">' . $data['ip_address'] . '</span>';
     }, 'search' => function ($data) {
         return $data['ip_address'];
     }, 'sort' => function ($data) {
         return $data['ip_address'];
     }), array('title' => $this('referer'), 'content' => function ($data, $loader) {
         return $data['referer'] ? urltolink($data['referer']) : $loader->lang('none');
     }, 'search' => function ($data) {
         return $data['user_agent'];
     }, 'sort' => function ($data) {
         return $data['user_agent'];
     }), array('title' => $this('arrival_date'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['date']) . '">' . time_span($data['date']) . '</span>';
     }, 'sort' => function ($data) {
         return $data['date'];
     }), array('title' => $this('last_activity'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['last_activity']) . '">' . time_span($data['last_activity']) . '</span>';
     }, 'sort' => function ($data) {
         return $data['last_activity'];
     }), array('title' => $this('history'), 'content' => function ($data, $loader) {
         $links = implode('<br />', array_map(function ($a) {
             return '<a href="' . url($a) . '">' . $a . '</a>';
         }, $data['history']));
         return '<span data-toggle="popover" title="' . $loader->lang('last_pages_visited') . '" data-content="' . utf8_htmlentities($links) . '" data-placement="auto" data-html="1">' . icon('fa-history') . ' ' . reset($data['history']) . '</span>';
     }), array('content' => array(function ($data) {
         if ($data['user_id'] && $data['session_id'] != NeoFrag::loader()->session('session_id')) {
             return button_delete('admin/members/sessions/delete/' . $data['session_id'] . '.html');
         }
     }))))->data($sessions);
     return new Panel(array('title' => $this('sessions'), 'icon' => 'fa-globe', 'content' => $this->table->display()));
 }
예제 #10
0
							<a href="https://plus.google.com/share?url=<?php 
echo $_SERVER['HTTP_HOST'] . $this->config->base_url;
?>
news/<?php 
echo $news['news_id'];
?>
/<?php 
echo url_title($news['title']);
?>
.html" target="_blank"><i class="fa fa-google-plus"></i></a>
						</div>
					</div>
				</div>
				<ul class="list-inline">
					<li><i class="fa fa-calendar"></i> Date :&nbsp;&nbsp;<span class="date"><?php 
echo timetostr('%e %b %Y', $data['date']);
?>
</span></li>
					<li><i class="fa fa-user"></i> Par :&nbsp;&nbsp;<?php 
echo $NeoFrag->user->link($data['user_id'], $data['username']);
?>
</li>
				</ul>
			</div>
		</div>
	</div>
	<?php 
if ($data['image']) {
    ?>
		<a href="<?php 
    echo url('news/' . $data['news_id'] . '/' . url_title($data['title'] . '.html'));
예제 #11
0
function time_span($timestamp)
{
    if (!is_numeric($timestamp)) {
        $timestamp = strtotime($timestamp);
    }
    $diff = time() - $timestamp;
    if (!$diff) {
        return NeoFrag::loader()->lang('now');
    } else {
        if ($diff == strtoseconds('1 seconds')) {
            return NeoFrag::loader()->lang('seconds_ago', 1);
        } else {
            if ($diff <= strtoseconds('30 seconds')) {
                return NeoFrag::loader()->lang('seconds_ago', $diff, $diff);
            } else {
                if ($diff < strtoseconds('45 seconds')) {
                    return NeoFrag::loader()->lang('seconds_ago', 30, 30);
                } else {
                    if ($diff < strtoseconds('50 seconds')) {
                        return NeoFrag::loader()->lang('seconds_ago', 45, 45);
                    } else {
                        if ($diff < strtoseconds('55 seconds')) {
                            return NeoFrag::loader()->lang('seconds_ago', 50, 50);
                        } else {
                            if ($diff < strtoseconds('2 minutes')) {
                                return NeoFrag::loader()->lang('minutes_ago', 1);
                            } else {
                                if ($diff <= strtoseconds('59 minutes')) {
                                    return NeoFrag::loader()->lang('minutes_ago', $diff = floor($diff / 60), $diff);
                                } else {
                                    if ($diff < strtoseconds('2 hours')) {
                                        return NeoFrag::loader()->lang('hours_ago', 1);
                                    } else {
                                        if ($diff <= strtoseconds('23 hours')) {
                                            return NeoFrag::loader()->lang('hours_ago', $diff = floor($diff / 3660), $diff);
                                        } else {
                                            if ($timestamp >= strtotime('yesterday')) {
                                                return NeoFrag::loader()->lang('yesterday_at', timetostr(NeoFrag::loader()->lang('time_short'), $timestamp));
                                            } else {
                                                if ($timestamp >= strtotime('6 days ago midnight')) {
                                                    return NeoFrag::loader()->lang('day_at', ucfirst(timetostr('%A', $timestamp)), timetostr(NeoFrag::loader()->lang('time_short'), $timestamp));
                                                } else {
                                                    return timetostr(NeoFrag::loader()->lang('date_time_short'), $timestamp);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
예제 #12
0
파일: data.php 프로젝트: rusteze89/QCS
function history_save($controller, $db_serv, $db_user, $db_pass, $db)
{
    // connect to MySQL database
    $con = mysqli_connect($db_serv, $db_user, $db_pass, $db);
    // load JSON data object from controller
    $json = file_get_contents($controller . '?data');
    $data = json_decode($json, true);
    $inputs = count($data['analog_data']);
    $points = count($data['analog_data'][0]);
    $dtime = time();
    $dtime -= $dtime % 300;
    for ($i = 0; $i < $points - 1; $i++) {
        $ptTime = $dtime - 300 * $i;
        $sql = 'INSERT INTO data (dt, v_battery' . ') VALUES (\'' . timetostr($ptTime) . '\',' . round($data['analog_data'][0][$i] / 51, 2) . ')';
        echo $sql . '<br>';
        if (!mysqli_query($con, $sql)) {
            echo mysqli_error($con) . '<br>';
            die(error_log(mysqli_error($con), 3, "/var/log/php-quoin-load_data.log"));
        }
    }
    echo 'Inserted ' . ($points - 1) . ' records<br>';
    mysqli_close($con);
}
예제 #13
0
 public function _edit($gallery_id, $category_id, $image_id, $name, $published, $title, $description, $category_name, $category_title, $category_image, $category_icon)
 {
     $this->css('dropzone.min')->css('admin')->js('dropzone')->js('admin')->js('preview');
     $form_album = $this->subtitle($title)->load->library('form')->add_rules('album', array('title' => $title, 'category_id' => $category_id, 'categories' => $this->model()->get_categories_list(), 'image' => $image_id, 'description' => $description, 'published' => $published, 'gallery_id' => $gallery_id))->add_submit($this('edit'))->add_back('admin/gallery.html')->save();
     $form_image = $this->form->add_rules(array('image' => array('label' => $this('image'), 'type' => 'file', 'upload' => 'gallery', 'info' => $this('file_picture', file_upload_max_size() / 1024 / 1024), 'check' => function ($filename, $ext) {
         if (!in_array($ext, array('gif', 'jpeg', 'jpg', 'png'))) {
             return i18n('select_image_file');
         }
     }, 'rules' => 'required'), 'title' => array('label' => $this('title'), 'type' => 'text'), 'description' => array('label' => $this('description'), 'type' => 'textarea')))->add_submit($this('add_image'))->save();
     $gallery_table = $this->load->library('table')->add_columns(array(array('content' => function ($data, $loader) {
         return '<a class="thumbnail thumbnail-link" data-toggle="tooltip" title="' . $loader->lang('view') . '" data-image="' . path($data['file_id']) . '" data-title="' . $data['title'] . '" data-description="' . $data['description'] . '"><img style="max-width: 80px;" src="' . path($data['thumbnail_file_id']) . '" alt="" /></a>';
     }, 'size' => TRUE), array('title' => $this('title'), 'content' => function ($data) {
         return $data['title'];
     }, 'align' => 'left', 'sort' => function ($data) {
         return $data['title'];
     }, 'search' => function ($data) {
         return $data['title'];
     }), array('title' => $this('date'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['date']) . '">' . time_span($data['date']) . '</span>';
     }, 'align' => 'left', 'sort' => function ($data) {
         return $data['date'];
     }, 'search' => function ($data) {
         return $data['date'];
     }), array('content' => array(function ($data, $loader) {
         return button('gallery/image/' . $data['image_id'] . '/' . url_title($data['title']) . '.html', 'fa-eye', $loader->lang('see_image'));
     }, function ($data) {
         return button_edit('admin/gallery/image/' . $data['image_id'] . '/' . url_title($data['title']) . '.html');
     }, function ($data) {
         return button_delete('admin/gallery/image/delete/' . $data['image_id'] . '/' . url_title($data['title']) . '.html');
     }), 'align' => 'right', 'size' => TRUE)))->data($images = $this->model()->get_images($gallery_id))->no_data($this('no_images'))->save();
     if ($form_album->is_valid($post)) {
         $this->model()->edit_gallery($gallery_id, $post['category'], $post['image'], in_array('on', $post['published']), $post['title'], $post['description'], $this->config->lang);
         //add_alert('success', $this('album_edited'));
         redirect_back('admin/gallery.html');
     } else {
         if ($form_image->is_valid($post)) {
             $this->model()->add_image($post['image'], $gallery_id, $post['title'], $post['description']);
             //add_alert('success', $this('image_added'));
             refresh();
         }
     }
     return new Row(new Col(new Panel(array('title' => $this('edit_album_title'), 'icon' => 'fa-photo', 'content' => $form_album->display(), 'size' => 'col-md-12 col-lg-7'))), new Col(new Panel(array('title' => $this('add_images_title'), 'icon' => 'fa-photo', 'content' => $this->load->view('upload', array('gallery_id' => $gallery_id, 'name' => $name, 'form_image' => $form_image->display())), 'footer' => $this->load->view('admin_gallery', array('images' => $images, 'gallery_table' => $gallery_table->display())), 'size' => 'col-md-12 col-lg-5'))));
 }
예제 #14
0
    ?>
</td>
		</tr>
		<?php 
}
?>
		<?php 
if (!empty($data['date_of_birth']) && $data['date_of_birth'] != '0000-00-00') {
    ?>
		<tr>
			<td class="col-lg-3 col-md-4 col-xs-5"><b><?php 
    echo icon('fa-birthday-cake') . ' ' . i18n('birth_date');
    ?>
</b></td>
			<td class="col-lg-9 col-md-8 col-xs-7"><?php 
    echo timetostr($NeoFrag->lang('date_short'), $data['date_of_birth']) . ' ' . i18n('age', $age = date_diff(date_create($data['date_of_birth']), date_create('today'))->y, $age);
    ?>
</td>
		</tr>
		<?php 
}
?>
		<?php 
if (!empty($data['sex'])) {
    ?>
		<tr>
			<td class="col-lg-3 col-md-4 col-xs-5"><b><?php 
    echo icon('fa-' . $data['sex']) . ' ' . i18n('gender');
    ?>
</b></td>
			<td class="col-lg-9 col-md-8 col-xs-7"><?php 
예제 #15
0
 private function _display_time($var, $options, $post)
 {
     if (!empty($options['value'])) {
         $options['value'] = timetostr(NeoFrag::loader()->lang('time_short'), $options['value']);
     }
     return $this->_display_text($var, $options, $post, 'time');
 }
예제 #16
0
							<tbody>
								<?php 
$rowtypes = array("even", "odd");
$row_contents = array();
foreach ($days as $day) {
    $css = "";
    if (empty($row_contents)) {
        $css = "sv-first-col";
    }
    $row_contents[] = "<td class='sv-grid-col sv-grid-cell sv-day-{$day} {$css}'></td>";
}
$row_contents = implode("", $row_contents);
$idx = 0;
for ($t = $start; $t < $end; $t += $step) {
    $mod = $idx % 2;
    $t_str = timetostr($t, false);
    echo "<tr class='sv-grid-row {$rowtypes[$mod]}' data-time='{$t_str}'>";
    echo $row_contents;
    echo "</tr>\n";
    $idx += 1;
}
?>
							</tbody>
						</table>
						<div class='sv-events-container'></div>
						<div class='sv-virtual-events'><strong>Non-meeting courses</strong></div>
					</div>
					<div style='clear:both'></div>
				</div>
			</div>
		</div>