1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Server Discussion [DEPRECATED] StarDanksCMS

Discussion in 'Multiplayer' started by danks_, Dec 26, 2013.

  1. danks_

    danks_ Existential Complex

    THANKS TO EVERYONE WHO SUPPORTED ME WHILE I WORKED ON THE STARDANKS CMS. THE LAST TIME I UPDATED THIS PROJECT, IT STILL HAD SOME BUGS AND ERROS, IS NOWHERE NEAR BEING DONE.

    I WILL STOP TO UPGRADE THIS PROJECT AND WILL NO LONGER OFFER SUPPORT FOR IT, IT STILL WORKS, YOU CAN USE IT AND MODIFY IT AND LEARN FROM IT OR IGNORE IT.

    I WILL START ANOTHER CMS PROJECT SOON, SAID CMS WILL BE LINKED TO THE STARNUB WRAPPER, DEVELOPED BY UNDERBALANCED.
    ----------------------------------------------------------------------------------------

    [​IMG]
    StarDanks CMS v2.0.3 + Upgrade Script [Download]

    Current Features: [PICS: 1, 2]
    • Mod List + Create .zip of Mod Folder
    • Donator List
    • Integrated News System Homepage (by RavenDust) |EVERYONE|
    • Custom HTML Pages stored on Database |EVERYONE|
    • Server Status (No more fsockopen = less lag) |EVERYONE|
    • Online Player Count, List, Server Chatlog and Visited Systems |EVERYONE|
    • Account Registration [Website & Whitelist AccessControl] |EVERYONE|
    • Secure Password and Login |REGISTERED|
    • User Panel (Change Password) |REGISTERED|
    • Staff Exclusive News System |STAFF|
    • File Creation (*.modinfo, *.recipe, player.config, *.questtemplate) |STAFF|
    • Menu Manager |STAFF+|
    • News (Homepage & Staff) Manager |STAFF+|
    • Server Exceptions List |STAFF+|
    • Server Currently Active Planets |STAFF|
    • Spawn World Manager (Backup & Restore) |STAFF+|
    • Key Registration Manager |STAFF+|
    • Plugin System and Page Creator |STAFF+|
    • Account List |STAFF+|
    • Whitelist Tools (Ban Manger) |STAFF|
    • Website ChatStaff Manager |STAFF+|
    • Bad Register Logs |STAFF+|
    • Server Manager (Linux & Windows) |STAFF+|
    Requirements
    • Apache 2.2 +
      Enabled mysqli extension
    • PHP 5 +
    • MySQL 5 +
    • Web and Starbound must be hosted on the same machine
    Installing Information

    Windows:
    - Do not install Starbound in a folder with underscores.
    - Do not install Starbound under the Program Files folder.
    - Website should now be XAMPP friendly.
    - AppServ is still my favourite Windows Web Server.
    - C:\Steam\SteamApps\common\Starbound <- Example folder
    - DO NOT ADD A TRAILING SLASH AT THE END OF THE PATH (Installation)

    Linux:
    - Do not install Starbound in a folder with underscores.
    - DO NOT ADD A TRAILING SLASH AT THE END OF THE PATH (Installation)

    1. Inside admin/scripts/ you will find a file called starbound (no extension)
      Open this file, edit HOST [cat /etc/hostname]
      If your webserver user isn't www-data, edit this as well.
      Copy this file inside your etc/sudoers.d folder
    2. If your user for starting the server isn't called STARBOUND go into admin/scripts/
      Edit line 8 of start.sh -> Replace first starbound with your username
      Edit line 5 of stop.sh -> Replace first starbound with your username
    3. Inside inc/ you will find a file called config.sh
      Open this file, edit the PATH to the location of your required Starbound/linux##/ folder (Linux64/32)


    Changelog

    Changelog 1.2
    +Hotfix for install.php
    Changelog 1.3
    +Fixed install.php mysql problem
    +New Key Registry System
    +New way to enable and disable the Key Registry System
    +Enable and disable the Visited Systems from the homepage
    +Chat should be working now
    +Easy to edit Quick Links (html/menu.html)
    Changelog 1.4
    +Spawn World Manager added (Backup/Restore)
    +Added website logo (images/logo.png)
    +Included logo.psd in the images folder
    +Fixed log.class.php error on line 129
    Changelog 1.4+ (Raven)
    +Added MySQL news manager
    +update.php available for download
    +log.class.php error on line 129 fixed (I guess)
    +Overall small website fixes
    Changelog 2.0.1a
    +New Menu System
    +New Database HTML Page Storage
    +New User Password Changer (Database & Access Control)
    +User News & Staff News (With Manager)
    +Plugin System and HTML Page Creator
    +Account List Reworked
    +Server Manager now working on Linux Systems
    Changelog 2.0.2
    +Fixed Server Version
    +Added "Edit Function" on the Menu Manger
    +Some bug on log.class.php
    +Added the Server Exceptions list back to the Admin Panel
    Changelog 2.0.3
    +Fixed install.php issues
    +Fixed default menu order
    +Fixed Page Manager (Admin Panel)
    +Added Donator List
    +Chat Staff changed to Character Rank
    +Added upgrade.php for those with older versions



    _________________________________________________________________________________
    Credits to @RavenDust for her help, the News System, Bug Fixes and Linux Management!
    Credits to Plnda, Meuhmeuh, class101 and all fellow starbounders who helped the development of PHP Functions.
    Credits to SKuDD3r who first made a .recipe and player.config maker for Excel.
    Credits to Tinderlight, who created a nice Web Control Panel, I plan on using his SH files for server management.
    Credits to Chucklefish, because they are awesome and I'm using the hobo font face they used on the game and on the roadmap.
    If I forgot to add someone's name, please let me know.
     
    Last edited: Sep 5, 2014
  2. BlastRed

    BlastRed Spaceman Spiff

    This, THIS IS A START OF A NEW ERA!
     
  3. danks_

    danks_ Existential Complex

    PLUGINS
    _______________________________________________

    modlist.php [13/02/2014 V1.1]
    • Title = Server Mod List
    • Page ID = modlist
    • Include? = Yes
    • Content = xxxxxxxxxxxxxxxxxxx

    PHP:
    <?php

     
    // STARDANKS PLUGIN \\
    #######################||
    #######################||
    ### ModList Plugin (Already Installed in Database)
    ### VERSION 1.1
    ### StarDanks CMS v2.0.x

    #######################||
    #######################||
    ### index.php?id=page&pid=3
    ### DB: id = 3 \\ p_id = modlist
    ### danks_ + RavenDust

    if ($auth_status == false || $u_rank == "" || $u_rank 1) {
    header("Location: index.php?id=elogin"); exit();
    }
    else
    {
        class 
    App_File_Zip_Exception extends Exception {}
    class 
    App_File_Zip {

        
    /**
         * Zip a file, or entire directory recursively.
         *
         * @param string $source directory or file name
         * @param string $destinationPathAndFilename full path to output
         * @throws App_File_Zip_Exception
         * @return boolean whether zip was a success
         */
        
    public static function CreateFromFilesystem($source$destinationPathAndFilename)
        {
            global 
    $config;
            
    $base realpath(dirname($destinationPathAndFilename));

            if (!
    is_writable($base))
            {
                throw new 
    App_File_Zip_Exception('Destination must be writable directory.');
            }

            if (!
    is_dir($base))
            {
                throw new 
    App_File_Zip_Exception('Destination must be a writable directory.');
            }

            if (!
    file_exists($source))
            {
                throw new 
    App_File_Zip_Exception('Source doesnt exist in location: ' $source);
            }

            
    $source realpath($source);

            if (!
    extension_loaded('zip') || !file_exists($source))
            {
                return 
    false;
            }

            
    $zip = new ZipArchive();
            
    $zip->open($destinationPathAndFilenameZipArchive::CREATE);
            if (
    is_dir($source) === true)
            {
                
    $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
                
    $baseName realpath($source);
                foreach (
    $files as $file)
                {
                    if( 
    in_array(substr($filestrrpos($fileDIRECTORY_SEPARATOR)+1), array('.''..')) )
                    {
                        continue;
                    }

                    
    $relative substr($filestrlen($baseName));
                    if (
    is_dir($file) === true)
                    {
                        
    // Add directory
                        
    $added $zip->addEmptyDir(trim($relative"\\/"));
                        if (!
    $added)
                        {
                            throw new 
    App_File_Zip_Exception('Unable to add directory named: ' trim($relative"\\/"));
                        }
                    }
                    else if (
    is_file($file) === true)
                    {
                        
    // Add file
                        
    $added $zip->addFromString(trim($relative"\\/"), file_get_contents($file));
                        if (!
    $added)
                        {
                            throw new 
    App_File_Zip_Exception('Unable to add file named: ' trim($relative"\\/"));
                        }
                    }
                }
            }
            else if (
    is_file($source) === true)
            {
                
    // Add file
                
    $added $zip->addFromString(trim(basename($source), "\\/"), file_get_contents($source));
                if (!
    $added)
                {
                    throw new 
    App_File_Zip_Exception('Unable to add file named: ' trim($relative"\\/"));
                }
            }
            else
            {
                throw new 
    App_File_Zip_Exception('Source must be a directory or a file.');
            }
            
    $comment $config[name]."'s Mod Pack".PHP_EOL;
            
    $comment .= "---------------".PHP_EOL;#
            
    $comment .= "Drop all the files contained in this zip into your Mods folder.".PHP_EOL;
            
    $comment .= "All the server's Mods are included in this archive.".PHP_EOL;
            
    $comment .= "---------------".PHP_EOL;
            
    $comment .= "This archive has been generated by StarDanks CMS.".PHP_EOL;
            
    $zip->setArchiveComment($comment);

            return 
    $zip->close();
        }

    }
    if(isset(
    $_POST['makezip'])) {
        try {
        
    App_File_Zip::CreateFromFilesystem($modPath'mod-folder.zip'); }
        catch (
    App_File_Zip_Exception $e) {
              echo 
    "<center><p>There was an error creating the .zip archive.</p></center>";
        }
    }
    if(isset(
    $_POST['delzip'])) {
        if(!
    unlink("mod-folder.zip")) { echo "<center><p>There was an error deleting the .zip archive.</p></center>"; }
        else { echo 
    "<center><p>Your mod-folder.zip has been deleted.</p></center>"; }
       
    }
    if(
    file_exists('mod-folder.zip')){ ?>
        <h3><a href="mod-folder.zip">Download all the Server Mods</a></h3><p></p>
        <p></p>
    <? }
    if ($auth_status == true && $u_rank > 1) { ?>
        <center><form name="isreg" method="POST" action=""; class="niceform">
        <button name="makezip" type="submit" value="Submit">Build .ZIP</button></form>
        <? if(file_exists('mod-folder.zip')){ ?> <form name="isreg" method="POST" action=""; class="niceform">
        <button name="delzip" type="submit" value="Submit">Delete .ZIP</button></form> <? } ?>
        </center>
        <p></p>
    <? }
    if ($config['os'] == "win32") { $odir = $config['path']."\\mods\\"; }
    else { $odir = $config['path']."/mods/"; }
    $dir1 = glob($odir.'*', GLOB_ONLYDIR);
    foreach ($dir1 as $k) {
        if ($config['os'] == "win32") { $l = glob($k.'\\*.modinfo', GLOB_MARK); }
        else { $l = glob($k.'/*.modinfo', GLOB_MARK); }

        foreach ($l as $i) { 
            $f = file_get_contents($i);
            $f = json_decode($f, true);
            if(isset($f['metadata']))
            {
                if(isset($f['metadata']['author'])) {   
                    $f['author'] = $f['metadata']['author'];
                } else {
                    $f['author'] = "No Author";
                }
               
                if(isset($f['metadata']['support_url'])) {
                    $f['link'] = $f['metadata']['support_url'];
                }
               
                if(isset($f['metadata']['version'])) {
                    $f['version'] = $f['metadata']['version'];
                } else {
                    $f['version'] = "Unknown version";
                }
            }
            if(isset($f['version']))
            {
                if(strpos($f['version'], "Koala") || $f['version'] == "")
                {
                    $f['version'] = "N/A";
                }
            }
            $location = substr_replace($k, '', 0, 48);
            ?>
            <center><h3><? if(isset($f['link'])) { echo "<a href='".$f['link']."'>".$f['name']."</a>"; } else { echo $f['name']; } ?></h3></center>
            <table id="rounded-corner">
        <thead>
            <tr>
                <th scope="col" class="rounded">Author</th>
                <th scope="col" class="rounded">Version</th>
            </tr>
        </thead>
        <tbody>
            <td><? if (isset($f['author'])) { echo $f['author']; } else { echo "No Author"; }?></td>
            <td><? echo $f['version']; ?></td></tr>
        </tbody>
        <thead>
            <tr>
                <th scope="col" class="rounded">Extras:</th><th scope="col" class="rounded">&nbsp;</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td colspan="6" class="rounded-foot-left">Location: <em><? echo $location; ?></em></td>
            </tr>
            <tr>
                <td colspan="6" class="rounded-foot-left">Dependencies: <?
                if (isset($f['dependencies']) && count($f['dependencies']) > 0) {
                foreach($f['dependencies'] as $dp) { echo "|[<em>".$dp."</em>]|"; } }
                else { echo "None"; }
                ?></td>
            </tr>
        </tfoot>
        </tbody></table><br />
            <?
        }
    }
    }
    ?>
     
    Last edited: Feb 13, 2014
    supernet2 and BlastRed like this.
  4. danks_

    danks_ Existential Complex

    OLDER RELEASES

    StarDanks CMS v2.0.2 [Download]
    StarDanks CMS v2.0.2 PATCH [Download]

    StarDanks CMS v2.0.1a [Download]
    StarDanks CMS v2.0.1b PATCH [Download]

    ___________________________________________
    StarDanks CMS v1.4 [Download]

    StarDanks CMS v1.4+ (Raven) [Download] - [update.php]
    ___________________________________________
    EVEN OLDER RELEASE
    _______________________________________
    S-WebTools Released [DOWNLOAD]

    Install in [www/Stools] - http://yourwebsite.com/Stools/index.php
    Will no longer be updated, instead I will add all future features directly to StarDanks CMS

    TESTED AND WORKING WITH APPSERV, PLEASE DON'T USE WAMP
    _______________________________________
    Here's a picture of the S-WebTools

    [​IMG]



    RECIPE GENERATOR (bow.recipe) [The recipe name is the output's item name]
    Code:
    { "input" : [
    { "item" : "fullwood1", "count" : 10 }, { "item" : "plantfibre", "count" : 1 }
    ], "output" : {
    "item" : "bow", "count" : 1
    }, "groups" : [
    "all", "plain", "tools" ] }


    PLAYER ITEM MERGER (player.config) [Simply drop this file into /yourmod/assets folder and have all your blueprint automatically added]
    Code:
    { "__merge" : [],
    "defaultBlueprints" : {
    "__merge" : [],
    "tier1" : [
    { "item" : "item1" }
    ], "tier2" : [], "tier3" : [], "tier4" : [], "portable3dprinter" : [
    { "item" : "item2" }
    ] } }


    { "name" : "SuperMod3000",
    "version" : "Beta v. Angry Koala",
    "path" : "./assets",
    "metadata" : {
    "author" : "danks_",
    "description" : "A Super Mod, 3000 features!",
    "support_url" : "http//google.com",
    "displayName" : "Super Mod 3000",
    "mod_version" : "1.1"
    } }
    [/CODE]


    CUSTOM QUEST GENERATOR (questname.questtemplate) [Multiple rewards, extra field for filename]
    { "id" : "tutorial6.gearup",
    "title" : "^#9be3d6;Shop Class",
    "text" : "LONG TEXT1",
    "completionText" : "LONG TEXT2",
    "conditions" : [ { "kind" : "gather", "item" : [ "woodencraftingtable1", 1] } ],
    "moneyRange" : [10, 100],
    "rewards" : [ [
    "metadata" : {
    [ "woodencraftingtable1", 2] ] ],
    "planetMode" : "none",
    "questDungeons" : [ ],
    "followUp" : "tutorial7.gearup" }
    [/CODE]
     

    Attached Files:

    Last edited: Apr 10, 2014
    sarahwalker and supernet2 like this.
  5. danks_

    danks_ Existential Complex

    Here's some more of what I've added so far! I'll start with the player list, the last picture on the row is how it looks right now. I added a table on the MySQL for the Staff Members, there will be a way to add and delete administrators and moderators to the list later on. Admins and Mods will also appear on the Current Online list if they are online.

    currentlyonline.PNG currentlyonline2.PNG currentlyonline3.PNG currentlyonline4.PNG

    This is the Server's Stats site, you access it by clicking on Sever on the horizontal menu.
    stats.PNG

    This is how the server chat looks, it also prints the name on Red and Green for admins and mods respectively, I emptied the table after I was done taking the list pictures
    chatlog.PNG

    And to end the update, here's the Visited Systems of the server. There will be a way to set the Coordinates and System name from the Admin Panel.
    visited systems.PNG
     
  6. danks_

    danks_ Existential Complex

    Another update and the last for today! Finally had time to sit back and continue the exciting journey of PHP errors, so here's some pictures, let's start with the homepage, that now has a link to the Admin Panel on the footer!
    sofarsogood.PNG

    This is where it leads to, the login.
    img2.PNG

    When you login, you see this
    adm1.PNG

    Whitelist tools are DONE! As you can see, adding accounts from here does not request key at any time, it also lets you see the password as text (so you don't mistype it) and it works pretty much like the other register, it does add the account to the mysql and to the file, already checked. Account removal is pretty straight forward, put the account in, click, see the account go. I might change this later on so that it will look like the Admin Account Manager (just the remove part)
    adm2.PNG adm3.PNG

    A, also, very straight forward ban system. Put the Account, Name or IP and click ban/unban. I've added a table to the MySQL, so you can tell what IP's, Accounts or Characters are banned, they are listed right next to the forms.
    adm4.PNG

    This is what I meant before about changing the remove account, this is how you add new admin accounts so they can access the Admin Panel.
    ADM5.PNG

    And just a little showoff, all the old file generation scripts are working perfectly :)
    recipes.PNG

    Tomorrow I'll do the same I did for the Admin Account Manager to make the Chat Staff Manager. I'll get the Register Key Manager going, it's just going to print the current key, have a button to set it to NULL and a field in case you want to change the key to something else.
    Bad register log will print all the IPs that tried to use the whitelist register and gave a wrong Key (+ date)
    I have to delete Accounts Registered from that list, because it'll be added later on to the Remove Account page it self.
    Website options will allow you to change the server name, which will affect the website title and multiple lines on the user interface, Forum URL (forum link in the user interface is added only if you give a Forum URL) and another couple of options.

    I'll probably leave server tools for the 3rd of january, last update for this year will be tomorrow probably, maybe the hungover january 1st, who knows!

    Please leave some feedback, it's pretty lonely in here :c
     
    sarahwalker likes this.
  7. wizzomafizzo

    wizzomafizzo Scruffy Nerf-Herder

    I haven't been able to test this but it's starting to look really cool. Nice work!

    Would you be able to set up a github repo for this? It's a little annoying having to download the rar file just to flick through the source.

    Also, before this gets any bigger, have considered using a framework for PHP? I can see the code is already getting a little unwieldy in places (not your fault, PHP is like that) and it would greatly simplify things.
     
  8. danks_

    danks_ Existential Complex

    well, it got a lot bigger than the files you have, but I don't really know if a framework is what I'd like it to be.
    I'm working more towards a "no brainer" for people that don't have any php skills. There's a lot of people that would rather just download a wrapper or a python script to tell how many people are online and leave it at that, there's enough people who already feel discouraged because JSON "is annoying" (the reason why I started the file generation S-WebTools)

    Anyone with php knowledge is obviously invited to pick up this files, for which having a gifthub repo is a great idea for those who'd be willing to update more often than "stable releases", and do what you like of them, add your own tools (maybe share them so everyone can get them at the stable releases), I'm trying to leave my code as easy to understand as possible, what my skills allow me to, but I think, also releasing this as a framework would scare a number of people who just don't want to sit and learn how to edit a php file (even tho they wouldn't need to).

    Thanks a lot for the feedback, very appreciated!
     
  9. danks_

    danks_ Existential Complex

    UPDATE! I've finally finished adding the Chat Staff Manager, the Register Key Manager, the Bad Register Log and the Website Options

    The Chat Staff manager is very straightforward and looks a lot like the ban manager, to the right you'll find a list of the current chat Admins or Mods respectively and on the left, a small form to either ADD or REMOVE a character name.
    chatstaff.PNG

    The Key Manager works as well, if you click on disable it will set the Key to NULL on the MySQL table, and the register will no longer ask you to enter a KEY when registering.
    keymang.PNG

    The bad register log takes on what IP's have tried to register and have failed to give the right key, you can delete the log by clicking on the delete button. If you have anyone trying to guess the key, you'll get his IP and will be able to ban him from the server if that's what you desire.
    badreg1.PNG badreg2.PNG

    And one of the most important features, the website configuration. Allows to change Server IP, Server Port, the filepath to starbound.log and accesscontrol.config. There's no need to put the filename at the end, just the path.
    If you change the Forum URL and leave it blank (literally just, leave the form blank and submit it) both links to the Forums will be automatically removed from the homepage.
    Changing the name will automatically change the website Title and some sub titles on the homepage, like the About page (About $name) or the Server Statistics ($name's Stats)

    The OS option will come in handy for the Server Management Panel, using that value the website will know whether to run a .bat or a .sh file to stop or start the server.
    weboptions.PNG

    The Exceptions Logs and Active systems are just a few minutes of work, shouldn't take very long to do since the functions for both were already written by @class101 (Thanks a lot for sharing!), so I'll finish that whenever I have time today or tomorrow morning. I'll work on the Management Panel (don't know what to expect, but seems fairly easy to accomplish). And I think I'll have a working Install script working the first week of January, so I'm hoping I can finally release v0.1 of StarDanks CMS before January 7th!
    last.PNG

    Please share some feedback ;)
     
    sarahwalker likes this.
  10. AaronEllerz

    AaronEllerz Yeah, You!

    Im trying to use this but when im checking it out i get just the index.php with no options to do anything
     
  11. danks_

    danks_ Existential Complex

    Important note for windows users, please run the files using AppServ 2.6.0 and not WAMP. This is very important.
    For Linux users, I've posted the requirements on the first post. Using another version of PHP might break the website (PHP 5 has deprecated some functions that I used to write the CMS and Stools)
     
    sarahwalker likes this.
  12. RavenDust

    RavenDust Scruffy Nerf-Herder

    I'd love to get my hands on that :D Looks really great!
     
  13. danks_

    danks_ Existential Complex

    Thanks for the feedback :) will certainly post it next week!

    Happy new year!
     
    allanmez and RavenDust like this.
  14. Stadl0r

    Stadl0r Contact!

    Hey, I was wondering how I might get the current server features working? So far only able to use the quest maker and news panel
     
  15. allanmez

    allanmez Guest

    This is a really cool system! Keep up the good work :)
     
  16. danks_

    danks_ Existential Complex

    Thanks for not reading the whole thread. StarDanks CMS and the S-WebTools are 2 different things, I have yet to release the CMS because I wasn't home for the last week and a half.

    Sorry for the delay, I'll get to work now and have it ready this week!
     
  17. RavenDust

    RavenDust Scruffy Nerf-Herder

    Hey danks_ - take your time :) If i can help wih something (though i doubt it), just call :D
     
  18. danks_

    danks_ Existential Complex

    Well, so far so good, I can open and close the server from the website in a windows machine, I'm downloading a linux dist so I can test the website, make sure the php version that's available for download works with my code and will then try and find a way to make the website open and close the server, this is what'll probably take the longest.

    After that, make a small install folder that'll insert the tables needed and a small form to set the basic config and website admin account.

    :) Thx for the feedback
     
  19. danks_

    danks_ Existential Complex

    So, I accidentally destroyed my databases and had to rebuild them, that took me a while to do, because I had to check file by file so that I could see what tables I was using in the first place. So far, you can see exceptions and active planets (where ships are parked) and start/stop the server on Windows machines. I'm currently working on the script to start/stop the server on Linux and after that, I'll get to the install script.
    Just having some troubles setting up LAMP (which is a bit embarrassing given that I've installed Oracle Databases on Solaris and LAMP, is well, LAMP)

    Hopefully, I'll get the linux scripts tonight to start and stop the server.
     
  20. Stadl0r

    Stadl0r Contact!

    Thanks for the update and sorry, The first post was just a bit misleading for me with the "Current Features" of the CMS. If you need any help testing on linux, let me know.
     

Share This Page