Esempio n. 1
0
function search_output()
{
    global $sqldebug;
    /*
        cacheid
        name
        latitude
        longitude
        type
        size
        difficulty
        terrain
        username
        waypoint
    */
    $sql = '
		SELECT
			&searchtmp.`cache_id` `cacheid`,
			&searchtmp.`longitude`,
			&searchtmp.`latitude`,
			`caches`.`name`,
			`caches`.`wp_oc`,
			`caches`.`terrain`,
			`caches`.`difficulty`,
			`cache_type`.`short` `typedesc`,
			`cache_size`.`name` `sizedesc`,
			`user`.`username`
		FROM
			&searchtmp,
			`caches`,
			`cache_type`,
			`cache_size`,
			`user`
		WHERE
			&searchtmp.`cache_id`=`caches`.`cache_id` AND
			&searchtmp.`type`=`cache_type`.`id` AND
			&searchtmp.`size`=`cache_size`.`id` AND
			&searchtmp.`user_id`=`user`.`user_id`';
    $rs = sql_slave($sql, $sqldebug);
    while ($r = sql_fetch_array($rs)) {
        $lat = sprintf('%07d', $r['latitude'] * 100000);
        $lon = sprintf('%07d', $r['longitude'] * 100000);
        $name = convert_string($r['name']);
        $username = convert_string($r['username']);
        $type = convert_string($r['typedesc']);
        $size = convert_string($r['sizedesc']);
        $difficulty = sprintf('%01.1f', $r['difficulty'] / 2);
        $terrain = sprintf('%01.1f', $r['terrain'] / 2);
        $cacheid = convert_string($r['wp_oc']);
        $line = "{$name} by {$username}, {$type}, {$size}, {$cacheid}";
        $record = pack("CLllA*x", 2, 1 + 4 + 4 + 4 + strlen($line) + 1, (int) $lon, (int) $lat, $line);
        append_output($record);
    }
    mysql_free_result($rs);
}
Esempio n. 2
0
function folderToZip($folder, &$zipFile, $exclusiveLength, $encoding, $imgDateNewer, $withfolder, $debug = 0)
{
    $handle = opendir($folder);
    while (false !== ($f = readdir($handle))) {
        if ($f != '.' && $f != '..' && $f != '') {
            $filePath = realpath("{$folder}/{$f}");
            // Remove prefix from file path before add to zip.
            $localPath = substr($filePath, $exclusiveLength);
            if ($localPath[0] == "/") {
                $localPath = substr($localPath, 1);
            }
            if (is_file($filePath)) {
                $lastchange = filemtime($filePath);
                if ($lastchange == null or $lastchange >= $imgDateNewer) {
                    $localPath = convert_string($localPath, null, $encoding);
                    $filenamezip = basename($localPath);
                    //if($withfolder) $filenamezip="$localPath\\".$filenamezip;
                    if ($withfolder) {
                        $filenamezip = "{$localPath}";
                    }
                    $zipFile->addFile($filePath, $filenamezip);
                    //$zipFile->addFile($filePath, $localPath);
                }
            } elseif (is_dir($filePath)) {
                // Add sub-directory.
                //$localPath=convert_string($localPath, null , $encoding);
                //$zipFile->addEmptyDir($localPath);
                folderToZip($filePath, $zipFile, $exclusiveLength, $encoding, $imgDateNewer, $withfolder);
            }
            if ($debug >= 2) {
                echo $localPath . "<br>";
            }
            //*/
        }
    }
    closedir($handle);
}
Esempio n. 3
0
                    echo "Column / Field: " . $data[2] . "<br />";
                    echo "Type: " . $data[3] . "<br />";
                    echo "Length: " . $data[4] . "<br />";
                    echo "Value_Range: " . (isset($data[5]) ? convert_string($data[5]) : "") . "<br />";
                    echo "Description: " . (isset($data[6]) ? $data[6] : "") . "<br />";
                    echo "Examples: " . (isset($data[7]) ? $data[7] : "") . "<br />";
                    echo "Comments: " . (isset($data[8]) ? $data[8] : "") . "<br /><br />";
                    //open DB
                    include dirname(__FILE__) . '/../include/dbconnopen.php';
                    //overwrite / skip existing records
                    if ($_POST['variable_overwrite_skip'] == 'Overwrite') {
                        //OVERWRITE EXISTING RECORDS
                        $imported_record = mysqli_query($cnnCDD, "Call 1_Import_Variable__Create_Variable_OVERWRITE('" . addslashes($data[0]) . "','" . addslashes($data[1]) . "','" . addslashes($data[2]) . "','" . addslashes($data[3]) . "','" . addslashes($data[4]) . "','" . addslashes(isset($data[5]) ? convert_string($data[5]) : "") . "','" . addslashes(isset($data[6]) ? $data[6] : "") . "','" . addslashes(isset($data[7]) ? $data[7] : "") . "','" . addslashes(isset($data[8]) ? $data[8] : "") . "','" . $_COOKIE['user_id'] . "')");
                    } else {
                        //SKIP EXISTING RECORDS
                        $imported_record = mysqli_query($cnnCDD, "Call 1_Import_Variable__Create_Variable_SKIP('" . addslashes($data[0]) . "','" . addslashes($data[1]) . "','" . addslashes($data[2]) . "','" . addslashes($data[3]) . "','" . addslashes($data[4]) . "','" . addslashes(isset($data[5]) ? convert_string($data[5]) : "") . "','" . addslashes(isset($data[6]) ? $data[6] : "") . "','" . addslashes(isset($data[7]) ? $data[7] : "") . "','" . addslashes(isset($data[8]) ? $data[8] : "") . "','" . $_COOKIE['user_id'] . "')");
                    }
                    if (is_object($imported_record)) {
                        //->num_rows > 0) {
                        echo "<b style=\"color: #0f0;\">IMPORTED!</b><hr />";
                    } else {
                        echo "<b style=\"color: #f00;\">NOT IMPORTED...<br />May already exist or corresponding table / database doesn't exist.</b><hr />";
                    }
                    //close DB
                    include dirname(__FILE__) . '/../include/dbconnclose.php';
                }
                echo "<a href=\"import.php\">Import Another</a>";
            }
        }
    }
}
Esempio n. 4
0
	difficulty
	terrain
	username
*/
$sql = 'SELECT `ov2content`.`cache_id` `cacheid`, `ov2content`.`longitude` `longitude`, `ov2content`.`latitude` `latitude`, `caches`.`date_hidden` `date_hidden`, `caches`.`name` `name`, `caches`.`wp_oc` `wp_oc`, `cache_type`.`short` `typedesc`, `cache_size`.`de` `sizedesc`, `caches`.`terrain` `terrain`, `caches`.`difficulty` `difficulty`, `user`.`username` `username` FROM `ov2content`, `caches`, `cache_type`, `cache_size`, `user` WHERE `ov2content`.`cache_id`=`caches`.`cache_id` AND `ov2content`.`type`=`cache_type`.`id` AND `ov2content`.`size`=`cache_size`.`id` AND `ov2content`.`user_id`=`user`.`user_id`';
$rs = sql_slave($sql, $sqldebug);
while ($r = sql_fetch_array($rs)) {
    $lat = sprintf('%07d', $r['latitude'] * 100000);
    $lon = sprintf('%07d', $r['longitude'] * 100000);
    $name = convert_string($r['name']);
    $username = convert_string($r['username']);
    $type = convert_string($r['typedesc']);
    $size = convert_string($r['sizedesc']);
    $difficulty = sprintf('%01.1f', $r['difficulty'] / 2);
    $terrain = sprintf('%01.1f', $r['terrain'] / 2);
    $cacheid = convert_string($r['wp_oc']);
    $line = "{$name} by {$username}, {$type}, {$size}, {$cacheid}";
    $record = pack("CLllA*x", 2, 1 + 4 + 4 + 4 + strlen($line) + 1, (int) $lon, (int) $lat, $line);
    append_output($record);
}
mysql_free_result($rs);
if ($sqldebug == true) {
    sqldbg_end();
}
// phpzip versenden
if ($bUseZip == true) {
    $phpzip->add_data($sFilebasename . '.ov2', $content);
    echo $phpzip->save($sFilebasename . '.zip', 'b');
}
exit;
function convert_string($str)
Esempio n. 5
0
function print_op_array($op_array)
{
    ?>
        <h2>Global file op_array</h2>
        <table>
            <tr>
                <th>N</th>
                <th>Line</th>
                <th>Opcode</th>
                <th>Extented value</th>
                <th>Op1</th>
                <th>Op2</th>
                <th>Result</th>
            </tr>
    <?php 
    $count = count($op_array);
    $line = 0;
    global $source;
    for ($i = 0; $i < $count; ++$i) {
        /* if the lineno is greater, than the last line displayed, then show the
           code until that line above the opcode */
        if ($line < $op_array[$i]['lineno']) {
            $print = $op_array[$i]['lineno'];
        }
        $code = '';
        while ($line < $print) {
            $code .= sprintf("%03d: %s\n", $line + 1, $source[$line]);
            ++$line;
        }
        if ($code != '') {
            echo "<tr>\n";
            echo '<td  class="source" colspan="7"><pre>' . $code . "</pre></td>\n";
            echo "</tr>\n";
        }
        ?>
            <tr>
                <td class="e"><?php 
        echo $i;
        ?>
</td>
                <td><nobr><?php 
        echo $op_array[$i]['lineno'];
        ?>
</nobr></td>
                <td><nobr><?php 
        echo $op_array[$i]['opcode'];
        ?>
</nobr></td>
                <td><nobr><?php 
        echo $op_array[$i]['extended_value'];
        ?>
</nobr></td>
                <td><nobr><?php 
        echo convert_string($op_array[$i]['op1'], 50);
        ?>
</nobr></td>
                <td><nobr><?php 
        echo convert_string($op_array[$i]['op2'], 50);
        ?>
</nobr></td>
                <td><nobr><?php 
        echo convert_string($op_array[$i]['result'], 50);
        ?>
</nobr></td>
            </tr>
    <?php 
    }
    $count = count($source);
    if ($line < $count) {
        $code = '';
        while ($line < $count) {
            $code .= sprintf("%03d: %s\n", $line + 1, $source[$line]);
            ++$line;
        }
        if ($code != '') {
            echo "<tr>\n";
            echo '<td  class="source" colspan="7"><pre>' . $code . "</pre></td>\n";
            echo "</tr>\n";
        }
    }
    ?>
        </table>
    <?php 
}
Esempio n. 6
0
            } else {
                if (!file_exists($lisa_pic)) {
                    echo "Fehler kann LiSA Datei: {$lisa_pic} nicht finden<br>\n";
                } else {
                    //Kopiere Dateien
                    if (!@copy($lisa_pic, $bbsplan_pic)) {
                        $errors = error_get_last();
                        echo "Fehler kann Datei {$lisa_pic} nicht nach {$bbsplan_pic} kopieren. Fehlertyp:" . $errors['type'] . " ";
                        echo "Fehlermeldung:" . $errors['message'] . "<br>\n";
                        $_SESSION["matches"][$key]["copy_done"] = 0;
                    } else {
                        $_SESSION["matches"][$key]["copy_done"] = 1;
                        $newfilename = $match["bbsplan"]["class"] . "/" . basename($bbsplan_pic);
                        //Damit die Datei unter Windows funktioniert.
                        if ($encoding != null) {
                            $newfilename = convert_string($newfilename, null, $encoding);
                        }
                        $zip->addFile($bbsplan_pic, $newfilename);
                    }
                }
            }
        }
    } else {
        echo "<!-- Fehler: Bildfelder fehlen";
        preecho($match);
        echo "-->\n";
    }
}
echo "<h2> Infos Zip-Datei </h2>";
echo "Anzahl Dateien: " . $zip->numFiles . "<br>";
echo "Letzte Meldung (sollte 0 sein, 23=Dateien in Zip-Datei &uuml;berschrieben.):" . $zip->status . "<br>";
 while ($r = $dbcSearch->dbResultFetch()) {
     $thisline = $ovlLine;
     $lat = sprintf('%01.5f', $r['latitude']);
     $thisline = mb_ereg_replace('{lat}', $lat, $thisline);
     $thisline = mb_ereg_replace('{latname}', $lat, $thisline);
     $lon = sprintf('%01.5f', $r['longitude']);
     $thisline = mb_ereg_replace('{lon}', $lon, $thisline);
     $thisline = mb_ereg_replace('{lonname}', $lon, $thisline);
     //modified coords
     if ($r['cache_mod_cords_id'] > 0) {
         //check if we have user coords
         $thisline = str_replace('{mod_suffix}', '<F>', $thisline);
     } else {
         $thisline = str_replace('{mod_suffix}', '', $thisline);
     }
     $thisline = mb_ereg_replace('{cachename}', convert_string($r['name']), $thisline);
     $thisline = mb_ereg_replace('{symbolnr1}', $nr, $thisline);
     $thisline = mb_ereg_replace('{symbolnr2}', $nr + 1, $thisline);
     append_output($thisline);
     ob_flush();
     $nr += 2;
 }
 $dbcSearch->reset();
 unset($dbc);
 $ovlFoot = mb_ereg_replace('{symbolscount}', $nr - 1, $ovlFoot);
 append_output($ovlFoot);
 if ($sqldebug == true) {
     sqldbg_end();
 }
 // phpzip versenden
 if ($bUseZip == true) {
Esempio n. 8
0
 //====== Entpacken
 $zip = new ZipArchive();
 $res = $zip->open($zip_path);
 if ($res === TRUE) {
     //Dateinamen Kodierung aller Dateien ermitteln
     $f_enc = array();
     $filenr = 0;
     while (false !== $zip->statIndex($filenr)) {
         $stat = $zip->statIndex($filenr);
         $filename = $stat['name'];
         $filename_enc = get_encoding($filename, $zipencsource);
         if ($filename_enc != 'ASCII' and $filename_enc != $zipenctarget) {
             $f = array();
             $f["filename_org"] = $filename;
             $f["encoding"] = $filename_enc;
             $f["filename_new"] = convert_string($filename, $filename_enc, $zipenctarget);
             $f_enc[] = $f;
         }
         $filenr++;
     }
     $zip->extractTo($path);
     $zip->close();
     echo "Das Zip-Archiv wurde nach {$path} entpackt. Es wurden {$filenr} Dateien entpackt!<br>\n";
     //Encoding anpassen
     foreach ($f_enc as $f) {
         //echo "rename: ".$path.$f["filename_org"]." to:". $path.$f["filename_new"]." encoding: ".$f["encoding"]."<br>\n";
         rename($path . $f["filename_org"], $path . $f["filename_new"]);
         //Datei umbennen
     }
 } else {
     echo "Fehler: Konnte Zip-Archiv nicht entpacken!<br>";
Esempio n. 9
0
function filename2student($dirname_org, $file_org, $target, $createTime = -1)
{
    global $studentnr;
    $dirname = convert_string($dirname_org);
    $dirnameex = explode("/", $dirname);
    $i = sizeof($dirnameex) - 1;
    if ($i > 1) {
        while (strlen($dirnameex[$i]) < 1 and $i >= 0) {
            $i--;
        }
        $dirname = $dirnameex[$i];
    }
    $file = convert_string($file_org);
    //Zerteilt die Zeichekette um später Name, Vorname, Gebdatum zu ermitteln
    $parts = explode("_", trim($file));
    $nr_parts = sizeof($parts);
    if ($nr_parts >= 3) {
        $student = array();
        //Set $createTime
        $student["createTime"] = $createTime;
        $student["lastname"] = $parts[0];
        $student["givenname"] = $parts[1];
        namenszusatz_hinter_vornamen($student, "givenname", "lastname", true);
        //Short Name for better matching
        $len_ln = strlen($student["lastname"]);
        if ($len_ln > 4) {
            $len_ln = 4;
        }
        $student["lastnameshort"] = substr($student["lastname"], 0, $len_ln);
        //Short Name for better matching
        $len_gn = strlen($student["givenname"]);
        if ($len_gn > 4) {
            $len_gn = 4;
        }
        $student["givennameshort"] = substr($student["givenname"], 0, $len_gn);
        $student["nr"] = $studentnr;
        $birthday = explode(".", $parts[2]);
        $birthday_nr_parts = sizeof($birthday);
        if ($birthday_nr_parts >= 3) {
            //Tag,Monat,Jahr müssen eine Zahl sein!
            if (is_numeric($birthday[0]) and is_numeric($birthday[1]) and is_numeric($birthday[2])) {
                //EINRÜCKEN
                $student["birthday_day"] = $birthday[0];
                $student["birthday_month"] = $birthday[1];
                $student["birthday_year"] = $birthday[2];
                $birthday = $student["birthday_day"] . "." . $student["birthday_month"] . "." . $student["birthday_year"];
                //$birthdaylong=$student["birthday_day"].".".$student["birthday_month"].".".$student["birthday_year"];
                $student["birthday"] = $birthday;
                $student["class"] = $dirname;
                //Short Class-Name for better matching
                $len_cl = strlen($student["class"]);
                if ($len_cl > 4) {
                    $len_cl = 4;
                }
                $student["classshort"] = substr($student["class"], 0, $len_cl);
                $student["picfile_org"] = "{$dirname_org}/{$file_org}";
                $student["picfile"] = "{$dirname}/{$file}";
                //Felder für verschiedene Vergleiche erzeugen
                //=====================================
                //=== name_birthday_class
                $student["name_birthday_class"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $birthday . "-" . $student["class"];
                $student["name_birthday_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthday_class"]);
                $student["name_birthday_class"] = strtolower($student["name_birthday_class"]);
                //Felder für verschiedene Vergleiche erzeugen
                //=== name_birthday_classshort
                $student["name_birthday_classshort"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $birthday . "-" . $student["classshort"];
                $student["name_birthday_classshort"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthday_classshort"]);
                $student["name_birthday_classshort"] = strtolower($student["name_birthday_classshort"]);
                //Felder für verschiedene Vergleiche erzeugen
                //=== name_birthday
                $student["name_geb"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $birthday;
                $student["name_geb"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_geb"]);
                $student["name_geb"] = strtolower($student["name_geb"]);
                //=== name_birthday(day_month)_class
                $student["name_birthdayDM_class"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_month"] . "-" . $student["class"];
                $student["name_birthdayDM_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthdayDM_class"]);
                $student["name_birthdayDM_class"] = strtolower($student["name_birthdayDM_class"]);
                //=== name_birthday(day_year)_class
                $student["name_birthdayDY_class"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_year"] . "-" . $student["class"];
                $student["name_birthdayDY_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthdayDY_class"]);
                $student["name_birthdayDY_class"] = strtolower($student["name_birthdayDY_class"]);
                //=== name_birthday(month_year)_class
                $student["name_birthdayMY_class"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $student["birthday_month"] . "-" . $student["birthday_year"] . "-" . $student["class"];
                $student["name_birthdayMY_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthdayMY_class"]);
                $student["name_birthdayMY_class"] = strtolower($student["name_birthdayMY_class"]);
                //=== lastname_birthday_class
                $student["lastname_birthday_class"] = $student["lastname"] . "-" . $birthday . "-" . $student["class"];
                $student["lastname_birthday_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["lastname_birthday_class"]);
                $student["lastname_birthday_class"] = strtolower($student["lastname_birthday_class"]);
                //=== lastname_birthday_class
                $student["givenname_birthday_class"] = $student["givenname"] . "-" . $birthday . "-" . $student["class"];
                $student["givenname_birthday_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["givenname_birthday_class"]);
                $student["givenname_birthday_class"] = strtolower($student["givenname_birthday_class"]);
                //=== name_birthday(day_month)
                $student["name_birthdayDM"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_month"];
                $student["name_birthdayDM"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthdayDM"]);
                $student["name_birthdayDM"] = strtolower($student["name_birthdayDM"]);
                //=== name_birthday(day_year)
                $student["name_birthdayDY"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_year"];
                $student["name_birthdayDY"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthdayDY"]);
                $student["name_birthdayDY"] = strtolower($student["name_birthdayDY"]);
                //=== name_birthday(month_year)
                $student["name_birthdayMY"] = $student["lastname"] . "-" . $student["givenname"] . "-" . $student["birthday_month"] . "-" . $student["birthday_year"];
                $student["name_birthdayMY"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["name_birthdayMY"]);
                $student["name_birthdayMY"] = strtolower($student["name_birthdayMY"]);
                //=== birthday_class
                $student["birthday_class"] = $birthday . "-" . $student["class"];
                $student["birthday_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["birthday_class"]);
                $student["birthday_class"] = strtolower($student["birthday_class"]);
                //=== birthday_classshort
                $student["birthday_classshort"] = $birthday . "-" . $student["classshort"];
                $student["birthday_classshort"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["birthday_classshort"]);
                $student["birthday_classshort"] = strtolower($student["birthday_classshort"]);
                //=== birthday
                $student["birthday"] = $birthday;
                $student["birthday"] = preg_replace('/[^A-Za-z0-9.]+/', '', $student["birthday"]);
                $student["birthday"] = strtolower($student["birthday"]);
                //=== nameShort_birthday
                $student["nameshort_geb"] = $student["lastnameshort"] . "-" . $student["givennameshort"] . "-" . $birthday;
                $student["nameshort_geb"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["nameshort_geb"]);
                $student["nameshort_geb"] = strtolower($student["nameshort_geb"]);
                //=== givenname_birthday(day_month)
                $student["givenname_birthdayDM"] = $student["givenname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_month"];
                $student["givenname_birthdayDM"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["givenname_birthdayDM"]);
                $student["givenname_birthdayDM"] = strtolower($student["name_birthdayDM"]);
                //=== givenname_birthday(day_year)
                $student["givenname_birthdayDY"] = $student["givenname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_year"];
                $student["givenname_birthdayDY"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["givenname_birthdayDY"]);
                $student["givenname_birthdayDY"] = strtolower($student["givenname_birthdayDY"]);
                //=== givenname_birthday(month_year)
                $student["givenname_birthdayMY"] = $student["givenname"] . "-" . $student["birthday_month"] . "-" . $student["birthday_year"];
                $student["givenname_birthdayMY"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["givenname_birthdayMY"]);
                $student["givenname_birthdayMY"] = strtolower($student["givenname_birthdayMY"]);
                //=== lastname_birthday(day_month)
                $student["lastname_birthdayDM"] = $student["lastname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_month"];
                $student["lastname_birthdayDM"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["lastname_birthdayDM"]);
                $student["lastname_birthdayDM"] = strtolower($student["lastname_birthdayDM"]);
                //=== lastname_birthday(day_year)
                $student["lastname_birthdayDY"] = $student["lastname"] . "-" . $student["birthday_day"] . "-" . $student["birthday_year"];
                $student["lastname_birthdayDY"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["lastname_birthdayDY"]);
                $student["lastname_birthdayDY"] = strtolower($student["lastname_birthdayDY"]);
                //=== lastname_birthday(month_year)
                $student["lastname_birthdayMY"] = $student["lastname"] . "-" . $student["birthday_month"] . "-" . $student["birthday_year"];
                $student["lastname_birthdayMY"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["lastname_birthdayMY"]);
                $student["lastname_birthdayMY"] = strtolower($student["lastname_birthdayMY"]);
                //=== nameshort_geb_classshort
                $student["nameshort_geb_classshort"] = $student["lastnameshort"] . "-" . $student["givennameshort"] . "-" . $birthday . "-" . $student["classshort"];
                $student["nameshort_geb_classshort"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["nameshort_geb_classshort"]);
                $student["nameshort_geb_classshort"] = strtolower($student["nameshort_geb_classshort"]);
                //=== nameshort_classshort
                $student["nameshort_classshort"] = $student["lastnameshort"] . "-" . $student["givennameshort"] . "-" . $student["classshort"];
                $student["nameshort_classshort"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["nameshort_classshort"]);
                $student["nameshort_classshort"] = strtolower($student["nameshort_classshort"]);
                //=== nameShort_class
                $student["nameshort_class"] = $student["lastnameshort"] . "-" . $student["givennameshort"] . "-" . $student["class"];
                $student["nameshort_class"] = preg_replace('/[^A-Za-z0-9]+/', '', $student["nameshort_class"]);
                $student["nameshort_class"] = strtolower($student["nameshort_class"]);
                //ENDE: Felder für verschiedene Vergleiche erzeugen
                //=====================================
                //Datensatz speichern
                $_SESSION[$target][$studentnr] = $student;
                $_SESSION[$target . "_sortbygeb"][$birthday][$studentnr] = $student;
                $studentnr++;
            } else {
                echo "Ignoriere: {$dirname}/{$file}";
                if (!is_numeric($birthday[0])) {
                    echo " - kann den Tag: '" . $birthday[0] . "'";
                }
                if (!is_numeric($birthday[1])) {
                    echo " - kann den Monat: '" . $birthday[1] . "'";
                }
                if (!is_numeric($birthday[2])) {
                    echo " - kann das Jahr: '" . $birthday[2] . "'";
                }
                echo " des Geburtstages nicht einlesen <br>";
            }
        } else {
            echo "Ignoriere: {$dirname}/{$file} - Kann Geburtstag nicht einlesen <br>";
        }
    } else {
        echo "Ignoriere: {$dirname}/{$file} - zu wenige Trennzeichen:" . ($nr_parts - 1) . " <br>";
    }
}
Esempio n. 10
0
function folderToZip($folder, &$zipFile, $exclusiveLength, $encoding)
{
    $handle = opendir($folder);
    while (false !== ($f = readdir($handle))) {
        if ($f != '.' && $f != '..') {
            $filePath = "{$folder}/{$f}";
            // Remove prefix from file path before add to zip.
            $localPath = substr($filePath, $exclusiveLength);
            if (is_file($filePath)) {
                $localPath = convert_string($localPath, null, $encoding);
                $zipFile->addFile($filePath, basename($localPath));
            }
            /*
            				elseif (is_dir($filePath)) {
            	          			// Add sub-directory.
            					//$localPath=convert_string($localPath, null , $encoding);
            	          			$zipFile->addEmptyDir($localPath);
            	          			folderToZip($filePath, $zipFile, $exclusiveLength);
                   			 }
            				echo $localPath."<br>";
            */
        }
    }
    closedir($handle);
}
Esempio n. 11
0
 //$name= substr($n2,0,64);
 $length = strlen($name);
 if ($length < 64) {
     $diff = 64 - $length;
     $thisline1 = mb_ereg_replace('{name}', $name, $thisline1);
     fwrite($file, $thisline1);
     for ($i = 1; $i <= $diff; $i++) {
         $tmp = sprintf('%c', 0);
         fwrite($file, $tmp);
     }
 } else {
     $thisline1 = mb_ereg_replace('{name}', $name, $thisline1);
     fwrite($file, $thisline1);
 }
 $thisline3 = $uamopis;
 $username = convert_string($r['username']);
 $opis1 = "Zalozona przez {$username} - Opis - ";
 //if ($r['html'] == 0)
 //      {
 $opis2 = strip_tags($r['desc']);
 //      }
 //      else
 //      {
 //          $opis2 = html2txt($r['desc']);
 //      }
 $opis12 = "{$opis1}{$opis2}";
 $opiss = substr($opis12, 0, 255);
 $length = strlen($opiss);
 if ($length < 255) {
     $diff = 255 - $length;
     $thisline3 = mb_ereg_replace('{opis}', $opiss, $thisline3);