Помощник
Нужна доработка DLE. |
profserg
|
Сообщение
#1
|
||
|
|
||
|
|||
Belos |
16.11.2010, 15:33;
Ответить: Belos
Сообщение
#2
|
|
Может подойдет....
Развернуть/Свернуть
<?PHP
// COPYRIGHT FDSTAR.NET @error_reporting(E_ALL ^ E_NOTICE); @ini_set('display_errors', true); @ini_set('html_errors', false); @ini_set('error_reporting', E_ALL ^ E_NOTICE); define('DATALIFEENGINE', true); $member_id = FALSE; $is_logged = FALSE; $content = ''; define('ROOT_DIR', dirname (__FILE__)); define('ENGINE_DIR', ROOT_DIR.'/engine'); define('DROP_IMAGES', false); @include (ENGINE_DIR.'/data/config.php'); if (!$config['version_id']) die("Datalife Engine not installed. Please run install.php"); require_once ENGINE_DIR.'/classes/mysql.php'; require_once ENGINE_DIR.'/data/dbconfig.php'; $sql = "SELECT *,count(*) as `post_counter` FROM `". PREFIX. "_post` GROUP BY `alt_name` ORDER BY `post_counter` DESC"; $res = $db->query($sql); $row = $db->get_row($res); if($row && count($row)) { if($row['post_counter']<=1) { die('COMPLETE !'); } if(DROP_IMAGES) { $sql= "SELECT * FROM `". PREFIX. "_images` WHERE `news_id`='{$row['id']}' "; $res2 = $db->query($sql); while($row2 = $db->get_row($res2)) { $images_array = split("\|\|\|", $row2['images']); foreach($images_array as $image) { if($image = trim($image)) { $image = ltrim($image, '/'); if(preg_match('#([0-9]{4}\-[0-9]{2}/)(.*)$#', $image, $match)) { $img_date_dir = $match[1]; $img_name = basename($match[2]); $img_thumb_address = ROOT_DIR. '/uploads/posts/'. $img_date_dir. 'thumbs/'. $img_name; $img_address = ROOT_DIR. '/uploads/posts/'. $img_date_dir. $img_name; @$img_thumb_address_delete = (int)unlink($img_thumb_address); @$img_address_delete = (int)unlink($img_address); $content.= "{$img_address} {$img_address_delete} <br /> {$img_thumb_address} {$img_thumb_address_delete}<hr />"; } else { $content.= '<br />NO IMAGES FOUND<br />'; } } } $sql = "DELETE FROM `". PREFIX. "_images` WHERE `id`='{$row2['id']}'"; $db->query($sql); $content.= $sql. "<hr />"; } } $sql= "DELETE FROM `". PREFIX. "_post` WHERE `id`='{$row['id']}' "; $db->query($sql); $content.= $sql. "<hr />"; } echo <<<HTML <html> <head> <script language="JavaScript" DEFER><!-- function reload_page() { document.location.reload(); } --></script> </head> <body onload="reload_page();"> {$content} </body> </html> HTML; ?> |
|
|
profserg
|
Сообщение
#3
|
|
Может подойдет.... Развернуть/Свернуть
<?PHP
// COPYRIGHT FDSTAR.NET @error_reporting(E_ALL ^ E_NOTICE); @ini_set('display_errors', true); @ini_set('html_errors', false); @ini_set('error_reporting', E_ALL ^ E_NOTICE); define('DATALIFEENGINE', true); $member_id = FALSE; $is_logged = FALSE; $content = ''; define('ROOT_DIR', dirname (__FILE__)); define('ENGINE_DIR', ROOT_DIR.'/engine'); define('DROP_IMAGES', false); @include (ENGINE_DIR.'/data/config.php'); if (!$config['version_id']) die("Datalife Engine not installed. Please run install.php"); require_once ENGINE_DIR.'/classes/mysql.php'; require_once ENGINE_DIR.'/data/dbconfig.php'; $sql = "SELECT *,count(*) as `post_counter` FROM `". PREFIX. "_post` GROUP BY `alt_name` ORDER BY `post_counter` DESC"; $res = $db->query($sql); $row = $db->get_row($res); if($row && count($row)) { if($row['post_counter']<=1) { die('COMPLETE !'); } if(DROP_IMAGES) { $sql= "SELECT * FROM `". PREFIX. "_images` WHERE `news_id`='{$row['id']}' "; $res2 = $db->query($sql); while($row2 = $db->get_row($res2)) { $images_array = split("\|\|\|", $row2['images']); foreach($images_array as $image) { if($image = trim($image)) { $image = ltrim($image, '/'); if(preg_match('#([0-9]{4}\-[0-9]{2}/)(.*)$#', $image, $match)) { $img_date_dir = $match[1]; $img_name = basename($match[2]); $img_thumb_address = ROOT_DIR. '/uploads/posts/'. $img_date_dir. 'thumbs/'. $img_name; $img_address = ROOT_DIR. '/uploads/posts/'. $img_date_dir. $img_name; @$img_thumb_address_delete = (int)unlink($img_thumb_address); @$img_address_delete = (int)unlink($img_address); $content.= "{$img_address} {$img_address_delete} <br /> {$img_thumb_address} {$img_thumb_address_delete}<hr />"; } else { $content.= '<br />NO IMAGES FOUND<br />'; } } } $sql = "DELETE FROM `". PREFIX. "_images` WHERE `id`='{$row2['id']}'"; $db->query($sql); $content.= $sql. "<hr />"; } } $sql= "DELETE FROM `". PREFIX. "_post` WHERE `id`='{$row['id']}' "; $db->query($sql); $content.= $sql. "<hr />"; } echo <<<HTML <html> <head> <script language="JavaScript" DEFER><!-- function reload_page() { document.location.reload(); } --></script> </head> <body onload="reload_page();"> {$content} </body> </html> HTML; ?> Такой у меня есть, к сожалению он убирает дубли по {title} и изменение названия на один знак делает из дубля-недубль. |
|
|
|
Похожие темы
Тема | Ответов | Автор | Просмотров | Последний ответ | |
---|---|---|---|---|---|
Нужна ли плоская структура категорий в ИМ? | 1 | noviktamw | 1066 | 26.3.2024, 21:50 автор: c4p1t4l15t |
|
Состояние после ампутации - нужна помощь благотворительный топик |
46 | vitvirtual | 5560 | 12.3.2024, 21:52 автор: Гиппопотам |
|
Нужна рассылка по емаил базе сео-студий | 0 | kasey7 | 622 | 2.3.2024, 23:13 автор: kasey7 |
|
Человеку нужна своя квартира/дом? | 187 | metvekot | 13954 | 21.2.2024, 22:39 автор: spomoni |
|
Разработка/доработка сайтов Wordpress, HTML/CSS/JS Вёрстка, перенос на WP, правки |
9 | malamut | 3335 | 25.1.2024, 14:36 автор: malamut |
Текстовая версия | Сейчас: 29.3.2024, 11:41 |