// для модуля DLE SocialPosting
function socialPosting ($db,$news_id,$category_sql) {
global $config;
define ( 'ROOT_DIR', "../../" );
define ( 'ENGINE_DIR', ROOT_DIR . '/engine' );
$category_list = explode( ",", $category_sql['category'] );
array_unshift( $category_list, "0" );
$sqlExport = array();
$sqlPosting = $db->query( "SELECT id FROM " . PREFIX . "_socialposting_conf WHERE category regexp '[[:<:]](" . implode( '|', $category_list ) . ")[[:>:]]' AND activ='1'" );
while( $rowP = $db->get_row( $sqlPosting ) ) {
$sqlExport[] = "('" . $rowP['id'] . "', '" . $news_id . "', '0')";
}
if( count( $sqlExport ) > 0 ) {
$db->query("DELETE FROM " . PREFIX . "_socialposting_list WHERE `post_id`='" . $news_id . "'" );
$db->query("INSERT IGNORE INTO " . PREFIX . "_socialposting_list (`conf_id`, `post_id`, `finished`) VALUES " . implode( ',', $sqlExport ) );
}
require_once ENGINE_DIR . '/data/config.posting.php';
if( $config_posting['cron_posting'] == "off" ) {
$config_posting['cron_posting'] = "on";
include ENGINE_DIR . "/modules/socialposting/cron.php";
}
}