public static function requireSDB($name, $dlurl) { if (!SDB_exists($name)) { $sdb = file_get_contents($dlurl); $sdbHandler = fopen('sdbs/' . $name, 'w'); if (fwrite($sdbHandler, $sdb)) { return true; } else { echo '<div class="alert alert-danger"> This plugin requires a database that doesn`t exists and couldn`t be created. Some public static functions might not work right. </div>'; return false; } } else { return true; } }
<?php if (!SDB_exists("fileDownloader.downloadList.sdb")) { createSDB("fileDownloader.downloadList.sdb"); } $downloadList = readSDB("fileDownloader.downloadList.sdb"); ?> Welcome to File Downloader. This plugin allows you to download files from other websites directly to your Synchro.<br> Please notice that this plugin is still in an early beta state.<br><br> <a href="<?php echo multiSite2_Link("addFile"); ?> " class="btn btn-lg btn-raised btn-block btn-primary">Add file to the Downloadlist</a><br> <table class="table table-striped"> <tr> <th> Your Downloadlist: </th> </tr> <?php foreach ($downloadList as $downloadItem) { ?> <tr> <td> <?php echo $downloadItem; ?> </td> </tr> <?php }