Ejemplo n.º 1
0
/* if the table that holds the actions is present, work on it */
if ($purge) {
    maint_debug("Purging Required - Files Found {$purge}");
    /* take the purge in steps */
    while (true) {
        maint_debug('Grabbing 1000 RRDfiles to Remove');
        $file_array = db_fetch_assoc('SELECT id, name, local_data_id, action 
			FROM data_source_purge_action
			ORDER BY name
			LIMIT 1000');
        if (sizeof($file_array) == 0) {
            break;
        }
        if (sizeof($file_array) || $force) {
            /* there's something to do for us now */
            remove_files($file_array);
            if ($force) {
                cleanup_ds_and_graphs();
            }
        }
    }
    /* record the start time */
    list($micro, $seconds) = explode(' ', microtime());
    $poller_end = $seconds + $micro;
    $string = sprintf('MAINT STATS: Time:%4.4f Purged:%s Archived:%s RRDfiles', $poller_end - $poller_start, $purged, $archived);
    cacti_log($string, true, 'SYSTEM');
}
/* removing security tokens older than 90 days */
if (read_config_option('auth_cache_enabled') == 'on') {
    db_execute("DELETE FROM user_auth_cache WHERE last_update<'" . date('Y-m-d H:i:s', time() - 86400 * 90) . "'");
} else {
Ejemplo n.º 2
0
require_once dirname(__FILE__) . '/../../../lib/fpdi/fpdi.php';
require_once dirname(__FILE__) . '/../../../lib/fpdf16/pdf.ext.php';
function remove_files($dir)
{
    if (!is_dir($dir)) {
        @mkdir("{$dir}", 0770, true);
    }
    if (is_dir($dir)) {
        $files = glob("" . $dir . "*.pdf");
    }
    foreach ($files as $f) {
        echo $image;
        @unlink($f);
    }
}
remove_files(PDF_TMP_DIR);
class Boletim extends PDF
{
    var $NCurso;
    function Header()
    {
        // IMAGEM COM A LOGO
        $this->Image(dirname(__FILE__) . '/../../../public/images/if_minas_campus_bambui-logo.png', 170, 16, 25);
        // SELECIONA FONT ARIAL BOLD 10
        $this->SetFont('Arial', '', 13);
        // PREPARA TITULO DO CABECALHO
        $this->Cell(0, 5, 'MEC - SETEC', 0, 1, 'L');
        $this->Cell(0, 5, 'INSTITUTO FEDERAL MINAS GERAIS - CAMPUS BAMBUÍ', 0, 1, 'L');
        $this->Cell(0, 5, 'GERÊNCIA DE REGISTROS ESCOLARES', 0, 1, 'L');
        // Quebra de linha
        $this->Ln();
Ejemplo n.º 3
0
/* Copyright (c) H. Reimers reimers@heye-tammo.de*/
require_once '../preload.php';
//Create Session an load Config
check_login_logout("admin");
echo create_header($_SESSION["settings"]["html_title"], "", "", "", "", "logolisa.svg");
if (!isset($_POST["folder"])) {
    echo "Fehlende Angaben <br>\n";
} else {
    if (!isset($_SESSION["settings"][$_POST["folder"]])) {
        echo "Ung&uuml;ltige Angaben<br>\n";
    } else {
        if ($path = realpath($_SESSION["lisa_path"] . "/" . $_SESSION["settings"][$_POST["folder"]])) {
            //Grober Test nicht ab "/" löschen
            if (strlen($path) > 5) {
                echo "Lösche den Inhalt des Verzeichnisses '{$path}' - (" . $_POST["folder"] . ")!<br><br>";
                remove_files($path, 3);
            } else {
                echo "Fehler kann Pfad zu temporären Dateien nicht ermitteln ('{$path}')!<br><br>";
            }
        } else {
            echo "Fehler kann Pfad zu den Dateien nicht ermitteln ";
        }
    }
}
?>



				<form action='index.php' method='POST' >
					<input type='submit' value='zur&uuml;ck'>
				</form>
Ejemplo n.º 4
0
function build(){
	CheckHttpdConf();
	RemoveAllSites();
	create_cron_task();
	$sock=new sockets();
	$unix=new unix();
	$varWwwPerms=$sock->GET_INFO("varWwwPerms");
	if($varWwwPerms==null){$varWwwPerms=755;}
	
	remove_files();
	$sql="SELECT * FROM freeweb ORDER BY servername";
	$httpdconf=$unix->LOCATE_APACHE_CONF_PATH();
	$apacheusername=$unix->APACHE_SRC_ACCOUNT();
	$GLOBALS["apacheusername"]=$apacheusername;
	$DAEMON_PATH=$unix->getmodpathfromconf($httpdconf);
	$q=new mysql();
	$results=$q->QUERY_SQL($sql,'artica_backup');
	if(!$q->ok){if($GLOBALS["VERBOSE"]){echo $q->mysql_error."\n";return;}}
	$d_path=$unix->APACHE_DIR_SITES_ENABLED();
	$mods_enabled=$DAEMON_PATH."/mods-enabled";
	
	
	echo "Starting......: Apache daemon path: $d_path\n";
	echo "Starting......: Apache mods path..: $mods_enabled\n";
	
	if(!is_dir($d_path)){@mkdir($d_path,666,true);}
	if(!is_dir($mods_enabled)){@mkdir($mods_enabled,666,true);}
	
	$count=mysql_num_rows($results);
	echo "Starting......: Apache checking virtual web sites count:$count\n";
	if($count==0){
		$users=new usersMenus();
		echo "Starting......: Apache building default $users->hostname...\n";
		buildHost($unix->LIGHTTPD_USER(),$users->hostname,0,$d_path);
	}
	
	
	while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
		$uid=$ligne["uid"];
		$hostname=$ligne["servername"];
		$ssl=$ligne["useSSL"];	
		echo "Starting......: Apache \"$hostname\" starting
		\n";
		buildHost($uid,$hostname,$ssl,$d_path);

	}
	
	$users=$GLOBALS["CLASS_USERS_MENUS"];
	$APACHE_MOD_AUTHNZ_LDAP=$users->APACHE_MOD_AUTHNZ_LDAP;
	if(is_file($GLOBALS["a2enmod"])){
		if($APACHE_MOD_AUTHNZ_LDAP){
			if($GLOBALS["VERBOSE"]){echo "Starting......: Apache {$GLOBALS["a2enmod"]} authnz_ldap\n";} 
			shell_exec("{$GLOBALS["a2enmod"]} authnz_ldap >/dev/null 2>&1");
		}
	} 
	
	

	$sock=$GLOBALS["CLASS_SOCKETS"];
	if($sock->GET_INFO("ArticaMetaEnabled")==1){
		sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN()." ".dirname(__FILE__)."/exec.artica.meta.users.php --export-freewebs");
	}

	
}
Ejemplo n.º 5
0
function build()
{
    $unix = new unix();
    if (is_file("/etc/artica-postfix/FROM_ISO")) {
        if ($unix->file_time_min("/etc/artica-postfix/FROM_ISO") < 1) {
            return;
        }
    }
    $mef = basename(__FILE__);
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, $mef)) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: Apache building : Process Already exist pid {$pid} line:" . __LINE__ . "\n";
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> CheckHttpdConf();\n";
    }
    CheckHttpdConf();
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> RemoveAllSites();\n";
    }
    RemoveAllSites();
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> create_cron_task();\n";
    }
    create_cron_task();
    sync_squid();
    $sock = new sockets();
    $FreeWebDisableSSL = intval(trim($sock->GET_INFO("FreeWebDisableSSL")));
    $php5 = $unix->LOCATE_PHP5_BIN();
    $varWwwPerms = $sock->GET_INFO("varWwwPerms");
    if ($varWwwPerms == null) {
        $varWwwPerms = 755;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> remove_files();\n";
    }
    remove_files();
    $sql = "SELECT * FROM freeweb ORDER BY servername";
    $httpdconf = $unix->LOCATE_APACHE_CONF_PATH();
    $apacheusername = $unix->APACHE_SRC_ACCOUNT();
    $GLOBALS["apacheusername"] = $apacheusername;
    $DAEMON_PATH = $unix->getmodpathfromconf($httpdconf);
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> sql();\n";
    }
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    if (!$q->ok) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache {$q->mysql_error}\n";
            return;
        }
    }
    $d_path = $unix->APACHE_DIR_SITES_ENABLED();
    $mods_enabled = $DAEMON_PATH . "/mods-enabled";
    if ($FreeWebDisableSSL == 0) {
        SSL_DEFAULT_VIRTUAL_HOST();
    }
    echo "Starting......: " . date("H:i:s") . " [INIT]: Apache daemon path: {$d_path}\n";
    echo "Starting......: " . date("H:i:s") . " [INIT]: Apache mods path..: {$mods_enabled}\n";
    if (!is_dir($d_path)) {
        @mkdir($d_path, 666, true);
    }
    if (!is_dir($mods_enabled)) {
        @mkdir($mods_enabled, 666, true);
    }
    $count = mysql_num_rows($results);
    echo "Starting......: " . date("H:i:s") . " [INIT]: Apache checking virtual web sites count:{$count}\n";
    if ($count == 0) {
        $users = new usersMenus();
        echo "Starting......: " . date("H:i:s") . " [INIT]: Apache building default {$users->hostname}...\n";
        buildHost($unix->LIGHTTPD_USER(), $users->hostname, 0, $d_path);
    }
    if ($GLOBALS["VERBOSE"]) {
        $add_plus = " --verbose";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $uid = $ligne["uid"];
        $hostname = $ligne["servername"];
        $ssl = $ligne["useSSL"];
        if ($FreeWebDisableSSL == 1) {
            $ssl = 0;
        }
        echo "Starting......: " . date("H:i:s") . " [INIT]: Apache \"{$hostname}\" starting\n";
        $cmd = "{$php5} " . __FILE__ . " --sitename \"{$hostname}\" --no-httpd-conf --noreload{$add_plus}";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: Apache \"{$cmd}\"\n";
        }
        shell_exec($cmd);
    }
    $users = $GLOBALS["CLASS_USERS_MENUS"];
    $APACHE_MOD_AUTHNZ_LDAP = $users->APACHE_MOD_AUTHNZ_LDAP;
    if (is_file($GLOBALS["a2enmod"])) {
        if ($APACHE_MOD_AUTHNZ_LDAP) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: Apache {$GLOBALS["a2enmod"]} authnz_ldap\n";
            }
            shell_exec("{$GLOBALS["a2enmod"]} authnz_ldap >/dev/null 2>&1");
        }
    }
    $sock = $GLOBALS["CLASS_SOCKETS"];
    if ($sock->GET_INFO("ArticaMetaEnabled") == 1) {
        sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-freewebs");
    }
    sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN() . " " . __FILE__ . " --monit");
}
Ejemplo n.º 6
0
 public function deleteUpdate($update_id)
 {
     // Begin transaction with the database
     $this->db->trans_start();
     // Update URL count
     $update = $this->getSingle($update_id, 1);
     if ($update['url']) {
         // Check if this is the only update using this url
         $num = $this->db->where('url', $update['url'])->get('update_url')->num_rows;
         if ($num > 1) {
             // More than one share
             $this->db->where('id', $update['url'])->set('share_count', 'share_count - 1', false)->update('url');
         } else {
             // Only one share
             // Delete from DB
             $this->db->where('id', $update['url'])->delete('url');
             $dir = getcwd() . '/upload/url/' . $update['url'];
             if (is_dir($dir)) {
                 empty_folder($dir);
                 if (!remove_folder($dir)) {
                     log_message('error', "user_model->deleteUpdate() - Remove folder failed:" . $dir);
                     return false;
                 }
             }
         }
     }
     // Delete files
     if ($update['image_id']) {
         // Check if this is the only update using this image
         $num = $this->db->where('image_id', $update['image_id'])->get('update_image')->num_rows;
         if ($num == 1) {
             // Delete from DB
             $this->db->where('image_id', $update['image_id'])->delete('image');
             $dir = getcwd() . '/upload/photo/' . $update['username'];
             remove_files(array($dir . '/' . $update['image_id'] . '-' . $update['image_filename'] . $update['image_fileext'], $dir . '/' . $update['image_id'] . '-' . $update['image_filename'] . '-large' . $update['image_fileext'], $dir . '/' . $update['image_id'] . '-' . $update['image_filename'] . '-small' . $update['image_fileext']));
         }
     }
     // Delete mentions
     $this->db->where('update_id', $update_id)->delete('user_notification');
     // Delete update
     $this->db->where('id', $update_id)->delete('update');
     $this->db->trans_complete();
     if ($this->db->trans_status() === false) {
         return false;
     }
     return true;
 }
Ejemplo n.º 7
0
            print "ERROR: Invalid Parameter " . $parameter . "\n\n";
            display_help();
            exit;
    }
}
/* are my tables already present? */
$sql = "show tables from `" . $database_default . "` like 'plugin_rrdclean_action'";
#$result = db_fetch_assoc($sql) or die (mysql_error());
$result = db_fetch_assoc($sql);
/* if the table that holds the actions is present, work on it */
if (sizeof($result)) {
    /* Get all files to act on */
    $file_array = db_fetch_assoc("SELECT " . "plugin_rrdclean_action.id, " . "plugin_rrdclean_action.name, " . "plugin_rrdclean_action.local_data_id, " . "plugin_rrdclean_action.action " . "FROM " . "plugin_rrdclean_action");
    if (sizeof($file_array) > 0 || $force) {
        /* there's something to do for us now */
        remove_files($file_array, $debug);
        if ($force) {
            cleanup_ds_and_graphs($debug);
        }
    }
}
/*
 * remove_files
 * remove all unwanted files; the list is given by table plugin_rrdclean_action
 */
function remove_files($file_array, $debug)
{
    global $config;
    include_once $config["library_path"] . "/api_graph.php";
    include_once $config["library_path"] . "/api_data_source.php";
    cacti_log("RRDClean is now running on " . sizeof($file_array) . " items", true, "RRDCLEAN");
Ejemplo n.º 8
0
function remove_files($path, $depth = 1, $delte_basefolder = false)
{
    $depth--;
    $path = realpath($path);
    //echo "check '$path' <br>\n";
    if (is_dir($path) === true) {
        $files = array_diff(scandir($path), array('.', '..'));
        foreach ($files as $file) {
            $f = realpath($path . "/" . $file);
            if ($depth >= 0) {
                remove_files($f, $depth, true);
            } else {
                echo "Warning - path {$f} is to deep<br>\n";
            }
        }
        if ($delte_basefolder and $depth >= 0) {
            rmdir($path);
        }
    } else {
        if (is_file($path)) {
            echo "Delete file: '{$path}'<br>\n";
            unlink($path);
        }
    }
}