function synchro_error_handler($number, $message, $file, $line, $vars) { global $config; $text = "\n[" . date('d/m/Y H:i:s') . "] ERROR: An error ({$number}) occurred on line {$line} and in the file: {$file}. \nMessage: {$message}"; if ($config["showVarsInLog"]) { $text .= "\nVars:" . print_r($vars, 1); } $path = file_get_contents("data/path.txt"); // Sort out all settings.php errors (otherwise it would spam the log file) if ($file !== $path . "/settings.php" && $number !== 2048) { $log = fopen("data/log.txt", 'a') or die("Couldn't open log file"); fwrite($log, $text); fclose($log); } if ($number !== E_NOTICE && $number < 2048) { $errortext = "\n[" . date('d/m/Y H:i:s') . "] Oops! There was an Error handeling an Error(so many errors!). Number: {$number}\nMessage: {$message}\nFile:{$file}\nLine: {$line}"; if ($config["showVarsInLog"]) { $errortext .= "\nVars: " . print_r($vars, 1); } write2logfile($errortext, "logger.php"); } }
header("Location: index.php"); return true; } else { write2logfile("Invalid Filename", "doupload.php"); header("Location: upload.php?error=Invalid+Filename%21"); return false; } } else { write2logfile("File doesnt exist", "doupload.php"); if ($_FILES['file']['name'] != '') { move_uploaded_file($_FILES['file']['tmp_name'], 'files/' . $_FILES['file']['name']); write2logfile("Saved file as " . $_FILES['file']['name'], "doupload.php"); header("Location: index.php"); return true; } else { write2logfile("Invalid Filename", "doupload.php"); header("Location: upload.php?error=Invalid+Filename%21"); return false; } } } function dateiname_bereinigen($dateiname) { // erwünschte Zeichen erhalten bzw. umschreiben // aus allen ä wird ae, ü -> ue, ß -> ss (je nach Sprache mehr Aufwand) // und sonst noch ein paar Dinge (ist schätzungsweise mein persönlicher Geschmach ;) $dateiname = strtolower($dateiname); $dateiname = str_replace('"', "-", $dateiname); $dateiname = str_replace("'", "-", $dateiname); $dateiname = str_replace("*", "-", $dateiname); $dateiname = str_replace("ß", "ss", $dateiname);
</div>'; write2logfile("Changed max. filesize", "settings.php"); } if (isset($_POST["guestuser"])) { if ($_POST["guestuser"] == "on") { $myfile = fopen("data/enableguestuser", "w") or die("Unable to open file!"); $txt = "ENABLED"; fwrite($myfile, $txt); fclose($myfile); } else { unlink("data/enableguestuser"); } echo '<div class="alert alert-info"> <strong>Changed setting "Guest User"</strong> </div>'; write2logfile("Changed settings 'Guest User'", "settings.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template"> <meta name="author" content="GeeksLabs"> <meta name="keyword" content="Creative, Dashboard, Admin, Template, Theme, Bootstrap, Responsive, Retina, Minimal"> <link rel="shortcut icon" href="img/favicon.png"> <title>Synchro</title> <!-- Bootstrap CSS -->
} } function deleteValue($SDBFile, $id) { $value = getValue(readSDB2($SDBFile), $id); $searchLine = $id . ";" . $value . "\n"; $file = "sdbs/" . $SDBFile; $lines = file($file); $count = 0; $result = ""; foreach ($lines as $line) { if ($line == $searchLine) { $count++; } else { $result .= $line; } } file_put_contents($file, $result); if ($count == 0) { return false; } else { return true; } } deleteValue("allm.logins.sdb", $sessionid); deleteValue("allm.loginTimes.sdb", $sessionid); deleteValue("allm.loggedInDevices.sdb", $sessionid); session_destroy(); include "logger.php"; write2logfile("Logged user out", "logout.php"); header("Location: index.php");
} else { write2logfile("Deleteing file " . $_GET["delete"], "files.php"); unlink($dir . $_GET["delete"]); header("Location: files.php"); exit; } } if (isset($_POST["dontask"])) { $myfile = fopen("data/dontaskdelete", "w") or die("Could not change setting 'DONTASK'"); $txt = "NOT EMPTY"; fwrite($myfile, $txt); fclose($myfile); write2logfile("Changed settings 'DONTASK'", "files.php"); } if (isset($_POST["delete"])) { write2logfile("Deleting file " . $_POST["delete"], "files.php"); unlink($dir . $_POST["delete"]); header("Location: files.php"); exit; } // Declare some functions function is_dir_empty($dir) { if (!is_readable($dir)) { return NULL; } $handle = opendir($dir); while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != ".DS_Store" && $entry != ".htaccess" && $entry != ".htdocs") { return FALSE; }
</div> <?php } ?> <table class="table table-striped table-advance table-hover"> <tbody> <tr> <th></th> <th>Filename</th> <th>Size</th> <th>Action</th> </tr><?php if (is_dir_empty("files/")) { write2logfile("No files found", "index.php"); ?> </table> <center><h3>You don't have any files!</h3></center> <?php } if ($handle = opendir("files/")) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != ".DS_Store" && $entry != ".htaccess" && $entry != ".htdocs") { $sum += filesize("files/" . $entry); $num = $num + 1; $filesize = filesize("files/" . $entry); $filesize = $filesize / 1024; $filesize = $filesize / 1024; $filesize = round($filesize, 3); ?>
config.php </header> <div class="panel-body"> <strong>Please only edit this file, if you really know what you are doing. Editing this file may cause problems with synchro!<br><br></strong> <form method="post"> <div class="form-group"> <textarea class="form-control js-auto-size" name="text" autofocus rows="10"> <?php $handle = fopen("config.php", "r") or die("Unable to open file!"); if ($handle) { while (($buffer = fgets($handle, 4096)) !== false) { echo htmlentities($buffer) . ""; } if (!feof($handle)) { echo "Error: unknown fgets() Error\n"; write2logfile("fgets Error", "editconfig.php"); } fclose($handle); } ?> </textarea> </div> <button type="submit" class="btn btn-info form-control" name="save">Save</button> </form> </div> </section> </div> <!--/.row-->
$myfile = fopen("data/dontlog", "w"); fclose($myfile); $txt = "\n[" . date('d/m/Y H:i:s') . "] viewlog.txt: Disabled logging"; $log = fopen("data/log.txt", 'a') or die("Couldn't open log file"); fwrite($log, $txt); fclose($log); } } if (file_exists("data/dontlog")) { $dologclass = "success"; $dologvalue = "Enable"; } else { $dologclass = "danger"; $dologvalue = "Disable"; } write2logfile("Showing log file", "viewlog.php"); if (isset($_POST["clearlog"])) { $fh = fopen('data/log.txt', 'w'); fclose($fh); $txt = "\n[" . date('d/m/Y H:i:s') . "] viewlog.php: Cleared log"; $log = fopen("data/log.txt", 'a') or die("Couldn't open log file"); fwrite($log, $txt); fclose($log); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template">
?> &share" class="btn btn-success btn-raised">Yes</a> <a href="files.php" class="btn btn-danger btn-raised">No</a> <?php } else { ?> <h3>Share files</h3> It seems like this file was already shared. <?php } } else { copy("files/" . $_GET["file"], "s/files/" . $_GET["file"]); $myfile = fopen("stats/" . $_GET["file"] . ".txt", "w"); fwrite($myfile, "0"); fclose($myfile); write2logfile("Made file '" . $_GET["file"] . "' social", "social.php"); ?> <h3>Share files</h3> <h4><?php echo $_GET["file"]; ?> was shared successfully. To let other people download your file send them this link:<br><br> <?php echo str_replace(" ", "", $domain . "/s/?d=" . $_GET["file"]); ?> .<br><br> <?php } } ?>
<strong>Invalid Version Number</strong> There is a error with your local version number. To avoid errors, please do a update by clicking <a href="update.php" class="">here</a>. If the error is still displayed after updating, please contact version.synchro@bennetthollstein.de. </div> <?php } if (isset($message)) { write2logfile("Showing global message", "index.php"); ?> <div class="alert alert-info"> <?php echo htmlentities($message); ?> </div> <?php } if (isset($offline)) { write2logfile("Offline error", "index.php"); ?> <div class="alert alert-danger"> <strong>Could not get global version</strong> It seems like Synchro can't download files from the Download URL. If you changed the Download URL to an invalid URL you can learn how to reset it again <a href="solveproblem.php?resetdownloadurl">here</a>. This error can also appear, when your computer isn't connected to the internet. </div> <?php } if (isset($wrongfilepermissions)) { ?> <div class="alert alert-danger"> <strong>Synchro has not enough file permissions</strong> There is a problem with the file permissions on your server. To learn how to fix that, click <a href="solveproblem.php?fixpermissionerror">here</a>. </div> <?php } if (isset($biglog)) { ?>
</div> <?php } ?> <table class="table table-striped table-advance table-hover"> <tbody> <tr> <th></th> <th>Filename</th> <th>Size</th> <th>Action</th> </tr><?php if (is_dir_empty("files/")) { write2logfile("No files found", "files.php"); ?> </table> <center><h3>You don't have any files!</h3></center> <?php } if ($handle = opendir("files/")) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != ".DS_Store" && $entry != ".htaccess" && $entry != ".htdocs") { $sum += filesize("files/" . $entry); $num = $num + 1; $filesize = filesize("files/" . $entry); $filesize = $filesize / 1024; $filesize = $filesize / 1024; $filesize = round($filesize, 3); ?>
// Check for messages $message = Synchro::getMessage(); if (empty($message)) { unset($message); } // Check, if updates are ignored if (Synchro::settingSet("ignoreupdates")) { $ignoreupdate = true; } // Check if Synchro has enough file permissions if (!is_writable("data/password.txt") || !is_writable("index.php")) { $wrongfilepermissions = TRUE; write2logfile("Synchro has not enough file permissions", "index.php"); } Synchro::clearLog(); // Check if the log.txt is over 550 KB big if (filesize("data/log.txt") > 563200) { $biglog = true; write2logfile("Log file is over 550 KB", "index.php"); } // Check for missing files include "scripts/files_exist.php"; // Check needed time $diff = time() - $start; write2logfile("Needed {$diff} seconds to run PHP", "index.php"); if ($diff > 4) { $longscript = true; write2logfile("Needed over 4 seconds to run PHP.", "index.php"); } // Include plugin hooks include "scripts/index.importhooks.script.php";
<div class="widget-foot"> <!-- Footer goes here --> </div> </div> </div> </div> </div> <!-- project team & activity end --> </section> </section> <?php if (isset($_GET["link"])) { write2logfile("User requests link of file " . $_GET["link"], "socialfiles.php"); ?> <div id="link" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Link to <?php echo $_GET["link"]; ?> </h4> </div> <div class="modal-body"> <p>
<?php // ALLM: Advanced Login/Logout Manager // Version 1.0 $sessionId = session_id(); $sessionId = hash("md5", $sessionId); if (!file_exists("sdbs/allm.logins.sdb")) { fopen("sdbs/allm.logins.sdb", "w"); } $lines = explode("\n", file_get_contents("sdbs/allm.logins.sdb")); foreach ($lines as $line) { if ($line !== '') { $r = explode(";", $line); $data1 = $r[0]; $data2 = $r[1]; $allm_logins[$data1] = $data2; } } if (isset($allm_logins[$sessionId])) { $ALLM_loggedin = true; } else { $ALLM_loggedin = false; } if ($ALLM_loggedin == false) { session_destroy(); write2logfile("User was not logged in.", "scripts/allm.php"); header("Location: login.php"); exit; }
} if (!file_exists("data/twofactorauth")) { $exists = false; } else { $exists = true; } if (isset($_POST['test'])) { $secret = file_get_contents("data/twofactorauth"); $checkResult = $ga->verifyCode($secret, $_POST['test'], 2); if ($checkResult) { $tested = "<font color='green'>It works!</font><br>"; } else { $tested = "<font color='red'>Thats now right!</font><br>"; } $firsttime = true; write2logfile("User just tested Two-Factor-Authentication", "twofacauth.php"); } $myfile = fopen("data/username.txt", "r"); $username = fgets($myfile); fclose($myfile); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template"> <meta name="author" content="GeeksLabs"> <meta name="keyword" content="Creative, Dashboard, Admin, Template, Theme, Bootstrap, Responsive, Retina, Minimal"> <link rel="shortcut icon" href="img/favicon.png">
$zip = new ZipArchive(); if ($zip->open($pathToZip) === TRUE) { $zip->extractTo($path . "/files/"); $zip->close(); $log .= "[" . date('d/m/Y H:i:s') . "] ZIP written successfully to 'files/' directory...\n"; } else { $log .= "[FATAL ERROR] Couldn't write files!\n"; $error[] = "Couldn't write files to 'files/' folder. Try to change the file permissions to 705."; $restoreSuccessful = false; } } $log .= "[" . date('d/m/Y H:i:s') . "] Writing ended...\n"; $log .= "[" . date('d/m/Y H:i:s') . "] Removing restore file...\n"; unlink("restoreFile.zip"); $log .= "[" . date('d/m/Y H:i:s') . "] Finishing restore process...\n"; write2logfile($log, "restorebackup.php"); } if (file_exists("backup.zip")) { $backupExists = true; } else { $backupExists = false; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template"> <meta name="author" content="GeeksLabs"> <meta name="keyword" content="Creative, Dashboard, Admin, Template, Theme, Bootstrap, Responsive, Retina, Minimal">
// This example site.php uses the package "multiSite" to display mutliple sites. // We recommend using the package "multiSite2" for this. if (!isset($permittedCall)) { echo "Please don't open this page directly!"; exit; } // Include the scriptfile (site.script.php) include scriptfile(); // Include the packages include package("ownLog"); include package("multiSite"); include package("tiles"); ownLog_clearLog(); ownLog_writeToLog("This is a test!"); write2logfile("I'm writing to the ownLog log!"); if (multiSite_Site("main")) { ?> Hello <?php echo $api->getSynchroUsername(); ?> ! You mail is: <?php echo $api->getMail(); ?> <br> This plugin is just a test. 'Real' plugins will come in the future!<br> Pluginname: <?php echo getValue(readSDB("examplePlugin.sdb"), "NAME"); ?> <br>
</textarea> </div> <input type="hidden" name="file" value="<?php echo $_GET["file"]; ?> "> <button type="submit" class="btn btn-info form-control" name="save" <?php if (!is_writable("files/" . $_GET["file"])) { echo "disabled"; } ?> > <?php if (!is_writable("files/" . $_GET["file"])) { echo "Cannot save file because of missing file permissions"; write2logfile("Cant save file '" . $_GET["file"] . "'", "watch.php"); } else { echo "Save"; } ?> </button> </form> </div> </section> <?php } } ?>
<div class="row"> <div class="col-lg-12"> <h3 class="page-header"><i class="fa fa-laptop"></i> Synchro Plugin Install</h3> <ol class="breadcrumb"> <li><i class="fa fa-home"></i><a href="index.php">Home</a></li> <li><i class="fa fa-laptop"></i>Plugin Installation</li> </ol> </div> </div> <?php if (isset($_FILES['userfile']['tmp_name'])) { ?> <?php if (isset($error)) { write2logfile("There was an error installing a plugin", "dlplugin.php"); ?> <div class="alert alert-danger"> There was an error installing the plugin: <?php echo $error; ?> . You will be redirected in <a id="countdown">10</a> seconds. </div> <?php } else { ?> <div class="progress"> <div class="progress-bar progress-bar-success progress-bar-striped active ease" data-transitiongoal="100"></div> </div> <span id="done">Installing Plugin "<?php echo $name;
fwrite($file, "\n" . $sessionId . ";" . $ip . "\n"); fclose($file); $file = fopen("sdbs/allm.loginTimes.sdb", "a"); fwrite($file, "\n" . $sessionId . ";" . date('d/F/Y - H:i:s') . "\n"); fclose($file); include "scripts/detectDevice.php"; $file = fopen("sdbs/allm.loggedInDevices.sdb", "a"); fwrite($file, "\n" . $sessionId . ";" . $device . "\n"); fclose($file); header("Location: index.php"); exit; } else { foreach ($error as $err) { $errorlist .= $err . "\n"; } write2logfile("Error while logging in: " . $errorlist, "login.php"); ?> <div class="alert alert-danger fade in"> <button data-dismiss="alert" class="close close-sm" type="button"> <i class="icon-remove"></i> </button> <strong>Error(s):<br> </strong> <?php echo $errorlist; ?> </div> <?php } } ?> <!DOCTYPE html>