Alternc  latest
Alternc logiel libre pour l'hébergement
main.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Main page shown after a successful login of an account
22  * Displays misc informations
23  *
24  * @copyright AlternC-Team 2000-2017 https://alternc.com/
25  */
26 
27 require_once("../class/config.php");
28 
29 include_once("head.php");
30 
31 // Show last login information :
32 echo "<p>";
33 __("Last Login: ");
34 
35 if ($mem->user["lastlogin"]=="0000-00-00 00:00:00") {
36  __("Never");
37 } else {
38  echo format_date(_('the %3$d-%2$d-%1$d at %4$d:%5$02d'),$mem->user["lastlogin"]);
39  printf("&nbsp;"._('from: <code> %1$s </code>')."<br />",$mem->user["lastip"]);
40 }
41  echo "</p>";
42 
43 if ($mem->user["lastfail"]) {
44  printf(_("%1\$d login failed since last login")."<br />",$mem->user["lastfail"]);
45 }
46 
47 echo $msg->msg_html_all();
48 if (!empty($error) ) { echo "<p class='alert alert-danger'>$error</p>";$error=''; }
49 
50 $feed_url = variable_get('rss_feed', '', 'This is an RSS feed that will be displayed on the users homepages when they log in.', array('desc'=>'URL','type'=>'string'));
51 if (!empty($feed_url)) {
52  $cache_time = 60*5; // 5 minutes
53  $cache_file = "/tmp/alterncpanel_cache_main.rss";
54  $timedif = @(time() - filemtime($cache_file));
55 
56  if (file_exists($cache_file) && $timedif < $cache_time) {
57  $string = file_get_contents($cache_file);
58  } else {
59  $string = file_get_contents("$feed_url");
60  file_put_contents($cache_file,$string);
61  }
62  $xml = @simplexml_load_string($string);
63 
64  if ( ! $xml === FALSE ) {
65  echo '<div align="center"><table class="tedit" cellspacing="0" cellpadding="6">';
66  echo "<tr><th colspan='2'><a target='_blank' style='font-size: 18px;font-weight: bold;color: #10507C;' href='".$xml->channel->link."'>".$xml->channel->title."</a><br/><i>".$xml->channel->description."</i></th></tr>";
67  //echo '<tr><th>'._("Title").'</th><th>'._("Date").'</th></tr>';
68  $count = 0;
69  $max = 5;
70  foreach ($xml->channel->item as $val) {
71  if ($count < $max) {
72  echo "<tr>\n<td ".(empty($val->pubDate)?'colpan=2':'').'><a target="_blank" href="'.$val->link.'">'.$val->title.'</a></td>';
73  if (!empty($val->pubDate)) {
74  echo '<td>'.strftime("%d/%m/%Y" , strtotime($val->pubDate)).'</td>';
75  }
76  echo '</tr>';
77  }
78  $count++;
79  } //foreach
80  echo "</table></div>\n";
81  echo "<br/>";
82  } // $xml === FALSE
83 } // empty feed_url
84 
85 if($admin->enabled) {
86  $expiring = $admin->renew_get_expiring_accounts();
87 
88  if(!empty($expiring) ) {
89  echo "<h2>" . _("Expired or about to expire accounts") . "</h2>\n";
90  echo "<table cellspacing=\"2\" cellpadding=\"4\">\n";
91  echo "<tr><th>"._("uid")."</th><th>"._("Last name, surname")."</th><th>"._("Expiry")."</th></tr>\n";
92  if (is_array($expiring)) {
93  foreach($expiring as $account) {
94  echo "<tr class=\"exp{$account['status']}\"><td>{$account['uid']}</td>";
95  if($admin->checkcreator($account['uid'])) {
96  echo "<td><a href=\"adm_edit.php?uid={$account['uid']}\">{$account['nom']}, {$account['prenom']}</a></td>";
97  }else{
98  echo "<td>{$account['nom']}, {$account['prenom']}</td>";
99  }
100  echo "<td>{$account['expiry']}</td></tr>\n";
101  }
102  }
103  echo "</table>\n";
104  }
105 
106  echo "<hr/><p>";
107  __("You are using the AlternC Panel. You can contact the AlternC community for information or feedback by joining the mailing-list");
108  echo "&nbsp;<a target='_blank' href='http://lists.alternc.org/listinfo/users'>users@alternc.org</a>";
109  echo "</p>";
110 } // if $admin->enabled
111 
112 $blocks=$hooks->invoke("hook_homepageblock");
113 uasort($blocks, function($a, $b) {return $a->pos<$b->pos ? -1 : 1;});
114 foreach ($blocks as $v) {
115  if (property_exists($v, "call")) {
116  $func=$v->call;
117  $func();
118  }
119  if (property_exists($v, "include")) {
120  include $v->include;
121  }
122 }
123 
124 ?>
125 <?php include_once("foot.php"); ?>
$hooks
Definition: bootstrap.php:74
$mem
Definition: bootstrap.php:71
$msg
Definition: bootstrap.php:75
variable_get($name, $default=null, $createit_comment=null)
Return a persistent variable.
Definition: variables.php:85
format_date($format, $date)
Definition: functions.php:494
__($str)
Definition: functions.php:404
$string
Definition: logs_tail.php:38
if( $mem->user["lastfail"])
Definition: main.php:43
if(!empty($feed_url)) if($admin->enabled) $blocks
Definition: main.php:112
if(!empty($error)) $feed_url
Definition: main.php:50
$error
Definition: ssl_delete.php:45
$val
Definition: tempovars.php:15