<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[مەکۆکانی وێبچن - کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
		<link>https://www.webchin.org/Meko/viewtopic.php?id=24596</link>
		<atom:link href="https://www.webchin.org/Meko/extern.php?action=feed&amp;tid=24596&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[دواترین و نوێترین په‌یامه‌كان له‌ کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌.]]></description>
		<lastBuildDate>Thu, 04 Aug 2011 21:55:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[وه‌ڵام: کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=202290#p202290</link>
			<description><![CDATA[<p>گەیلان گیان ئەمە دابگرە بزانە چۆنە کێشەکەت چارە دەکات.</p><p><a href="http://webchinupload.com/files/images_4.zip">http://webchinupload.com/files/images_4.zip</a></p>]]></description>
			<author><![CDATA[null@example.com (Shamal986)]]></author>
			<pubDate>Thu, 04 Aug 2011 21:55:11 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=202290#p202290</guid>
		</item>
		<item>
			<title><![CDATA[وه‌ڵام: کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=201922#p201922</link>
			<description><![CDATA[<p>ده‌ستان خۆش،</p>]]></description>
			<author><![CDATA[null@example.com (گه‌یلان)]]></author>
			<pubDate>Tue, 02 Aug 2011 20:05:18 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=201922#p201922</guid>
		</item>
		<item>
			<title><![CDATA[وه‌ڵام: کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=201920#p201920</link>
			<description><![CDATA[<p>من لە کاتی بەدیکردنی ئەم جۆرە کێشەیە<br />کۆدی header لادەبەم، warnin&nbsp; ـەگە نامێنێت.</p><p>لە هێلی ژمارە ٣١١ ئەمە ناچالاک بکە<br /></p><div class="codebox"><pre><code data-language=php> //   header(&#039;Location: &#039;.$PHP_SELF);</code></pre></div><p>warningـەگە نامێنێت.</p>]]></description>
			<author><![CDATA[null@example.com (MAYAN)]]></author>
			<pubDate>Tue, 02 Aug 2011 19:56:56 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=201920#p201920</guid>
		</item>
		<item>
			<title><![CDATA[وه‌ڵام: کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=201917#p201917</link>
			<description><![CDATA[<p>ئه‌وه‌ Warning ـه‌، بۆیه‌ ده‌توانی Error Reporting له‌ PHP ناچالاك بكه‌یت بۆ ئه‌وه‌ی ده‌رنه‌كه‌وێت. Warning مه‌رج نییه‌ هه‌ڵه‌ بێت و پێویستیش ناكات ده‌ربكه‌وێت، جا كه‌ سكریپته‌كه‌ت به‌ درووستی كار ده‌كات به‌ پێویستی نازانم سه‌ر ئێشه‌ بۆ خۆت درووست بكه‌یت.</p>]]></description>
			<author><![CDATA[null@example.com (ئاسۆ نادری)]]></author>
			<pubDate>Tue, 02 Aug 2011 19:50:26 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=201917#p201917</guid>
		</item>
		<item>
			<title><![CDATA[وه‌ڵام: کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=201916#p201916</link>
			<description><![CDATA[<p>هه‌ر به‌رده‌وامه‌ و له‌کاتی باکردنی وێنه‌ ئه‌م هه‌ڵه‌یه‌ نیشان ئه‌دات، به‌ڵام وێنه‌که‌ش بارده‌کرێت!</p>]]></description>
			<author><![CDATA[null@example.com (گه‌یلان)]]></author>
			<pubDate>Tue, 02 Aug 2011 19:48:44 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=201916#p201916</guid>
		</item>
		<item>
			<title><![CDATA[وه‌ڵام: کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=201910#p201910</link>
			<description><![CDATA[<p>كێشه‌كه‌ت بۆ چاره‌سه‌ر بووه‌ یان تاوتوێی بكه‌ین؟</p>]]></description>
			<author><![CDATA[null@example.com (ئاسۆ نادری)]]></author>
			<pubDate>Tue, 02 Aug 2011 19:20:49 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=201910#p201910</guid>
		</item>
		<item>
			<title><![CDATA[کێشه‌یه‌ک له‌ کاتی دانانی دووگمه‌ی بارکردنی وێنه‌]]></title>
			<link>https://www.webchin.org/Meko/viewtopic.php?pid=201618#p201618</link>
			<description><![CDATA[<p>سڵاو،<br />له‌ کاتی ناردنی بابه‌ته‌ ئه‌مه‌وێت دووگمه‌یه‌ک دابنێم بۆ بارکردنی وێنه‌ی Avatar<br />ئه‌م هه‌نگاوانه‌م جێبه‌جێ کردووه‌ <br /><a href="http://forum.cutenewsru.com/more-avatars-t828.html#5299">http://forum.cutenewsru.com/more-avatars-t828.html#5299</a><br />به‌ڵام ئه‌م هه‌ڵه‌یه‌ نیشان ئه‌دات کاتێک وێنه‌که‌ ده‌ستنیشان ده‌که‌م و کرته‌ که‌ upload ده‌که‌م<br /><span class="postimg"><img src="http://www.webchinupload.com/files/cu1.png" alt="http://www.webchinupload.com/files/cu1.png" /></span><br />ئه‌مه‌ش کۆده‌کانی ناو images.mdu<br /></p><div class="codebox"><pre><code data-language=php>&lt;?php
///////////////////////////////////////////////////////////////////
//
//Original images.mdu modified by FI-DD
//http://english.cutenews.ru/forum/profile.php?mode=viewprofile&amp;u=2
//
///////////////////////////////////////////////////////////////////

if ($member[&#039;level&#039;] &gt; 2 and ($action == &#039;remove&#039; or $action == &#039;rename&#039;)){
    $action = &#039;&#039;;
}

if ($config_use_images_uf == &#039;yes&#039; or $member[&#039;level&#039;] &lt; 3 and $user){
    $user = (($member[&#039;level&#039;] &lt; 3 and $user) ? totranslit($user) : totranslit($member[&#039;username&#039;]));
}

$query_string = cute_query_string($QUERY_STRING, array(&#039;action&#039;, &#039;mod&#039;, &#039;image&#039;, &#039;name&#039;, &#039;start_from&#039;, &#039;align&#039;, &#039;sortby&#039;, &#039;subfolder&#039;, &#039;act&#039;));
$PHP_SELF .= &#039;?mod=images&#039;.$query_string;
$allowed_upload = false;

//Configuration
$settings = new PluginSettings(&#039;image_manager&#039;);
    
    if(!is_array($settings -&gt; settings)){
            $settings -&gt; settings = array(
                &#039;align&#039;                =&gt;&#039;none&#039;,
                &#039;popup&#039;                =&gt; &#039;0&#039;,
                &#039;update&#039;            =&gt; &#039;0&#039;,
                &#039;replace&#039;            =&gt; &#039;0&#039;,
                &#039;replace_template&#039;    =&gt; &#039;&lt;i&gt;{date:d.m.Y}: &lt;b&gt;{image}&lt;/b&gt; was removed.&lt;/i&gt;&#039;,
                &#039;video_width&#039;        =&gt; &#039;320&#039;,
                &#039;video_height&#039;        =&gt; &#039;240&#039;,
                &#039;auto_start&#039;        =&gt; &#039;yes&#039;,
                &#039;uimode&#039;            =&gt; &#039;full&#039;,
                &#039;media_extensions&#039;    =&gt; &#039;avi,mpg&#039;
            );
            
            $settings -&gt; save();
    }
    
    if($settings -&gt; settings[&#039;align&#039;] == &#039;left&#039;) $default_align = &#039;align=&quot;left&quot;&#039;;
    if($settings -&gt; settings[&#039;align&#039;] == &#039;right&#039;) $default_align = &#039;align=&quot;right&quot;&#039;;
    if($settings -&gt; settings[&#039;align&#039;] == &#039;none&#039;) $default_align = &#039;&#039;;
    
    if($settings -&gt; settings[&#039;popup&#039;] == &#039;1&#039;) $popup = true;
    if($settings -&gt; settings[&#039;popup&#039;] == &#039;0&#039;) $popup = false;
    
    if($settings -&gt; settings[&#039;update&#039;] == &#039;1&#039;) $update = true;
    if($settings -&gt; settings[&#039;update&#039;] == &#039;0&#039;) $update = false;
    
    if($settings -&gt; settings[&#039;replace&#039;] == &#039;1&#039;) $replace = true;
    if($settings -&gt; settings[&#039;replace&#039;] == &#039;0&#039;) $replace = false;
    
    $replace_template = $settings -&gt; settings[&#039;replace_template&#039;];
    
    $media_extensions = explode(&quot;,&quot;, $settings -&gt; settings[&#039;media_extensions&#039;]);
    
//Show configuration
if($_GET[&#039;act&#039;] == &quot;configuration&quot; and !$area and $member[&#039;level&#039;] == 1){
echoheader(&#039;images&#039;, $echo[&#039;header&#039;]);

        echo     &#039;&lt;b&gt;&#039;.$echo[&#039;configuration&#039;].&#039;&lt;/b&gt;&lt;br /&gt;&#039;.
                &#039;&lt;form method=&quot;post&quot; action=&quot;&#039;.$PHP_SELF.&#039;&quot;&gt;&#039;.
                &#039;&lt;table&gt;&#039;.
                &#039;&lt;tr&gt;&lt;td&gt;&#039;.$echo[&#039;align&#039;].&#039;&lt;/td&gt;&lt;td&gt;&lt;label for=&quot;aleft&quot;&gt;&#039;.$echo[&#039;alignLeft&#039;].&#039;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input id=&quot;aleft&quot; type=&quot;radio&quot; name=&quot;align1&quot; value=&quot;left&quot; &#039;.($settings -&gt; settings[&#039;align&#039;] == &#039;left&#039; ? &#039;checked&#039; : &#039;&#039;).&#039;&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;label for=&quot;aright&quot;&gt;&#039;.$echo[&#039;alignRight&#039;].&#039;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input id=&quot;aright&quot; type=&quot;radio&quot; name=&quot;align1&quot; value=&quot;right&quot; &#039;.($settings -&gt; settings[&#039;align&#039;] == &#039;right&#039; ? &#039;checked&#039; : &#039;&#039;).&#039;&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;label for=&quot;anone&quot;&gt;&#039;.$echo[&#039;alignNone&#039;].&#039;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input id=&quot;anone&quot; type=&quot;radio&quot; name=&quot;align1&quot; value=&quot;none&quot; &#039;.($settings -&gt; settings[&#039;align&#039;] == &#039;none&#039; ? &#039;checked&#039; : &#039;&#039;).&#039;&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&lt;label title=&quot;&#039;.$echo[&#039;updateTitle&#039;].&#039;&quot; for=&quot;update&quot;&gt;&#039;.$echo[&#039;update&#039;].&#039;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input id=&quot;update&quot; type=&quot;checkbox&quot; name=&quot;update1&quot; value=&quot;1&quot; &#039;.($settings -&gt; settings[&#039;update&#039;] == &#039;1&#039; ? &#039;checked&#039; : &#039;&#039;).&#039;&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&lt;label title=&quot;&#039;.$echo[&#039;replaceTitle&#039;].&#039;&quot; for=&quot;replace&quot;&gt;&#039;.$echo[&#039;replace&#039;].&#039;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input onClick=&quot;javascript:ShowOrHide(\&#039;show_template\&#039;)&quot; id=&quot;replace&quot; type=&quot;checkbox&quot; name=&quot;replace1&quot; value=&quot;1&quot; &#039;.($settings -&gt; settings[&#039;replace&#039;] == &#039;1&#039; ? &#039;checked&#039; : &#039;&#039;).&#039;&gt;&lt;/td&gt;&lt;td&gt;&lt;div style=&quot;display:&#039;.($settings -&gt; settings[&#039;replace&#039;] == &#039;1&#039; ? &#039;block&#039; : &#039;none&#039;).&#039;&quot;id=&quot;show_template&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;replace_template1&quot; value=&quot;&#039;.$settings -&gt; settings[&#039;replace_template&#039;].&#039;&quot; size=&quot;40&quot; /&gt;&lt;br /&gt;&#039;.$settings -&gt; settings[&#039;replace_template&#039;].&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&#039;.$echo[&#039;extensions&#039;].&#039;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;media_extensions1&quot; value=&quot;&#039;.$settings -&gt; settings[&#039;media_extensions&#039;].&#039;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&#039;.$echo[&#039;playerWidth&#039;].&#039;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;video_width1&quot; value=&quot;&#039;.$settings -&gt; settings[&#039;video_width&#039;].&#039;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&#039;.$echo[&#039;playerHeight&#039;].&#039;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;video_height1&quot; value=&quot;&#039;.$settings -&gt; settings[&#039;video_height&#039;].&#039;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&#039;.$echo[&#039;playerMode&#039;].&#039;&lt;/td&gt;&lt;td&gt;&#039;.makeDropDown(array(&#039;none&#039; =&gt; &#039;&#039;.$echo[&#039;non&#039;].&#039;&#039;, &#039;mini&#039; =&gt; &#039;&#039;.$echo[&#039;mini&#039;].&#039;&#039;, &#039;full&#039; =&gt; &#039;&#039;.$echo[&#039;full&#039;].&#039;&#039;), &#039;uimode1&#039;, $settings -&gt; settings[&#039;uimode&#039;]).&#039;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&#039;.$echo[&#039;autostart&#039;].&#039;&lt;/td&gt;&lt;td&gt;&#039;.makeDropDown(array(&#039;yes&#039; =&gt; $echo[&#039;sayyes&#039;], &#039;no&#039; =&gt; &#039;&#039;.$echo[&#039;sayno&#039;].&#039;&#039;), &#039;auto_start1&#039;, $settings -&gt; settings[&#039;auto_start&#039;]).&#039;&lt;/td&gt;&lt;/tr&gt;&#039;.
                
                &#039;&lt;tr&gt;&lt;td&gt;&lt;label title=&quot;&#039;.$echo[&#039;popupTitle&#039;].&#039;&quot; for=&quot;popup&quot;&gt;&#039;.$echo[&#039;popup&#039;].&#039;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input id=&quot;popup&quot; type=&quot;checkbox&quot; onclick=&quot;javascript:ShowOrHide(\&#039;show_help\&#039;)&quot; name=&quot;popup1&quot; value=&quot;1&quot; &#039;.($settings -&gt; settings[&#039;popup&#039;] == &#039;1&#039; ? &#039;checked&#039; : &#039;&#039;).&#039;&gt;&lt;/td&gt;&lt;/tr&gt;&#039;.
                &#039;&lt;/table&gt;&#039;.
                &#039;&lt;span id=&quot;show_help&quot; style=&quot;display:&#039;.($settings -&gt; settings[&#039;popup&#039;] == &#039;1&#039; ? &#039;block&#039; : &#039;none&#039;).&#039;&quot;&gt;&#039;.
                &#039;1. Copy popup.js in the same folder as your news page.&lt;br /&gt;&#039;.
                &#039;2. Put this code in the &amp;lt;head&amp;gt; tag of your news page:&lt;br /&gt;&#039;.
                &#039;&lt;div class=&quot;code&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;./popup.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;&#039;.
                &#039;&lt;/span&gt;&lt;br /&gt;&#039;.
                &#039;&lt;input type=&quot;hidden&quot; name=&quot;act&quot; value=&quot;save_config&quot;&gt;&#039;.
                &#039;&lt;input type=&quot;submit&quot; value=&quot;&#039;.$echo[&#039;save&#039;].&#039;&quot;&gt;&#039;.
                &#039;&lt;/form&gt;&#039;;
                
                echofooter();
                exit;
}

//Save the config
    if($_POST[&#039;act&#039;] == &quot;save_config&quot;){
            
            $settings -&gt; settings = array(
                &#039;align&#039; =&gt; $_POST[&#039;align1&#039;],
                &#039;popup&#039; =&gt; ($_POST[&#039;popup1&#039;] == &quot;1&quot; ? &#039;1&#039; : &#039;0&#039;),
                &#039;update&#039; =&gt; ($_POST[&#039;update1&#039;] == &quot;1&quot; ? &#039;1&#039; : &#039;0&#039;),
                &#039;replace&#039; =&gt; ($_POST[&#039;replace1&#039;] == &quot;1&quot; ? &#039;1&#039; : &#039;0&#039;),
                &#039;replace_template&#039; =&gt; $_POST[&#039;replace_template1&#039;],
                &#039;video_width&#039;        =&gt; $_POST[&#039;video_width1&#039;],
                &#039;video_height&#039;        =&gt; $_POST[&#039;video_height1&#039;],
                &#039;auto_start&#039;        =&gt; $_POST[&#039;auto_start1&#039;],
                &#039;uimode&#039;            =&gt; $_POST[&#039;uimode1&#039;],
                &#039;media_extensions&#039;    =&gt; $_POST[&#039;media_extensions1&#039;]
            );
            
            $settings -&gt; save();
            
    }


$folder = end($folder = cute_parse_url($config_path_image_upload));
if(!file_exists($folder))
@mkdir($folder, chmod);


if ($config_use_images_uf == &#039;yes&#039; or $user){
    $folder .= &#039;/&#039;.$user;
    $config_path_image_upload .= &#039;/&#039;.$user;
    if(!file_exists($folder))
    @mkdir($folder, chmod);
    if(!file_exists($folder.&#039;/thumbs&#039;))
    @mkdir($folder.&#039;/thumbs&#039;, chmod);
}

$base_folder = $folder;

if(!file_exists($folder.&#039;/subfolders&#039;))
@mkdir($folder.&#039;/subfolders&#039;, chmod);

if(!file_exists($folder.&#039;/thumbs&#039;))
@mkdir($folder.&#039;/thumbs&#039;, chmod);


if($_POST[&#039;subfolder&#039;] == &#039;base&#039; or $_GET[&#039;subfolder&#039;] == &#039;base&#039;){

}

elseif($_POST[&#039;subfolder&#039;] and $_POST[&#039;subfolder&#039;] != &#039;&#039;){
    $subfolder = $_POST[&#039;subfolder&#039;];
    $folder .= &#039;/subfolders/&#039;.$subfolder;
    $config_path_image_upload .= &#039;/subfolders/&#039;.$subfolder;
    
    if(!file_exists($folder.&#039;/thumbs&#039;))
    @mkdir($folder.&#039;/thumbs&#039;, chmod);
}

elseif($_GET[&#039;subfolder&#039;] and $_GET[&#039;subfolder&#039;] != &#039;&#039;){
    $subfolder = $_GET[&#039;subfolder&#039;];
    $folder .= &#039;/subfolders/&#039;.$subfolder;
    $config_path_image_upload .= &#039;/subfolders/&#039;.$subfolder;
    
    if(!file_exists($folder.&#039;/thumbs&#039;))
    @mkdir($folder.&#039;/thumbs&#039;, chmod);
}

//Rename image
if ($action == &#039;rename&#039; and $image and $name){
    @rename($folder.&#039;/&#039;.$image, $folder.&#039;/&#039;.$name);
    @rename($folder.&#039;/thumbs/&#039;.$image, $folder.&#039;/thumbs/&#039;.$name);
    if($update){
        $old = array(&#039;/&#039;.$image, &#039;/thumbs/&#039;.$image, $image);
        $new = array(&#039;/&#039;.$name, &#039;/thumbs/&#039;.$name, $name);
        update_stories($old, $new);
    }
    header(&#039;Location: &#039;.$PHP_SELF);
}

//Remove image
if ($action == &#039;remove&#039; and $image){
    @unlink($folder.&#039;/&#039;.$image);
    @unlink($folder.&#039;/thumbs/&#039;.$image);
    if($update and $replace){
        $old = array(&#039;#&lt;a (.*)&#039;.$_GET[&#039;subfolder&#039;].&#039;\/&#039;.$image.&#039;(.*)&lt;\/a&gt;#i&#039;, &#039;#&lt;img (.*)&#039;.$_GET[&#039;subfolder&#039;].&#039;\/&#039;.$image.&#039;(.*)\/&gt;#i&#039;, &#039;#&lt;OBJECT (.*)&#039;.$_GET[&#039;subfolder&#039;].&#039;\/&#039;.$image.&#039;(.*)&lt;\/OBJECT&gt;#i&#039;);
        $new_tmp = str_replace(&#039;{image}&#039;, $image, $replace_template);
        $new_tmp = preg_replace(&#039;/{date:(.*?)}/ie&#039;, &quot;langdate(&#039;\\1&#039;, time())&quot;, $new_tmp);
        $new = array($new_tmp, $new_tmp, $new_tmp);
        update_stories($old, $new, true);
    }
    header(&#039;Location: &#039;.$PHP_SELF);
}

//Add subfolder
if ($action == &#039;add_folder&#039; and (!file_exists($folder.&#039;/subfolders/&#039;.$_POST[&#039;new_folder&#039;]))){
    @mkdir($folder.&#039;/subfolders/&#039;.$_POST[&#039;new_folder&#039;], chmod);
    @mkdir($folder.&#039;/subfolders/&#039;.$_POST[&#039;new_folder&#039;].&#039;/thumbs&#039;, chmod);
    
    header(&#039;Location: &#039;.$PHP_SELF);
}

//Rename subfolder
if($action == &#039;rename_subfolders&#039;){
    @rename($base_folder.&#039;/subfolders/&#039;.$old_folder, $base_folder.&#039;/subfolders/&#039;.$selected_folder);
    if($update){
        $old = &#039;subfolders/&#039;.$old_folder;
        $new = &#039;subfolders/&#039;.$selected_folder;
        update_stories($old, $new);
    }
    header(&#039;Location: &#039;.$PHP_SELF);
}

//Delete subfolder
if($action == &#039;delete_folder&#039;){
    @rmdir($base_folder.&#039;/subfolders/&#039;.$selected_folder.&#039;/thumbs&#039;);
    @rmdir($base_folder.&#039;/subfolders/&#039;.$selected_folder);
    header(&#039;Location: &#039;.$PHP_SELF);
}

//Move image to another folder
if($action == &#039;move_file&#039;){
    if(!file_exists($base_folder.($new_path == &#039;base&#039; ? &#039;&#039; : &#039;/subfolders/&#039;.$new_path).&#039;/&#039;.$image)){
        @copy($folder.&#039;/&#039;.$image, $base_folder.($new_path == &#039;base&#039; ? &#039;&#039; : &#039;/subfolders/&#039;.$new_path).&#039;/&#039;.$image);
        @copy($folder.&#039;/thumbs/&#039;.$image, $base_folder.($new_path == &#039;base&#039; ? &#039;/thumbs/&#039; : &#039;/subfolders/&#039;.$new_path.&#039;/thumbs/&#039;).$image);
        if($update){
            if($subfolder == &#039;&#039;){
                $old = array(&#039;}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).$image, &#039;/thumbs/&#039;.$image);
                $new = array(&#039;}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).&#039;subfolders/&#039;.$new_path.&#039;/&#039;.$image, &#039;/subfolders/&#039;.$new_path.&#039;/thumbs/&#039;.$image);
            }
            elseif($new_path != &#039;base&#039;){
                $old = array(&#039;/subfolders/&#039;.$subfolder.&#039;/&#039;.$image, &#039;/subfolders/&#039;.$subfolder.&#039;/thumbs/&#039;.$image);
                $new = array(&#039;/subfolders/&#039;.$new_path.&#039;/&#039;.$image, &#039;/subfolders/&#039;.$new_path.&#039;/thumbs/&#039;.$image);
            }
            else{
                $old = array(&#039;/subfolders/&#039;.$subfolder.&#039;/&#039;.$image, &#039;/subfolders/&#039;.$subfolder.&#039;/thumbs/&#039;.$image);
                $new = array(&#039;/&#039;.$image, &#039;/thumbs/&#039;.$image);
            }
            update_stories($old, $new);
        }
        @unlink($folder.&#039;/&#039;.$image);
        @unlink($folder.&#039;/thumbs/&#039;.$image);
    }
    header(&#039;Location: &#039;.$PHP_SELF);
    
}

if ($_FILES[&#039;image&#039;][&#039;name&#039;]){
    for ($i = 0; $i &lt; count($_FILES[&#039;image&#039;][&#039;name&#039;]); $i++){
        $ext   = end($ext = explode(&#039;.&#039;, $_FILES[&#039;image&#039;][&#039;name&#039;][$i]));
        $type  = end($type = explode(&#039;/&#039;, $_FILES[&#039;image&#039;][&#039;type&#039;][$i]));
        $image = preg_replace(&#039;/(.*?).&#039;.$ext.&#039;$/ie&#039;, &quot;totranslit(&#039;\\1&#039;)&quot;, $_FILES[&#039;image&#039;][&#039;name&#039;][$i]).&#039;.&#039;.$ext;

        foreach ($allowed_extensions as $allow){
            if (substr($type, -strlen($allow)) == $allow){
                $allowed_upload = true;
            }
        }
        
        foreach($media_extensions as $allow){
            if(strtolower($ext) == $allow){
                $allowed_upload = true;
            }
        }
        
        
        if ((file_exists($folder.&#039;/&#039;.$image) and $overwrite) or $allowed_upload){
            move_uploaded_file($_FILES[&#039;image&#039;][&#039;tmp_name&#039;][$i], $folder.&#039;/&#039;.$image);
            
            //Resize image
                if ($resize_image and $resize_pic){
                    if ($resize_pic &lt; 1 or $resize_pic == &quot;&quot;) {$resize_pic = 100;}
                    if ($square_pic == &quot;yes&quot;) {
                        @img_resize($folder.&#039;/&#039;.$image, $folder.&#039;/&#039;.$image, $resize_pic, &#039;square&#039;);
                    }
                    else{
                        @img_resize($folder.&#039;/&#039;.$image, $folder.&#039;/&#039;.$image, $resize_pic, &#039;normal&#039;);
                    }
                    if ($shadow_pic) {
                        @make_shadow($folder.&#039;/&#039;.$image);
                    }
                }
            
                //Add watermark (text)
                if ($watermark and $watermark_text != &quot;&quot;) { 
                    if($watermark_font == &quot;none&quot;) {
                    @add_watermark($folder.&#039;/&#039;.$image, $watermark_text, $hotspot1, ($textcolor ? $textcolor : &#039;FFFFFF&#039;), ($textsize ? $textsize : &#039;12&#039;));
                    }
                    else {
                    @add_watermark($folder.&#039;/&#039;.$image, $watermark_text, $hotspot1, ($textcolor ? $textcolor : &#039;FFFFFF&#039;), ($textsize ? $textsize : &#039;12&#039;), &#039;data/watermark/&#039;.$watermark_font);
                    }
                }
                //Add watermark (image)
                if ($merge) {
                @mergePix($folder.&#039;/&#039;.$image, &#039;data/watermark/&#039;.$watermark_image, $folder.&#039;/&#039;.$image, $hotspot2, ($merge_transition ? $merge_transition : &#039;40&#039;));
                }
                
                //Create thumb
            if ($thumb and $make_thumb){
                if ($make_thumb &lt; 1 or $make_thumb == &quot;&quot;) {$make_thumb = 100;}
                if ($square == &quot;yes&quot;) {
                    @img_resize($folder.&#039;/&#039;.$image, $folder.&#039;/thumbs/&#039;.$image, $make_thumb, &#039;square&#039;);
                }
                else{
                    @img_resize($folder.&#039;/&#039;.$image, $folder.&#039;/thumbs/&#039;.$image, $make_thumb, &#039;normal&#039;);
                }
                if ($shadow) {
                    @make_shadow($folder.&#039;/thumbs/&#039;.$image);
                }
            }
        }
    }

    header(&#039;Location: &#039;.$PHP_SELF);
}

if ($area){
?&gt;

&lt;link href=&quot;skins/default.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;skins/cute.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
&lt;!--
function insertimage(text){
    text = &#039; &#039; + text + &#039; &#039;;
    opener.document.forms[&#039;addnews&#039;].&lt;?=$area; ?&gt;_story.focus();
    opener.document.forms[&#039;addnews&#039;].&lt;?=$area; ?&gt;_story.value  += text;
    opener.document.forms[&#039;addnews&#039;].&lt;?=$area; ?&gt;_story.focus();
}
//--&gt;
&lt;/script&gt;

&lt;?
} else {
    echoheader(&#039;images&#039;, $echo[&#039;header&#039;]);
    
    echo &#039;&lt;a href=&quot;&#039;.$PHP_SELF.&#039;&amp;act=configuration&quot;&gt;&#039;.$echo[&#039;configuration&#039;].&#039;&lt;/a&gt;&#039;;
}
?&gt;

&lt;table class=&quot;panel&quot;&gt;
&lt;tr&gt;&lt;td&gt;

&lt;form action=&quot;&lt;?=$PHP_SELF; ?&gt;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
&lt;b&gt;&lt;?=$echo[&#039;addNew&#039;]; ?&gt;&lt;/b&gt; 
&lt;? if(!$area) { ?&gt;
&lt;label for=&quot;manage_folders&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;manage_folders&quot; id=&quot;manage_folders&quot; onclick=&quot;javascript:ShowOrHide(&#039;show_folders&#039;)&quot;&gt;&lt;b&gt;&lt;?=$echo[&#039;manage&#039;]; ?&gt;&lt;/b&gt;&lt;/label&gt;
&lt;? } ?&gt;
&lt;table border=&quot;0&quot; cellpading=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;250&quot; class=&quot;panel&quot;&gt;
 &lt;tr&gt;
  &lt;td&gt;

&lt;script language=&quot;javascript&quot;&gt;
f = 0
function file_uploader(which){
if (which &lt; f) return
    f ++
    d = document.getElementById(&#039;image_&#039;+f)
    d.innerHTML = &#039;&lt;input type=&quot;file&quot; name=&quot;image[&#039;+f+&#039;]&quot; id=&quot;image_&#039;+f+&#039;&quot; value=&quot;&quot; onchange=&quot;file_uploader(&#039;+f+&#039;);&quot; /&gt;&lt;br /&gt;&lt;span id=&quot;image_&#039;+(f+1)+&#039;&quot;&gt;&#039;
}
document.writeln(&#039;&lt;input type=&quot;file&quot; name=&quot;image[0]&quot; value=&quot;&quot; onchange=&quot;file_uploader(0);&quot; /&gt;&lt;br /&gt;&#039;)
document.writeln(&#039;&lt;span id=&quot;image_1&quot;&gt;&lt;/span&gt;&#039;)
&lt;/script&gt;

&lt;?=$echo[&#039;saveIn&#039;].&#039; &#039;; ?&gt;
&lt;?=makeDropDown(get_subfolders(), &#039;subfolder&#039;, ($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : ($_GET[&#039;subfolder&#039;] ? $_GET[&#039;subfolder&#039;] : $echo[&#039;baseFolder&#039;]))); ?&gt;
&lt;br /&gt;

   &lt;label for=&quot;overwrite&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;overwrite&quot; id=&quot;overwrite&quot;&gt;&lt;?=$echo[&#039;overwrite&#039;]; ?&gt;&lt;/label&gt;&lt;br /&gt;
   
   &lt;label for=&quot;thumb&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;thumb&quot; id=&quot;thumb&quot; onclick=&quot;javascript:ShowOrHide(&#039;make_thumb&#039;)&quot;&lt;?=(!extension_loaded(&#039;gd&#039;) ? &#039; disabled&#039; : &#039;&#039;); ?&gt;&gt;&lt;?=$echo[&#039;makeThumb&#039;]; ?&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;span id=&quot;make_thumb&quot; style=&quot;display: none;&quot;&gt;
   &lt;ul style=&quot;list-style-type:none&quot;&gt;
   &lt;li&gt;&lt;input type=&quot;text&quot; name=&quot;make_thumb&quot; size=&quot;1&quot; value=&quot;150&quot;&gt; &lt;?=$echo[&#039;thumbSettings&#039;]; ?&gt;&lt;/li&gt;
   &lt;li&gt;&lt;input type=&quot;checkbox&quot; name=&quot;square&quot; id=&quot;square&quot; value=&quot;yes&quot;&gt;&lt;label title=&quot;&lt;?=$echo[&#039;crop&#039;]; ?&gt;&quot; for=&quot;square&quot;&gt;&lt;?=$echo[&#039;crop&#039;]; ?&gt;&lt;/label&gt;&lt;/li&gt;
   &lt;li&gt;&lt;input type=&quot;checkbox&quot; name=&quot;shadow&quot; id=&quot;shadow&quot;&gt;&lt;label title=&quot;&lt;?=$echo[&#039;shadowTitle&#039;]; ?&gt;&quot; for=&quot;shadow&quot;&gt;&lt;?=$echo[&#039;shadow&#039;]; ?&gt;&lt;/label&gt;&lt;/li&gt;
   &lt;/ul&gt;
   &lt;/span&gt;
   
   &lt;label for=&quot;resize_image&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;resize_image&quot; id=&quot;resize_image&quot; onclick=&quot;javascript:ShowOrHide(&#039;show_resize&#039;)&quot;&lt;?=(!extension_loaded(&#039;gd&#039;) ? &#039; disabled&#039; : &#039;&#039;); ?&gt;&gt;&lt;?=$echo[&#039;resizeImage&#039;]; ?&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;span id=&quot;show_resize&quot; style=&quot;display: none;&quot;&gt;
   &lt;ul style=&quot;list-style-type:none&quot;&gt;
   &lt;li&gt;&lt;input type=&quot;text&quot; name=&quot;resize_pic&quot; size=&quot;1&quot; value=&quot;300&quot;&gt; &lt;?=$echo[&#039;resizeWidth&#039;]; ?&gt;&lt;/li&gt;
   &lt;li&gt;&lt;input type=&quot;checkbox&quot; name=&quot;square_pic&quot; id=&quot;square_pic&quot; value=&quot;yes&quot;&gt;&lt;label title=&quot;&lt;?=$echo[&#039;resizeCrop&#039;]; ?&gt;&quot; for=&quot;square_pic&quot;&gt;&lt;?=$echo[&#039;resizeCrop&#039;]; ?&gt;&lt;/label&gt;&lt;/li&gt;
   &lt;li&gt;&lt;input type=&quot;checkbox&quot; name=&quot;shadow_pic&quot; id=&quot;shadow_pic&quot;&gt;&lt;label title=&quot;&lt;?=$echo[&#039;shadowTitle&#039;]; ?&gt;&quot; for=&quot;shadow_pic&quot;&gt;&lt;?=$echo[&#039;shadow&#039;]; ?&gt;&lt;/label&gt;&lt;/li&gt;
   &lt;/ul&gt;
   &lt;/span&gt;
   
&lt;?
   $dir = opendir(&quot;./data/watermark&quot;);
while ($single_file = readdir($dir)){
    $file_ending = strtolower(end(explode(&#039;.&#039;, $single_file)));
    if ($file_ending == &quot;jpg&quot; or $file_ending == &quot;jpeg&quot; or $file_ending == &quot;gif&quot; or $file_ending == &quot;png&quot;){
        $watermarks[] = $single_file;
    }
    if ($file_ending == &quot;ttf&quot;){
        $fonts[] = $single_file;
    }
}
?&gt;
   
   &lt;label for=&quot;watermark&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;watermark&quot; id=&quot;watermark&quot; onclick=&quot;javascript:ShowOrHide(&#039;make_watermark&#039;)&quot;&lt;?=(!extension_loaded(&#039;gd&#039;) ? &#039; disabled&#039; : &#039;&#039;); ?&gt;&gt;&lt;?=$echo[&#039;makeWatermark&#039;]; ?&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;span id=&quot;make_watermark&quot; style=&quot;display: none;&quot;&gt;
   &lt;table width=&quot;200&quot; align=&quot;center&quot;&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;?=$echo[&#039;text&#039;]; ?&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$echo[&#039;color&#039;]; ?&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$echo[&#039;size&#039;]; ?&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;watermark_text&quot; size=&quot;10&quot; value=&quot;[date]&quot;&gt;&lt;/td&gt;
   &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;textcolor&quot; maxlength=&quot;6&quot; size=&quot;3&quot; value=&quot;FFFFFF&quot;&gt;&lt;/td&gt;
   &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;textsize&quot; maxlength=&quot;2&quot; size=&quot;1&quot; value=&quot;12&quot;&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;?=$echo[&#039;position&#039;]; ?&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$echo[&#039;font&#039;]; ?&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;1&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;2&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;3&quot;&gt;&lt;br /&gt;
   &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;4&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;5&quot; checked&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;6&quot;&gt;&lt;br /&gt;
   &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;7&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;8&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot1&quot; value=&quot;9&quot;&gt;&lt;/td&gt;
   &lt;td valign=&quot;top&quot;&gt;
   &lt;? if($fonts) { ?&gt;
   &lt;select name=&quot;watermark_font&quot;&gt;
   &lt;option value=&quot;none&quot;&gt;Select&lt;/option&gt;
   &lt;? foreach($fonts as $font) {
   echo &#039;&lt;option value=&quot;&#039;.$font.&#039;&quot;&gt;&#039;.$font.&#039;&lt;/option&gt;&#039;;
   }
   ?&gt;
   &lt;/select&gt;
   &lt;? } else {echo $echo[&#039;emptyFont&#039;];} ?&gt;
    &lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;br /&gt;&lt;/span&gt;
   
   &lt;label for=&quot;merge&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;merge&quot; id=&quot;merge&quot; onclick=&quot;javascript:ShowOrHide(&#039;make_merge&#039;)&quot;&lt;?=(!extension_loaded(&#039;gd&#039;) ? &#039; disabled&#039; : &#039;&#039;); ?&gt;&gt;&lt;?=$echo[&#039;makeMerge&#039;]; ?&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;span id=&quot;make_merge&quot; style=&quot;display: none;&quot;&gt;
   &lt;table width=&quot;200&quot; align=&quot;center&quot;&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;?=$echo[&#039;transition&#039;]; ?&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;merge_transition&quot; maxlength=&quot;2&quot; size=&quot;1&quot; value=&quot;40&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$echo[&#039;explanationTransition&#039;]; ?&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;?=$echo[&#039;position&#039;]; ?&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$echo[&#039;watermark&#039;]; ?&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td width=&quot;50%&quot;&gt;&lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;1&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;5&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;2&quot;&gt;&lt;br /&gt;
   &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;8&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;0&quot; checked&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;6&quot;&gt;&lt;br /&gt;
   &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;4&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;7&quot;&gt; &lt;input type=&quot;radio&quot; name=&quot;hotspot2&quot; value=&quot;3&quot;&gt;&lt;/td&gt;
   &lt;td width=&quot;50%&quot; valign=&quot;top&quot;&gt;
   &lt;? if($watermarks) { ?&gt;
   &lt;select onchange=&quot;showpreview(&#039;data/watermark/&#039;+this.options[this.selectedIndex].value, &#039;previewimage&#039;)&quot; name=&quot;watermark_image&quot;&gt;
   &lt;? foreach($watermarks as $watermark_image) {
   echo &#039;&lt;option value=&quot;&#039;.$watermark_image.&#039;&quot;&gt;&#039;.$watermark_image.&#039;&lt;/option&gt;&#039;;
   }
   ?&gt;
   &lt;/select&gt;&lt;br /&gt;
   &lt;img name=&quot;previewimage&quot; width=&quot;100px&quot; src=&quot;data/watermark/&lt;?=$watermarks[0]; ?&gt;&quot; align=&quot;left&quot; style=&quot;margin: 5px;&quot;&gt;
   &lt;? } 
   else { echo $echo[&#039;emptyWatermark&#039;]; }
   ?&gt;
   
    &lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;br /&gt;&lt;/span&gt;
   
      &lt;input type=&quot;submit&quot; value=&quot;&lt;?=$echo[&#039;upload&#039;]; ?&gt;&quot;&gt;
&lt;/table&gt;
&lt;/form&gt;

&lt;/td&gt;&lt;td&gt;
    
    &lt;span id=&quot;show_folders&quot; style=&quot;display: none;&quot;&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    function insert_folder(){
        myform = document.subfolder_form;
        if(myform.dropfolder.selectedIndex == 0){
            myform.selected_folder.disabled = true;
            myform.rename_folder.disabled = true;
            myform.delete_folder.disabled = true;
        }
        else{
            myform.selected_folder.disabled = false;
            myform.rename_folder.disabled = false;
            myform.delete_folder.disabled = false;
        }
        
        myform.selected_folder.value = myform.dropfolder.options[myform.dropfolder.selectedIndex].value;
        myform.old_folder.value = myform.dropfolder.options[myform.dropfolder.selectedIndex].value;
    }
    &lt;/script&gt;
    &lt;form method=&quot;post&quot; action=&quot;&quot;&gt;
   &lt;b&gt;&lt;?=$echo[&#039;newFolder&#039;]; ?&gt;&lt;/b&gt;&lt;br /&gt;
   &lt;input type=&quot;text&quot; name=&quot;new_folder&quot; /&gt;
   &lt;input type=&quot;submit&quot; value=&quot;&lt;?=$echo[&#039;submitNewFolder&#039;]; ?&gt;&quot; /&gt;
   &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;add_folder&quot; /&gt;
   &lt;/form&gt;
   
   &lt;br /&gt;&lt;b&gt;Edit&lt;/b&gt;&lt;br /&gt;
   &lt;form method=&quot;post&quot; name=&quot;subfolder_form&quot; action=&quot;&quot;&gt;
   &lt;?=makeDropDown(get_subfolders(), &#039;dropfolder&quot;  onChange=&quot;insert_folder();&#039;, $echo[&#039;baseFolder&#039;]); ?&gt;&lt;br /&gt;
   &lt;input type=&quot;text&quot; name=&quot;selected_folder&quot; value=&quot;&quot; disabled /&gt;
   &lt;input type=&quot;hidden&quot; name=&quot;old_folder&quot; value=&quot;&quot; /&gt;
   &lt;input type=&quot;submit&quot; id=&quot;rename_folder&quot; value=&quot;&lt;?=$echo[&#039;renameFolder&#039;]; ?&gt;&quot; disabled /&gt;
   &lt;input type=&quot;submit&quot; id=&quot;delete_folder&quot; value=&quot;&lt;?=$echo[&#039;deleteFolder&#039;]; ?&gt;&quot; onclick=&quot;confirmDelete(&#039;&lt;?=$PHP_SELF; ?&gt;&amp;action=delete_folder&#039;)&quot; disabled /&gt;
   &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;rename_subfolders&quot; /&gt;
   &lt;/form&gt;
    &lt;/span&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;br /&gt;&lt;br /&gt;

&lt;? if($area) { ?&gt;
&lt;table width=&quot;200&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;?=$echo[&#039;align&#039;]; ?&gt;: &lt;select onchange=&quot;window.location=this.options[this.selectedIndex].value&quot;&gt;
&lt;option value=&quot;&lt;?=$config_http_script_dir.&#039;/index.php?mod=images&amp;area=&#039;.$_GET[&#039;area&#039;].&#039;&amp;sortby=&#039;.$_GET[&#039;sortby&#039;].&#039;&amp;start_from=&#039;.$_GET[&#039;start_from&#039;].&#039;&amp;align=left&#039;; ?&gt;&quot; &lt;?=($_GET[&#039;align&#039;] == &#039;left&#039; ? &#039;selected&#039; : &#039;&#039;) ?&gt;&gt;&lt;?=$echo[&#039;alignLeft&#039;]; ?&gt;&lt;/option&gt;
&lt;option value=&quot;&lt;?=$config_http_script_dir.&#039;/index.php?mod=images&amp;area=&#039;.$_GET[&#039;area&#039;].&#039;&amp;sortby=&#039;.$_GET[&#039;sortby&#039;].&#039;&amp;start_from=&#039;.$_GET[&#039;start_from&#039;].&#039;&amp;align=right&#039;; ?&gt;&quot; &lt;?=(!$_GET[&#039;align&#039;] ? ($default_align == &#039;align=&quot;right&quot;&#039; ? &#039;selected&#039; : &#039;&#039;) : ($_GET[&#039;align&#039;] == &#039;right&#039; ? &#039;selected&#039; : &#039;&#039;)) ?&gt;&gt;&lt;?=$echo[&#039;alignRight&#039;]; ?&gt;&lt;/option&gt;
&lt;option value=&quot;&lt;?=$config_http_script_dir.&#039;/index.php?mod=images&amp;area=&#039;.$_GET[&#039;area&#039;].&#039;&amp;sortby=&#039;.$_GET[&#039;sortby&#039;].&#039;&amp;start_from=&#039;.$_GET[&#039;start_from&#039;].&#039;&amp;align=none&#039;; ?&gt;&quot; &lt;?=(!$_GET[&#039;align&#039;] ? ($default_align == &#039;&#039; ? &#039;selected&#039; : &#039;&#039;) : ($_GET[&#039;align&#039;] == &#039;none&#039; ? &#039;selected&#039; : &#039;&#039;)) ?&gt;&gt;&lt;?=$echo[&#039;alignNone&#039;]; ?&gt;&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;? } ?&gt;

&lt;table width=&quot;600&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;&lt;td&gt;
&lt;form method=&quot;post&quot; name=&quot;current_folder&quot; action=&quot;&quot;&gt;
&lt;?=$echo[&#039;selectFolder&#039;]; ?&gt;&lt;?=makeDropDown(get_subfolders(), &#039;subfolder&quot;  onChange=&quot;document.current_folder.submit();&#039;, ($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : ($_GET[&#039;subfolder&#039;] ? $_GET[&#039;subfolder&#039;] : &#039;Main&#039;))); ?&gt;
&lt;input type=&quot;hidden&quot; name=&quot;start_from&quot; value=&quot;&quot; /&gt;
&lt;/form&gt;
&lt;/tr&gt;&lt;/td&gt;


&lt;tr&gt;&lt;td&gt;&lt;?=(($_GET[&#039;sortby&#039;] == &quot;time&quot;) ? &quot;&lt;a href=&#039;&quot;.$config_http_script_dir.&quot;/index.php?mod=images&amp;area=&quot;.$_GET[&#039;area&#039;].&quot;&amp;sortby=name&amp;start_from=&quot;.$_GET[&#039;start_from&#039;].&quot;&amp;subfolder=&quot;.($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : $_GET[&#039;subfolder&#039;]).($area ? &#039;&amp;amp;align=&#039;.$_GET[&#039;align&#039;] : &#039;&#039;).&quot;&#039;&gt;&quot;.$echo[&#039;sortbyName&#039;].&quot;&lt;/a&gt;&quot; : &quot;&lt;a href=&#039;&quot;.$config_http_script_dir.&quot;/index.php?mod=images&amp;area=&quot;.$_GET[&#039;area&#039;].&quot;&amp;sortby=time&amp;start_from=&quot;.$_GET[&#039;start_from&#039;].&quot;&amp;subfolder=&quot;.($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : $_GET[&#039;subfolder&#039;]).($area ? &#039;&amp;amp;align=&#039;.$_GET[&#039;align&#039;] : &#039;&#039;).&quot;&#039;&gt;&quot;.$echo[&#039;sortbyTime&#039;].&quot;&lt;/a&gt;&quot;); ?&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;?
$handle = opendir($folder);
while ($file = readdir($handle)){
    if (in_array(strtolower(end(explode(&#039;.&#039;, $file))), $allowed_extensions) or in_array(strtolower(end(explode(&#039;.&#039;, $file))), $media_extensions)){
        $files[$file] = filemtime($folder.&#039;/&#039;.$file);
    }
}

if (count($files)){
(($_GET[&#039;sortby&#039;] == &quot;time&quot;) ? arsort($files) : ksort($files));

foreach ($files as $file =&gt; $time){
$all_images += filesize($folder.&#039;/&#039;.$file);
}

    $subfolder = end($dummy = explode(&quot;/&quot;, $folder));
    if($subfolder == &#039;upimages&#039; or $subfolder == $user){
        $subfolder = false;
    }
    
    $image_per_page = ($image_per_page ? $image_per_page : 21);
    $start_from = ($start_from ? $start_from : &#039;&#039;);
    $i = $start_from;
    $j = 0;
    foreach ($files as $file =&gt; $time){
    
    $info = array();
    $info_pic = array();
    
        if ($j &lt; $start_from){
            $j++;
            continue;
        }

        $i++;
        $total += filesize($folder.&#039;/&#039;.$file);
        
        if(!in_array(strtolower(end(explode(&#039;.&#039;, $file))), $media_extensions)){
        
            $info    = getimagesize($config_path_image_upload.(file_exists($folder.&#039;/thumbs/&#039;.$file) ? &#039;/thumbs/&#039; : &#039;/&#039;).$file);
            $info_pic = getimagesize($config_path_image_upload.&#039;/&#039;.$file);
        }

        if (file_exists($folder.&#039;/thumbs/&#039;.$file)){
            if($popup){
                $insert = &#039;&lt;a href=&quot;javascript:popupMedia(\\\&#039;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).$file.&#039;\\\&#039;, \\\&#039;&#039;.$info_pic[0].&#039;\\\&#039;, \\\&#039;&#039;.$info_pic[1].&#039;\\\&#039;)&quot;&gt;&lt;img &#039;.($_GET[&#039;align&#039;] == &#039;left&#039; ? &#039;align=&quot;left&quot;&#039; : ($_GET[&#039;align&#039;] == &#039;right&#039; ? &#039;align=&quot;right&quot;&#039; : ($_GET[&#039;align&#039;] == &#039;none&#039; ? &#039;&#039; : $default_align))).&#039; src=&quot;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).&#039;thumbs/&#039;.$file.&#039;&quot; alt=&quot;&#039;.$file.&#039;&quot; border=&quot;0&quot; &#039;.$info[3].&#039; /&gt;&lt;/a&gt;&#039;;
            }
            else{
                $insert = &#039;&lt;a target=&quot;_blank&quot; href=&quot;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).$file.&#039;&quot;&gt;&lt;img &#039;.($_GET[&#039;align&#039;] == &#039;left&#039; ? &#039;align=&quot;left&quot;&#039; : ($_GET[&#039;align&#039;] == &#039;right&#039; ? &#039;align=&quot;right&quot;&#039; : ($_GET[&#039;align&#039;] == &#039;none&#039; ? &#039;&#039; : $default_align))).&#039; src=&quot;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).&#039;thumbs/&#039;.$file.&#039;&quot; alt=&quot;&#039;.$file.&#039;&quot; border=&quot;0&quot; &#039;.$info[3].&#039; /&gt;&lt;/a&gt;&#039;;
            }
        } 
        
        else {
            $insert = &#039;&lt;img &#039;.($_GET[&#039;align&#039;] == &#039;left&#039; ? &#039;align=&quot;left&quot;&#039; : ($_GET[&#039;align&#039;] == &#039;right&#039; ? &#039;align=&quot;right&quot;&#039; : ($_GET[&#039;align&#039;] == &#039;none&#039; ? &#039;&#039; : $default_align))).&#039; src=&quot;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).$file.&#039;&quot; alt=&quot;&#039;.$file.&#039;&quot; border=&quot;0&quot; &#039;.$info[3].&#039; /&gt;&#039;;
            
            $media_embed = &#039;&lt;OBJECT id=&quot;VIDEO&quot; width=&quot;&#039;.$settings -&gt; settings[&#039;video_width&#039;].
                            &#039;&quot; height=&quot;&#039;.$settings -&gt; settings[&#039;video_height&#039;].&#039;&quot; &#039;.
                            &#039;CLASSID=&quot;CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6&quot; type=&quot;application/x-oleobject&quot;&gt; &#039;.
                            &#039;&lt;PARAM NAME=&quot;URL&quot; VALUE=&quot;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).
                            ($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).$file.&#039;&quot;&gt; &#039;.
                            &#039;&lt;PARAM NAME=&quot;AutoStart&quot; VALUE=&quot;&#039;.($settings -&gt; settings[&#039;auto_start&#039;] == &#039;yes&#039; ? &#039;True&#039; : &#039;False&#039;).&#039;&quot;&gt; &#039;.
                            &#039;&lt;PARAM NAME=&quot;uiMode&quot; VALUE=&quot;&#039;.$settings -&gt; settings[&#039;uimode&#039;].&#039;&quot;&gt;&lt;/OBJECT&gt;&#039;;
                            
            $media_download = &#039;&lt;a href=&quot;{imagepath}/&#039;.($user ? $user.&#039;/&#039; : &#039;&#039;).
                            ($subfolder ? &#039;subfolders/&#039;.$subfolder.&#039;/&#039; : &#039;&#039;).$file.&#039;&quot;&gt;Download this video.&lt;/a&gt;&#039;;
            
        }

        if(in_array(strtolower(end(explode(&#039;.&#039;, $file))), $allowed_extensions)){
            $insert = ($area ? &#039;&lt;a &#039;.(file_exists($folder.&#039;/thumbs/&#039;.$file) ? &#039;title=&quot;&#039;.sprintf($echo[&#039;insertThumbTitle&#039;], $area).&#039;&quot;&#039; : &#039;title=&quot;&#039;.sprintf($echo[&#039;insertImageTitle&#039;], $area).&#039;&quot;&#039;).&#039;href=&quot;javascript:insertimage(\&#039;&#039;.htmlspecialchars($insert).&#039;\&#039;)&quot;&gt;&#039;.$echo[&#039;insert&#039;].&#039;&lt;/a&gt;&#039; : &#039;&amp;nbsp;&#039;);
        }
        elseif(in_array(strtolower(end(explode(&#039;.&#039;, $file))), $media_extensions)){
            $insert = ($area ? &#039;&lt;a href=&quot;javascript:insertimage(\&#039;&#039;.htmlspecialchars($media_embed).&#039;\&#039;)&quot;&gt;&#039;.$echo[&#039;embed&#039;].&#039;&lt;/a&gt;&#039; : &#039;&amp;nbsp;&#039;);
            $insert .= ($area ? &#039;&lt;br /&gt;&lt;a href=&quot;javascript:insertimage(\&#039;&#039;.htmlspecialchars($media_download).&#039;\&#039;)&quot;&gt;&#039;.$echo[&#039;insertLink&#039;].&#039;&lt;/a&gt;&#039; : &#039;&amp;nbsp;&#039;);
        }
?&gt;

 &lt;tr &lt;?=cute_that(); ?&gt; align=&quot;center&quot;&gt;
 
 &lt;? if(in_array(strtolower(end(explode(&#039;.&#039;, $file))), $media_extensions)){ ?&gt;
    &lt;td&gt;&lt;?=$echo[&#039;mediaFile&#039;]; ?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?=$file; ?&gt;&lt;/td&gt;
 &lt;?
 }
 else{ ?&gt;
 
 &lt;td&gt;&lt;?=(file_exists($folder.&#039;/thumbs/&#039;.$file) ? &#039;&lt;a target=&quot;_blank&quot; title=&quot;&#039;.$echo[&#039;thumbTitle&#039;].&#039;&quot; href=&quot;&#039;.$config_path_image_upload.&#039;/thumbs/&#039;.$file.&#039;&quot;&gt;&lt;img src=&quot;&#039;.$config_path_image_upload.&#039;/thumbs/&#039;.$file.&#039;&quot; height=&quot;50px&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&#039; : &#039;&lt;img src=&quot;&#039;.$config_path_image_upload.&#039;/&#039;.$file.&#039;&quot; height=&quot;50px&quot;&gt;&#039;); ?&gt;
  &lt;td height=&quot;17&quot;&gt;&lt;a target=&quot;_blank&quot; title=&quot;&lt;?=$echo[&#039;imageTitle&#039;]; ?&gt;&quot; href=&quot;&lt;?=$config_path_image_upload.&#039;/&#039;.$file; ?&gt;&quot;&gt;&lt;?=$file; ?&gt;&lt;/a&gt;
  
  &lt;? } ?&gt;
  &lt;?

if($area == &#039;avatar&#039;){

         $insert = &#039;&lt;a href=&quot;javascript:insertimage(\&#039;&#039;.htmlspecialchars($config_path_image_upload.&#039;/&#039;.$file).&#039;\&#039;)&quot;&gt;Insert as avatar&lt;/a&gt;&#039;;

      }?&gt;
  &lt;?=($area ? &#039;&lt;td&gt;&#039;.$insert : &#039;&#039;); ?&gt;
  &lt;td&gt;&lt;a href=&quot;?mod=images&amp;amp;action=rename&lt;?=($_POST[&#039;subfolder&#039;] ? &#039;&amp;amp;subfolder=&#039;.$_POST[&#039;subfolder&#039;] : ($_GET[&#039;subfolder&#039;] ? &#039;&amp;amp;subfolder=&#039;.$_GET[&#039;subfolder&#039;] : &#039;&#039;)); ?&gt;&amp;amp;image=&lt;?=$file.$query_string; ?&gt;&quot; onclick=&quot;if (ren=window.prompt(&#039;&#039;, &#039;&lt;?=$file; ?&gt;&#039;)){window.location.href=this.href+&#039;&amp;name=&#039;+ren;}return false;&quot;&gt;&lt;?=$echo[&#039;rename&#039;]; ?&gt;&lt;/a&gt;
  &lt;td&gt;&lt;a href=&quot;javascript:confirmDelete(&#039;?mod=images&amp;amp;action=remove&lt;?=($_POST[&#039;subfolder&#039;] ? &#039;&amp;amp;subfolder=&#039;.$_POST[&#039;subfolder&#039;] : ($_GET[&#039;subfolder&#039;] ? &#039;&amp;amp;subfolder=&#039;.$_GET[&#039;subfolder&#039;] : &#039;&#039;)); ?&gt;&amp;amp;image=&lt;?=$file.$query_string; ?&gt;&#039;)&quot;&gt;&lt;?=$echo[&#039;remove&#039;]; ?&gt;&lt;/a&gt;
  
  &lt;? if(!$area){ ?&gt;
  &lt;td&gt;&lt;?=$echo[&#039;moveTo&#039;]; ?&gt;&lt;br /&gt;
  &lt;form method=&quot;post&quot; name=&quot;move_file_form_&lt;?=$i; ?&gt;&quot; action=&quot;&quot;&gt;
  &lt;?=makeDropDown(get_subfolders(), &#039;new_path&quot;  onChange=&quot;document.move_file_form_&#039;.$i.&#039;.submit();&#039;, ($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : ($_GET[&#039;subfolder&#039;] ? $_GET[&#039;subfolder&#039;] : $echo[&#039;baseFolder&#039;]))); ?&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;move_file&quot; /&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;image&quot; value=&quot;&lt;?=$file; ?&gt;&quot; /&gt;
  &lt;? if(!$_GET[&#039;subfolder&#039;] or $_GET[&#039;subfolder&#039;] == &#039;&#039;){ ?&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;subfolder&quot; value=&quot;&lt;?=$subfolder; ?&gt;&quot; /&gt;
  &lt;? } ?&gt;
  &lt;/form&gt;
  &lt;? } ?&gt;
  
  &lt;td&gt;&lt;?=$info[0]?&gt;x&lt;?=$info[1]?&gt; &lt;?=formatsize(filesize($folder.&#039;/&#039;.$file)); ?&gt;

&lt;?
        if ($i &gt;= $image_per_page + $start_from){
            break;
        }
    }

    if ($start_from &gt; 0){
        $previous = $start_from - $image_per_page;
        $npp_nav .= &#039;&lt;a href=&quot;&#039;.$PHP_SELF.&#039;&amp;amp;start_from=&#039;.$previous.&#039;&amp;amp;subfolder=&#039;.($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : $_GET[&#039;subfolder&#039;]).($_GET[&#039;area&#039;] ? &#039;&amp;amp;area=&#039;.$_GET[&#039;area&#039;].&#039;&amp;amp;align=&#039;.$_GET[&#039;align&#039;] : &#039;&#039;).&#039;&quot;&gt;&amp;lt;&amp;lt;&lt;/a&gt;&#039;;
    }

    if (count($files) &gt; $image_per_page){
        $npp_nav .= &#039; [ &#039;;
        $enpages_count = @ceil(count($files) / $image_per_page);
        $enpages_start_from = 0;
        $enpages = &#039;&#039;;

        for ($j = 1; $j &lt;= $enpages_count; $j++){
            if ($enpages_start_from != $start_from){
                $enpages .= &#039;&lt;a href=&quot;&#039;.$PHP_SELF.&#039;&amp;amp;start_from=&#039;.$enpages_start_from.&#039;&amp;amp;subfolder=&#039;.($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : $_GET[&#039;subfolder&#039;]).($_GET[&#039;area&#039;] ? &#039;&amp;amp;area=&#039;.$_GET[&#039;area&#039;].&#039;&amp;amp;align=&#039;.$_GET[&#039;align&#039;] : &#039;&#039;).&#039;&quot;&gt;&#039;.$j.&#039;&lt;/a&gt; &#039;;
            } else {
                $enpages .= &#039; &lt;b&gt; &lt;u&gt;&#039;.$j.&#039;&lt;/u&gt; &lt;/b&gt; &#039;;
            }

            $enpages_start_from += $image_per_page;
        }

        $npp_nav .= $enpages;
        $npp_nav .= &#039; ] &#039;;
    }

    if (count($files) &gt; $i){
        $npp_nav .= &#039;&lt;a href=&quot;&#039;.$PHP_SELF.&#039;&amp;amp;start_from=&#039;.$i.&#039;&amp;amp;subfolder=&#039;.($_POST[&#039;subfolder&#039;] ? $_POST[&#039;subfolder&#039;] : $_GET[&#039;subfolder&#039;]).($_GET[&#039;area&#039;] ? &#039;&amp;amp;area=&#039;.$_GET[&#039;area&#039;].&#039;&amp;amp;align=&#039;.$_GET[&#039;align&#039;] : &#039;&#039;).&#039;&quot;&gt;&amp;gt;&amp;gt;&lt;/a&gt;&#039;;
    }
?&gt;

&lt;tr&gt;
 &lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;?=$npp_nav; ?&gt;
 &lt;td align=&quot;right&quot; colspan=&quot;5&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;?=sprintf($echo[&#039;total&#039;], formatsize($total)); 

if (count($files) &gt; $image_per_page){
    echo &#039;&lt;tr&gt;&lt;td align=&quot;right&quot; colspan=&quot;6&quot;&gt;&#039;.sprintf($echo[&#039;allimages&#039;], formatsize($all_images));
}
?&gt;

&lt;/table&gt;

&lt;?
}

if (!$area){
    echofooter();
}
/////////////////
//Function image resize
/////////////////
function img_resize($src, $dest, $new_size, $way) {

        $size = getimagesize($src);
        $img_width = $size[0];
        $img_height = $size[1];
        
        if(($img_width &gt; $new_size) or ($img_height &gt; $new_size)){
            //Keep dimensions
            if($way == &quot;normal&quot;){
                $ratio = $new_size/$img_width;
                $new_width = $new_size;
                $new_height = $img_height*$ratio;
                $off_w = 0;
                $off_h = 0;
            }
            //Crop
            else {
                if($img_width &gt; $img_height){
                    $new_width = $new_size;
                    $new_height = $new_size;
                    $off_w = ($img_width-$img_height)/2;
                    $off_h = 0;
                    $img_width = $img_height;
                }
                else if ($img_height &gt; $img_width){
                    $new_width = $new_size;
                    $new_height = $new_size;
                    $off_w = 0;
                    $off_h = ($img_height - $img_width)/2;
                    $img_height = $img_width;
                }
                else{
                    $new_width = $new_size;
                    $new_height = $new_size;
                    $off_w = 0;
                    $off_h = 0;
                }
            }
            
switch (strtolower(end(explode(&#039;.&#039;, $src))))
    {
        case &#039;gif&#039;:
            $im_in = @imagecreatefromgif($src);
            break;
        case &#039;jpg&#039;:
            $im_in = @imagecreatefromjpeg($src);
            break;
        case &#039;png&#039;:
            $im_in = @imagecreatefrompng($src);
            break;
    }

            $im_out = @imagecreatetruecolor($new_width, $new_height);

            @imagecopyresampled($im_out, $im_in, 0, 0, $off_w, $off_h, $new_width, $new_height, $img_width, $img_height);
        }
        
        else {
            @copy($src, $dest);
        }

switch (strtolower(end(explode(&#039;.&#039;, $src))))
    {
        case &#039;gif&#039;:
            @imagegif($im_out, $dest);
            break;
        case &#039;jpg&#039;:
            @imagejpeg($im_out, $dest);
            break;
        case &#039;png&#039;:
            @imagepng($im_out, $dest);
            break;
    }
}

///////////////////////////
//Function dropshadow
//Adds a dropshadow to the thumb
//Code taken from http://codewalkers.com/tutorials/83/1.html
//////////////////////////////////
function make_shadow($thumb_in) {

define(&quot;DS_OFFSET&quot;,     5);
define(&quot;DS_STEPS&quot;, 10);
define(&quot;DS_SPREAD&quot;, 1);

$background = array(&quot;r&quot; =&gt; 255, &quot;g&quot; =&gt; 255, &quot;b&quot; =&gt; 255);
list($o_width, $o_height) = getimagesize($thumb_in);

$width    = $o_width + DS_OFFSET;
$height = $o_height + DS_OFFSET;
$image_sh = @imagecreatetruecolor($width, $height);

$step_offset = array(&quot;r&quot; =&gt; ($background[&quot;r&quot;] / DS_STEPS), &quot;g&quot; =&gt; ($background[&quot;g&quot;] / DS_STEPS), &quot;b&quot; =&gt; ($background[&quot;b&quot;] / DS_STEPS));

$current_color = $background;
for ($i = 0; $i &lt;= DS_STEPS; $i++) {
    $colors[$i] = @imagecolorallocate($image_sh, round($current_color[&quot;r&quot;]), round($current_color[&quot;g&quot;]), round($current_color[&quot;b&quot;]));

    $current_color[&quot;r&quot;] -= $step_offset[&quot;r&quot;];
    $current_color[&quot;g&quot;] -= $step_offset[&quot;g&quot;];
    $current_color[&quot;b&quot;] -= $step_offset[&quot;b&quot;];
}
@imagefilledrectangle($image_sh, 0,0, $width, $height, $colors[0]);

for ($i = 0; $i &lt; count($colors); $i++) {
    @imagefilledrectangle($image_sh, DS_OFFSET, DS_OFFSET, $width, $height, $colors[$i]);
    $width -= DS_SPREAD;
    $height -= DS_SPREAD;
}

switch (strtolower(end(explode(&#039;.&#039;, $thumb_in))))
    {
        case &#039;gif&#039;:
            $original_image = imageCreateFromGIF($thumb_in);
            break;
        case &#039;jpg&#039;:
            $original_image = imageCreateFromJPEG($thumb_in);
            break;
        case &#039;png&#039;:
            $original_image = imageCreateFromPNG($thumb_in);
            break;
    }

  @imagecopymerge($image_sh, $original_image, 0,0, 0,0, $o_width, $o_height, 100);

switch (strtolower(end(explode(&#039;.&#039;, $thumb_in))))
    {
        case &#039;gif&#039;:
            @imagegif($image_sh, $thumb_in);
            break;
        case &#039;jpg&#039;:
            @imagejpeg($image_sh, $thumb_in);
            break;
        case &#039;png&#039;:
            @imagepng($image_sh, $thumb_in);
            break;
    }

}

/////////////////
//Function Watermark
//Code taken from http://edge.dev.box.sk/smsread.php?newsid=310
///////////////////
function add_watermark($thumb_in,$text=&quot;[date]&quot;,$hotspot=8,$rgbtext=&quot;FFFFFF&quot;,$font_size=12,$font=&quot;Arial.TTF&quot;,$datfmt=&quot;d-m-Y&quot;,$rgbtsdw=&quot;000000&quot;,$txp=15,$typ=5,$sxp=1,$syp=1) {

$suffx=substr($thumb_in,strlen($thumb_in)-4,4);
$suffx = strtolower($suffx);
if ($suffx==&quot;.jpg&quot; || $suffx==&quot;jpeg&quot; || $suffx==&quot;.png&quot; || $suffx==&quot;.gif&quot;) {
$text=str_replace(&quot;[date]&quot;,date($datfmt),$text);

if ($suffx==&quot;.jpg&quot; || $suffx==&quot;jpeg&quot;) {
$image=imagecreatefromjpeg($thumb_in);
}
if ($suffx==&quot;.png&quot;) {
$image=imagecreatefrompng($thumb_in);
}
if ($suffx == &quot;.gif&quot;) {
$image=imagecreatefromgif($thumb_in);
}

$rgbtext=HexDec($rgbtext);
$txtr=floor($rgbtext/pow(256,2));
$txtg=floor(($rgbtext%pow(256,2))/pow(256,1));
$txtb=floor((($rgbtext%pow(256,2))%pow(256,1))/pow(256,0));

$rgbtsdw=HexDec($rgbtsdw);
$tsdr=floor($rgbtsdw/pow(256,2));
$tsdg=floor(($rgbtsdw%pow(256,2))/pow(256,1));
$tsdb=floor((($rgbtsdw%pow(256,2))%pow(256,1))/pow(256,0));

$coltext = imagecolorallocate($image,$txtr,$txtg,$txtb);
$coltsdw = imagecolorallocate($image,$tsdr,$tsdg,$tsdb);

if ($hotspot!=0) {
$ix=imagesx($image); $iy=imagesy($image); $tsw=strlen($text)*$font_size/imagefontwidth($font)*3; $tsh=$font_size/imagefontheight($font);
switch ($hotspot) {
case 1:
$txp=$txp; $typ=$tsh*$tsh+imagefontheight($font)*2+$typ;
break;
case 2:
$txp=floor(($ix-$tsw)/2); $typ=$tsh*$tsh+imagefontheight($font)*2+$typ;
break;
case 3:
$txp=$ix-$tsw-$txp; $typ=$tsh*$tsh+imagefontheight($font)*2+$typ;
break;
case 4:
$txp=$txp; $typ=floor(($iy-$tsh)/2);
break;
case 5:
$txp=floor(($ix-$tsw)/2); $typ=floor(($iy-$tsh)/2);
break;
case 6:
$txp=$ix-$tsw-$txp; $typ=floor(($iy-$tsh)/2);
break;
case 7:
$txp=$txp; $typ=$iy-$tsh-$typ;
break;
case 8:
$txp=floor(($ix-$tsw)/2); $typ=$iy-$tsh-$typ;
break;
case 9:
$txp=$ix-$tsw-$txp; $typ=$iy-$tsh-$typ;
break;
}
}

ImageTTFText($image,$font_size,0,$txp+$sxp,$typ+$syp,$coltsdw,$font,$text);
ImageTTFText($image,$font_size,0,$txp,$typ,$coltext,$font,$text);

if ($suffx==&quot;.jpg&quot; || $suffx==&quot;jpeg&quot;) {
imagejpeg($image, $thumb_in);
}
if ($suffx==&quot;.png&quot;) {
imagepng($image, $thumb_in);
}
if ($suffx == &quot;.gif&quot;) {
imagegif($image, $thumb_in);
}
}
}
////////////////////
//Function mergePix
//Taken from http://de3.php.net/manual/de/function.imagecopymerge.php
///////////////////////
function mergePix($sourcefile,$insertfile, $targetfile, $pos=0,$transition=30)
{
//Get the resource id?s of the pictures 
switch (strtolower(end(explode(&#039;.&#039;, $sourcefile))))
    {
        case &#039;gif&#039;:
            $sourcefile_id = imageCreateFromGIF($sourcefile);
            break;
        case &#039;jpg&#039;:
            $sourcefile_id = imageCreateFromJPEG($sourcefile);
            break;
        case &#039;png&#039;:
            $sourcefile_id = imageCreateFromPNG($sourcefile);
            break;
    }
switch (strtolower(end(explode(&#039;.&#039;, $insertfile))))
    {
        case &#039;gif&#039;:
            $insertfile_id = imageCreateFromGIF($insertfile);
            break;
        case &#039;jpg&#039;:
            $insertfile_id = imageCreateFromJPEG($insertfile);
            break;
        case &#039;png&#039;:
            $insertfile_id = imageCreateFromPNG($insertfile);
            break;
    }

//Get the sizes of both pix
    $sourcefile_width=imageSX($sourcefile_id);
    $sourcefile_height=imageSY($sourcefile_id);
    $insertfile_width=imageSX($insertfile_id);
    $insertfile_height=imageSY($insertfile_id);

//middle
    if( $pos == 0 ) 
    { 
        $dest_x = ( $sourcefile_width / 2 ) - ( $insertfile_width / 2 );
        $dest_y = ( $sourcefile_height / 2 ) - ( $insertfile_height / 2 );
    }

//top left
        if( $pos == 1 )
        {
                $dest_x = 10;
                $dest_y = 10;
        }

//top right
        if( $pos == 2 )
        {
                $dest_x = $sourcefile_width - $insertfile_width - 10;
                $dest_y = 10;
        }

//bottom right
        if( $pos == 3 )
        {
                $dest_x = $sourcefile_width - $insertfile_width - 10;
                $dest_y = $sourcefile_height - $insertfile_height - 10;
        }

//bottom left
        if( $pos == 4 )
        {
                $dest_x = 10;
                $dest_y = $sourcefile_height - $insertfile_height - 10;
        }

//top middle
        if( $pos == 5 )
        {
                $dest_x = ( ( $sourcefile_width - $insertfile_width ) / 2 );
                $dest_y = 10;
        }

//middle right
        if( $pos == 6 )
        {
                $dest_x = $sourcefile_width - $insertfile_width - 10;
                $dest_y = ( $sourcefile_height / 2 ) - ( $insertfile_height / 2 );
        }

//bottom middle
        if( $pos == 7 )
        {
                $dest_x = ( ( $sourcefile_width - $insertfile_width ) / 2 );
                $dest_y = $sourcefile_height - $insertfile_height - 10;
        }

//middle left
        if( $pos == 8 )
        {
                $dest_x = 10;
                $dest_y = ( $sourcefile_height / 2 ) - ( $insertfile_height / 2 );
        }

//The main thing : merge the two pix
    imageCopyMerge($sourcefile_id, $insertfile_id,$dest_x,$dest_y,0,0,$insertfile_width,$insertfile_height,$transition);

//Create a jpeg/gif/png out of the modified picture 
switch (strtolower(end(explode(&#039;.&#039;, $sourcefile))))
    {
        case &#039;gif&#039;:
            imagegif ($sourcefile_id,&quot;$targetfile&quot;);
            break;
        case &#039;jpg&#039;:
            imagejpeg ($sourcefile_id,&quot;$targetfile&quot;);
            break;
        case &#039;png&#039;:
            imagepng ($sourcefile_id,&quot;$targetfile&quot;);
            break;
    }

}

function get_subfolders(){
global $base_folder, $echo;

$dir = opendir($base_folder.&#039;/subfolders&#039;);

$all_subfolders = array();
$all_subfolders[&#039;base&#039;] = $echo[&#039;baseFolder&#039;];
while ($subfolder = readdir($dir)){
    if (is_dir($base_folder.&#039;/subfolders&#039;) and $subfolder != &quot;.&quot; and $subfolder != &quot;..&quot; and $subfolder != &quot;thumbs&quot;){
        $all_subfolders[$subfolder] = &#039;- &#039;.$subfolder;
    }
}

return $all_subfolders;

}

function dir_is_empty($path){
$dir = opendir($path);
$i = 0;
    while ($files_in_subfolder = readdir($dir)) {
        if($files_in_subfolder != &quot;.&quot; and $files_in_subfolder != &quot;..&quot; and $files_in_subfolder != &quot;thumbs&quot; and $files_in_subfolder != &quot;.htaccess&quot;){
            $i++;
        }
    }
    if($i == 0) return true;
    else return false;
}

function update_stories($old, $new, $preg = false){
global $sql;

    foreach($sql-&gt;select(array(&#039;table&#039; =&gt; &#039;story&#039;)) as $row){
        
        if($preg){
            $sql-&gt;update(array(
                &#039;table&#039;     =&gt; &#039;story&#039;,
                &#039;where&#039;     =&gt; array(&quot;post_id = &quot;.$row[&#039;post_id&#039;]),
                &#039;values&#039; =&gt; array(
                                    &#039;short&#039; =&gt; preg_replace($old, $new, $row[&#039;short&#039;]),
                                    &#039;full&#039; =&gt; preg_replace($old, $new, $row[&#039;full&#039;])
                                    )
                ));
        }
        else{
            $sql-&gt;update(array(
                &#039;table&#039;     =&gt; &#039;story&#039;,
                &#039;where&#039;     =&gt; array(&quot;post_id = &quot;.$row[&#039;post_id&#039;]),
                &#039;values&#039; =&gt; array(
                                    &#039;short&#039; =&gt; str_replace($old, $new, $row[&#039;short&#039;]),
                                    &#039;full&#039; =&gt; str_replace($old, $new, $row[&#039;full&#039;])
                                    )
                ));
        }
    }
}
?&gt;</code></pre></div><p>سوپاس.</p>]]></description>
			<author><![CDATA[null@example.com (گه‌یلان)]]></author>
			<pubDate>Sun, 31 Jul 2011 21:38:18 +0000</pubDate>
			<guid>https://www.webchin.org/Meko/viewtopic.php?pid=201618#p201618</guid>
		</item>
	</channel>
</rss>
