• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Znote AAC Gallery imgland/ii.gl link replace

elektrus

Uninvited Guest
Joined
Jun 16, 2011
Messages
28
Reaction score
0
Location
Poland
Hello there, apparently Znote's AAC replaces urls in gallery so that only these from imgland.net and ii.gl are valid ones.
I found the code that does that but my script kiddie skills aren't enough to make it so that it uses any direct link.

I.E https://i.imgur.com/CtTwhYU.jpg is being replaced to http://i.ii.gl/imgur.comBLBQNrc and that
obviously doesn't work. So if someone could tell me what to edit that would be great :3

Code that I think has anything to do with it:
PHP:
$image = str_replace("www", "", str_replace(":", "", str_replace("/", "", str_replace(".", "!", str_replace("ii.gl", "", str_replace("http", "", $image))))));
PHP:
$pw = explode("!", $image);
PHP:
<a href="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>" target="_BLANK"><img class="galleryImage" src="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>"/></a>


Whole gallery.php just in case:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; 
$logged_in = user_logged_in();
if ($logged_in === true) {
    if (!empty($_POST['new'])) {
        ?>
        <h1>Create image article</h1>
        <p>Only works with "Direct link" URLs from <a href="http://www.imgland.net/">imgland.net</a>
        <br />Don't understand? Don't worry! Watch this <a href="http://youtu.be/r9pEc7T3cJg" target="_BLANK">video guide!</a></p>
        <form action="" method="post">
            Image URL:<br /><input type="text" name="image" size="70"><br />
            Image Title:<br /><input type="text" name="title" size="70"><br />
            Image Description:<br /><textarea name="desc" cols="55" rows="15"></textarea><br />
            <input type="submit" name="Submit" value="Post Image Article">
        </form>
        <?php
    }
    if (!empty($_POST['image']) && !empty($_POST['title']) && !empty($_POST['desc'])) {
        $image = sanitize($_POST['image']);
        $image = str_replace("www", "", str_replace(":", "", str_replace("/", "", str_replace(".", "!", str_replace("ii.gl", "", str_replace("http", "", $image))))));
        $title = sanitize($_POST['title']);
        $desc = sanitize($_POST['desc']);
       
        // Insert to database
        insertImage((int)$session_user_id, $title, $desc, $image);
       
        $pw = explode("!", $image);
        ?>
        <h1>Image Posted</h1>
        <p>However, your image will not be listed until a GM have verified it.<br />
        Feel free to remind the GM in-game to login on website and approve the image post.</p>
        <h2>Preview:</h2>
        <table>
            <tr class="yellow">
                <td><h3><?php echo $title; ?></h3></td>
            </tr>
            <tr>
                <td>
<a href="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>" target="_BLANK"><img class="galleryImage" src="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>"/></a>
                </td>
            </tr>
            <tr>
                <td>
                <?php
                $descr = str_replace("\\r", "", $desc);
                $descr = str_replace("\\n", "<br />", $descr);
                ?>
                <p><?php echo $descr; ?></p>
                </td>
            </tr>
        </table>
        <?php
    }
}
if (empty($_POST)) {
    ?>
    <h1>Gallery</h1>
    <?php
    if ($logged_in === false) echo 'You need to be logged in to add images.';
    elseif ($logged_in === true)
    { ?>
    <form action="" method="post">
        Got some cool images to show the community? <input type="submit" name="new" value="Add Image">
    </form>
    <?php
    }
   
    $cache = new Cache('engine/cache/gallery');
    $images = $cache->load();
    if ($images != false) {
        foreach($images as $image) {
            $pw = explode("!", $image['image']);
            ?>
            <table>
                <tr class="yellow">
                    <td><h3><?php echo $image['title']; ?></h3></td>
                </tr>
                <tr>
                    <td>
<a href="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>" target="_BLANK"><img class="galleryImage" src="<?php echo 'http://'. $pw[0] .'.ii.gl/'. $pw[1] .'.'. $pw[2]; ?>"/></a>
                    </td>
                </tr>
                <tr>
                    <td>
                    <?php
                    $descr = str_replace("\\r", "", $image['desc']);
                    $descr = str_replace("\\n", "<br />", $descr);
                    ?>
                    <p><?php echo $descr; ?></p>
                    </td>
                </tr>
            </table>
        <?php }
    } else echo '<h2>There are currently no public images.</h2>';
   
    if ($logged_in === false) echo 'You need to be logged in to add images.';
}
include 'layout/overall/footer.php';
/*
$url = strtolower("HTTP://1.imgland.net/pxPmUL.jpg");
echo $url .'<br />';
$url = str_replace("www", "", str_replace(":", "", str_replace("/", "", str_replace(".", "!", str_replace("imgland.net", "", str_replace("http", "", $url))))));
$url = sanitize($url);
echo $url;
$url = explode("!", $url);
<a href="<?php echo 'http://'. $url[0] .'.imgland.net/'. $url[1] .'.'. $url[2]; ?>"><img src="<?php echo 'http://'. $url[0] .'.imgland.net/'. $url[1] .'.'. $url[2]; ?>" width="650"/></a>
echo time();
//insertImage(2, "Yaay!", "Super description!", "1!pxpmul!jpg");
*/?>
 
Back
Top