function tasks_list(){ $sql=new mysql(); $sock=new sockets(); $sql="SELECT * FROM backup_schedules ORDER BY ID DESC"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_backup"); $backup=new backup_protocols(); $cron=new cron_macros(); $storages["usb"]="{usb_external_drive}"; $storages["smb"]="{remote_smb_server}"; $storages["rsync"]="{remote_rsync_server}"; $storages["automount"]="{automount_ressource}"; $storages["local"]="{local_directory}"; $html="<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <th>{task}</th> <th> </th> <th> </th> <th>{test}</th> <th>{STORAGE_TYPE}</th> <th>{resource}</th> <th>{schedule}</th> <th>{sources}</th> <th> </th> </thead> <tbody class='tbody'>"; while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} $ressources=unserialize(base64_decode($ligne["datasbackup"])); $sources=(count($ressources)-1)+FOLDER_BACKUPED_NUMBER($ligne["ID"])." {sources}"; $sources=texttooltip($sources,"{show}","BACKUP_TASKS_SOURCE({$ligne["ID"]})",null,0,"font-size:12px"); $run=imgtootltip("run-24.png","{run_task}","BACKUP_TASK_RUN({$ligne["ID"]})"); if($ligne["pid"]>5){ $array_pid=unserialize(base64_decode($sock->getFrameWork("cmd.php?procstat={$ligne["pid"]}"))); if($array_pid["since"]<>null){ $run=imgtootltip("ajax-menus-loader.gif","{running}: {since} {$array_pid["since"]}",""); } } $html=$html. "<tr class=$classtr> <td width=1% align='center'><strong style='font-size:12px'>{$ligne["ID"]}</strong></td> <td width=1% style='font-size:12px' align='left'>". imgtootltip("events-24.png","{events}","TASK_EVENTS_DETAILS({$ligne["ID"]})")."</td> <td width=1%>$run</td> <td width=1%>". imgtootltip("eclaire-24.png","{BACKUP_TASK_TEST}","BACKUP_TASK_TEST({$ligne["ID"]})")."</td> <td style='font-size:12px' nowrap><a href=\"javascript:BACKUP_TASK_MODIFY_RESSOURCES('{$ligne["ID"]}')\" style='text-decoration:underline'>[{$storages[$ligne["resource_type"]]}]</a></td> <td style='font-size:12px'>". $backup->extractFirsRessource($ligne["pattern"])."</td> <td style='font-size:12px' nowrap>". $cron->cron_human($ligne["schedule"])."</td> <td style='font-size:12px'>$sources</td> <td style='font-size:12px'>". imgtootltip("delete-24.png","{delete}","DeleteBackupTask({$ligne["ID"]})")."</td> </tr>"; } $html=$html."</tbody></table> <hr> <table style='width:100%'> <tr> <td align='left'>". button("{add_task}","Loadjs('wizard.backup-all.php');")."</td> <td align='right'><div style='width:100%;text-align:right'>". imgtootltip('32-refresh.png',"{refresh}","BACKUP_TASKS_LISTS()")."</div></td> </tr> </table> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function tasks_list() { $sql = new mysql(); $sock = new sockets(); $sql = "SELECT * FROM backup_schedules ORDER BY ID DESC"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); $backup = new backup_protocols(); $cron = new cron_macros(); $storages["usb"] = "{usb_external_drive}"; $storages["smb"] = "{remote_smb_server}"; $storages["rsync"] = "{remote_rsync_server}"; $html = "<table style='width:99%'>\n\t<th>{task}</th>\n\t<th> </th>\n\t<th> </th>\n\t<th>{test}</th>\n\t<th>{STORAGE_TYPE}</th>\n\t<th>{resource}</th>\n\t<th>{schedule}</th>\n\t<th>{sources}</th>\n\t<th> </th>\n\t</tr>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ressources = unserialize(base64_decode($ligne["datasbackup"])); $sources = count($ressources) - 1 + FOLDER_BACKUPED_NUMBER($ligne["ID"]) . " {sources}"; $sources = texttooltip($sources, "{show}", "BACKUP_TASKS_SOURCE({$ligne["ID"]})", null, 0, "font-size:12px"); $run = imgtootltip("run-24.png", "{run_task}", "BACKUP_TASK_RUN({$ligne["ID"]})"); if ($ligne["pid"] > 5) { $array_pid = unserialize(base64_decode($sock->getFrameWork("cmd.php?procstat={$ligne["pid"]}"))); if ($array_pid["since"] != null) { $run = imgtootltip("ajax-menus-loader.gif", "{running}: {since} {$array_pid["since"]}", ""); } } $html = $html . "<tr " . CellRollOver() . ">\n\t\t\n\t\t<td width=1% align='center'><strong style='font-size:12px'>{$ligne["ID"]}</strong></td>\n\t\t<td width=1% style='font-size:12px' align='left'>" . imgtootltip("events-24.png", "{events}", "TASK_EVENTS_DETAILS({$ligne["ID"]})") . "</td>\n\t\t<td width=1%>{$run}</td>\n\t\t<td width=1%>" . imgtootltip("eclaire-24.png", "{BACKUP_TASK_TEST}", "BACKUP_TASK_TEST({$ligne["ID"]})") . "</td>\n\t\t<td style='font-size:12px' nowrap>{$storages[$ligne["resource_type"]]}</td>\n\t\t<td style='font-size:12px'>" . $backup->extractFirsRessource($ligne["pattern"]) . "</td>\n\t\t<td style='font-size:12px' nowrap>" . $cron->cron_human($ligne["schedule"]) . "</td>\n\t\t<td style='font-size:12px'>{$sources}</td>\n\t\t<td style='font-size:12px'>" . imgtootltip("delete-24.png", "{delete}", "DeleteBackupTask({$ligne["ID"]})") . "</td>\n\t\t</tr>"; } $html = $html . "</table>\n\t<hr>\n\t<table style='width:100%'>\n\t<tr>\n\t<td align='left'>" . button("{add_task}", "Loadjs('wizard.backup-all.php');") . "</td>\n\t<td align='right'><div style='width:100%;text-align:right'>" . imgtootltip('32-refresh.png', "{refresh}", "BACKUP_TASKS_LISTS()") . "</div></td>\n\t</tr>\n\t</table>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function tasks_list() { $sql = new mysql(); $sock = new sockets(); $sql = "SELECT * FROM backup_schedules ORDER BY ID DESC"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); $backup = new backup_protocols(); $cron = new cron_macros(); $storages["usb"] = "{usb_external_drive}"; $storages["smb"] = "{remote_smb_server}"; $storages["rsync"] = "{remote_rsync_server}"; $html = "<table style='width:99%'>\n\t<th> </th>\n\t<th>{task}</th>\n\t<th>{STORAGE_TYPE}</th>\n\t<th>{resource}</th>\n\t<th>{schedule}</th>\n\t</tr>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ressources = unserialize(base64_decode($ligne["datasbackup"])); $sources = count($ressources) . " {sources}"; $html = $html . "<tr " . CellRollOver("TasksListConnectSource({$ligne["ID"]})", "{choose}:{task} {$ligne["ID"]}") . ">\n\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t<td width=1% nowrap><strong>{task} {$ligne["ID"]}</strong></td>\n\t\t<td style='font-size:12px'>{$storages[$ligne["resource_type"]]}</td>\n\t\t<td style='font-size:12px'>" . $backup->extractFirsRessource($ligne["pattern"]) . "</td>\n\t\t<td style='font-size:12px'>" . $cron->cron_human($ligne["schedule"]) . "</td>\n\t\t</tr>"; } $html = $html . "</table>\n\t<hr>\n\t<div style='width:100%;text-align:right'>" . imgtootltip('32-refresh.png', "{refresh}", "BACKUP_TASKS_LISTS()") . "</div>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function tasks_rows() { $sql = new mysql(); $sock = new sockets(); $tpl = new templates(); $backup = new backup_protocols(); $cron = new cron_macros(); $storages["usb"] = "{usb_external_drive}"; $storages["smb"] = "{remote_smb_server}"; $storages["rsync"] = "{remote_rsync_server}"; $storages["automount"] = "{automount_ressource}"; $storages["local"] = "{local_directory}"; $storages["ssh"] = "{remote_ssh_service}"; $MyPage = CurrentPageName(); $q = new mysql(); $search = '%'; $table = "backup_schedules"; $page = 1; if ($q->COUNT_ROWS($table, "artica_backup") == 0) { json_error_show("No task..."); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!$q->ok) { json_error_show($q->mysql_error); } $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table, "artica_backup"); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { json_error_show($q->mysql_error); } $fontsize = 14; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ressources = unserialize(base64_decode($ligne["datasbackup"])); $sources = count($ressources) - 1 + FOLDER_BACKUPED_NUMBER($ligne["ID"]) . " {sources}"; $sources = "<a href=\"javascript:Loadjs('backup.sources.tasks.php?ID={$ligne["ID"]}')\" style='text-decoration:underline;font-size:{$fontsize}px'>{$sources}</a>"; $run = imgsimple("run-24.png", "{run_task}", "BACKUP_TASK_RUN({$ligne["ID"]})"); if ($ligne["pid"] > 5) { $array_pid = unserialize(base64_decode($sock->getFrameWork("cmd.php?procstat={$ligne["pid"]}"))); if ($array_pid["since"] != null) { $run = imgsimple("ajax-menus-loader.gif", "{running}: {since} {$array_pid["since"]}", ""); } } $sql = "SELECT SUM(size) as tsize FROM backup_storages WHERE taskid={$ligne["ID"]}"; $ligneSize = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $sizeStorages = FormatBytes($ligneSize["tsize"]); $divStart = "<span style='font-size:{$fontsize}px'>"; $divStop = "</span>"; $data['rows'][] = array('id' => $ligne["ID"], 'cell' => array("{$divStart}{$ligne["ID"]}{$divStop}", imgsimple("events-24.png", "{events}", "TASK_EVENTS_DETAILS({$ligne["ID"]})"), $run, imgsimple("eclaire-24.png", "{BACKUP_TASK_TEST}", "BACKUP_TASK_TEST({$ligne["ID"]})"), "<a href=\"javascript:BACKUP_TASK_MODIFY_RESSOURCES('{$ligne["ID"]}')\" style='text-decoration:underline;font-size:{$fontsize}px'>" . $tpl->_ENGINE_parse_body($storages[$ligne["resource_type"]]) . "</a>", "<a href=\"javascript:BACKUP_TASK_SHOW_CONTAINERS('{$ligne["ID"]}')\" style='text-decoration:underline;font-size:{$fontsize}px'>" . $backup->extractFirsRessource($ligne["pattern"]) . "</a> ({$sizeStorages})", "{$divStart}" . $tpl->_ENGINE_parse_body($cron->cron_human($ligne["schedule"])) . "{$divStop}", "{$divStart}" . $tpl->_ENGINE_parse_body($sources) . "{$divStop}", imgsimple("delete-24.png", "{delete}", "DeleteBackupTask({$ligne["ID"]})"))); } echo json_encode($data); }