本文整理汇总了PHP中mysql::BuildTables方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::BuildTables方法的具体用法?PHP mysql::BuildTables怎么用?PHP mysql::BuildTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::BuildTables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: STREAM_LINE
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";
}
示例2: SingleDebug
function SingleDebug($ID)
{
$q = new mysql();
$q->BuildTables();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$ID}.pid";
$unix = new unix();
$pid = $unix->get_pid_from_file($pidfile);
$fetchmail = $unix->find_program("fetchmail");
if ($unix->process_exists($pid)) {
SingleDebugEvents("Task aborted", "This task is aborted, it already running PID {$pid}, please wait before executing a new task", $ID);
return;
}
@file_put_contents($pidfile, getmypid());
SingleDebugEvents("Task executed", "Starting rule number {$ID}\nThis task is executed please wait before executing a new task", $ID);
$fetch = new fetchmail();
$output = array();
$fetch = new fetchmail();
$l[] = "set logfile /var/log/fetchmail-rule-{$ID}.log";
$l[] = "set daemon {$fetch->FetchmailPoolingTime}";
$l[] = "set postmaster \"{$fetch->FetchmailDaemonPostmaster}\"";
$l[] = "set idfile \"/var/log/fetchmail.{$ID}.id\"";
$l[] = "";
$GLOBALS["SINGLE_DEBUG"] = true;
BuildRules();
$pattern = $GLOBALS["FETCHMAIL_RULES_ID"][$ID];
$l[] = $pattern;
@file_put_contents("/tmp/fetchmailrc.{$ID}", @implode("\n", $l));
shell_exec("/bin/chmod 600 /tmp/fetchmailrc.{$ID}");
$cmd = "{$fetchmail} -v -N -f /tmp/fetchmailrc.{$ID} --pidfile /tmp/fetcmailrc.{$ID}.pid 2>&1";
exec($cmd, $output);
SingleDebugEvents("Task finish with " . count($output) . " event(s)", @implode("\n", $output), $ID);
}
示例3: BuildDayTable
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 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;
}
示例4: rsync_server_queue
function rsync_server_queue(){
$q=new mysql();
$q->BuildTables();
foreach (glob("/var/log/artica-postfix/rsync/*") as $filename) {
ScanRsyncServer($filename);
}
}
示例5: rebuild_imapsync
function rebuild_imapsync(){
$q=new mysql();
writelogs("DELETE imapsync table...",__FUNCTION__,__FILE__,__LINE__);
$sql="DROP TABLE `imapsync`";
$q->QUERY_SQL($sql,"artica_backup");
if(!$q->ok){echo "$sql:: $q->mysql_error\n";}
writelogs("Rebuild tables",__FUNCTION__,__FILE__,__LINE__);
$q->BuildTables();
}
示例6: clean_events
function clean_events()
{
$q = new mysql();
$q->QUERY_SQL("DROP TABLE kav4proxy_updates", "artica_events");
$q->BuildTables();
if (!$q->ok) {
echo $q->mysql_error;
}
}
示例7: reconstruct
function reconstruct()
{
$database = $_POST["reconstruct"];
$tpl = new templates();
if ($database == "squidlogs") {
$q = new mysql_squid_builder();
$q->CheckTables();
echo $tpl->javascript_parse_text("{success}");
return;
}
$q = new mysql();
$q->BuildTables();
echo $tpl->javascript_parse_text("{success}");
}
示例8: popup
function popup()
{
$uid = $_GET["uid"];
$t = $_GET["t"];
$sql = "SELECT script_code FROM logon_scriptsusers WHERE uid='{$uid}'";
$q = new mysql();
if (!$q->TABLE_EXISTS("logon_scriptsusers", "artica_backup")) {
$q->BuildTables();
}
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$ligne["script_code"] = base64_decode($ligne["script_code"]);
$_POST["script_data"] = str_replace("\n\n", "\n", $_POST["script_data"]);
$html = "\n\t<div style='font-size:13px' class=explain>{LOGON_SCRIPT_TEXT}<br>\n\t{LOGON_SCRIPT_PUT}</div>\n\t<div style='float:right;margin-bottom:8px;'>" . imgtootltip("delete-32.png", "{delete}", "LOGON_SCRIPT_DEL{$t}()") . "</div>\n\t<textarea id='script_code{$t}' style='width:100%;height:350px;overflow:auto; font-family: \"Courier New\", Courier, monospace;padding:3px'>" . $ligne["script_code"] . "</textarea>\n\t<div style='text-align:right'><hr>" . button("{apply}", "LOGON_SCRIPT_SAVE{$t}()", "18px") . "</div>";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例9: optimize
function optimize()
{
$sock = new sockets();
$unix = new unix();
$q = new mysql();
$basename = basename(__FILE__);
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".MAIN.pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, $basename)) {
mysql_admin_events("Already running pid {$pid}, aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
$t = 0;
if ($GLOBALS["VERBOSE"]) {
echo "Start ok ->CheckTables() \n";
}
$q->BuildTables();
$EnableMysqlOptimize = $sock->GET_INFO("EnableMysqlOptimize");
if (!is_numeric($EnableMysqlOptimize)) {
$EnableMysqlOptimize = 0;
}
if ($GLOBALS["VERBOSE"]) {
echo "EnableMysqlOptimize= {$EnableMysqlOptimize} \n";
}
if ($EnableMysqlOptimize == 0) {
return;
}
$t1 = time();
$ARRAY = unserialize(base64_decode($sock->GET_INFO("MysqlOptimizeDBS")));
if ($GLOBALS["VERBOSE"]) {
echo "MysqlOptimizeDBS= " . count($ARRAY) . " \n";
}
mysql_admin_events("Starting optimize " . count($ARRAY) . " databases ", __FUNCTION__, __FILE__, __LINE__, "defrag");
$c = 0;
while (list($database, $enabled) = each($ARRAY)) {
if (!is_numeric($enabled)) {
continue;
}
if ($enabled == 1) {
$c++;
optimize_tables($database);
}
}
$time = $unix->distanceOfTimeInWords($t1, time(), true);
mysql_admin_events("{$c} Database(s) checked {$time}", __FUNCTION__, __FILE__, __LINE__, "defrag");
}
示例10: folders_list
function folders_list()
{
$page = CurrentPageName();
$tpl = new templates();
$users = new usersMenus();
$search = $_GET["search"];
$search = "*{$search}*";
$search = str_replace("***", "*", $search);
$search = str_replace("**", "*", $search);
$search_sql = str_replace("*", "%", $search);
$search_sql = str_replace("%%", "%", $search_sql);
$search_regex = str_replace(".", "\\.", $search);
$search_regex = str_replace("*", ".*?", $search);
$sure_delete_smb_vrt = $tpl->javascript_parse_text("{sure_delete_smb_vrt}");
$add = imgtootltip("plus-24.png", "{add}", "SambaVirtalServerEditShare(0,'')");
$html = "<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>{$add}</th>\n\t\t<th colspan=2>{shared_folders} | {$search_regex} | {$search_sql}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
$q = new mysql();
$sql = "SELECT ID,share_name FROM samba_hosts_share WHERE hostname='{$_GET["hostname"]}' AND share_name LIKE '{$search_sql}' ORDER BY share_name";
writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
if (strpos($q->mysql_error, "doesn't exist") > 0) {
$q->BuildTables();
$results = $q->QUERY_SQL($sql, "artica_backup");
}
}
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2>";
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
if ($classtr == "oddRow") {
$classtr = null;
} else {
$classtr = "oddRow";
}
$select = imgtootltip("folder-granted-properties-32.png", "{apply}", "SambaVirtalServerEditShare('{$ligne["ID"]}','{$ligne["share_name"]}')");
$delete = imgtootltip("delete-32.png", "{delete}", "SambaVirtalServerDeleteShare('{$ligne["ID"]}')");
$color = "black";
$html = $html . "\n\t\t\t\t<tr class={$classtr}>\n\t\t\t\t\t<td width=1%>{$select}</td>\n\t\t\t\t\t<td style='font-size:14px;font-weight:bold;color:{$color}'>{$ligne["share_name"]}</a></td>\n\t\t\t\t\t<td width=1%>{$delete}</td>\n\t\t\t\t</tr>\n\t\t\t\t";
}
$html = $html . "\n\t</table>\n\t<script>\n\t\tfunction SambaVirtalServerEditShare(ID,s){\n\t\t\tif(!s){s='New';}\n\t\t\tYahooWin4('485','{$page}?folder-id='+ID+'&hostname={$_GET["hostname"]}',s);\n\t\t}\n\t\t\n\tvar x_SambaVirtalServerDeleteShare=function (obj) {\n\t\t\ttempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>2){alert(tempvalue);return;}\n\t\t\tBrowseSambaFSearch();\n\t\t\t\n\t}\t\t\n\t\t\n\tfunction SambaVirtalServerDeleteShare(ID){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\tXHR.appendData('folder-id',ID);\n\t\tXHR.appendData('share_delete','yes');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SambaVirtalServerDeleteShare);\t\t\n\t}\n\t\t\n\t</script>\n\t\n\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例11: main_table
function main_table()
{
$t = time();
$page = CurrentPageName();
$tpl = new templates();
$users = new usersMenus();
$sock = new sockets();
$q = new mysql();
if (!$q->TABLE_EXISTS("sender_dependent_relay_host", "artica_backup")) {
$q->BuildTables();
}
if ($_GET["hostname"] == null) {
$_GET["hostname"] = "master";
}
$t = time();
$domain = $tpl->_ENGINE_parse_body("{sender_domain_email}");
$are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}");
$relay = $tpl->javascript_parse_text("{relay}");
$MX_lookups = $tpl->javascript_parse_text("{MX_lookups}");
$delete = $tpl->javascript_parse_text("{delete}");
$InternetDomainsAsOnlySubdomains = $sock->GET_INFO("InternetDomainsAsOnlySubdomains");
if (!is_numeric($InternetDomainsAsOnlySubdomains)) {
$InternetDomainsAsOnlySubdomains = 0;
}
$add_local_domain_form_text = $tpl->javascript_parse_text("{add_local_domain_form}");
$add_local_domain = $tpl->_ENGINE_parse_body("{add_local_domain}");
$sender_dependent_relayhost_maps_title = $tpl->_ENGINE_parse_body("{sender_dependent_relayhost_maps_title}");
$ouescape = urlencode($ou);
$networks = $tpl->javascript_parse_text("{networks}");
$hostname = $_GET["hostname"];
$apply = $tpl->javascript_parse_text("{apply}");
$about2 = $tpl->javascript_parse_text("{about2}");
$title = $tpl->javascript_parse_text("{smtpd_sasl_exceptions_networks_text}");
$add_sender_routing_rule = $tpl->_ENGINE_parse_body("{add_new_network}");
$explain = $tpl->javascript_parse_text("{smtpd_sasl_exceptions_networks_explain}");
$give_the_new_network = $tpl->javascript_parse_text("{give the new network}");
$buttons = "\n\tbuttons : [\n\t{name: '{$add_sender_routing_rule}', bclass: 'add', onpress : newrule{$t}},\n\t{name: '{$apply}', bclass: 'recycle', onpress : apply{$t}},\n\t{name: '{$about2}', bclass: 'help', onpress : Help{$t}},\n\t],";
$html = "\n\t<input type='hidden' id='ou' value='{$ou}'>\n\t<table class='SMTP_SASL_EXCEPT_TABLE' style='display: none' id='SMTP_SASL_EXCEPT_TABLE' style='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#SMTP_SASL_EXCEPT_TABLE').flexigrid({\n\turl: '{$page}?list=yes&hostname={$hostname}&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$networks}', name : 'domain', width : 749, sortable : true, align: 'left'},\n\t{display: '{$delete};', name : 'delete', width : 90, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$domain}', name : 'domain'},\n\t],\n\tsortname: 'domain',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:16px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: '550',\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n});\n\nfunction Help{$t}(){\nalert('{$explain}');\n}\n\nvar xnewrule{$t}= function (obj) {\n\t\$('#SMTP_SASL_EXCEPT_TABLE').flexReload();\n\n}\n\t\t\n\n\nfunction newrule{$t}(){\n\tvar a=prompt('{$give_the_new_network}');\n\tif(!a){\n\t\treturn;\n\t}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('smtpd_sasl_exceptions_networks_add',a);\n\tXHR.sendAndLoad('{$page}', 'GET',xnewrule{$t});\n}\n\t\nfunction apply{$t}(){\n\tLoadjs('postfix.sasl.progress.php');\n}\n\nfunction smtpd_sasl_exceptions_delete(id_encrypted){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('smtpd_sasl_exceptions_networks_del',id_encrypted);\n\tXHR.sendAndLoad('{$page}', 'GET', xnewrule{$t});\n}\n\n</script>\n";
echo $html;
}
示例12: popup
function popup()
{
$page = CurrentPageName();
$tpl = new templates();
$q = new mysql();
$q->BuildTables();
$servicename = $tpl->_ENGINE_parse_body("{servicename}");
$interface = $tpl->_ENGINE_parse_body("{interface}");
$backends = $tpl->_ENGINE_parse_body("{backends}");
$enabled = $tpl->_ENGINE_parse_body("{enable}");
$weight = $tpl->_ENGINE_parse_body("{weight}");
$select = $tpl->_ENGINE_parse_body("{select}");
$delete_rule_ask = $tpl->javascript_parse_text("{delete_rule_ask}");
$new_backend = $tpl->_ENGINE_parse_body("{new_backend}");
$delete_service = $tpl->javascript_parse_text("{delete_this_service}");
$delete_backend = $tpl->javascript_parse_text("{delete_backend}");
$CallBack = $_GET["CallBack"];
$servicename = $_GET["servicename"];
$tt = $_GET["tt"];
$t = time();
$html = "\n\t<table class='HAPROXY_BACKENDS_BROWSE' style='display: none' id='HAPROXY_BACKENDS_BROWSE' style='width:99%'></table>\n\t<script>\n\tvar tmp{$t}='';\n\t\$(document).ready(function(){\n\t\$('#HAPROXY_BACKENDS_BROWSE').flexigrid({\n\turl: '{$page}?balancer-backends-list=yes&t={$t}&servicename={$servicename}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<span style=font-size:16px>{$backends}</span>', name : 'backendname', width : 192, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:16px>{$interface}</span>', name : 'listen_ip', width : 172, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:16px>{$weight}</span>', name : 'bweight', width : 52, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:16px>{$select}</span>', name : 'delete', width : 119, sortable : false, align: 'center'},\n\n\t],\n\tsearchitems : [\n\t{display: '{$backends}', name : 'backendname'},\n\t{display: '{$interface}', name : 'listen_ip'},\n\t],\n\tsortname: 'bweight',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:22px>{$servicename}</span>',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 350,\n\tsingleSelect: true\n\n});\n});\nfunction BackendCallBack(ID) {\n\tYahooWin6Hide();\n\t{$CallBack}(ID);\n\t\n\n}\n\n\n\n\nvar x_DeleteSquidAclGroup= function (obj) {\nvar res=obj.responseText;\nif(res.length>3){alert(res);return;}\nif(document.getElementById('main_filter_rule_edit')){RefreshTab('main_filter_rule_edit');}\nif(document.getElementById('main_dansguardian_tabs')){RefreshTab('main_dansguardian_tabs');}\n\$('#rowtime'+TimeRuleIDTemp).remove();\n}\n\n\n\nvar x_EnableDisableBackendSilent= function (obj) {\nvar res=obj.responseText;\nif(res.length>3){alert(res);return;}\n\n}\n\nvar x_BackendDelete= function (obj) {\nvar res=obj.responseText;\nif(res.length>3){alert(res);return;}\n\$('#rowTF'+tmp{$t}).remove();\n\$('#HAPROXY_BACKENDS_TABLE').flexReload();\n\$('#MAIN_HAPROXY_BALANCERS_TABLE').flexReload();\n}\n\n\nfunction BackendDelete(backendname,servicename,md){\ntmp{$t}=md;\nif(confirm('{$delete_backend} :{$servicename}/'+backendname+' ?')){\nvar XHR = new XHRConnection();\nXHR.appendData('backends-delete', backendname);\nXHR.appendData('servicename', '{$servicename}');\nXHR.sendAndLoad('{$page}', 'POST',x_BackendDelete);\n}\n}\n\n\n\nfunction EnableDisableBackend(backendname){\nvar XHR = new XHRConnection();\nXHR.appendData('backends-enable', backendname);\nXHR.appendData('servicename', '{$servicename}');\nif(document.getElementById('HaProxBckDisable_'+backendname).checked){XHR.appendData('enable', '1');}else{XHR.appendData('enable', '0');}\nXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableBackendSilent);\n}\n\n\n\n\n</script>";
echo $html;
}
示例13: ip_list
function ip_list()
{
$page = CurrentPageName();
$tpl = new templates();
$sock = new sockets();
$EnableAmavisInMasterCF = $sock->GET_INFO("EnableAmavisInMasterCF");
$html = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{ip_addr}</th>\n\t\t<th> </th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
$sql = "SELECT * FROM amavisd_bypass ORDER BY ip_addr";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
if (preg_match("#doesn't exist#", $q->mysql_error)) {
$q->BuildTables();
$results = $q->QUERY_SQL($sql, "artica_backup");
}
if (!$q->ok) {
echo $q->mysql_error;
return;
}
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
if ($classtr == "oddRow") {
$classtr = null;
} else {
$classtr = "oddRow";
}
$delete = imgtootltip("delete-32.png", "{delete}", "DeleteAmavisBypass('{$ligne["ip_addr"]}')");
$color = "black";
if ($EnableAmavisInMasterCF != 1) {
$color = "#CCCCCC";
}
$html = $html . "\n\t\t<tr class={$classtr}>\n\t\t<td width=99% style='font-size:16px;color:{$color}' nowrap>{$ligne["ip_addr"]}</td>\n\t\t<td width=1%>{$delete}</td>\n\t\t</tr>";
}
$html = $html . "</table>";
echo $tpl->_ENGINE_parse_body($html);
}
示例14: items
function items()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql();
$t = $_GET["tt"];
$search = '%';
$table = "texttoldap";
$page = 1;
$FORCE_FILTER = null;
$total = 0;
if (!$q->TABLE_EXISTS("texttoldap", "artica_backup")) {
$q->BuildTables();
}
if (isset($_POST["sortname"])) {
if ($_POST["sortname"] != null) {
$ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
}
}
if (isset($_POST['page'])) {
$page = $_POST['page'];
}
$searchstring = string_to_flexquery();
if ($searchstring != null) {
$sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$total = $ligne["TCOUNT"];
} else {
$total = $q->COUNT_ROWS("texttoldap", "artica_backup");
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
$pageStart = ($page - 1) * $rp;
if (is_numeric($rp)) {
$limitSql = "LIMIT {$pageStart}, {$rp}";
}
$sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
$results = $q->QUERY_SQL($sql, "artica_backup");
$no_rule = $tpl->_ENGINE_parse_body("{no_rule}");
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
if (!$q->ok) {
json_error_show($q->mysql_error . "<br>{$sql}");
}
if (mysql_num_rows($results) == 0) {
json_error_show("no data {$sql}");
}
$fontsize = "14";
while ($ligne = mysql_fetch_assoc($results)) {
$color = "black";
$NICNAME = null;
$delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?remove-connection-js={$ligne["ID"]}&t={$_GET["t"]}&t-rule={$_GET["t-rule"]}&tt={$_GET["tt"]}')");
$editjs = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?js=yes&connection-id={$ligne['ID']}&t={$_GET["t"]}',true);\"\n\t\tstyle='font-size:{$fontsize}px;font-weight:bold;color:{$color};text-decoration:underline'>";
$connection = $ligne["connection"];
$folder = $ligne["folder"];
$hostname = $ligne["hostname"];
$filename = $ligne["filename"];
$ldap_group = $ligne["ldapgroup"];
$ldap_group_text = "-";
if ($ligne["ldapgroup"] > 0) {
$gp = new groups($ligne["ldapgroup"]);
$ldap_group_text = $gp->groupName;
}
$data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$connection}</span>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$folder}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$hostname}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$filename}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$ldap_group_text}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>"));
}
echo json_encode($data);
}
示例15: backup
function backup($ID)
{
$date_start = time();
$sock = new sockets();
$q = new mysql();
$unix = new unix();
$users = new usersMenus();
$GLOBALS["RESOURCE_MOUNTED"] = true;
$sql = "SELECT * FROM backup_schedules WHERE ID='{$ID}'";
if ($GLOBALS["VERBOSE"]) {
backup_events($ID, "initialization", "{$sql}", __LINE__);
}
$mount_path = "/opt/artica/mounts/backup/{$ID}";
if (!$q->TABLE_EXISTS("backup_storages", "artica_backup", true)) {
$q->BuildTables();
if (!$q->TABLE_EXISTS("backup_storages", "artica_backup", true)) {
backup_events($ID, "initialization", "ERROR, backup_storages, no such table", __LINE__);
return;
}
}
$servername = $users->fqdn;
$servername = str_replace('.(none)', "", $servername);
$servername = str_replace(')', "", $servername);
$servername = str_replace('(', "", $servername);
$GLOBALS["MYSERVERNAME"] = $servername;
$ExecBackupDeadAfterH = $sock->GET_INFO("ExecBackupDeadAfterH");
if (!is_numeric($ExecBackupDeadAfterH)) {
$ExecBackupDeadAfterH = 2;
}
if ($ExecBackupDeadAfterH < 2) {
$ExecBackupDeadAfterH = 2;
}
$ExecBackupDeadAfterH = $ExecBackupDeadAfterH * 60;
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
send_email_events("Backup Task {$ID}:: Mysql database error !", "Aborting backup\n{$q->mysql_error}", "backup");
backup_events($ID, "initialization", "ERROR, Mysql database error\n{$q->mysql_error}", __LINE__);
return false;
}
if (!$GLOBALS["ONNLY_MOUNT"]) {
$pid = $ligne["pid"];
if ($unix->process_exists($pid)) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($time > $ExecBackupDeadAfterH) {
send_email_events("Backup Task {$ID}:: Already instance {$pid} running since {$time}Mn", "The old process was killed and a new backup task will be performed\nstatus:\n\n{$unix->proc_status}", "backup");
} else {
send_email_events("Backup Task {$ID}:: Already instance {$pid} running since {$time}Mn", "Aborting backup\n{$unix->proc_status}", "backup");
backup_events($ID, "initialization", "ERROR, Already instance {$pid} running since {$time}Mn", $unix->proc_status);
return false;
}
}
}
$sql = "UPDATE backup_schedules set pid='" . getmypid() . "' WHERE ID='{$ID}'";
$q->QUERY_SQL($sql, "artica_backup");
$ressources = unserialize(base64_decode($ligne["datasbackup"]));
if (count($ressources) == 0) {
backup_events($ID, "initialization", "ERROR,No source specified");
send_email_events("Backup Task {$ID}:: No source specified", "Aborting backup", "backup");
return false;
}
if ($ressources["OPTIONS"]["STOP_IMAP"] == 1) {
$GLOBALS["NO_STOP_CYRUS"] = " --no-cyrus-stop";
}
$backup = new backup_protocols();
$resource_type = $ligne["resource_type"];
$pattern = $ligne["pattern"];
$first_ressource = $backup->extractFirsRessource($ligne["pattern"]);
$container = $ligne["container"];
backup_events($ID, "initialization", "resource: {$resource_type} -> {$first_ressource}", __LINE__);
if ($resource_type == null) {
backup_events($ID, "initialization", "ERROR,No resource specified");
send_email_events("Backup Task {$ID}:: No resource specified !", "Aborting backup", "backup");
return false;
}
if ($resource_type == "smb") {
$GLOBALS["CAN_CLEAN_CONTAINERS"] = true;
$mounted_path_sep = "/";
if (!mount_smb($pattern, $ID, true)) {
backup_events($ID, "initialization", "ERROR,{$first_ressource} unable to mount mount_smb()", __LINE__);
send_email_events("Backup Task {$ID}:: resource: {$first_ressource} unable to mount", "Aborting backup", "backup");
return false;
}
$GLOBALS["PCOPY"] = true;
}
if ($resource_type == "ssh") {
$GLOBALS["CAN_CLEAN_CONTAINERS"] = true;
$mounted_path_sep = "/";
if (!mount_ssh($pattern, $ID, true)) {
backup_events($ID, "initialization", "ERROR,{$first_ressource} unable to mount mount_ssh()", __LINE__);
send_email_events("Backup Task {$ID}:: resource: {$first_ressource} unable to mount to remote ssh service", "Aborting backup", "backup");
return false;
}
$GLOBALS["PCOPY"] = true;
}
if ($resource_type == "usb") {
$GLOBALS["CAN_CLEAN_CONTAINERS"] = true;
$mounted_path_sep = "/";
if (!mount_usb($pattern, $ID, true)) {
backup_events($ID, "initialization", "ERROR,{$first_ressource} unable to mount mount_usb()", __LINE__);
send_email_events("Backup Task {$ID}:: resource: {$first_ressource} unable to mount", "Aborting backup", "backup");
//.........这里部分代码省略.........