Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Image Upload Center (DLE CMS)

Parašė PyccKuu· 2008 Gru. 11 15:12:03
#1

Laba diena , aš atsiunčiau moduli ant Datalife engine. štai čia išsamiau : http://english.datalifecms.ir/mo...imple.html

Nu va viskas veikia gerai. Bet uploadinti galima tik po vieną paveikslelį gal butu imanoma padariti kad pazymi kelis paveikslelius ir uploadini iskarto visus ...

Va kodas

<?php
// This Module Created By Mohammad Yekta (Mohammad.1ta@Gmail.Com)
// Datalife Engine v7.3
// DLE Site: Www.English.DatalifeCMS.IR
if(!defined('DATALIFEENGINE'))
{
  die("Hacking attempt!");
}

# Settings [Start]
$maxsize = 2000000; // Max File Size In Bytes
$accepted = array('png', 'jpg', 'jpeg','JPEG', 'gif', 'ico', 'tif', 'bmp'); // Accepted Extensions
$filedir = 'uploads/img/'; // Directory For Image Uploads + Must Be Permissioned To 777
# Settings [End]

# Image Upload Center Code [Start]
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    preg_match('/\.([a-zA-Z]+?)$/', $_FILES['file']['name'], $matches);
    if(in_array(strtolower($matches[1]), $accepted)) {
        if($_FILES['file']['size'] <= $maxsize) {
            $newname = md5_file($_FILES['file']['tmp_name']).'.'.$matches[1];
            move_uploaded_file($_FILES['file']['tmp_name'], $filedir.'/'.$newname);
            $linkurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'#'.$newname;
            $imgurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).$filedir.'/'.$newname;

        } else
            print '<p>Atsipra&#353;ome, maksimalus leistinas failo dydis: 2 Mb.</p>';
    } else
        print '<p>Atsipra&#353;ome, failas nerasas.</p>';



$uploadimage2  = <<<HTML
<center>
<font style="font-family: tahoma; font-size: 11px;">Failas buvo s&#279;kmingai &#303;keltas!</font>
<p id="codes">
<a href="$imgurl" target="_blank"><img style="border: 3px solid #cccccc;" src="$imgurl" height="300" alt="Uploaded Image" ></a><BR><BR>
<table align=center border="0" cellspacing="0" cellpadding="0"><tr>
<td height="25" width="100" align=left>BBCode:</td>
<td align=left><input class="f_input" style="font-family: tahoma; height: 20px;" type="text" dir=ltr value="[IMG]{$imgurl}[/IMG]" onclick="javascript:this.focus();this.select();" readonly="true" /></td>
</tr><tr>
<td height="25" align=left>HTML:</td>
<td align=left><input class="f_input" style="font-family: tahoma; height: 20px;" type="text" dir=ltr value='&lt;img src="{$imgurl}"&gt;' onclick="javascript:this.focus();this.select();" readonly="true" /></td>
</tr><tr>
<td height="25" align=left>Direct:</td>
<td align=left><input class="f_input" style="font-family: tahoma; height: 20px;" type="text" dir=ltr value="$imgurl" onclick="javascript:this.focus();this.select();" readonly="true" /></td>
</tr></table>
</center>
HTML;

$tpl->load_template('static.tpl');
$tpl->set('{description}','Uploaded');
$tpl->set('{static}',$uploadimage2);
$tpl->set('&#1578;&#1593;&#1583;&#1575;&#1583;','');
$tpl->set('&#1576;&#1575;&#1586;&#1583;&#1610;&#1583;&#1607;&#1575;:','');
$tpl->set('&#1576;&#1575;&#1586;&#1583;&#1610;&#1583;:','');
$tpl->set('[{views}]','');
$tpl->set('[ {views} ]','');
$tpl->set('({views})','');
$tpl->set('( {views} )','');
$tpl->set('{views}','');
$tpl->set('{pages}','');
$tpl->compile('content');
$tpl->clear();



}
# Image Upload Center Code [End]

# Uploaded Image [Start]

# Uploaded Image [End]

# Image Upload Center Main [Start]
$uploadimage  = <<<HTML
<center><form enctype="multipart/form-data" action="pagrindinis.php?do=uploadimage" method="post">
(Maksimalus leistinas failo dydis: 2 Mb)<BR><BR>
<label for="file">Failas: </label><input class="f_input" style="font-family: tahoma; height: 20px;" type="file" name="file" id="file" /><br><br>
<input name="submit" type="submit" class=bbcodes value="Pirmyn" />
</form></center>
HTML;
# Image Upload Center Main [End]

$tpl->load_template('static.tpl');
$tpl->set('{description}','Ikelti paveiksl&#279;l&#303;');
$tpl->set('{static}',$uploadimage);
$tpl->set('&#1578;&#1593;&#1583;&#1575;&#1583;','');
$tpl->set('&#1576;&#1575;&#1586;&#1583;&#1610;&#1583;&#1607;&#1575;:','');
$tpl->set('&#1576;&#1575;&#1586;&#1583;&#1610;&#1583;:','');
$tpl->set('[{views}]','');
$tpl->set('[ {views} ]','');
$tpl->set('({views})','');
$tpl->set('( {views} )','');
$tpl->set('{views}','');
$tpl->set('{pages}','');

$tpl->compile('content');
$tpl->clear();
?>




Manau šitoje vietoje reikia redaguoti

<label for="file">Failas: </label><input class="f_input" style="font-family: tahoma; height: 20px;" type="file" name="file" id="file" /><br><br>



Redagavo PyccKuu· 2008 Gru. 11 15:12:37