| |||||||
| المدوّنات | البحث | مشاركات اليوم | اجعل كافة المشاركات مقروءة |
|
| | LinkBack | أدوات الموضوع |
| |||||
| هل من طريقة لعمل محرك بحث لقوالب المنتدى ملاحظة هذه القوالب موجود في ملفات وليس لها اي ارتباط بقاعدة البيانات الآلية البرمجية لحذف وتعديل واضافة القوالب لهذا المنتدى مبرمجة بهذا الشكل : كود: <?php
class STControl
{
var $tdir; #Template dir
var $mainpath; #main file path
var $editpath; #edit file path
var $addpath; #add file path
var $delpath; #delete file path
var $starteditpath; #start edit file path
var $defualtex; #defualt extension .. example (.tpl)
/*
GetTemplate :
this function get template name and put it in list
*/
function GetTemplate()
{
if (is_dir($this->tdir))
{
if ($dh = opendir($this->tdir))
{
echo '<br /><div align="center">';
echo '<table class="border" summary="جدول" cellspacing="1" width="50%">
<tr>
<td class="row2" width="60%">اسم القالب</td>
<td class="row2" width="20%">تحرير</td>
<td class="row2" width="20%">حذف</td>
</tr>';
while (($file = readdir($dh)) !== false)
{
if ($file == "." or $file == ".." or $file == ".htaccess")
{
continue;
}
echo '<tr>
<td class="row1">' . $file . '</td>
<td class="row1"><a href="' . $this->editpath . '&file=' . $file . '&path=' . htmlspecialchars($_GET['path']) . '">تحرير</a></td>
<td class="row1"><a href="' . $this->delpath . '&file=' . $file . '&path=' . htmlspecialchars($_GET['path']) . '">حذف</a></td>
</tr>';
}
echo '</table>';
echo '</div><br />';
closedir($dh);
}
}
}
/*
EditTemplate :
edit form get one parameter and usualy it $D1 , this parameter = file name
*/
function EditTemplate($D1,$path)
{
global $SF;
if (!file_exists($this->tdir . $D1))
{
$SF->error('الملف المطلوب غير موجود');
}
$fp = file($this->tdir . $D1);
$ln = count($fp);
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">';
echo '<div dir="rtl" align="center">تحرير القالب ' . $D1 . '</div>';
echo '<form method="POST" action="' . $this->starteditpath . '&filename=' . $D1 . '&path=' . $path . '">';
echo '<p align="center"><textarea rows="30" name="S1" cols="70" dir="ltr">';
for ($i=0;$i<=$ln;$i++)
{
echo htmlspecialchars($fp[$i]);
}
echo '</textarea>';
echo '<br><input type="submit" value="موافق" name="B1" style="font-family: Tahoma; font-size: 8pt"></p>';
}
/*
StartEdit :
this function will change template code and get one parameter , it is usualy $S1
and $S1 = template code
*/
function StartEdit($S1,$path)
{
global $filename;
$S1 = stripslashes($S1);
$fp = fopen($this->tdir . $filename,'w+');
$fw = fwrite($fp,$S1);
if ($fw)
{
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">';
$this->msg("حُرِّرَ القالب بنجاح");
$this->goto($this->mainpath . '&path=' . $_GET['path'],'2');
}
}
/*
AddTemplate :
this function will show add form
*/
function AddTemplate()
{
include('config.php');
global $DB;
$getstyle_query = $DB->sql_query("SELECT * FROM " . $db_prefix . "style ORDER BY id DESC");
echo '<form method="POST" action="' . $this->addpath . '">';
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">';
echo '<p dir="rtl" align="center">اسم القالب : ';
echo '<input name="T1" type="text" style="font-family: Tahoma; font-size: 8pt">';
echo '<br>القالب يعود للستايل التالي : ';
echo '
<select size="1" name="D1" style="font-family: Tahoma; font-size: 8pt" dir="rtl">
';
echo '<option selected value="no">[الستايل]</option>';
while ($getstyle_row = $DB->sql_fetch_array($getstyle_query))
{
echo '<option value="' . $getstyle_row['template_path'] . '">' . $getstyle_row['style_title'] . '</option>';
}
echo '</select><p align="center"><textarea rows="30" name="S1" cols="70" dir="ltr" style="font-family: Tahoma; font-size: 10pt">';
echo '</textarea>';
echo '<br><input type="submit" value="موافق" name="B1" style="font-family: Tahoma; font-size: 8pt"></p>';
}
/*
StartAdd :
this function will add template
*/
function StartAdd()
{
global $T1,$S1,$_POST;
$S1 = stripslashes($S1);
$fp = fopen("../" . $_POST['D1'] . "/" . $T1 . $this->defualtex,'w');
$fw = fwrite($fp,$S1);
if ($fw)
{
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">';
$this->msg("أُضيفَ القالب بنجاح");
$this->goto("template.php?edit=1&form=1&path=" . $_POST['D1'],'2');
}
}
/*
DeleteTemplate :
this function will kll template
by: bokhalifa -- bo@ib4arab.com
*/
function DeleteTemplate($D1,$path)
{
$fw = unlink("../" . $path . "/" . $D1 . "");
if ($fw)
{
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">';
$this->msg("حُذِفَ القالب بنجاح");
$this->goto($this->mainpath . "&path=" . $path,'2');
}
}
function msg_die($msg)
{
die('<p align="center" dir="rtl">' . $msg . '</p>');
}
function msg($msg)
{
echo('<p align="center" dir="rtl">' . $msg . '</p>');
}
function goto($site,$m)
{
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"$m; URL=$site\">\n";
}
}
?> | |||||
|
| |||||
|
السلام عليكم , هل تقصد ان يقوم بالبحث عن الملفات من انوع tpl ؟ ... كود PHP: انتظر ردك ..
__________________ رئيس قسم برمجيات ومشروعات الويب اكاديمية المنارة الدولية , الاكاديمية الالمانية المصرية مصر - المنيا dewan159@gmail.com التعديل الأخير تم بواسطة : dewan159 بتاريخ 18-03-2008 الساعة 07:04 PM. | |||||
|
| |||||
|
السلام عليكم اخوي الكلاس هذا ممكن يفيدك بالي تحتاج وتقدر تحدد الاكستيشن الي تبي تبحث فيه Class: Search File Contents - PHP Classes | |||||
|
| |||||
|
dewan159 لكن هذه الدالة لم تعمل !! بخصوص عمليات الحذف والتعديل والإضافة فقد تم عملها سابقاً ولست بحاجة لها كل ما أحتاجة هو البحث في داخل هذه الملفات او القوالب ليتم إظهار نتيجة البحث بدقة عن الكلمة المبحوث عنها شكراً لك .. أخي جواني بالفعل افدتني واقتربت نوعا ما تم ظهور جميع الملفات التي بصيغة tpl ولم تقم بالبحث بداخلها عن الكلمة او الجملة التي اريدها !! سأستفيد من هذا في البحث عن اسماء القوالب كخيار إضافي لكن لو يظهر نتيجة اسم الملف او القالب المراد فقط لكان افضل .. ما اريده بالتحديد ان يتم البحث بداخل هذه الملفات واظهار النتيجة بشكل دقيق عن الكلمة المبحوث عنها واظهار فقط الملفات التي تحتوي بداخلها على هذه الكلمة .. | |||||
|
| |||||
|
السلام عليكم اخي مشراق .. يبدو لم تقوم بالطريقة الصحيحة للبحث داخل الملفات .. كود PHP: اطيب تحية
__________________ ما يجنى من ثمار الجنات ويلتقط, قال عز وجل {وجنى الجنتين دان} و إذا أردنا أن نجمع الاسم جنى فسيصبح جَــوَ ا نـِــي Abdullah ALHoshan ALTamimi | |||||
|
| |||||
|
انت تريد البحث داخل الملفات نفسها .... انا والله لم افهم استفسارك
__________________ رئيس قسم برمجيات ومشروعات الويب اكاديمية المنارة الدولية , الاكاديمية الالمانية المصرية مصر - المنيا dewan159@gmail.com | |||||
|
| |||||
| اقتباس:
مشابه لمحرك بحث القوالب الموجود في منتدى الفي بي او منتدى الآي بي .. جربت القالب السهل للأخ ضيف لكنه ويبدو ان غير متوافق مع كافة إصدارات php | |||||
|
| |||||
|
جواني ياعبقري بالفعل تمت عملية البحث وقد ظهرت نتائج البحث عن النص بنجاح .. لكن في هذا الكلاس : كود: $search->search('C:/AppServ/www/MySmartBB/styles', '</html>'); هل يمكن ربط (search_phrase) عبارة البحث </html> بمتغير يتم ربطه بفريم بحث عادي كهذا : كود: <form method="POST" action="../includes/searchFileContents.php"> <p dir="rtl" align="center">ابحث : <input name="T1" type="text" style="font-family: Tahoma; font-size: 8pt"> <br><input type="submit" value="ابحث" name="B1" style="font-family: Tahoma; font-size: 8pt"></p> | |||||
|
| |||||
| اقتباس:
كود: $search->search('C:/AppServ/www/MySmartBB/styles', $_POST[T1]);
__________________ أهلا و سهلا بكم في :- موقع دار الأوائل ----------------- تفضل معنا خدمات الاستضافة مع تركيب و دعم خاص للبوابة العربية لكافة العملاء موقع خدمات العرب | |||||
|
| |||||
|
استفسار آخر بخصوص تنسيق نتائج البحث حالياً تظهر لدي بهذا الشكل : اقتباس:
كود: class searchFileContents{
var $dir_name = '../style';
var $search_phrase = '$_POST[T1]';
var $allowed_file_types = array('tpl');
var $foundFiles;
var $myfiles;
function search($directory, $search_phrase){
$this->dir_name = $directory;
$this->search_phrase = $search_phrase;
$this->myfiles = $this->GetDirContents($this->dir_name);
$this->foundFiles = array();
if ( empty($this->search_phrase) ) die('لم تقم بكتابة كلمة للبحث');
if ( empty($this->dir_name) ) die('You must select a directory to search');
foreach ( $this->myfiles as $f ){
if ( in_array(array_pop(explode ( '.', $f )), $this->allowed_file_types) ){
$contents = file_get_contents($f);
if ( strpos($contents, $this->search_phrase) !== false )
$this->foundFiles [] = $f;
}
}
return $this->foundFiles;
}
function GetDirContents($dir){
if (!is_dir($dir)){die ("Function GetDirContents: Problem reading : $dir!");}
if ($root=@opendir($dir)){
while ($file=readdir($root)){
if($file=="." || $file==".."){continue;}
if(is_dir($dir."/".$file)){
$files=array_merge($files,$this->GetDirContents($dir."/".$file));
}else{
$files[]=$dir."/".$file;
}
}
}
return $files;
}
}
//Example :
echo "<style type='text/css' media='all'>
@import url(../admin/style/css/style.css);
</style>";
echo "<br /><body bgcolor='#EEEEEE'><table dir='rtl' class='td' border='1' cellpadding='1' cellspacing='1' width='100%'><tr><td dir='rtl' valign='top'>";
$search = new searchFileContents;
$search->search('C:/AppServ/www/MySmartBB/styles', $_POST[T1]);
var_dump($search->foundFiles);
echo "</td></tr></table>"; اريدها ان تكون منسقة بشكل افضل وتظهر بهذا الشكل بالمرفقات : | |||||
|
![]() |
| |
| |
| أدوات الموضوع | |
| |
المواضيع المتشابهه | ||||
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| المنتدى يتعرض للاختراق والصدمه الكبرى اعادة باك اب من شهر من قبل شركة مربع | vb3vb3 | إصلاح وصيانة المنتديات | 30 | 09-10-2007 06:15 AM |
| محرك بحث أين .. أخيرا محرك بحث عربي بدون الاعتماد على قووقل | alnassaj | تطوير الويب | 18 | 09-02-2007 11:08 AM |
| محاولة فاشلة لعمل محرك بحث للقوالب - يرجا المساعدة -جنني!!!!!!!!! | elkaser | PHP | 1 | 20-11-2006 08:49 AM |
| شرح بالصور ( محرك بحث في موقعك بتصميم موقعك + زيادة أرشفة موقعك بجوجول ) | Ahmed-Mousa | خدمات البيع والشراء والإعلانات التجارية | 0 | 01-03-2006 03:30 PM |
| شرح طريقة استعادة لوحة تحكم المنتدى بعد اختراقها + استعادة كلمة السر | ســــاري | إصلاح وصيانة المنتديات | 15 | 01-04-2005 11:04 AM |