diff --git a/engine/ajax/maharder/telegram/cronadd.php b/engine/ajax/maharder/telegram/cronadd.php index 7d17275..b2c3feb 100644 --- a/engine/ajax/maharder/telegram/cronadd.php +++ b/engine/ajax/maharder/telegram/cronadd.php @@ -17,8 +17,8 @@ define( 'ROOT_DIR', dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) ); define( 'ENGINE_DIR', ROOT_DIR . '/engine' ); -include ENGINE_DIR . "/data/telegram.php"; -include ENGINE_DIR . '/data/config.php'; +include (DLEPlugins::Check(ENGINE_DIR . "/data/telegram.php")); +include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); date_default_timezone_set ( $config['date_adjust'] ); if( $config['http_home_url'] == "" ) { @@ -29,11 +29,11 @@ } -require_once ENGINE_DIR . '/classes/mysql.php'; -require_once ENGINE_DIR . '/data/dbconfig.php'; +require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); +require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); if($telebot['onof'] && $telebot['cron']) { - require_once (ENGINE_DIR . "/inc/maharder/telegram/functions.php"); + require_once (DLEPlugins::Check(ENGINE_DIR . "/inc/maharder/telegram/functions.php")); if($telebot['cron_news'] > 0) $limit = "LIMIT " . $telebot['cron_news']; else $limit = ""; diff --git a/engine/inc/maharder/telegram/addnews.php b/engine/inc/maharder/telegram/addnews.php index d661e36..52e1f5d 100644 --- a/engine/inc/maharder/telegram/addnews.php +++ b/engine/inc/maharder/telegram/addnews.php @@ -17,8 +17,8 @@ $id = intval($row); if(!$id) return; -@include (ENGINE_DIR . '/data/'.$codename.'.php'); -require_once (ENGINE_DIR . '/inc/maharder/'.$codename.'/functions.php'); +@include (DLEPlugins::Check(ENGINE_DIR . '/data/'.$codename.'.php')); +require_once (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/functions.php')); if($telebot['onof']) { diff --git a/engine/inc/maharder/telegram/editnews.php b/engine/inc/maharder/telegram/editnews.php index 44847e1..ee88a37 100644 --- a/engine/inc/maharder/telegram/editnews.php +++ b/engine/inc/maharder/telegram/editnews.php @@ -19,8 +19,8 @@ $TIME = time(); -@include (ENGINE_DIR . '/data/'.$codename.'.php'); -require_once (ENGINE_DIR . '/inc/maharder/'.$codename.'/functions.php'); +@include (DLEPlugins::Check(ENGINE_DIR . '/data/'.$codename.'.php')); +require_once (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/functions.php')); if($telebot['onof']) { diff --git a/engine/inc/maharder/telegram/version.php b/engine/inc/maharder/telegram/version.php index f806d2c..bbdf4f1 100644 --- a/engine/inc/maharder/telegram/version.php +++ b/engine/inc/maharder/telegram/version.php @@ -19,9 +19,12 @@ 'E-Mail' => "info@maxim-harder.de", ], ]; -$version = "1.2"; +$version = "1.2.1"; $descr = "Позволяет уведомлять пользователей в телеграме о новых добавлениях на сайте"; $changes = [ + '1.2.1' => [ + 'Версия для DLE 13 и выше' + ], '1.2' => [ 'Мелкие правки', 'Добавлена возможность использовать прокси (актуально для сайтов размещённых в РФ)', diff --git a/engine/inc/telegram.php b/engine/inc/telegram.php index d53f7af..2163018 100644 --- a/engine/inc/telegram.php +++ b/engine/inc/telegram.php @@ -14,10 +14,10 @@ $codename = "telegram"; -@include (ENGINE_DIR . '/data/'.$codename.'.php'); -require_once (ENGINE_DIR . '/inc/maharder/assets/functions.php'); -require_once (ENGINE_DIR . '/inc/maharder/'.$codename.'/version.php'); -require_once (ENGINE_DIR . '/inc/maharder/'.$codename.'/functions.php'); +@include (DLEPlugins::Check(ENGINE_DIR . '/data/'.$codename.'.php')); +require_once (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/assets/functions.php')); +require_once (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/version.php')); +require_once (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/functions.php')); impFiles('css', $cssfiles); @@ -26,23 +26,23 @@ switch ($_GET['do']) { case 'save': - include (ENGINE_DIR . '/inc/maharder/'.$codename.'/save.php'); + include (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/save.php')); break; case 'crontab': - include (ENGINE_DIR . '/inc/maharder/'.$codename.'/cron.php'); + include (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/cron.php')); break; case 'chat_id': - include (ENGINE_DIR . '/inc/maharder/'.$codename.'/getChat.php'); + include (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/getChat.php')); break; case 'sendMessage': - include (ENGINE_DIR . '/inc/maharder/'.$codename.'/sendMessage.php'); + include (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/sendMessage.php')); break; default: - include (ENGINE_DIR . '/inc/maharder/'.$codename.'/default.php'); + include (DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/'.$codename.'/default.php')); break; } diff --git a/install.php b/install.php index 7e58e4d..40e38a8 100644 --- a/install.php +++ b/install.php @@ -11,55 +11,17 @@ define('ENGINE_DIR', ROOT_DIR.'/engine'); define('INC_DIR', ENGINE_DIR.'/inc'); -require_once ENGINE_DIR.'/classes/mysql.php'; require_once INC_DIR.'/include/functions.inc.php'; -include ENGINE_DIR.'/data/dbconfig.php'; include ENGINE_DIR.'/data/config.php'; require_once (ENGINE_DIR . '/inc/maharder/assets/functions.php'); require_once (ENGINE_DIR . '/inc/maharder/'.$codename.'/version.php'); -if($config['version_id'] >= 13) die('Версия DLE равна или больше 13. Данная версия предназначена для версий 12.1 и ниже.'); +if($config['version_id'] < 13) die('Версия DLE ниже 13. Данная версия предназначена для версий 13 и выше.'); -$check_db = new db; -$check_db->connect(DBUSER, DBPASS, DBNAME, DBHOST, false); -if( version_compare($check_db->mysql_version, '5.6.4', '<') ) { - $storage_engine = "MyISAM"; -} else $storage_engine = "InnoDB"; -unset($check_db); -switch ($_GET['action']) { - case 'install': - try { - $tableSchema = array(); - $tableSchema[] = "INSERT INTO " . PREFIX . "_admin_sections (name, title, descr, icon, allow_groups) VALUES ('{$codename}', '{$name} v{$version}', '{$descr}', '{$codename}.png', '1')"; - $tableSchema[] = "CREATE TABLE IF NOT EXISTS " . PREFIX . "_telegram_cron ( cron_id int auto_increment primary key, news_id int not null, time timestamp null, type varchar(255) not null ) comment 'Отправка сообщений по крону';"; - foreach ($tableSchema as $table) { - $db->query($table); - } - $html = "Успешно установлено"; - } catch (Exception $e) { - $fail = $e->getMessage(); - $html = "Произошла ошибка: {$fail}"; - } - break; - case 'update': - try { - $tableSchema = array(); - $tableSchema[] = "DELETE FROM " . PREFIX . "_admin_sections WHERE name = '{$codename}'"; - $tableSchema[] = "INSERT INTO " . PREFIX . "_admin_sections (name, title, descr, icon, allow_groups) VALUES ('{$codename}', '{$name} v{$version}', '{$descr}', '{$codename}.png', '1')"; - $tableSchema[] = "CREATE TABLE IF NOT EXISTS " . PREFIX . "_telegram_cron ( cron_id int auto_increment primary key, news_id int not null, time timestamp null, type varchar(255) not null ) comment 'Отправка сообщений по крону';"; - foreach ($tableSchema as $table) { - $db->query($table); - } - $html = "Успешно обновлено"; - } catch (Exception $e) { - $fail = $e->getMessage(); - $html = "Произошла ошибка: {$fail}"; - } break; - default: - $html = << @@ -111,13 +73,11 @@
    -
  1. Для установки достаточно закинуть в корень сайта все файлы и запустить этот скрипт (раз вы это читаете, значит вы молодец).
  2. -
  3. В настройках модуля укажите токен бота и ID чата, иначе работать не будет.
  4. -
  5. Открываем engine/inc/addnews.php и ищем
    clear_cache( array('news_', 'tagscloud_', 'archives_', 'calendar_', 'topnews_', 'rss', 'stats') );
    и ставим выше
    include_once (ENGINE_DIR . "/inc/maharder/telegram/addnews.php");
  6. -
  7. Открываем engine/inc/editnews.php и ищем
    clear_cache( array('news_', 'full_'.\$item_db[0], 'comm_'.\$item_db[0], 'tagscloud_', 'archives_', 'calendar_', 'rss', 'stats') );
    и ставим выше
    include_once (ENGINE_DIR . "/inc/maharder/telegram/editnews.php");
  8. -
  9. Открываем /cron.php и ищем
    \$allow_cron = 0;
    и меняем значение на
    \$allow_cron = 1;
  10. +
  11. Для установки достаточно закинуть в корень сайта все файлы
  12. +
  13. Установите install_telegramposting.xml в админпанеле через систему плагинов .
  14. +
  15. Открываем /cron.php и ищем
    \$allow_cron = 0;
    и меняем значение на
    \$allow_cron = 1;
  16. Ищем в /cron.php
    } elseif(\$cronmode == "antivirus") {
    и ставим выше
    } elseif(\$cronmode == "telegram") {
    -            include(ENGINE_DIR . "/ajax/maharder/telegram/cronadd.php");
    +            include_once (DLEPlugins::Check(ENGINE_DIR . "/ajax/maharder/telegram/cronadd.php"));
                 die ("done");
     
  17. Удаляем install.php с корня сайта
  18. @@ -222,8 +182,4 @@ HTML; - break; - -} - echo $html; \ No newline at end of file diff --git a/install_telegramposting.xml b/install_telegramposting.xml new file mode 100644 index 0000000..ca49766 --- /dev/null +++ b/install_telegramposting.xml @@ -0,0 +1,30 @@ + + + Telegram Posting + Модуль будет отправлять сообщения в выбранный чат при помощи бота. Гибкие настройки позволят модулю отправлять лишь то, что вы хотите. + engine/skins/images/telegram.png + 1.2.1 + 13.0 + greater + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\320\237\321\200\320\276\321\207\321\202\320\270 \320\274\320\265\320\275\321\217.txt" "b/\320\237\321\200\320\276\321\207\321\202\320\270 \320\274\320\265\320\275\321\217.txt" index 89b72c3..c6bc9da 100644 --- "a/\320\237\321\200\320\276\321\207\321\202\320\270 \320\274\320\265\320\275\321\217.txt" +++ "b/\320\237\321\200\320\276\321\207\321\202\320\270 \320\274\320\265\320\275\321\217.txt" @@ -1,7 +1,4 @@ -Установка +Установка / Обновление 1. Загрузить все файлы на сервер с перезаписью 2. Запустить файл www.ваш-сайт.ru/install.php 3. Следовать инструкциям - -Обновление до 1.01 -1. Заменить все файлы \ No newline at end of file