Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
functions.php File Reference

Go to the source code of this file.

Functions

 fl ($str)
 variable_get ($name, $default=null, $createit_comment=null, $type=null)
 checkhostallow ($domain, $dns)
 checkhostallow_nodns ($domain)
 get_remote_ip ()
 checkurl ($url)
 checksubtxt ($txt)
 checkcname ($cname)
 checkip ($ip)
 checkipv6 ($ip)
 checkloginmail ($mail)
 checkmail ($mail)
 checkfqdn ($fqdn)
 checkuserpath ($path)
 getuserpath ($user=null)
 get the home of the user
 cbox ($test)
 selected ($bool)
 ecif ($test, $tr, $fa="", $affiche=1)
 __ ($str)
 ife ($test, $tr, $fa="")
 format_size ($size, $html=0)
 getlinkhelp ($hid)
 linkhelp ($hid)
 format_date ($format, $date)
 ssla ($str)
 _md5cr ($pass, $salt="")
 Hashe un mot de passe en clair en MD5 avec un salt aléatoire.
 split_mysql_database_name ($dbname)
 split mysql database name between username and custom database name
 xml_entities ($string)
 Echappe les caractères pouvant perturber un flux XML standard :
 pretty_months ($months)
 Converti un nombre de mois en une chaine plus lisible.

string $name Nom pour le composasnt

Fabrique un drop-down pour les durées de comptes

number Option selectionée du composant

Returns
string Code html pour le drop-down private
const DEFAULT_PASS_SIZE = 8
 duration_list ($name, $selected=0)
 eoption ($values, $cur, $onedim=false)
 ehe ($str, $affiche=1)
 getFields ($fields, $requestOnly=false)
 printVar ($array)
 list_properties_order ($a, $b)
 pager ($offset, $count, $total, $url, $before="", $after="")
 Show a pager as Previous page 0 1 2 ...
 create_pass ($length=8)
 display_div_generate_password ($pass_size=DEFAULT_PASS_SIZE, $fields_to_fill1="", $fields_to_fill2="")
 display_browser ($dir="", $caller="main.dir", $width=350, $height=450)
 auto_wrap ($message="", $max=10, $wrap_string="<wbr/>")
 fHSVtoRGB ($iH, $iS, $iV)
 hexa ($hex)
 PercentToColor ($p=0)
 panel_lock ()
 panel_unlock ()
 panel_islocked ()

Function Documentation

__ (   $str)

Definition at line 261 of file functions.php.

Referenced by display_div_generate_password(), and sub_domains_edit().

{
echo _($str);
}
_md5cr (   $pass,
  $salt = "" 
)

Hashe un mot de passe en clair en MD5 avec un salt aléatoire.

Parameters
string$passMot de passe à crypter (max 32 caractères)
Returns
string Retourne le mot de passe crypté private

Definition at line 348 of file functions.php.

References $i.

Referenced by m_ftp\add_ftp(), m_aws\add_login(), m_admin\add_mem(), m_hta\add_user(), m_hta\change_pass(), m_mem\login(), m_mem\passwd(), m_ftp\put_ftp_details(), and m_admin\update_mem().

{
if (!$salt) {
$chars="./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for ($i=0;$i<12;$i++) {
$salt.=substr($chars,(mt_rand(0,strlen($chars))),1);
}
$salt="$1$".$salt;
}
return crypt($pass,$salt);
}
auto_wrap (   $message = "",
  $max = 10,
  $wrap_string = "<wbr/>" 
)

Definition at line 667 of file functions.php.

References isset.

{
$cpt = 0;
$mot = split(" ",$message);
while (isset($mot[$cpt]) && ($mot[$cpt] != "")){
if(@strlen($mot[$cpt]) > $max){
$nvmot = chunk_split ($mot[$cpt], $max, $wrap_string );
$message = str_replace($mot[$cpt], $nvmot, $message);
}
$cpt++;
}
return $message;
}
cbox (   $test)

Definition at line 235 of file functions.php.

Referenced by sub_domains_edit(), and var_input().

{
if ($test) echo (" checked=\"checked\"");
}
checkcname (   $cname)

Definition at line 131 of file functions.php.

Referenced by m_dom\check_type_value().

{
return true;
}
checkfqdn (   $fqdn)

Definition at line 164 of file functions.php.

References $key, $members, and $val.

Referenced by m_dom\add_domain(), checkurl(), m_dom\edit_domain(), m_dom\get_domain_all(), and m_dom\set_sub_domain().

{
// (RFC 1035 http://www.ietf.org/rfc/rfc1035.txt)
// Retourne 0 si tout va bien, sinon, retourne un code erreur...
// 1. Nom de domaine complet trop long.
// 2. L'un des membres est trop long.
// 3. Caractere interdit dans l'un des membres.
// 4. Le fqdn ne fait qu'un seul membre (il n'est donc pas fq...)
if (strlen($fqdn)>255)
return 1;
$members=explode(".", $fqdn);
if (count($members)>1) $ret=0; else $ret=4;
reset($members);
while (list ($key, $val) = each ($members)) {
if (strlen($val)>63)
return 2;
// Note: a.foo.net is a valid domain
// Note: RFC1035 tells us that a domain should not start by a digit, but every registrar allows such a domain to be created ... too bad.
if (!preg_match("#^[a-z0-9_]([a-z0-9-_]*[a-z0-9_])?$#i",$val)) {
return 3;
}
}
return $ret;
}
checkhostallow (   $domain,
  $dns 
)

Definition at line 43 of file functions.php.

References $db, $dom, $domain, $found, $i, $key, and $val.

Referenced by m_dom\add_domain(), and m_dom\edit_domain().

{
global $L_NS1,$L_NS2,$db,$dom;
$sizefound=0;
$found="";
$db->query("SELECT tld,mode FROM tld;");
while ($db->next_record()) {
list($key,$val)=$db->Record;
if (substr($domain,-1-strlen($key))==".".$key) {
if ($sizefound<strlen($key)) {
$sizefound=strlen($key);
$fmode=$val;
}
}
}
if ( $dom->tld_no_check_at_all )
return 0; // OK , the boss say that you can.
if (!$found || $fmode==0) // TLD not allowed at all
return -1;
if (($fmode!=4) && (!is_array($dns))) // NO dns found in the whois, and domain MUST exists
return -2;
if ($fmode>2) // OK, in the case 3 4 5
return $found;
$n1=false; $n2=false;
for ($i=0;$i<count($dns);$i++) {
if (strtolower($dns[$i])==strtolower($L_NS1)) $n1=true;
if (strtolower($dns[$i])==strtolower($L_NS2)) $n2=true;
}
if ($fmode==1 && $n1) // OK
return $found;
if ($fmode==2 && $n1 && $n2) // OK
return $found;
return -3; // DNS incorrect in the whois
}
checkhostallow_nodns (   $domain)

Definition at line 82 of file functions.php.

References $db, $domain, $found, $key, and $val.

Referenced by m_dom\add_domain().

{
global $db;
$sizefound=0;
$found="";
$db->query("SELECT tld,mode FROM tld;");
while ($db->next_record()) {
list($key,$val)=$db->Record;
if (substr($domain,-1-strlen($key))==".".$key) {
if ($sizefound<strlen($key)) {
$sizefound=strlen($key);
$fmode=$val;
}
}
}
// If we found a correct tld, let's find how many . before ;)
if (!$found || $fmode==0) // TLD not allowed at all
return 1;
if (count(explode(".",substr($domain,0,-$sizefound)))>2) {
return 1;
}
return 0;
}
checkip (   $ip)

Definition at line 136 of file functions.php.

Referenced by m_dom\add_slave_ip(), m_dom\check_type_value(), m_dom\del_slave_ip(), m_authip\ip_save(), and m_authip\list_ip().

{
// return true or false whether the ip is correctly formatted
return filter_var($ip,FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
checkipv6 (   $ip)

Definition at line 142 of file functions.php.

Referenced by m_dom\check_type_value(), m_authip\ip_save(), and m_authip\list_ip().

{
// return true or false whether the ip is correctly formatted
return filter_var($ip,FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
}
checkloginmail (   $mail)

Definition at line 149 of file functions.php.

Referenced by m_hta\add_user().

{
return true;
}
checkmail (   $mail)

Definition at line 155 of file functions.php.

Referenced by m_cron\_update_one(), m_admin\add_mem(), and m_admin\mailallmembers().

{
if (filter_var($mail,FILTER_VALIDATE_EMAIL)) {
return 0;
} else {
return 1;
}
}
checksubtxt (   $txt)

Definition at line 127 of file functions.php.

{
return true;
}
checkurl (   $url)

Definition at line 113 of file functions.php.

References $t, and checkfqdn().

{
// TODO : add a path/file check
if (substr($url,0,7)!="http://" && substr($url,0,8)!="https://" && substr($url,0,6)!="ftp://") return false;
if (substr($url,0,7)=="http://" ) $fq=substr($url,7);
if (substr($url,0,8)=="https://") $fq=substr($url,8);
if (substr($url,0,6)=="ftp://" ) $fq=substr($url,6);
$f=explode("/",$fq);
if (!is_array($f)) $f=array($f);
$t=checkfqdn($f[0]);
if ($t) return false;
return true;
}
checkuserpath (   $path)

Definition at line 189 of file functions.php.

References $mem, $user, ALTERNC_HTML, and getuserpath().

Referenced by m_dom\check_type_value().

{
/*
return 0 if the path is not in the user's space
return 1 if this is a directory
return 2 if this is a regular file
*/
global $mem;
$user=$mem->user["login"];
$usar=substr($user,0,1);
if (substr($path,0,1)!="/")
$path="/".$path;
$rpath = realpath(ALTERNC_HTML."/$usar/$user$path");
if (!$rpath) { // if file or directory does not exist
return 1; // FIXME is it safe to say OK in this case ?
}
$userpath = getuserpath();
if(strpos($rpath,$userpath) === 0){
if (is_dir(ALTERNC_HTML."/$usar/$user$path")) {
return 1;
}
if (is_file(ALTERNC_HTML."/$usar/$user$path")) {
return 2;
}
}
return 0;
}
create_pass (   $length = 8)

Definition at line 604 of file functions.php.

References $i, and $password.

Referenced by m_mysql\add_db(), m_mysql\alternc_add_member(), and m_piwik\user_add().

{
$chars = "1234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$i = 0;
$password = "";
while ($i <= $length) {
$password .= @$chars{mt_rand(0,strlen($chars))};
$i++;
}
return $password;
}
display_browser (   $dir = "",
  $caller = "main.dir",
  $width = 350,
  $height = 450 
)

Definition at line 628 of file functions.php.

References ehe().

Referenced by sub_domains_edit().

{
// Browser id
$bid="b".rand(1,1000);
echo "<script type=\"text/javascript\">
<!--
$(function() {
$( \"#".$bid."\" ).dialog({
autoOpen: false,
width: ".$width.",
height: ".$height.",
modal: true,
open: function()
{
$('.ui-widget-overlay').css('opacity', .70);
$('.ui-dialog-content').css('background-color', '#F0F0FA');
},
});
$( \"#bt".$bid."\" )
.button()
.attr(\"class\", \"ina\")
.click(function() {
$( \"#".$bid."\" ).dialog( \"open\" );
return false;
});
});
document.write('&nbsp;<input type=\"button\" id=\"bt".$bid."\" value=\""._("Choose a folder...")."\" class=\"ina\">');
document.write('<div id=\"".$bid."\" title=\""._("Choose a folder...")."\" style=\"display: none; bgcolor:red;\">');
document.write(' <iframe src=\"/browseforfolder2.php?caller=".$caller."&amp;file=".ehe($dir, 0)."&amp;bid=".$bid."\" width=\"".($width-40)."\" height=\"".($height-64)."\" frameborder=\"no\" id=\"browseiframe\"></iframe>');
document.write('</div>');
// -->
</script>
";
}
display_div_generate_password (   $pass_size = DEFAULT_PASS_SIZE,
  $fields_to_fill1 = "",
  $fields_to_fill2 = "" 
)

Definition at line 618 of file functions.php.

References __().

{
$id=rand(1,1000);
echo "<div id='z$id' style='display:none;'><a href=\"javascript:generate_password_html('$id',$pass_size,'$fields_to_fill1','$fields_to_fill2');\">";
__("Clic here to generate a password");
echo "</a></div>";
echo "<script type='text/javascript'>$('#z$id').show();</script>";
return 0;
}
duration_list (   $name,
  $selected = 0 
)

Definition at line 402 of file functions.php.

References $res, and pretty_months().

{
$res = "<select name=\"$name\" id=\"$name\" class=\"inl\">";
foreach(array(0, 1, 2, 3, 4, 6, 12, 24) as $dur) {
$res .= "<option value=\"$dur\"";
if($selected == $dur) {
$res .= ' selected="selected" ';
}
$res .= '>';
if($dur == 0) {
$res .= _('Not managed');
} else {
$res .= pretty_months($dur);
}
$res .= '</option>';
}
$res .= '</select>';
return $res;
}
ecif (   $test,
  $tr,
  $fa = "",
  $affiche = 1 
)

Definition at line 249 of file functions.php.

{
if ($test)
$retour = $tr;
else
$retour = $fa;
if ($affiche)
echo $retour;
else
return $retour;
}
ehe (   $str,
  $affiche = 1 
)

Definition at line 446 of file functions.php.

Referenced by add_var(), display_browser(), edit_var(), and var_input().

{
global $charset;
$retour = htmlspecialchars($str,ENT_QUOTES,$charset);
if ($affiche) {
echo $retour;
} else {
return $retour;
}
}
eoption (   $values,
  $cur,
  $onedim = false 
)

Definition at line 429 of file functions.php.

Referenced by add_var().

{
if (is_array($values)) {
foreach ($values as $k=>$v) {
if ( $onedim ) $k=$v;
echo "<option value=\"$k\"";
if ($k==$cur) echo " selected=\"selected\"";
echo ">".$v."</option>";
}
}
}
fHSVtoRGB (   $iH,
  $iS,
  $iV 
)

Definition at line 693 of file functions.php.

Referenced by PercentToColor().

{
if($iH < 0) $iH = 0; // Hue:
if($iH > 360) $iH = 360; // 0-360
if($iS < 0) $iS = 0; // Saturation:
if($iS > 100) $iS = 100; // 0-100
if($iV < 0) $iV = 0; // Lightness:
if($iV > 100) $iV = 100; // 0-100
$dS = $iS/100.0; // Saturation: 0.0-1.0
$dV = $iV/100.0; // Lightness: 0.0-1.0
$dC = $dV*$dS; // Chroma: 0.0-1.0
$dH = $iH/60.0; // H-Prime: 0.0-6.0
$dT = $dH; // Temp variable
while($dT >= 2.0) $dT -= 2.0; // php modulus does not work with float
$dX = $dC*(1-abs($dT-1)); // as used in the Wikipedia link
switch($dH) {
case($dH >= 0.0 && $dH < 1.0):
$dR = $dC; $dG = $dX; $dB = 0.0; break;
case($dH >= 1.0 && $dH < 2.0):
$dR = $dX; $dG = $dC; $dB = 0.0; break;
case($dH >= 2.0 && $dH < 3.0):
$dR = 0.0; $dG = $dC; $dB = $dX; break;
case($dH >= 3.0 && $dH < 4.0):
$dR = 0.0; $dG = $dX; $dB = $dC; break;
case($dH >= 4.0 && $dH < 5.0):
$dR = $dX; $dG = 0.0; $dB = $dC; break;
case($dH >= 5.0 && $dH < 6.0):
$dR = $dC; $dG = 0.0; $dB = $dX; break;
default:
$dR = 0.0; $dG = 0.0; $dB = 0.0; break;
}
$dM = $dV - $dC;
$dR += $dM; $dG += $dM; $dB += $dM;
$dR *= 255; $dG *= 255; $dB *= 255;
return array('r'=>round($dR), 'g'=>round($dG), 'b'=>round($dB) );
}
fl (   $str)

Definition at line 31 of file functions.php.

{ return str_replace("<","&lt;",str_replace("\"","&quot;",$str)); }
format_date (   $format,
  $date 
)

Definition at line 317 of file functions.php.

References $d, and $i.

{
$d=substr($date,8,2);
$m=substr($date,5,2);
$y=substr($date,0,4);
$h=substr($date,11,2);
$i=substr($date,14,2);
if ($h>12) {
$hh=$h-12;
$am="pm";
} else {
$hh=$h;
$am="am";
}
return sprintf($format,$d,$m,$y,$h,$i,$hh,$am);
}
format_size (   $size,
  $html = 0 
)

Definition at line 272 of file functions.php.

References $r.

Referenced by m_quota\display_val(), and m_quota\hook_menu().

{
// Retourne une taille formattée en Octets, Kilo-octets, Méga-octets ou Giga-Octets, avec 2 décimales.
if ("-" == $size) {
return $size;
}
$size=(float)$size;
if ($size<1024) {
$r=$size;
if ($size!=1) {
$r.=" "._("Bytes");
} else {
$r.=" "._("Byte");
}
} else {
$size=$size/1024;
if ($size<1024) {
$r=round($size,2)." "._("Kb");
} else {
$size=$size/1024;
if ($size<1024) {
$r=round($size,2)." "._("Mb");
} else {
$size=$size/1024;
if ($size<1024) {
$r=round($size,2)." "._("Gb");
} else {
$r=round($size/1024,2)." "._("Tb");
}
}
}
}
if ($html) {
return str_replace(" ","&nbsp;",$r);
}else{
return $r;
}
}
get_remote_ip ( )

Definition at line 106 of file functions.php.

Referenced by m_mem\checkid(), m_mem\del_session(), m_err\log(), m_mem\login(), m_mem\resetlast(), and m_mem\setid().

{
// Return the remote IP.
// If you are behind a proxy, use X_FORWARDED_FOR instead of REMOTE_ADDR
return getenv('REMOTE_ADDR');
}
getFields (   $fields,
  $requestOnly = false 
)

Definition at line 459 of file functions.php.

References $fields, $options, $value, and isset.

{
$vars = array();
$methodType = array ("get", "post", "request", "files", "server");
foreach ($fields AS $name => $options) {
if (in_array(strtolower($options[0]), $methodType) === false)
die ("Unrecognized method type used for field " . $name . " : " . $options[0]);
if ($requestOnly === true)
$method = "_REQUEST";
else
$method = "_" . strtoupper($options[0]);
switch ($options[1]) {
case "integer":
$vars[$name] = (isset($GLOBALS[$method][$name]) && is_numeric($GLOBALS[$method][$name]) ? intval($GLOBALS[$method][$name]) : $options[2]);
break;
case "float":
$vars[$name] = (isset($GLOBALS[$method][$name]) && is_numeric($GLOBALS[$method][$name]) ? floatval($GLOBALS[$method][$name]) : $options[2]);
break;
case "string":
$vars[$name] = (isset($GLOBALS[$method][$name]) ? trim($GLOBALS[$method][$name]) : $options[2]);
break;
case "array":
$vars[$name] = (isset($GLOBALS[$method][$name]) && is_array($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]);
break;
case "boolean":
$vars[$name] = (isset($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]);
break;
case "file":
$vars[$name] = (isset($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]);
break;
default:
die ("Illegal method type used for field " . $name . " : " . $options[1]);
}
}
// Insert into $GLOBALS.
foreach ($vars AS $var => $value)
$GLOBALS[$var] = $value;
return $vars;
}
getlinkhelp (   $hid)

Definition at line 310 of file functions.php.

Referenced by linkhelp().

{
return "(<a href=\"javascript:help($hid);\">?</a>)";
}
getuserpath (   $user = null)

get the home of the user

string $user the username, if null will use the global $mem. no security checks performed on path

Returns
string the actual absolute path

Definition at line 224 of file functions.php.

References $mem, $user, and ALTERNC_HTML.

Referenced by m_ftp\add_ftp(), m_admin\add_mem(), m_bro\alternc_export_data(), checkuserpath(), m_admin\del_mem(), m_bro\DeleteFile(), m_bro\DownloadTBZ(), m_bro\DownloadTGZ(), m_bro\DownloadZ(), m_dom\generate_apacheconf(), m_ftp\get_ftp_details(), m_mysql\get_mysql_details(), m_bro\get_user_root(), m_ftp\is_ftp(), and m_ftp\put_ftp_details().

{
if (is_null($user)) {
global $mem;
$user = $mem->user['login'];
}
return rtrim(ALTERNC_HTML,"/")."/".substr($user,0,1)."/".$user;
}
hexa (   $hex)

Definition at line 735 of file functions.php.

{
$num = dechex($hex);
return (strlen("$num") >= 2) ? "$num" : "0$num";
}
ife (   $test,
  $tr,
  $fa = "" 
)

Definition at line 265 of file functions.php.

Referenced by _subbrowse(), and browseforfolder().

{
if ($test)
return $tr;
else
return $fa;
}
linkhelp (   $hid)

Definition at line 313 of file functions.php.

References getlinkhelp().

{
echo getlinkhelp($hid);
}
list_properties_order (   $a,
  $b 
)

Definition at line 508 of file functions.php.

{
if ( $a['label'] == $b['label']) {
return 0;
}
return ($a['label']<$b['label'])?-1:1;
} // end private function list_properties_order
pager (   $offset,
  $count,
  $total,
  $url,
  $before = "",
  $after = "" 
)

Show a pager as Previous page 0 1 2 ...

16 17 18 19 20 ... 35 36 37 Next page Arguments are as follow : $offset = the current offset from 0 $count = The number of elements shown per page $total = The total number of elements $url = The url to show for each page. %offset%% will be replace by the proper offset $before & $after are HTML code to show before and after the pager only if the pager is to be shown

Definition at line 525 of file functions.php.

References $i, and $total.

{
$offset=intval($offset);
$count=intval($count);
$total=intval($total);
if ($offset<=0) $offset="0";
if ($count<=1) $count="1";
if ($total<=0) $total="0";
if ($total<$offset) $offset=max(0,$total-$count);
if ($total<=$count) { // When there is less element than 1 complete page, just don't do anything :-D
return true;
}
echo $before;
// Shall-we show previous page link ?
if ($offset) {
$o=max($offset-$count,0);
echo "<a href=\"".str_replace("%%offset%%",$o,$url)."\" alt=\"(Ctl/Alt-p)\" title=\"(Alt-p)\" accesskey=\"p\">"._("Previous Page")."</a> ";
} else {
echo _("Previous Page")." ";
}
if ($total>(2*$count)) { // On n'affiche le pager central (0 1 2 ...) s'il y a au moins 2 pages.
echo " - ";
if (($total<($count*10)) && ($total>$count)) { // moins de 10 pages :
for($i=0;$i<$total/$count;$i++) {
$o=$i*$count;
if ($offset==$o) {
echo $i." ";
} else {
echo "<a href=\"".str_replace("%%offset%%",$o,$url)."\">$i</a> ";
}
}
} else { // Plus de 10 pages, on affiche 0 1 2 , 2 avant et 2 après la page courante, et les 3 dernieres
for($i=0;$i<=2;$i++) {
$o=$i*$count;
if ($offset==$o) {
echo $i." ";
} else {
echo "<a href=\"".str_replace("%%offset%%",$o,$url)."\">$i</a> ";
}
}
if ($offset>=$count && $offset<($total-2*$count)) { // On est entre les milieux ...
// On affiche 2 avant jusque 2 après l'offset courant mais sans déborder sur les indices affichés autour
$start=max(3,intval($offset/$count)-2);
$end=min(intval($offset/$count)+3,intval($total/$count)-3);
if ($start!=3) echo " ... ";
for($i=$start;$i<$end;$i++) {
$o=$i*$count;
if ($offset==$o) {
echo $i." ";
} else {
echo "<a href=\"".str_replace("%%offset%%",$o,$url)."\">$i</a> ";
}
}
if ($end!=intval($total/$count)-3) echo " ... ";
} else {
echo " ... ";
}
for($i=intval($total/$count)-3;$i<$total/$count;$i++) {
$o=$i*$count;
if ($offset==$o) {
echo $i." ";
} else {
echo "<a href=\"".str_replace("%%offset%%",$o,$url)."\">$i</a> ";
}
}
echo " - ";
} // More than 10 pages?
}
// Shall-we show the next page link ?
if ($offset+$count<$total) {
$o=$offset+$count;
echo "<a href=\"".str_replace("%%offset%%",$o,$url)."\" alt=\"(Ctl/Alt-s)\" title=\"(Alt-s)\" accesskey=\"s\">"._("Next Page")."</a> ";
} else {
echo _("Next Page")." ";
}
echo $after;
}
panel_islocked ( )

Definition at line 765 of file functions.php.

References ALTERNC_LOCK_PANEL.

Referenced by m_mem\checkid(), and m_mem\login().

{
return file_exists(ALTERNC_LOCK_PANEL);
}
panel_lock ( )

Definition at line 753 of file functions.php.

References $cuid, $err, $mem, and ALTERNC_LOCK_PANEL.

{
global $err,$mem,$cuid;
if ($cuid!=2000) return false;
return touch(ALTERNC_LOCK_PANEL);
}
panel_unlock ( )

Definition at line 759 of file functions.php.

References $cuid, $err, $mem, and ALTERNC_LOCK_PANEL.

{
global $err,$mem,$cuid;
if ($cuid!=2000) return false;
return unlink(ALTERNC_LOCK_PANEL);
}
PercentToColor (   $p = 0)

Definition at line 741 of file functions.php.

References $p, and fHSVtoRGB().

{
if ($p>100) $p=100;
if ($p<0) $p=0;
// Pour aller de vert a rouge en passant par jaune et orange
$h = 1+((100-$p)*130/100);
$rvb = fHSVtoRGB( (int)$h, 96, 93);
$color = "#".hexa($rvb['r']).hexa($rvb['g']).hexa($rvb['b']);
return $color;
}
pretty_months (   $months)

Converti un nombre de mois en une chaine plus lisible.

Parameters
number$monthsNombre de mois
Returns
string Chaîne représentant le nombre de mois private

Definition at line 386 of file functions.php.

Referenced by duration_list().

{
if( $months % 12 == 0 && $months > 11) {
$years = $months / 12;
return "$years " . ($years > 1 ? _("years") : _("year"));
} else {
return "$months " . ($months > 1 ? _("months") : _("month"));
}
}
printVar (   $array)

Definition at line 503 of file functions.php.

{
echo "<pre style=\"border: 1px solid black; text-align: left; font-size: 9px\">\n";
print_r($array);
echo "</pre>\n";
}
selected (   $bool)

Definition at line 243 of file functions.php.

{
if ($bool) {
echo " selected=\"selected\"";
}
}
split_mysql_database_name (   $dbname)

split mysql database name between username and custom database name

Parameters
string$dbnamedatabase name
Returns
array returns username as first element, custom name as second

Definition at line 363 of file functions.php.

Referenced by m_mysql\get_dblist(), and m_mysql\get_mysql_details().

{
$db_exploded_name = explode("_",$dbname);
return array($db_exploded_name[0],
implode("_", array_slice($db_exploded_name, 1)));
}
ssla (   $str)

Definition at line 334 of file functions.php.

Referenced by m_bro\ChangePermissions(), m_bro\CopyFile(), m_bro\CreateDir(), m_bro\CreateFile(), m_bro\DeleteFile(), m_bro\MoveFile(), and m_bro\RenameFile().

{
if (get_magic_quotes_gpc()) {
return stripslashes($str);
} else {
return $str;
}
}
variable_get (   $name,
  $default = null,
  $createit_comment = null,
  $type = null 
)

Definition at line 33 of file functions.php.

References $variables.

Referenced by m_action\archive(), m_admin\hook_admin_add_member(), m_admin\m_admin(), m_dom\m_dom(), m_ftp\m_ftp(), m_lxc\m_lxc(), m_mail\m_mail(), m_mysql\m_mysql(), m_piwik\m_piwik(), m_quota\m_quota(), and m_mysql\put_mysql_backup().

{
global $variables;
return $variables->variable_get($name, $default, $createit_comment, $type);
}
xml_entities (   $string)

Echappe les caractères pouvant perturber un flux XML standard :

Parameters
string$stringChaine de caractère à encoder en valeur xml.
Returns
string Retourne la chaîne modifiée si besoin. private

Definition at line 376 of file functions.php.

{
return str_replace("<","&lt;",str_replace(">","&gt;",str_replace("&","&amp;",$string)));
}

Variable Documentation

const DEFAULT_PASS_SIZE = 8

Definition at line 615 of file functions.php.