Example #1
0
 function do_upload()
 {
     $config['upload_path'] = $this->photos_path;
     $config['allowed_types'] = 'gif|jpg|png|jpeg';
     $fileNameParsed = explode('.', $_FILES['userfile']['name']);
     $ext = array_pop($fileNameParsed);
     $config['file_name'] = implode('.', [slug(implode('.', $fileNameParsed)), $ext]);
     $this->load->library('upload', $config);
     if ($this->upload->do_upload()) {
         //Get DATA
         $file_data = $this->upload->data();
         if ($file_data["image_width"] > 900) {
             //RESIZE
             $config = array('source_image' => $file_data['full_path'], 'maintain_ratio' => true, 'width' => 900, 'height' => 600);
             $this->image_lib->initialize($config);
             if (!$this->image_lib->resize()) {
                 return false;
             }
         }
         // GET COLOR
         $color = get_main_color($file_data);
         //SAVE IN DB
         $data = array('title' => humanize($file_data['raw_name']), 'filename' => $file_data['file_name'], 'origin_width' => $file_data['image_width'], 'origin_height' => $file_data['image_height'], 'created' => $this->now, 'updated' => $this->now, 'type' => $file_data['image_type'], 'r' => $color['r'], 'g' => $color['g'], 'b' => $color['b']);
         //CREATE Header
         create_header($data);
         //CREATE THUMB
         create_thumbnail($data);
         if ($this->db->insert('photos', $data)) {
             return true;
         } else {
             $this->session->set_flashdata('message', array('title' => 'Error', 'content' => 'Unexpected Error', 'type' => 'error'));
             return false;
         }
     } else {
         //ERROR
         $this->session->set_flashdata('message', array('title' => 'Error', 'content' => $this->upload->display_errors(), 'type' => 'error'));
         return false;
         // $this->upload->display_errors();
     }
 }
Example #2
0
    $crop_x = round($_SESSION["crop_x"]);
    $crop_y = round($_SESSION["crop_y"]);
    $crop_w = $crop_x + round($_SESSION["crop_w"]);
    $crop_h = $crop_y + round($_SESSION["crop_h"]);
} else {
    //Vorauswahl des Bereiches
    $crop_x = 50;
    $crop_y = 0;
    $crop_w = 100;
    $crop_h = 100;
}
$style = "\n\t    #main\n\t        {\n\t\t\twidth: " . ($max_xy + 100) . "px;\n\t\t\t//height: " . ($max_xy + 250) . "px;\n\t        }\n\t\t#imagediv\n\t        {\n\t\t\tvertical-align: middle;\n\t\t\tmargin: 2em auto 0;\n\t\t\twidth: " . ($image_width + 10) . "px;\n\t\t\theight: " . ($image_height + 10) . "px;\n\t\t\tbackground: gray;\n\t\t\tpadding: 10px;\n\t\t}";
$script = "\n\t\t jQuery(function(){\n\t\t\n\t\t\tjQuery('#cropbox').Jcrop({\n\t\t\t\taspectRatio: " . $settings["picture_aspectRatio"] . ",\n\t\t\t\t//setSelect:   [50, 0, 100,100],\n\t\t\t\tsetSelect:   [{$crop_x} , {$crop_y} , {$crop_w} , {$crop_h}],\n\t\t\t\tminSize: [ " . $settings["picture_min_x"] . " , " . $settings["picture_min_y"] . " ],\n\t\t\t\tonSelect: updateCoords\n\t\t\t});\n\t\t\n\t\t});\n\t\t\n\t\tfunction updateCoords(c)\n\t\t{\n\t\t\tjQuery('#x').val(c.x);\n\t\t\tjQuery('#y').val(c.y);\n\t\t\tjQuery('#w').val(c.w);\n\t\t\tjQuery('#h').val(c.h);\n\t\t};\n\t\t\n\t\tfunction checkCoords()\n\t\t{\n\t\t\tif (parseInt(jQuery('#w').val())>0) return true;\n\t\t\talert('Please select a crop region then press submit.');\n\t\t\treturn false;\n\t\t};\t";
$meta = "\n\t\t<script src='jquery-1.11.1.min.js' type='text/javascript'></script>\n\t\t<script src='jQueryRotate.js' type='text/javascript'></script>\n\t\t<script src='jquery.Jcrop.js' type='text/javascript'></script>\n\t\t<script src='jquery.color.js' type='text/javascript'></script>\t\n\t\t<link rel='stylesheet' href='jquery.Jcrop.min.css' type='text/css' />\n\t\t<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>\n\t\t<META HTTP-EQUIV='Expires' CONTENT='-1'>  \n\t";
//Start Page ($tilte, $style,$script,$meta,$body)
echo create_header($_SESSION["settings"]["html_title"], $style, $script, $meta, "", "logolisa.svg", false);
?>

			<h3>2. Schritt: Bitte markieren Sie Ihren Kopf!!</h3>

			<table>
				<tr>
					<td align="right">
						<?php 
print_button($lastpage, "button-back-croppicure", "zurück/drehen");
?>
					</td>
					<td align="left">
						<!-- This is the form that our event handler fills -->
						<form action="<?php 
echo $nextpage;
Example #3
0
<?php

/* Copyright (c) H. Reimers reimers@heye-tammo.de
	
	Info:
		Icons: http://commons.wikimedia.org/wiki/User:Seahen/gallery
		Images Demodate http://openclipart.org
	**/
/*
	$path=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].pathinfo($_SERVER["PHP_SELF"])["dirname"]."/eingabe/index.php";
	header("Location: $path");
	exit;
*/
require_once 'preload.php';
//Create Session an load Config
$meta_refresh = "<meta http-equiv='refresh' content='10; URL=eingabe/index.php'>";
$body = "<h2>Welcome to LiSA</h2>\n\t\t\t<a href='eingabe/'>Eingabe neuer Daten</a> &nbsp;&nbsp;-&nbsp;&nbsp;\n\t\t\t<a href='print/'>Drucken/Download</a> &nbsp;&nbsp;-&nbsp;&nbsp;\n\t\t\t<a href='upload/'>Upload</a> &nbsp;&nbsp;-&nbsp;&nbsp;\t\t\t\n\t\t\t<a href='edit/'>Sch&uuml;lerdaten &auml;ndern</a> &nbsp;&nbsp;-&nbsp;&nbsp;\n\t\t\t<a href='admin/'>Einstellungen &auml;ndern</a> &nbsp;&nbsp;&nbsp;&nbsp;<br><br>\n\t\t\t";
$html_title = isset($_SESSION["settings"]["html_title"]) ? $_SESSION["settings"]["html_title"] : 'LiSA';
$lisa_web_base_path = isset($_SESSION["lisa_web_base_path"]) ? $_SESSION["lisa_web_base_path"] : '';
echo create_header($html_title, "", "", $meta_refresh, $body, "logolisa.svg", false);
echo create_footer("", $lisa_web_base_path);
?>
 

Example #4
0
<?php

/* Copyright (c) H. Reimers reimers@heye-tammo.de*/
require_once '../preload.php';
//Create Session an load Config
check_login_logout("eingabe");
$lastpage = "index.php";
//Test if Session is valid ($step)
test_session(0);
$debug = 0;
//Start Page ($tilte, $style,$script,$meta,$body)
echo create_header($_SESSION["settings"]["html_title"], "", "", "", "", "logolisa.svg", false);
if (!isset($_POST["part1"]) or !isset($_POST["part2"]) or !isset($_POST["part3"])) {
    error_msg("Es fehlen Daten");
} else {
    $part1 = trim($_POST["part1"]);
    $part2 = trim($_POST["part2"]);
    $part3 = trim($_POST["part3"]);
}
$error_msg = "";
//Prüfe allgemeinen Aufbau (Quersumme muss %10=0 sein
if (quersumme($part2) % 10 != 0) {
    $error_msg .= "Der Block 2 ist fehlerhaft<br>";
}
//Prüfe allgemeinen Aufbau (Quersumme muss %10=0 sein)
if (quersumme($part3) % 10 != 0) {
    $error_msg .= "Der Block 3 ist fehlerhaft<br>";
}
if ($error_msg != "") {
    echo "\n\t\t\t<h3>Bitte geben Sie die TAN ein!</h3>\n\t\t\t<p>\n\t\t\t\t<form action='check_tan.php' method='POST' >\n\t\t\t\t\t<input type='text' name='part1' size='5' value='{$part1}'> -\n\t\t\t\t\t<input type='text' name='part2' size='5' value='{$part2}'> -\n\t\t\t\t\t<input type='text' name='part3' size='5' value='{$part3}'> -\n\t\t\t\t\t<input type='submit' value='weiter'>\n\t\t\t\t</form>\n\t\t\t</p>\t";
    error_msg($error_msg);
function get_jumpgate($sid)
{
    global $uid;
    global $map_info;
    if (!in_array($sid, $map_info->get_possible_scan_systems()) && !in_array($sid, $map_info->get_all_fleet_scans())) {
        return false;
    }
    // BUTTON Definitionen
    $buttonShape = "button_circle_30x30_shadow";
    $system_info = $map_info->get_system($sid);
    $j_pid = get_pid_of_jumpgate($sid);
    // pid des jumpgates
    $j_uname = get_name_by_uid($j_uid);
    // name des jumpgatebesitzers
    $sth = mysql_query("select prod_id from jumpgates where pid='{$j_pid}'");
    if (!$sth || mysql_num_rows($sth) == 0) {
        return 0;
    }
    list($j_prodid) = mysql_fetch_row($sth);
    $j_prodname = get_name_by_prod_id($j_prodid);
    $j_pic = PIC_ROOT . get_pic($j_prodid);
    // Ok, Buttons kreieren und in $new_button[] speichern
    $new_button = array();
    $new_button[] = create_button($buttonShape, "button_face_info", "alert('not yet implemented')", 0, "show info");
    $new_header = create_header($j_pic, "Jumpgate in " . $system_info["name"], "", "", "");
    // Button in das Header Tag einfügen
    for ($i = 0; $i < sizeof($new_button); $i++) {
        $new_header .= $new_button[$i];
    }
    $new_header .= "</SR_HEAD>";
    echo "newItemBox\n";
    // nötig um zu ermitteln wie der inhalt behnadelt werden soll!
    echo $new_header;
}
Example #6
0
        $error = 4;
    }
}
if ($error == 0) {
    $pagetitle = "Daten wurden gespeichert";
    $msg = "Bitte verlassen Sie den PC!";
    //$url=$_SESSION["settings"]["domainSubFolder"]."/print/show_one_student.php?img=".urlencode(str_replace($_SESSION["lisa_path"],"",$image_filename_new,1)."&a=".$_SESSION["ablaufdatum"];
    //Zeige Link um Ausweis zu drucken (entferne dabei die Verzeichnisangaben aus sicht des Betriebsystems (lisa_path) )
    $url = "show_one_student.php?img=" . urlencode(str_replace($_SESSION["lisa_path"], "", $image_filename_new)) . "&a=" . $_SESSION["ablaufdatum"];
    $msg .= "<br><a href='{$url}' target='_blanc'><small>Ausweis drucken</small></a><br>";
    $meta_refresh = "<meta http-equiv='refresh' content='10; URL=index.php'>";
    if ($settings["write_csv"]) {
        //Nur wenn CSV-Dateien erstellt werden sollen
        if (!isset($_SESSION["data_written"])) {
            //if(true){ //
            write_data_csv($given_name, $last_name, $birthday, $class, $filename, $filename);
            write_bbsplanung_data_csv($given_name, $last_name, create_birthday_bbs_planung(), $class);
        }
    }
    //		$_SESSION=array();
    //		$_SESSION["data_written"]="1";
} else {
    $pagetitle = "Fehler";
    $meta_refresh = "";
    $msg = $error_msg;
}
//Start Page ($tilte, $style,$script,$meta,$body)
$body = "<h3> {$pagetitle} </h3> {$msg} \n<br><br>\n<a href='index.php'>Neue Eingabe starten</a><br>\n";
//$meta_refresh=""; //Nur fürs debugging
echo create_header($_SESSION["settings"]["html_title"], "", "", $meta_refresh, $body, "logolisa.svg", false);
echo create_footer("");
Example #7
0
 function get_thumbnail($url)
 {
     $this->load->library('upload');
     $url_original = $url;
     if (parse_url($url)) {
         $url = $this->addhttp($url);
         $url = parse_url($url);
         switch ($url['host']) {
             case 'www.youtube.com':
                 parse_str($url['query'], $data);
                 $video = $data['v'];
                 $video_data = get_json("https://www.googleapis.com/youtube/v3/videos?id={$video}&part=snippet&key=AIzaSyBRa_48GW6LpDcB8VlQxrt5alf-4-GTThQ");
                 $thumbnail = $video_data->items[0]->snippet->thumbnails->high->url;
                 break;
             case 'youtu.be':
                 $video = str_replace('/', '', $url['path']);
                 $json = get_json("https://www.googleapis.com/youtube/v3/videos?id={$video}&part=snippet&key=AIzaSyBRa_48GW6LpDcB8VlQxrt5alf-4-GTThQ");
                 $video_data = json_decode($json);
                 $thumbnail = $video_data->items[0]->snippet->thumbnails->high->url;
                 break;
             case 'www.dailymotion.com':
                 $path = explode('/', $url['path']);
                 $video = $path[2];
                 $thumbnail = "http://www.dailymotion.com/thumbnail/video/{$video}";
                 break;
             case 'vimeo.com':
                 $path = explode('/', $url['path']);
                 $video = end($path);
                 $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/{$video}.php"));
                 $thumbnail = $hash[0]['thumbnail_large'];
                 break;
             case 'www.mmpro.de':
                 $this->load->library('simple_html_dom');
                 $html = file_get_html($url_original);
                 foreach ($html->find('link[rel=canonical]') as $element) {
                     $canonical_url = $element->href;
                 }
                 $canonical_url = $this->addhttp($canonical_url);
                 $canonical_url = parse_url($canonical_url);
                 parse_str($canonical_url['query'], $data);
                 $video_id = $data['videoId'];
                 $json_output = get_json("http://www.mmpro.de/cache/videolist.json", true);
                 foreach ($json_output as $object) {
                     foreach ($object as $video) {
                         $video_to_display = $video;
                         foreach ($video["video"] as $video_data) {
                             $video_uri = $video_data['uri'];
                             if ($video_data['uri'] == $video_id) {
                                 break 3;
                             }
                         }
                     }
                 }
                 if (isset($video_to_display['mcf'])) {
                     $thumbnail = "http://www.mcfootage.com/imagereplace.php?width=900&height=600&kunde=archive&file=" . $video_to_display['picture'];
                 } else {
                     $json_output = get_json("http://www.admiralcloud.com/player/json/" . $video_uri);
                     $thumbnail = $json_output->movies[0]->jpg;
                 }
                 break;
             case 'www.tvbvideo.de':
                 $CI =& get_instance();
                 $CI->load->library('simple_html_dom');
                 $html = file_get_html($url_original);
                 $r = html_entity_decode($html->find('#export_website_code', 0)->innertext());
                 $r_html = str_get_html($r);
                 preg_match('(http://api.kewego.com/video/getHTML5Thumbnail.+\\"\\))', $r_html, $thumbnail);
                 $thumbnail = substr($thumbnail[0], 0, -2);
                 $thumbnail = $this->get_final_url($thumbnail);
                 break;
             default:
                 echo "Je ne connais pas ce site web... Veuillez vérifier le lien.";
                 break;
         }
         if (isset($thumbnail) && $thumbnail != "assets/img/nopic.jpg") {
             //UPLOAD THUMBNAILS
             $filename = 'import_' . slug($_POST['title']) . '.jpg';
             grab_image($thumbnail, $this->photos_path . $filename);
             $data['filename'] = $filename;
             if (autoCrop($data)) {
                 create_thumbnail($data);
                 create_header($data);
                 unlink($this->photos_path . $filename);
             }
             return $filename;
         } else {
             if ($thumbnail == "assets/img/nopic.jpg") {
                 return "nopic.jpg";
             } else {
                 return false;
             }
         }
     } else {
         return false;
     }
 }
Example #8
0
function test_session($step)
{
    //Schutz vor Sessionübernahme durch andere IPs
    if (isset($_SERVER["REMOTE_ADDR"])) {
        //Kontrolle ob Session von einer anderen IP gekapert wurde.
        if (isset($_SESSION["REMOTE_ADDR"])) {
            if ($_SESSION["REMOTE_ADDR"] != $_SERVER["REMOTE_ADDR"]) {
                echo create_header("Fehler", "", "", "", "");
                $msg = "Fehler, Client-IP der Session wurde verändert!<br>Abbruch!";
                create_footer($msg);
                exit(0);
            }
        } else {
            $_SESSION["REMOTE_ADDR"] = $_SERVER["REMOTE_ADDR"];
        }
    } else {
        echo create_header("Fehler", "", "", "", "");
        $msg = "Interner Fehler, kann Client-IP nicht ermitteln<br>Abbruch!";
        create_footer($msg);
        exit(0);
    }
    //Test ob die allgemeinen Einstellungen geladen wurden
    if (!isset($_SESSION["settings"])) {
        echo create_header("Fehler", "", "", "", "");
        echo "<div align='center' id='main'>\n\t\t\t\t\t\t<h3> Bitte beginnen Sie von vorne! </h3>";
        print_button("index.php", "button_check_data", "zurück");
        echo "\t\t</div>";
        create_footer("");
        exit(0);
    }
    $back2start = false;
    if (isset($_SESSION["step"])) {
        if ($_SESSION["step"] >= $step - 1) {
            if ($_SESSION["step"] == $step - 1) {
                $_SESSION["step"]++;
            }
        } else {
            echo "Fehlerhafte Reihenfolge<br>";
            $back2start = true;
        }
    } else {
        echo "Datenfehler<br>";
        $back2start = true;
    }
    if ($back2start == true) {
        echo "<a href='index.php'>Neue Eingabe</a><br>";
        exit(0);
    }
}
Example #9
0
             }
             # Ending the switch
             ConfigFile::tab(-1);
             ConfigFile::write('}');
             ConfigFile::write('');
         }
     }
     # Logging
     $G_OUTPUT_RESULTS[] = ' - Closing the config file.<br />';
     # Closing the config file
     ConfigFile::close();
 }
 # Advanced install of storage servers
 if ($_POST['install-mode'] == 'advanced' && (isset($_POST['create_database_host']) && $_POST['create_database_host'] != '' || isset($_POST['create_storage_host']) && $_POST['create_storage_host'] != '')) {
     # Storage Servers header
     create_header('Storage Servers', $G_OUTPUT_RESULTS);
     # Adding controller to database host
     if (isset($_POST['create_database_host']) && $_POST['create_database_host'] != '') {
         # Creating image host
         $G_OUTPUT_RESULTS[] = ' - Creating database host.<br />';
         $query = "\tINSERT INTO\n\t\t\t\t\t\t\t" . NQ_CONTROLLER_DATABASE . ".`" . NQ_CONTROLLER_TABLE_PREFIX . "servers_database`\n\t\t\t\t\t\tSET\n\t\t   \t\t\t\t\t`local_name` \t\t= 'Database Server #1', \n\t\t   \t\t\t\t\t`host_app_id`\t\t= 0,\n\t\t   \t\t\t\t\t`host_app_group`\t= 0,\n\t\t   \t\t\t\t\t`host`\t\t\t= '" . mysqli_escape_string($G_CONTROLLER_DBLINK, NQ_DATABASE_STORAGE_HOST) . "', \n\t\t   \t\t\t\t\t`username`\t\t= '" . mysqli_escape_string($G_CONTROLLER_DBLINK, NQ_DATABASE_STORAGE_USERNAME) . "',\n\t\t   \t\t\t\t\t`password`\t\t= '" . mysqli_escape_string($G_CONTROLLER_DBLINK, NQ_DATABASE_STORAGE_PASSWORD) . "',\n\t\t   \t\t\t\t\t`environment`\t\t= '*', \n\t\t   \t\t\t\t\t`database`\t\t= '" . mysqli_escape_string($G_CONTROLLER_DBLINK, NQ_DATABASE_STORAGE_DATABASE) . "', \n\t\t   \t\t\t\t\t`ssh_username`\t\t= '', \n\t\t   \t\t\t\t\t`ssh_password`\t\t= '',\n\t\t   \t\t\t\t\t`space_used`\t\t= 0, \n\t\t   \t\t\t\t\t`available_space`\t= 0, \n\t\t   \t\t\t\t\t`available_percent`\t= 100.00, \n\t\t   \t\t\t\t\t`total_space`\t\t= 2147483648";
         $result = mysqli_query($G_CONTROLLER_DBLINK, $query) or die(mysqli_error($G_CONTROLLER_DBLINK));
     }
     # Creating our storage hosts
     if (isset($_POST['create_storage_host']) && $_POST['create_storage_host'] != '') {
         # Making the storage directory
         $G_OUTPUT_RESULTS[] = ' - Creating _nqstorage directory.<br />';
         mkdir(__DIR__ . '/_nqstorage');
         # Blocking all requests from this folder
         $G_OUTPUT_RESULTS[] = ' - Creating _nqstorage .htaccess file.<br />';
         $handle = fopen(__DIR__ . '/_nqstorage/.htaccess', 'w');
Example #10
0
function check_login_logout($area = false)
{
    if ($area == false) {
        //Get folder name = area (admin, print, upload, ...)
        $path = pathinfo($_SERVER["SCRIPT_FILENAME"]);
        $path = explode("/", $path["dirname"]);
        $area = trim($path[sizeof($path) - 1]);
    }
    if (isset($_POST["logout"]) or isset($_GET["logout"])) {
        if (isset($_SESSION["LOGINAREA"])) {
            $_SESSION["LOGINAREA"] = false;
            unset($_SESSION['LOGINAREA']);
        }
    } else {
        if (isset($_SESSION["LOGINAREA"])) {
            //Logout ???
            //Bereits in dem bereich eingeloggt?
            if ($_SESSION["LOGINAREA"] == $area) {
                return true;
            }
        }
    }
    //if( check_ip() ) return true;
    if (isset($_POST["password"])) {
        if (check_passwd($area, $_POST["password"])) {
            $_SESSION["LOGINAREA"] = $area;
            //Anmeldung in Session speichern
            return true;
        }
    } else {
        if (check_passwd($area, false)) {
            $_SESSION["LOGINAREA"] = $area;
            //Anmeldung in Session speichern
            return true;
        }
    }
    echo create_header($_SESSION["settings"]["html_title"], "", "", "", "", "logolisa.svg");
    echo "<form action='' method='POST'>\n\t\t\t" . ucfirst($area) . "-Passwort: <input type='password' name='password'>\n\t\t\t<input type='submit' value='anmelden'>\n\t\t\t</form>\n\t\t";
    echo create_footer();
    exit(0);
}