Smarty ile hazırladığım sistemde bir sayfa içinde yazdığım function yine aynı sayfada bulunamıyor.
Unknow Function list_media_image diye hata alıyorum çok saçma geliyor.
content_edit.php kodları
<?php
################## YETKİ KONTROLÜ ####################
if ($User->check_login()!=1) {
header("Location: index.php?do=Notice&num=403");
exit(); }
$id = $_GET[id];
if (empty($id)) {
$id = $_POST[id];
}
if (empty($id)) {
foreach ( $_POST[checkid] as $id ) {
$ContentData = $db->get_row("select * from tbl_products where contentid = $id");
$id = $ContentData->contentid;
} } else {
$ContentData = $db->get_row("select * from tbl_products where contentid = $id");
$id = $ContentData->contentid;
}
require_once('libary/class_language.php');
require_once('libary/class_products.php');
$Content = new Products();
$Language = new Language();
################## AJAX BALANGICI ####################
$xajax = new xajaxExtend;
$xajax->waitCursorOff();
################## AJAX FONKSİYONLARI ####################
if ($_POST['edit']) {
$Seo = new Seo();
foreach ($_POST['langid'] as $LanguageId) {
$Lid[]= $LanguageId;
}
if ($category!=0) {
$CatName = $Content->categoryName($_POST[category]);
$sefurlFirst = $Seo->seo_cevir($CatName).'/';
}
if (!empty($Lid[0]) ) {
$LanguageData = $db->get_row("select * from tbl_languages where id = $Lid[0]");
$sefurl = $sefurlFirst.$Seo->seo_cevir($_POST['title'.$LanguageData->languagecode]);
$db->query("update tbl_products set ".
"catid = '".$_POST[category]."',
title = '".addslashes($_POST['title'.$LanguageData->languagecode])."',
title2 = '".addslashes($_POST['title2'.$LanguageData->languagecode])."',
content = '".addslashes($_POST['data'.$LanguageData->languagecode])."',
prodcode = '".addslashes($_POST['prodcode'])."',
certs = '".$certs."',
".$renamed_file." ".$file_2."
sefurl = '$sefurl',
seotitle = '".addslashes($_POST['seotitle'])."',
seometa = '".addslashes($_POST['seometa'])."',
seokeyword = '".addslashes($_POST['seokeyword'])."' where contentid='$id' and langid = '".$Lid[0]."' ");
$db->query("delete from tbl_seo_map where sourceurl = 'index.php?do=Products&id=$id'");
$db->query("insert into tbl_seo_map VALUES (NULL,'$sefurl','index.php?do=Products&id=$id','Ürün - ".addslashes($_POST['title'.$LanguageData->languagecode])."','products')");
for ($i = 1; $i <= count($Lid); $i++) {
$sefurl = $sefurlFirst.$Seo->seo_cevir($_POST['title'.$LanguageData->languagecode]);
if (!empty($Lid[$i])) {
$LanguageData = $db->get_row("select * from tbl_languages where id = $Lid[$i]");
$db->query("update tbl_products set ".
"catid = '".$_POST[category]."',
title = '".addslashes($_POST['title'.$LanguageData->languagecode])."',
title2 = '".addslashes($_POST['title2'.$LanguageData->languagecode])."',
content = '".addslashes($_POST['data'.$LanguageData->languagecode])."',
prodcode = '".addslashes($_POST['prodcode'])."',
certs = '".$certs."',
".$renamed_file." ".$file_2."
sefurl = '$sefurl',
seotitle = '".addslashes($_POST['seotitle'])."',
seometa = '".addslashes($_POST['seometa'])."',
seokeyword = '".addslashes($_POST['seokeyword'])."' where contentid='$id' and langid = '".$Lid[$i]."' ");
}
}
unset($Lid);
printmessage('İşleminiz Tamamlandı','Ürün Bilgileri başarılı bir şekilde güncellendi.','index.php?do=Products','');
}
}
[COLOR="Red"]function list_media_images($processid) {
global $db,$config;
$query = $db->get_results("select * from tbl_prod_images where prodid='0' and timestamp < ".(mktime()-3600)." ");
if (count($query)>0) {
foreach ($query as $tempimg) {
$exp_fn_d = explode('.',$tempimg->data);
$exp_fn_d[0] = str_replace('.','',$exp_fn_d[0]);
@unlink(ROOT_PATH."media/products/".$tempimg->data);
@unlink(ROOT_PATH."media/products/thumbnail/".$tempimg->data);
$db->query("delete from tbl_prod_images where id = $tempimg->id");
}
}
$objResponse = new xajaxResponse();
$query = $db->get_results("select * from tbl_prod_images where processid='$processid'");
if (count($query)>0) {
foreach ($query as $data) {
$image = '<a href="'.$config[siteurl].'media/products/'.$data->data.'" id="mediaitem"><img src="'.$config[siteurl].'media/products/thumbnail/'.$data->data.'" width="85" height="85" align="center" border="0"/></a>';
$list.='
<tr>
<td class="list_item" width="20%" align="center">'.$image.'</td>
<td class="list_item" width="70%">'.$data->data.'</td>
<td class="list_item" width="10%"><a href="javascript:delete_media('.$data->id.')"><img src="templates/v4_1/images/misc/delete.gif" width="16" height="16" border="0" title="Sil"> </a></td>
</tr>';
}
}
$rtn ='
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="list_title" width="20%">Önizleme</td>
<td class="list_title" width="70%">Dosya Adı</td>
<td class="list_title" width="10%"></td>
</tr>';
$rtn.=$list;
$rtn.='
<tr>
<td class="list_item_blue" width="20%">Resim Ekle</td>
<td class="list_item_blue" width="70%">
<div id="upload_err" class="alert" style="display:none">Hata: Eklemeye çalıştığınız dosya bir resim dosyası değil veya dosya adı çok uzun</div>
<div id="media_loading" style="display:none"><img src="templates/v4_1/images/misc/media_loading.gif" width="16" height="16" align="left" /> Dosyanız Gönderiliyor Lütfen Bekleyiniz...</div>
<div id="upload_inp">
<input name="mediaupload" type="file" id="mediaupload" />
<input name="Submit" type="submit" id="Submit" class="frm_button" style="font-family: Arial; font-size: 8pt; font-weight: bold" value="EKLE >" onclick="document.getElementById(\'act\').value= \'addmedia\';"/>
</div>
</td>
<td class="list_item_blue" width="10%"></td>
</tr>';
$rtn.='</table>';
$objResponse->addAssign("media_div","innerHTML",$rtn);
return $objResponse;
}[/COLOR]
function set_file_name($nama) {
$path_parts = pathinfo($nama);
$uzanti=$path_parts['extension'];
$name =strtotime("now");
sleep(3);
return $name.'.'.$uzanti;
}
$cfg[orginal_photo_dir] = ROOT_PATH.'media/products/';
$cfg[thumb_photo_dir] = ROOT_PATH.'media/products/thumbnail/';
function write_scaled_thumb($img_file,$width,$height)
{ global $cfg;
$img_path = pathinfo($img_file);
$img_size = getimagesize($img_file);
$img_ratio = $img_size[1]/$img_size[0];
$widtht = ($height/$img_size[1])*$img_size[0];
if($widtht>150){$widthtt=150;}else{$widthtt=$widtht;}
$heightt = $height;
switch($img_path[extension])
{
case 'jpeg':
case 'jpg':
case 'jpe':
$imgsrc = imagecreatefromjpeg($img_file);
break;
case '':
printmessage('Hata','"Secilen Dosya resim deÄŸil.."','index.php?do=Products','');
exit;
break;
case 'bmp':
printmessage('Hata','"Bmp Sorunu"','index.php?do=Products','');
exit;
break;
case 'gif':
if(!function_exists('imagecreatefromgif'))
{
printmessage('Hata','"Gif Sorunu"','index.php?do=Products','');
exit;
}
else
$imgsrc = imagecreatefromgif($img_file);
break;
case 'png':
$imgsrc = imagecreatefrompng($img_file);
break;
default:
$imgsrc = imagecreatefromjpeg($img_file);
break;
}
$imgdst = imagecreatetruecolor($widthtt,$heightt);
imagecopyresampled ( $imgdst,$imgsrc,0, 0, 0, 0, $widthtt, $heightt, $img_size[0], $img_size[1]);
imagejpeg($imgdst,"$cfg[thumb_photo_dir]/$img_path[basename]",70);
return true;
}
function resimekle($data) {
global $db,$config,$cfg;
$uploaddir = $cfg[orginal_photo_dir];
$renamed_files = eregi_replace(' ','_',$_FILES['mediaupload']['name']);
$renamed_file=set_file_name($renamed_files);
$objResponse = new xajaxResponse();
if (!empty($data[id])) {
$id = $data[id];
if($_FILES['mediaupload']){
move_uploaded_file($_FILES['mediaupload']['tmp_name'], $uploaddir . $renamed_file);
if(write_scaled_thumb($uploaddir . $renamed_file,113,150)){$upload='true';} else{$upload='false';}
}
}
if ($upload=='true') {
$db->query("insert into tbl_prod_images VALUES (NULL,
'$id','$renamed_file','$sessionID','".mktime()."')");
$objResponse->addScript("xajax_list_media_images('".$id."');");
$objResponse->addScript("document.getElementById('media_loading').style.display = 'none';");
$objResponse->addScript("document.getElementById('upload_err').style.display = 'none';");
$objResponse->addScript("document.getElementById('upload_inp').style.display = 'block';");
$objResponse->addScript("document.getElementById('mediaupload').value = '';");
$objResponse->addScript("document.getElementById('act').value = '';");
} else {
$objResponse->addScript("document.getElementById('media_loading').style.display = 'none';");
$objResponse->addScript("document.getElementById('upload_err').style.display = 'block';");
$objResponse->addScript("document.getElementById('upload_inp').style.display = 'block';");
$objResponse->addScript("document.getElementById('mediaupload').value = '';");
$objResponse->addScript("document.getElementById('act').value = '';");
}
return $objResponse;
}
function delete_image($id,$processid) {
global $db;
$data = $db->get_row("select * from tbl_prod_images where id = '$id' and prodid = '$processid' ");
$exp_fn_d = explode('.',$data->data);
$exp_fn_d[0] = str_replace('.','',$exp_fn_d[0]);
@unlink(ROOT_PATH."media/products/".$data->data);
@unlink(ROOT_PATH."media/products/thumbnail/".$exp_fn_d[0]."-thumb.".$exp_fn_d[1]);
$db->query("delete from tbl_prod_images where id = '$id' and prodid = '$processid' ");
$objResponse = new xajaxResponse();
$objResponse->addScript("xajax_list_media_images('".$processid."');");
return $objResponse;
}
################## AJAX FONKSİYONLARININ TANIMLANMASI ####################
$xajax = new xajaxExtend;
$xajax->waitCursorOff();
$xajax->registerFunction('addFormSave');
$xajax->registerFunction('resimekle');
$xajax->registerFunction('list_media_images');
$xajax->registerFunction('delete_image');
$xajax->decodeUTF8InputOn();
$xajax->processRequests();
################## SMARTY PARAMETRELERİ ####################
$skin = new Smarty();
$skin->caching = false;
$skin->template_dir=ADMIN_PATH.'/templates/'.$config['AdminTheme'].'/';
$skin->compile_dir=ROOT_PATH.'_c/';
################## SMARTY inc/glob_sm_vars.php ####################
require_once('libary/sm_vars.php');
################## SAYFAYA ÖZGÜ SMARTY PARAMETRELERİ ###############
$lang = $db->get_results("select id,title,languagecode from tbl_languages order by defLang desc");
if (count($lang)>0) {
$js = '<script type="text/javascript">
function tabs_select(id) {
var tabs = '.(count($lang)-1).';
for (i=0;i<=tabs;i++)
{
if (id!=i) {
document.getElementById(\'tab_\'+i).className = \'passive_tabs\';
document.getElementById(\'content_\'+i).style.display = \'none\';
} else {
document.getElementById(\'tab_\'+i).className = \'selected_tabs\';
document.getElementById(\'content_\'+i).style.display = \'block\';
}}
}
</script>';
$i=0;
$tab = '<div id="tabs"><ul>';
foreach ($lang as $ldata) {
$tab.='<li><a href="javascript:tabs_select(\''.$i.'\');" onFocus="blur();" onclick="document.getElementById(\'content_'.$i.'\').style.display=\'block\';">
<span class="selected_tabs" id="tab_'.$i.'">'.stripslashes($ldata->title).' Ürün Detayları</span></a></li>';
$ContentLangQuery = $db->get_row("select * from tbl_products where contentid = $id and langid = $ldata->id");
$convlang.='
<div id="content_'.$i.'" style="display:none;" class="tab_container"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="NodeItem"><strong>'.stripslashes($ldata->title).' Ürün Adı</strong><br>Sayfanın '.stripslashes($ldata->title).' dil seçeneği seçildiğinde gözükecek Ürün adını yazınız.</td>
<td width="50%" class="NodeItem"><input name="title'.$ldata->languagecode.'" type="text" class="input" value="'.stripslashes($ContentLangQuery->title).'"/>
<input type="hidden" name="langid[]" value="'.$ldata->id.'"></td>
</tr>
<tr>
<td width="50%" class="NodeItem"><strong>'.stripslashes($ldata->title).' İkinci Ürün Adı</strong><br>Eğer var ise ürüne ait ikinci adı yazabilirsiniz.</td>
<td width="50%" class="NodeItem"><input name="title2'.$ldata->languagecode.'" type="text" class="input" value="'.stripslashes($ContentLangQuery->title2).'"/>
</tr>
<tr>
<td colspan="2" align="left" class="NodeTitle">'.stripslashes($ldata->title).' Ürün Detayları</td>
</tr>
<tr>
<td colspan="2" class="NodeInfo">'.stripslashes($ldata->title).' dil seçeneği seçildiğinde gözükecek içeriği giriniz.</td>
</tr>
<tr>
<td colspan="2" class="NodeItem">
<textarea class="ckeditor" name="data" id="data">'.stripslashes($ContentLangQuery->content).'</textarea></td>
</tr></table></div>';
$i++;
}
$tab.='</ul></div>';
}
$skin->assign('ContentData',$js.$tab.$convlang);
$skin->assign('id',$ContentData->contentid);
$skin->assign('prodcode',stripslashes($ContentData->prodcode));
$skin->assign('seotitle',stripslashes($ContentData->seotitle));
$skin->assign('seometa',stripslashes($ContentData->seometa));
$skin->assign('seokeyword',stripslashes($ContentData->seokeyword));
$skin->assign('javaaction','onload="javascript:tabs_select(\'0\');xajax_list_media_images(\''.$id.'\');"');
$skin->assign('processid',$_COOKIE['shopProcessId']);
$skin->assign('ContentCategories',$Content->ddCategories($ContentData->catid,''));
################## TEMAYI EKRANA BAS ####################
$skin->clear_cache('html/products/contents_edit.html');
$skin->display('html/products/contents_edit.html');
?>fonksiyonu bir türlü görmüyor anlamadım..