main.php 4.33 KB
Newer Older
1 2 3 4
<?php
/*
 ----------------------------------------------------------------------
 AlternC - Web Hosting System
5 6
 Copyright (C) 2000-2012 by the AlternC Development Team.
 https://alternc.org/
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 ----------------------------------------------------------------------
 LICENSE

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License (GPL)
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html
 ----------------------------------------------------------------------
22
 Purpose of file: Main page shown after login, display misc information
23 24 25 26
 ----------------------------------------------------------------------
*/
require_once("../class/config.php");

27
include_once("head.php");
28

29 30
// Show last login information :
echo "<p>";
31 32
__("Last Login: ");

33 34 35
if ($mem->user["lastlogin"]=="0000-00-00 00:00:00") {
  __("Never");
} else { 
36
  echo format_date(_('the %3$d-%2$d-%1$d at %4$d:%5$02d'),$mem->user["lastlogin"]); 
37 38 39
  printf("&nbsp;"._('from: <code> %1$s </code>')."<br />",$mem->user["lastip"]);
}
  echo "</p>";
40 41 42 43 44

if ($mem->user["lastfail"]) {
	printf(_("%1\$d login failed since last login")."<br />",$mem->user["lastfail"]);
}

alban's avatar
alban committed
45
if (!empty($error) ) { echo "<p class='alert alert-danger'>$error</p>";$error=''; } 
46

Alan Garcia's avatar
Alan Garcia committed
47
$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'));
Alan Garcia's avatar
Alan Garcia committed
48
if (!empty($feed_url)) {
49 50 51
  $cache_time = 60*5; // 5 minutes
  $cache_file = "/tmp/alterncpanel_cache_main.rss";
  $timedif = @(time() - filemtime($cache_file));
Alan Garcia's avatar
Alan Garcia committed
52

53 54 55 56 57 58 59
  if (file_exists($cache_file) && $timedif < $cache_time) {
    $string = file_get_contents($cache_file);
  } else {
    $string = file_get_contents("$feed_url");
    file_put_contents($cache_file,$string);
  }
  $xml = @simplexml_load_string($string);
60

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
  if ( ! $xml === FALSE ) {
    echo '<div align="center"><table class="tedit" cellspacing="0" cellpadding="6">';
    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>";
    //echo '<tr><th>'._("Title").'</th><th>'._("Date").'</th></tr>';
    $count = 0;
    $max = 5;
    foreach ($xml->channel->item as $val) {
      if ($count < $max) {
        echo "<tr>\n<td ".(empty($val->pubDate)?'colpan=2':'').'><a target="_blank" href="'.$val->link.'">'.$val->title.'</a></td>';
        if (!empty($val->pubDate)) { 
          echo '<td>'.strftime("%d/%m/%Y" , strtotime($val->pubDate)).'</td>'; 
        }
        echo '</tr>';
      }
      $count++;
    } //foreach
    echo "</table></div>\n";
    echo "<br/>";
  } // $xml === FALSE
Alan Garcia's avatar
Alan Garcia committed
80
} // empty feed_url
81

82 83 84
if($admin->enabled) {
  $expiring = $admin->renew_get_expiring_accounts();

85
  if(!empty($expiring) ) {
86 87 88
    echo "<h2>" . _("Expired or about to expire accounts") . "</h2>\n";
    echo "<table cellspacing=\"2\" cellpadding=\"4\">\n";
    echo "<tr><th>"._("uid")."</th><th>"._("Last name, surname")."</th><th>"._("Expiry")."</th></tr>\n";
89
    if (is_array($expiring)) {
Alan Garcia's avatar
Alan Garcia committed
90 91 92 93 94 95 96
      foreach($expiring as $account) {
        echo "<tr class=\"exp{$account['status']}\"><td>{$account['uid']}</td>";
        if($admin->checkcreator($account['uid'])) {
          echo "<td><a href=\"adm_edit.php?uid={$account['uid']}\">{$account['nom']}, {$account['prenom']}</a></td>";
        }else{
          echo "<td>{$account['nom']}, {$account['prenom']}</td>";
        }
97 98
        echo "<td>{$account['expiry']}</td></tr>\n";
      }
99 100 101
    }
    echo "</table>\n";
  }
102 103

  echo "<hr/><p>";
104
  __("You are using the AlternC Panel. You can contact the AlternC community for information or feedback by joining the mailing-list");
Alan Garcia's avatar
Alan Garcia committed
105
  echo "&nbsp;<a target='_blank' href='http://lists.alternc.org/listinfo/users'>users@alternc.org</a>";
106 107
  echo "</p>";
} // if $admin->enabled
108

domi's avatar
 
domi committed
109
$c = $admin->get($cuid);
110

111
define("QUOTASONE","1");
Alan Garcia's avatar
Alan Garcia committed
112
echo "<hr/>";
113
require_once("quotas_oneuser.php");
114 115 116 117


?>
<?php include_once("foot.php"); ?>