function zoom_popup(){ $q=new mysql(); $page=CurrentPageName(); $tpl=new templates(); $MAIN=unserialize(base64_decode($_GET["zoom-popup"])); if(is_numeric($MAIN["ID"])){ $ligne=mysql_fetch_array($q->QUERY_SQL("SELECT eth,rulename FROM iptables_main WHERE ID='{$MAIN["ID"]}'","artica_backup")); $title="{$ligne["eth"]}::".$tpl->javascript_parse_text($ligne["rulename"]); } $html="<div style='font-size:26px'>$title</div> <div style='width:98%' class=form> <table style='width:100%'> "; unset($MAIN['MAC']); unset($MAIN['ID']); while (list ($num, $line) = each ($MAIN)){ $tr[]="<tr> <td class=legend style='font-size:18px;width=1%' nowrap>$num</td> <td style='font-size:18px'>$line</td> </tr>"; } $html=$html.@implode("", $tr)."</table></div>"; echo $tpl->_ENGINE_parse_body($html); }
function create_user_from_mysql() { $q = new mysql(); ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); ini_set('error_prepend_string', null); ini_set('error_append_string', null); $GLOBALS["WAIT"] = true; build_progress("{start}", 10); $results = $q->QUERY_SQL("SELECT * FROM CreateUserQueue", "artica_backup"); if (!$q->ok) { echo $q->mysql_error; build_progress("MySQL error", 110); return; } @mkdir("/usr/share/artica-postfix/ressources/logs/web/create-users", 0755, true); echo mysql_num_rows($results) . " member(s) to create...\n"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $zMD5 = $ligne["zMD5"]; $content = $ligne["content"]; @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/create-users/{$zMD5}", $content); if (create_user($zMD5)) { build_progress("{removing_order}", 95); $q->QUERY_SQL("DELETE FROM `CreateUserQueue` WHERE `zMD5`='{$zMD5}'", "artica_backup"); } else { $q->QUERY_SQL("DELETE FROM `CreateUserQueue` WHERE `zMD5`='{$zMD5}'", "artica_backup"); build_progress("{failed}", 110); return; } } build_progress("{done}", 100); }
function postfix_status() { $user = new usersMenus(); if (!$user->POSTFIX_INSTALLED) { return null; } $user->LoadModulesEnabled(); $q = new mysql(); $fetchmail_count = 0; if ($user->fetchmail_installed) { BuildingExecRightStatus("Building fetchmail statistics...", 25); $sql = "SELECT COUNT(ID) as tcount FROM `fetchmail_events` WHERE DATE_FORMAT(zDate,'%Y-%m-%d')=DATE_FORMAT( NOW( ) ,'%Y-%m-%d' )"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events')); $fetchmail_count = $ligne["tcount"]; $sql = "SELECT SUM(size) as tcount FROM `fetchmail_events` WHERE DATE_FORMAT(zDate,'%Y-%m-%d')=DATE_FORMAT( NOW( ) ,'%Y-%m-%d' )"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events')); $fetchmail_size = FormatBytes($ligne["tcount"] / 1024); events("fetchmail_count={$fetchmail_count}, fetchmail_size={$fetchmail_size}"); } else { events('Fetchmail is not installed'); } BuildingExecRightStatus("Building storage statistics...", 30); $sql = "SELECT COUNT( MessageID ) as tcount FROM storage WHERE DATE_FORMAT( zDate, '%Y-%m-%d' ) = DATE_FORMAT( NOW( ) , '%Y-%m-%d' ) "; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); $backuped_mails = $ligne["tcount"]; BuildingExecRightStatus("Building quarantine statistics...", 35); $sql = "SELECT COUNT( MessageID ) as tcount FROM quarantine WHERE DATE_FORMAT( zDate, '%Y-%m-%d' ) = DATE_FORMAT( NOW( ) , '%Y-%m-%d' ) "; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); $quarantine_mails = $ligne["tcount"]; BuildingExecRightStatus("Building messages number statistics...", 40); $sql = "SELECT COUNT(ID) as tcount FROM `smtp_logs` WHERE DATE_FORMAT( time_sended, '%Y-%m-%d' ) = DATE_FORMAT( NOW( ) , '%Y-%m-%d' )"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events')); $flow_mails = $ligne["tcount"]; if ($user->cyrus_imapd_installed) { BuildingExecRightStatus("Building imap/pop3 number statistics...", 45); $sql = "SELECT COUNT(ID) as tcount FROM `mbx_con` WHERE DATE_FORMAT( zDate, '%Y-%m-%d' ) = DATE_FORMAT( NOW( ) , '%Y-%m-%d' )"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events')); $mbx_con = $ligne["tcount"]; $mbx_con = "<tr>\n\t\t\t<td class=legend nowrap>{mbx_con}:</td>\n\t\t\t<td style='font-size:12px;font-weight:bold'>{$mbx_con} {connections}</td>\n\t\t</tr>"; } if ($fetchmail_count > 0) { $fetchmail = "<tr>\n\t\t\t<td class=legend nowrap>{fetchmail_recup}:</td>\n\t\t\t<td style='font-size:12px;font-weight:bold'>{$fetchmail_count} {emails} ({$fetchmail_size})</td>\n\t\t</tr>"; } $html = "\n\t<H5>Postfix: {today}</h5>\n\t<table class=table_form>\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{received_mails}:</td>\n\t\t\t<td style='font-size:12px;font-weight:bold'>{$flow_mails}</td>\n\t\t</tr>\n\t\t{$mbx_con}\t\n\t\t{$fetchmail}\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{backuped_mails}:</td>\n\t\t\t<td style='font-size:12px;font-weight:bold'>{$backuped_mails}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{quarantine_mails}:</td>\n\t\t\t<td style='font-size:12px;font-weight:bold'>{$quarantine_mails}</td>\n\t\t</tr>\n\t</table>\n\t\t\t\t\t\t\n\t\n\t"; if ($user->AMAVIS_INSTALLED) { if ($user->EnableAmavisDaemon) { BuildingExecRightStatus("Building Amavis statistics...", 50); $ini = new Bs_IniHandler(); $sock = new sockets(); $ini->loadString($sock->getfile('amavisstatus')); $status_amavis = DAEMON_STATUS_ROUND("AMAVISD", $ini, null); $status_amavismilter = DAEMON_STATUS_ROUND("AMAVISD_MILTER", $ini, null); $status = "<br>{$status_amavis}<br>{$status_amavismilter}"; } } $html = RoundedLightGrey($html) . $status . "<br>"; file_put_contents('/usr/share/artica-postfix/ressources/logs/status.postfix.flow.html', $html); system('/bin/chmod 755 /usr/share/artica-postfix/ressources/logs/status.postfix.flow.html'); BuildingExecRightStatus("Building done...", 100); }
function cnx_list() { $page = CurrentPageName(); $tpl = new templates(); $html = "\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{$refresh}</th>\n\t\t<th>{date}</th>\n\t\t<th>{server}</th>\n\t\t<th>{member}</th>\n\t\t<th>{panel}</th>\n\t\t<th>{ipaddr}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $sql = "SELECT * FROM admin_cnx ORDER BY connected DESC LIMIT 0,100"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_events"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } if ($ligne["uid"] == -100) { $uid = "Manager"; } else { $u = new user($ligne["uid"]); $uid = $u->DisplayName; } $date = date('H:i:s', strtotime($ligne["connected"])); $html = $html . "<tr class={$classtr}>\n\t\t<td width=1%><img src='img/user-32.png'></td>\n\t\t<td style='font-size:11px'>{$date}</td>\n\t\t<td style='font-size:11px'>{$ligne["webserver"]}</td>\n\t\t<td style='font-size:11px'>{$uid}</td>\n\t\t<td style='font-size:11px'>{$ligne["InterfaceType"]}</td>\n\t\t<td style='font-size:11px'>{$ligne["ipaddr"]} ({$ligne["hostname"]})</td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>"; echo $tpl->_ENGINE_parse_body($html); }
function Save() { $sock = new sockets(); $disksize = $_POST["disksize"]; $UpdateUtilityStorePath = $_POST["UpdateUtilityStorePath"]; $HardDriveSizeMB = unserialize(base64_decode($sock->getFrameWork("system.php?HardDriveDiskSizeMB=" . base64_encode($UpdateUtilityStorePath)))); if (!is_array($HardDriveSizeMB)) { echo "Fatal Error Cannot retreive information for `{$UpdateUtilityStorePath}`"; return; } if ($disksize < 2500) { echo "Fatal 2500MB minimal size"; return; } $AVAILABLEMB = $HardDriveSizeMB["AVAILABLE"]; if ($AVAILABLEMB < $disksize) { $T = $disksize - $AVAILABLEMB; echo "Fatal Error : Available: {$AVAILABLEMB}MB, need at least {$T}MB"; return; } $sql = "INSERT INTO loop_disks (`path`,`size`,`disk_name`,`maxfds`) VALUES ('{$UpdateUtilityStorePath}','{$disksize}','UpdateUtility','25000')"; $q = new mysql(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $sock = new sockets(); $sock->SET_INFO("UpdateUtilityUseLoop", 1); $sock->getFrameWork("lvm.php?loopcheck=yes"); $sock->getFrameWork("freeweb.php?reconfigure-updateutility=yes"); }
function install_app() { $sock = new sockets(); $tpl = new templates(); $q = new mysql(); $sql = "SELECT upgrade FROM setup_center WHERE CODE_NAME='{$_GET["product"]}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["upgrade"] == 1) { $echo = $tpl->javascript_parse_text("{installapp_already_scheduled}", 1); return; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT CODE_NAME FROM setup_center WHERE CODE_NAME='{$_GET["product"]}'", "artica_backup")); if ($ligne["CODE_NAME"] == null) { $q->QUERY_SQL("INSERT IGNORE INTO setup_center (upgrade,progress,progress_text,CODE_NAME) VALUES(1,5,'{scheduled}','{$_GET["product"]}')", "artica_backup"); } else { $q->QUERY_SQL("UPDATE setup_center SET upgrade=1,progress=5,progress_text='{scheduled}',events='' WHERE CODE_NAME='{$_GET["product"]}'", "artica_backup"); } if (!$q->ok) { echo $q->mysql_error; return; } $echo = "{{$_GET["product"]}}\n{installation_lauched}"; $echo = $tpl->javascript_parse_text($echo, 1); echo $echo; }
function EnablePolicyd() { $unix = new unix(); $php = $unix->LOCATE_PHP5_BIN(); system("{$php} " . dirname(__FILE__) . "/exec.postfix.maincf.php--smtpd-client-restrictions"); $q = new mysql(); $sql = "SELECT * FROM postfix_whitelist_con"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "{$q->mysql_error}\n"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $finalwhitelist[] = $ligne["ipaddr"] . "\tOK"; if (strpos($ligne["hostname"], "*") == 0) { $finalwhitelist[] = $ligne["hostname"] . "\tOK"; } } if (is_array($finalwhitelist)) { $conf = implode("\n", $finalwhitelist); } events("saving " . strlen($conf) . " bytes length in /etc/postfix/wbl_connections"); @file_put_contents("/etc/postfix/wbl_connections", $conf); system("postmap hash:/etc/postfix/wbl_connections"); events("adding policyd-weight done..."); }
function idclustered($md5) { $sql = "SELECT ID FROM gluster_paths WHERE zmd='{$md5}'"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); return $ligne["ID"]; }
public function chk_login() { global $db, $config, $enterprisemodel; $r['err'] = ''; $db2 = new mysql($config["db2"]); $db2->connect(); $query = "SELECT * FROM `{$config['db'][0]['dbname']}`.`{$config['default_prefix']}enterprise` e\r\n\t\t JOIN `{$config['db'][0]['dbname']}`.`{$config['default_prefix']}enterprise_profile` ep\r\n\t\t\t\t ON e.enterpriseid=ep.enterpriseid and e.switch='Y'\r\n\t\t WHERE e.prefixid = '{$config['default_prefix_id']}' \r\n\t\t\t AND e.loginname = '{$_POST['loginname']}' \r\n\t\t\t AND e.switch = 'Y' \r\n\t\t LIMIT 1\r\n\t\t"; error_log("[ajax/enterprise.chk_login]" . $query); $table = $db2->getQueryRecord($query); if (empty($table['table']['record'])) { //'账号不存在' $r['err'] = 3; } else { $_SESSION['sajamanagement']['enterprise'] = ''; $enterprise = $table['table']['record'][0]; $passwd = $this->str->strEncode($_POST['passwd'], $config['encode_key']); if ($enterprise['passwd'] === $passwd) { $_SESSION['sajamanagement']['enterprise'] = $enterprise; setcookie("enterpriseid", $enterprise['enterpriseid'], time() + 43200, "/", COOKIE_DOMAIN); $r['err'] = ''; } else { //'密码不正确' $r['err'] = 5; } } return $r; }
function schedules(){ $unix=new unix(); $files=$unix->DirFiles("/etc/cron.d"); $cron=new cron_macros(); $php5=$unix->LOCATE_PHP5_BIN(); while (list ($index, $line) = each ($files) ){ if($index==null){continue;} if(preg_match("#^LdapImport-#",$index)){ @unlink("/etc/cron.d/$index"); } } $sql="SELECT * FROM ldap_ou_import WHERE enabled=1"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_backup"); while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){ if(trim($ligne["ScheduleMin"]==null)){continue;} $schedule=$cron->cron_defined_macros[$ligne["ScheduleMin"]]; $f[]="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/share/artica-postfix/bin"; $f[]="MAILTO=\"\""; $f[]="$schedule root $php5 ".__FILE__." --import {$ligne["ID"]}"; $f[]=""; @file_put_contents("/etc/cron.d/LdapImport-{$ligne["ID"]}",implode("\n",$f)); @chmod("/etc/cron.d/LdapImport-{$ligne["ID"]}",600); unset($f); } }
function BuildDayTable() { $q = new mysql(); $q->BuildTables(); if (!$q->TABLE_EXISTS('smtp_logs_day', 'artica_events')) { send_email_events("Mysql error on smtp_logs_day table", "Artica was unable to create or detect smtp_logs_day table...", "system"); return false; } $today = date('Y-m-d'); $sql = "SELECT COUNT(id) as tcount,delivery_domain,DATE_FORMAT(time_stamp,'%Y-%m-%d') as tdate,bounce_error FROM \n\tsmtp_logs \n\tGROUP BY delivery_domain,tdate,bounce_error HAVING tdate<'{$today}' ORDER BY tdate DESC"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "Wrong sql query {$q->mysql_error}\n"; write_syslog("Wrong sql query {$q->mysql_error}", __FILE__); return false; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $count = $count + 1; $emails = $ligne["tcount"]; $delivery_domain = $ligne["delivery_domain"]; $date = $ligne["tdate"]; $bounce_error = $ligne["bounce_error"]; $md5 = md5($delivery_domain . $date . $bounce_error . $emails); $sql = "INSERT IGNORE INTO smtp_logs_day (`key`,`day`,`delivery_domain`,`bounce_error`,`emails`)\n\t\tVALUES('{$md5}','{$date}','{$delivery_domain}','{$bounce_error}','{$emails}')"; $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "Wrong sql query {$q->mysql_error}\n"; write_syslog("Wrong sql query \"{$sql}\" {$q->mysql_error}", __FILE__); return false; } } return true; }
function view_stats() { if (!privs()) { die; } $ou = $_GET["ou"]; $users = new usersMenus(); sql_domain($ou); $sql = "SELECT COUNT( ID ) AS tcount, DATE_FORMAT( time_stamp, '%m-%d' ) AS tday\nFROM smtp_logs\nWHERE {$GLOBALS["SQL_DOMAINS"]}\nAND time_stamp > DATE_ADD( NOW( ) , INTERVAL -7\nDAY )\nGROUP BY DATE_FORMAT( time_stamp, '%m-%d' )"; $q = new mysql(); //echo $sql; $g = new artica_graphs($fileName, 60); $results = $q->QUERY_SQL($sql, "artica_events"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $g->ydata[] = $ligne["tcount"]; $g->xdata[] = $ligne["tday"]; } //print_r($g->ydata); $fileName = "/usr/share/artica-postfix/ressources/logs/web/{$ou}-stats-7.png"; $g->title = "Inbound messages"; $g->x_title = "messages number"; $g->y_title = "days-month"; $g->width = 700; $g->filename = $fileName; $g->line_green(); echo "<img src='ressources/logs/web/{$ou}-stats-7.png'>"; }
function main_rules_exceptionsitelist_list($rule_main, $noecho = 0) { $dans = new dansguardian_rules($_GET["hostname"], $rule_main); $sql = "SELECT * FROM dansguardian_files WHERE filename='exceptionsitelist' AND RuleID={$rule_main} ORDER BY ID DESC"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); $style = CellRollOver(); $categ = "\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t<thead class='thead'>\n\t\t<tr>\n\t\t<th width=99% colspan=2> </th>\n\t\t</tr>\n\t</thead>\n\t<tbody class='tbody'>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $num = $ligne["ID"]; $pattern = $ligne["pattern"]; $categ = $categ . "<tr class={$classtr}>\n\t\t<td width=99%><strong style='font-size:16px'>{$pattern}</strong></td>\n\t\t<td width=1%>" . imgtootltip('delete-32.png', '{delete}', "exceptionsitelist_del('{$hostname}','{$rule_main}','{$num}')") . "</td>\n\t\t</tr>\n\t\t"; } $categ = $categ . "</table>"; $tpl = new templates(); if ($noecho == 1) { return $tpl->_ENGINE_parse_body("{$categ}"); } echo $tpl->_ENGINE_parse_body("{$categ}"); $tpl = new templates(); }
function operations_build($p, $o) { reqp('mysql'); //$ret=$p.'-'.$o; //$r=plugin('mysql',$p,$o); p($r); $msq = new mysql('qda'); //echo $msq->b; $msq->read('id,day', 'kv', 'frm="oaxiiboo 6" order by day ASC'); $r = $msq->ret; setlocale(LC_ALL, "fr_FR"); $dr = array('jan' => 'jan', 'fev' => 'feb', 'mars' => 'mar', 'avr.' => 'apr', 'mai' => 'may', 'juin' => 'jun', 'juil' => 'jul', 'août' => 'aug', 'sept' => 'sep', 'oct' => 'oct', 'nov' => 'nov', 'déc' => 'dec'); foreach ($r as $k => $v) { $nb++; //14.12.28 00.50 (122) //$suj=date('y.m.d H.i',$v).' ('.$nb.')'; //20:41 - 19 juin 2015 $suj = date("H:i - d M Y", $v); //$suj=strftime("%R - %e %b %G",$v); //$suj=date('H:i - d m Y',$v).' ('.$nb.')'; $suj = strtolower($suj); $suj = str_replace(array_values($dr), array_keys($dr), $suj); $suj .= ' (' . $nb . ')'; echo $suj . br(); //$msq->update('suj',$suj,'id',$k); } //p($r); return $ret; }
function main_extensions_bannedextensionslist_list($rule_main = null, $noecho = 0) { $q = new mysql(); if ($rule_main == null) { $rule_main = $_GET["rule_main"]; } $dans = new dansguardian_rules(null, $rule_main); writelogs("Loading RuleID={$rule_main}", __FUNCTION__, __FILE__); $sql = "SELECT * FROM dansguardian_files WHERE filename='bannedextensionlist' AND RuleID={$rule_main}"; writelogs("{$sql}", __FUNCTION__, __FILE__); $results = $q->QUERY_SQL($sql, "artica_backup"); $style = CellRollOver(); $categ = "\n\t<table style='width:99%' class=form>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $num = $ligne["ID"]; $onoff = Field_checkbox("bannedextensionlist_id_{$num}", 1, $ligne["enabled"], "bannedextensionlist_switch('{$num}')"); $ext = $ligne["pattern"]; $ext = str_replace('.', '', $ext); $img = "img/ext/def_small.gif"; if (file_exists("img/ext/{$ext}_small.gif")) { $img = "img/ext/{$ext}_small.gif"; } $categ = $categ . "<tr {$style}>\n\t\t<td width=1%><IMG SRC='{$img}' id='image_{$num}'></td>\n\t\t<td width=1%>{$onoff}</td>\n\t\t<td width=1% style='font-size:12px'> <strong id='pattern_{$num}'>{$ligne["pattern"]}</strong></td>\n\t\t<td width=98% style='font-size:12px'><strong id='info_{$num}'>{$ligne["infos"]}</strong></td>\n\t\t<td width=1%>" . imgtootltip('ed_delete.gif', '{delete}', "bannedextensionlist_del('{$hostname}','{$rule_main}','{$num}')") . "</td>\n\t\t</tr>\n\t\t"; } $categ = $categ . "</table>"; $tpl = new templates(); $categ = $tpl->_ENGINE_parse_body($categ); if ($noecho == 1) { return $categ; } echo $categ; }
function save() { $databasename = $_GET["databasename"]; $databasename = format_mysql_table($databasename); $ou = base64_decode($_GET["ou"]); $q = new mysql(); $tpl = new templates(); //CheckTableEmailingContacts while (list($key, $line) = each($_GET)) { if (preg_match("#DB_ADD_[0-9]+#", $key)) { $tables[] = "emailing_{$line}"; } } if (count($tables) == 0) { echo $tpl->javascript_parse_text("{NODB_SELECTED}"); return; } $q->CheckTableEmailingContacts("emailing_{$databasename}", $tables); if (!$q->ok) { echo $q->mysql_error; return; } $sql = "INSERT INTO emailing_db_paths (databasename,progress,finish,ou,zDate,merged)\n\tVALUES('{$databasename}','100','1','{$ou}',NOW(),'1');"; $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } }
function PostfixLogs() { include_once 'ressources/class.mysql.inc'; $sql = "SELECT * FROM events WHERE event_id={$_GET["event"]} ORDER BY zDate DESC LIMIT 0,100"; $my = new mysql(); $html = "<table style='width:100%'>"; $html = $html . "<tr style='background-color:#005447'>\n\t <td width=1%> </td>\n\t <td width=1% nowrap> </td>\n\t <td> </td>\n\t </tr>"; $resultat = $my->QUERY_SQL($sql, 'artica_events'); while ($ligne = @mysql_fetch_array($resultat, MYSQL_ASSOC)) { switch ($ligne["event_type"]) { case 0: $img = "icon_mini_warning.gif"; break; case 1: $img = "icon-mini-ok.gif"; break; case 2: $img = "icon-mini-info.gif"; break; default: $img = "icon-mini-info.gif"; break; } $html = $html . "<tr " . CellRollOver() . ">\n\t <td width=1%><img src='img/{$img}' style='margin:2px'></td>\n\t <td width=1% nowrap>{$ligne["zDate"]}</td>\n\t <td>{$ligne["text"]}</td>\n\t </tr>"; } $html = $html . "</table>"; $html = RoundedLightGrey($html); $page = $html; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($page); }
function popup() { $ou = base64_decode($_GET["ou"]); $sql = "SELECT ID,enabled,report_datas FROM reports WHERE ou='{$ou}' AND report_type=1"; $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $array = unserialize(base64_decode($ligne["report_datas"])); if ($array["day"] == null) { $array["day"] = 1; } if ($array["hour"] == null) { $array["hour"] = "5"; } if ($array["min"] == null) { $array["min"] = "0"; } if ($array["lastdays"] == null) { $array["lastdays"] = "7"; } $cron = new cron_macros(1); $days = $cron->cron_days; for ($i = 1; $i < 60; $i++) { $lastdays[$i] = $i; } $html = "\n\t" . Field_hidden("ID", $ligne["ID"]) . "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'><img src='img/postmaster-identity-128.png' id='report-image'></td>\n\t\t<td>\n\t\t<div style='font-size:14px' class=explain>{global_director_report_explain}</div>\n\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{enabled}:</td>\n\t\t\t<td>" . Field_checkbox("report_enabled", 1, $ligne["enabled"]) . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{generate_report_each}:</td>\n\t\t\t<td>" . Field_array_Hash($days, "day", $array["day"], null, null, 0, "font-size:13px;padding:3px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{time}:</td>\n\t\t\t<td><table style='width:1%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t" . Field_array_Hash($cron->cron_hours, "hour", $array["hour"], null, null, 0, "font-size:13px;padding:3px") . "</td>\n\t\t\t\t\t<td width=1% style='font-size:13px'>:</td>\n\t\t\t\t\t<td>" . Field_array_Hash($cron->cron_mins, "min", $array["min"], null, null, 0, "font-size:13px;padding:3px") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{recipient}:</td>\n\t\t\t<td>" . Field_text("recipient", $array["recipient"], "font-size:13px;padding:3px") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{last_days}:</td>\n\t\t\t<td>" . Field_array_Hash($lastdays, "lastdays", $array["lastdays"], null, null, 0, "font-size:13px;padding:3px") . "</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td colspan='2' align='right'><hr>" . button("{apply}", "DIRECTOR_SAVE()") . "</td>\n\t\t</tr>\n\t\t\n\t\t</table>\n\t\t\n\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function wizard_certificate_save() { $password = url_decode_special_tool($_POST["wizard-certificate-password"]); $password = mysql_escape_string2($password); $CommonName = url_decode_special_tool($_POST["wizard-certificate-commonname"]); $CommonName = strtolower(trim($CommonName)); if ($CommonName == null) { echo "CommonName, no such data"; return; } $q = new mysql(); $sql = "SELECT CommonName FROM sslcertificates WHERE CommonName='{$CommonName}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["CommonName"] != null) { echo "{$CommonName} Already exists...\n"; return; } $sql = "INSERT IGNORE INTO sslcertificates (CommonName,keyPassword,password) VALUES ('{$CommonName}','{$password}','{$password}')"; $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "MySQL Error:\n" . $q->mysq_error . "\n{$sql}"; return; } $sock = new sockets(); $CommonName = urlencode($CommonName); echo base64_decode($sock->getFrameWork("system.php?BuildCSR={$CommonName}")); }
function SaveInfos() { $q = new mysql(); $_POST["uid"] = addslashes($_POST["uid"]); $sql = "SELECT uid FROM quotaroot WHERE uid='{$_POST["uid"]}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!isset($_POST["GraceTime"])) { $_POST["GraceTime"] = 10080; } if (!is_numeric($_POST["GraceTime"])) { $_POST["GraceTime"] = 10080; } if ($ligne["uid"] == null) { $sql = "INSERT INTO quotaroot (`uid`,`block-hardlimit`,`block-softlimit`,`inode-softlimit`,`inode-hardlimit`,`enabled`,`GraceTime`) VALUES\n\t\t('{$_POST["uid"]}','{$_POST["block-hardlimit"]}','{$_POST["block-softlimit"]}','{$_POST["inode-softlimit"]}','{$_POST["inode-hardlimit"]}','{$_POST["enabled"]}','{$_POST["GraceTime"]}')"; } else { $sql = "UPDATE quotaroot SET \n\t\t\t`block-hardlimit`='{$_POST["block-hardlimit"]}',\n\t\t\t`block-softlimit`='{$_POST["block-softlimit"]}',\n\t\t\t`inode-hardlimit`='{$_POST["inode-hardlimit"]}',\n\t\t\t`inode-softlimit`='{$_POST["inode-softlimit"]}',\n\t\t\t`GraceTime`='{$_POST["GraceTime"]}',\n\t\t\t`enabled`='{$_POST["enabled"]}'\n\t\t\tWHERE `uid`='{$_POST["uid"]}'\n\t\t\t"; } $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error . "\nMySQL Command:\n{$sql}\n"; return; } $sock = new sockets(); $sock->getFrameWork("services.php?setquotas=yes"); }
function infos() { $q = new mysql(); $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $sql = "SELECT * FROM kav4proxy_license ORDER BY expiredate DESC LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $expiredate_color = "black"; $expiredate = $ligne["expiredate"]; $expiredate = strtotime($expiredate); $button = "<hr><div style='width:100%;text-align:right'>" . button("{license_manager}", "YahooWin5Hide();Loadjs('Kav4Proxy.license-manager.php')", 18) . "</div>"; if ($expiredate - time() < 0) { $expiredate_color = "#B60000"; $button = "<hr><div style='width:100%;text-align:right'>" . button("{renew}", "YahooWin5Hide();Loadjs('Kav4Proxy.license-manager.php')", 18) . "</div>"; } if ($tpl->language == "fr") { $expiredate = date("Y l F d", $expiredate); } else { $expiredate = date("{l} d {F} Y", $expiredate); } $t = time(); $html = "\n\t<div style='width:97%' id='div-{$t}' class=form>\t\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t\n\t\t<td style='font-weight:bold;font-size:16px;color:{$expiredate_color}' colspan=2>{$ligne["productname"]}<hr></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px;color:{$expiredate_color}'>{key_file}:</td>\n\t\t<td style='font-weight:bold;font-size:16px;color:{$expiredate_color}'>{$ligne["keyfile"]}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px;color:{$expiredate_color}'>{serial}:</td>\n\t\t<td style='font-weight:bold;font-size:16px;color:{$expiredate_color}'>{$ligne["serial"]}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px;color:{$expiredate_color}'>{creationdate}:</td>\n\t\t<td style='font-weight:bold;font-size:16px;color:{$expiredate_color}'>{$ligne["creationdate"]}</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px;color:{$expiredate_color}'>{expiredate}:</td>\n\t\t<td style='font-weight:bold;font-size:16px;color:{$expiredate_color}'>{$expiredate}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px;color:{$expiredate_color}'>{lifespan}:</td>\n\t\t<td style='font-weight:bold;font-size:16px;color:{$expiredate_color}'>{$ligne["lifespan"]} {days}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{rescan}", "Rescan{$t}()", 14) . "</td>\n\t</tr>\t\t\t\t\n\t</table>\n\t</div>\n\t{$button}\n\t\n<script>\nvar xRescan{$t} = function (obj) {\n\tdocument.getElementById('div-{$t}').innerHTML='';\n\tYahooWin5Hide();\n\tLoadjs('{$page}');\n}\t\n\t\nfunction Rescan{$t}(){\nvar XHR = new XHRConnection();\n\tXHR.appendData('xrescan',1);\n\tdocument.getElementById('div-{$t}').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\tXHR.sendAndLoad('{$page}', 'POST',xRescan{$t});\t\n}\n</script>\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $databases = $q->DATABASE_LIST(); while (list($database, $line) = each($databases)) { $tbs = $tbs + $line[0]; $tx = trim($line[1]); $re = explode(" ", $tx); $tsize = $re[0]; $unit = $re[1]; if ($unit == "KB") { $size = $size + $tsize; } if ($unit == "MB") { $tsize = intval($tsize) * 1024; $size = $size + $tsize; } if ($unit == "GB") { $tsize = intval($tsize) * 1024; $tsize = $tsize * 1024; $size = $size + $tsize; } } $text = $tpl->javascript_parse_text("{convertto_innodb_file_per_tableask}"); $text = str_replace("%free", "{$size}", $text); $text = str_replace("%tablesnum", "{$tbs}", $text); $t = time(); $html = "\n\t<center id='{$t}-div'></center>\n\t<div class=explain style='font-size:14px'>{convertto_innodb_file_per_table_text}</div>\n\t<div style='text-align:right;text-decoration:underline'><a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('http://www.mail-appliance.org/index.php?cID=278','1024','900');\" style='font-size:16px;'>{online_help}</a></div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td align='center' style='padding:10px'>" . button("{convertto_innodb_file_per_table}", "ConvertInnodb{$t}()", "18px") . "</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tvar x_ConvertInnodb{$t}= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tdocument.location.href='admin.index.php';\n\t\t\t\n\t\t}\n\t\n\t\tfunction ConvertInnodb{$t}(){\n\t\t\tif(confirm('{$text}')){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('ConvertInnoDB','yes');\n\t\t\t\tAnimateDiv('{$t}-div');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ConvertInnodb{$t});\t\n\t\t\t}\t\t\n\t\t\n\t\t}\t\n\t\t\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function ActionItem() { $servicename = $_GET["servicename"]; $selected = $_GET["selected"]; $t = $_GET["t"]; $q = new mysql(); $ARRAY = array(); if ($selected == 1) { $sql = "SELECT ID,groupname FROM haproxy_backends_groups WHERE servicename='{$servicename}'"; $results = $q->QUERY_SQL($sql, 'artica_backup'); while ($ligne = mysql_fetch_assoc($results)) { $ARRAY[$ligne["ID"]] = $ligne["groupname"]; } echo field_array_Hash($ARRAY, "rule_action_data-{$t}", $_GET["rule_action_data"], "blur()", null, 0, "font-size:22px", false); return; } if ($selected == 2) { $sql = "SELECT ID,backendname FROM haproxy_backends WHERE servicename='{$servicename}'"; $results = $q->QUERY_SQL($sql, 'artica_backup'); while ($ligne = mysql_fetch_assoc($results)) { $ARRAY[$ligne["ID"]] = $ligne["backendname"]; } echo field_array_Hash($ARRAY, "rule_action_data-{$t}", $_GET["rule_action_data"], "blur()", null, 0, "font-size:22px", false); return; } if ($selected == 3) { $ARRAY[null] = "{deny}"; echo field_array_Hash($ARRAY, "rule_action_data-{$t}", $_GET["rule_action_data"], "blur()", null, 0, "font-size:22px", false); } }
function SAVE_SCRIPT() { $gpid = $_POST["gpid"]; $_POST["script_data"] = stripslashes($_POST["script_data"]); $_POST["script_data"] = str_replace("\n\n", "\n", $_POST["script_data"]); $datas = base64_encode($_POST["script_data"]); $sql = "SELECT gpid FROM logon_scripts WHERE gpid={$gpid}"; $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $sql_edit = "UPDATE logon_scripts SET script_code='{$datas}' WHERE gpid={$gpid}"; $sql_add = "INSERT INTO logon_scripts(gpid,script_code) VALUES({$gpid},'{$datas}');"; if ($ligne["gpid"] == null) { $sql = $sql_add; } else { $sql = $sql_edit; } $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; } else { $tpl = new templates(); echo $tpl->javascript_parse_text("{success}"); $sock = new sockets(); $sock->getFrameWork("cmd.php?smb-logon-scripts=yes"); } }
public function cargar_horas_disponibles() { $fecha = trim($_POST['date']); die('FECHA: ' . $fecha); //list($dia,$mes,$ano) = explode("-",$fecha); //die ($dia.'-'.$mes.'-'.$ano); //$fecha = $ano.'-'.$mes.'-'.$dia; //$fecha = "2012-08-16"; $this->fecha = $fecha; $mysql = new mysql(); $result = $mysql->verificar_horarios($this->fecha); $horarios_consulta = array("1:00", "1:30", "2:00", "2:30", "3:00", "3:30", "4:00", "4:30", "5:00", "5:30"); $horarios_consulta_disponible_bd = array(); while ($Rs = mysql_fetch_assoc($result)) { array_push($horarios_consulta_disponible_bd, substr($Rs['hora'], 1, 4)); } $horarios_consulta_length = count($horarios_consulta); $horarios_consulta_disponible_bd_length = count($horarios_consulta_disponible_bd); for ($i = 0; $i < $horarios_consulta_length; $i++) { for ($j = 0; $j < $horarios_consulta_disponible_bd_length; $j++) { if ($horarios_consulta[$i] == $horarios_consulta_disponible_bd[$j]) { unset($horarios_consulta[$i]); $horarios_consulta = array_values($horarios_consulta); $horarios_consulta_length--; } } } $horarios_consulta_length = count($horarios_consulta); $this->horarios_consulta = $horarios_consulta; $this->horarios_consulta_length = $horarios_consulta_length; }
function process_message($msg) { echo "\n############ 信息日志开始 ###############\n"; echo date('Y-m-d H:i:s') . "=====" . $msg->body; echo "\n############ 信息日志结束 ###############\n"; //执行SQL语句 $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], ''); $dbConn->select_db($db_config["master1"][4]); $sql = $msg->body; $query = $dbConn->query($sql); if (!$query) { Log::write($sql, Log::ERR); } else { echo date('Y-m-d H:i:s') . '===== [ok] ', '=====', $sql, "\n"; //确认消费OK $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']); } $dbConn->close(); // Send a message with the string "quit" to cancel the consumer. if ($msg->body === 'quit') { $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']); } }
function STREAM_LINE() { $sock = new sockets(); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($EnableWebProxyStatsAppliance == 0) { writelogs("EnableWebProxyStatsAppliance={$EnableWebProxyStatsAppliance} from " . $_SERVER["REMOTE_ADDR"] . " (aborting)", __FUNCTION__, __FILE__, __LINE__); die; } $q = new mysql(); $sql = base64_decode($_POST["STREAM_LINE"]); $q->BuildTables(); $hostname = $_POST["HOSTNAME"]; $q->QUERY_SQL("DELETE FROM youtubecache WHERE proxyname='{$hostname}'", "artica_events"); $q->QUERY_SQL($sql, "artica_events"); if ($sql == null) { return; } if (!$q->QUERY_SQL($sql, "artica_events")) { writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " ({$_POST["HOSTNAME"]}) (failed)", __FUNCTION__, __FILE__, __LINE__); writelogs("Mysql error: `{$q->mysql_error}`", __FUNCTION__, __FILE__, __LINE__); writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__); writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__); writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__); echo "{$q->mysql_error}\n"; die; } writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " (success)", __FUNCTION__, __FILE__, __LINE__); echo "<ANSWER>OK</ANSWER>\n"; }
function popup_list() { include_once 'ressources/class.freeweb.inc'; $MyPage = CurrentPageName(); $tpl = new templates(); $data = array(); $data['page'] = 1; $data['total'] = 0; $data['rows'] = array(); $t = $_GET["t"]; $sql = "SELECT datasbackup FROM backup_schedules WHERE ID='{$_GET["ID"]}'"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $ressources = unserialize(base64_decode($ligne["datasbackup"])); $c = 0; if (is_array($ressources)) { while (list($num, $val) = each($ressources)) { if (is_array($val)) { continue; } $val = str_replace("all", "{BACKUP_ALL_MEANS}", $val); if (preg_match("#MYSQLINSTANCE:([0-9]+)#", $val, $re)) { $sql = "SELECT servername FROM mysqlmulti WHERE ID={$re[1]}"; $ligne2 = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $MysqlInstanceName = $ligne2["servername"]; $val = "{mysql_instance_databases} «{$MysqlInstanceName}»"; } if (preg_match("#FREEWEB:(.+)#", $val, $re)) { $free = new freeweb($re[1]); $val = "{website} «{$re[1]}»"; } if (preg_match("#WEBGET:(.+)#", $val, $re)) { $arr = unserialize(base64_decode($re[1])); if ($arr["AutoRestore"] == 1) { $AutorestoreText = " {and} {auto-restore} {to} {$arr["AutoRestoreSiteName"]}"; } $val = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('backup.sources.WebGet.php?taskid={$_GET["ID"]}&index={$num}');\"\n\t\t\tstyle='text-decoration:underline;font-weight:bold'>WebGET {remote_artica_server} «{$arr["RemoteArticaSite"]}»</a><br>{from}: «{$arr["RemoteArticaServer"]}»{$AutorestoreText}"; } $val = $tpl->_ENGINE_parse_body($val); $c++; $data['rows'][] = array('id' => $num, 'cell' => array("<STRONG style='font-size:14px'>{$num}</STRONG>", "<code style='font-size:14px;font-weight:bold'>{$val}</code>", imgsimple("delete-24.png", "{delete}", "DELETE_BACKUP_SOURCES{$t}({$_GET["ID"]},{$num})"))); } } $folder = $tpl->_ENGINE_parse_body("{folder}"); $sql = "SELECT * FROM backup_folders WHERE taskid={$_GET["ID"]}"; $results = $q->QUERY_SQL($sql, "artica_backup"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $c++; if ($ligne["recursive"] == 1) { $ligne["recursive"] = "{enabled}"; } else { $ligne["recursive"] = "{disabled}"; } $ligne["recursive"] = $tpl->_ENGINE_parse_body($ligne["recursive"]); $id = md5(base64_decode($ligne["path"])); $data['rows'][] = array('id' => $id, 'cell' => array("<STRONG style='font-size:14px'>{$folder} ({$ligne["recursive"]})</STRONG>", "<code style='font-size:14px;font-weight:bold'><code>" . base64_decode($ligne["path"]) . "</code></code>", " ")); } $data['total'] = $c; echo json_encode($data); }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $q = new mysql(); $sql = "SELECT * FROM officials_domains ORDER BY domain"; writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $domains[$ligne["domain"]] = $ligne["domain"]; } $OverWriteRestrictedDomains = 0; if ($users->OverWriteRestrictedDomains) { $OverWriteRestrictedDomains = 1; } if ($OverWriteRestrictedDomains == 1) { $over = "\n\t\t<hr>\n\t\t<div class=explain>{OverWriteRestrictedDomains_allow_text}</div>\n\t\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{domain}:</td>\n\t\t<td width=100%>" . Field_text("overwrite-domain", null, "font-size:16px;padding:3px;width:320px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "AddSubdomainOUOver()") . "</td>\n\t</tr>\n\t</table>\n\t\t"; } $_GET["ou"] = urlencode($_GET["ou"]); $domains[null] = "{select}"; $html = "\n\t<div id='add_subdomain_explain'></div>\n\t<div class=explain >{add_subdomain_explain}</div>\n\t\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{subdomain}:</td>\n\t\t<td width=50%>" . Field_text("subdomain", null, "font-size:16px;padding:3px;width:220px") . "</td>\n\t\t<td style='font-size:16px;padding:3px' width=1%><strong>.</strong></td>\n\t\t<td width=50%>" . Field_array_Hash($domains, "maindomain", null, "style:font-size:16px;padding:3px;") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=4 align='right'><hr>" . button("{add}", "AddSubdomainOU()") . "</td>\n\t</tr>\n\t</table>\n\t{$over}\n\t<script>\n\tvar x_AddSubdomainOU= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tdocument.getElementById('subdomain').innerHTML='';\n\t\tif(results.length>3){alert(results);return;}\n\t\tYahooWin4Hide();\n\t\tLoadAjax('LocalDomainsList','domains.edit.domains.php?LocalDomainList=yes&ou={$_GET["ou"]}');\n\t}\t\t\n\t\t\n\t\tfunction AddSubdomainOU(){\n\t\t\tvar maindomain=document.getElementById('maindomain').value;\n\t\t\tvar subdomain=document.getElementById('subdomain').value;\n\t\t\tif(maindomain.length<3){return;}\n\t\t\tif(subdomain.length<3){return;}\n\t\t\tvar domain=subdomain+'.'+maindomain;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('AddNewInternetDomain','{$_GET["ou"]}');\n\t\t\tXHR.appendData('AddNewInternetDomainDomainName',domain);\t\n\t\t\tAnimateDiv('add_subdomain_explain');\n\t\t\tXHR.sendAndLoad('domains.edit.domains.php', 'GET',x_AddSubdomainOU);\n\t\t\t\n\t\t}\n\t\t\n\t\tfunction AddSubdomainOUOver(){\n\t\t\tvar maindomain=document.getElementById('overwrite-domain').value;\n\t\t\tif(maindomain.length<3){return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('AddNewInternetDomain','{$_GET["ou"]}');\n\t\t\tXHR.appendData('AddNewInternetDomainDomainName',maindomain);\t\n\t\t\tAnimateDiv('add_subdomain_explain');\n\t\t\tXHR.sendAndLoad('domains.edit.domains.php', 'GET',x_AddSubdomainOU);\t\t\t\n\t\t}\n\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
public static function getStatus() { if (in::getCookie('session') && in::getCookie('v')) { $bdd = new mysql(); $Qsession = $bdd->prepare("SELECT session,password_tmp,last_here FROM user WHERE session=:session"); $Qsession->bindParam(':session', in::getCookie('session'), PDO::PARAM_STR); $Qsession->execute(); $session = $Qsession->fetch(); $Qsession->closeCursor(); $tmpPassword = $session['password_tmp']; $lastHere = $session['last_here']; $session = $session['session']; if (in::getCookie('session') == $session && md5(in::getCookie('v')) == $tmpPassword) { if ($lastHere >= time() - 60 * 30) { return true; } else { self::getLogout(); return false; } } else { self::getLogout(); return false; } } else { return false; } }