Advertisement
MaHarder

Categories

Oct 26th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 101.68 KB | None | 0 0
  1. <?PHP
  2. /*
  3. =====================================================
  4.  DataLife Engine - by SoftNews Media Group
  5. -----------------------------------------------------
  6.  http://dle-news.ru/
  7. -----------------------------------------------------
  8.  Copyright (c) 2004,2011 SoftNews Media Group
  9. =====================================================
  10.  Данный код защищен авторскими правами
  11. =====================================================
  12.  Файл: categories.php
  13. -----------------------------------------------------
  14.  Назначение: управление категориями
  15. =====================================================
  16. */
  17.  
  18. if( !defined( 'DATALIFEENGINE' ) OR !defined( 'LOGGED_IN' ) ) {
  19.     die( "Hacking attempt!" );
  20. }
  21.  
  22. $result = "";
  23. $catid = intval( $_REQUEST['catid'] );
  24.  
  25. if( ! $user_group[$member_id['user_group']]['admin_categories'] ) {
  26.     msg( "error", $lang['index_denied'], $lang['cat_perm'] );
  27. }
  28.  
  29. function get_sub_cats($id, $subcategory = false) {
  30.    
  31.     global $cat_info;
  32.     $subfound = array ();
  33.    
  34.     if( ! $subcategory ) {
  35.         $subcategory = array ();
  36.         $subcategory[] = $id;
  37.     }
  38.    
  39.     foreach ( $cat_info as $cats ) {
  40.         if( $cats['parentid'] == $id ) {
  41.             $subfound[] = $cats['id'];
  42.         }
  43.     }
  44.    
  45.     foreach ( $subfound as $parentid ) {
  46.         $subcategory[] = $parentid;
  47.         $subcategory = get_sub_cats( $parentid, $subcategory );
  48.     }
  49.    
  50.     return $subcategory;
  51.  
  52. }
  53.  
  54.     function check_gallery($array) {
  55.         if (count($array)){
  56.             foreach ($array as $value)
  57.                 if ($value != '') {
  58.                     return TRUE;
  59.                     break;
  60.                 }
  61.         } else
  62.             return FALSE;
  63.     }  
  64.  
  65. function makeDropDown($options, $name, $selected) {
  66.     $output = "<select size=1 name=\"$name\">\r\n";
  67.     foreach ( $options as $value => $description ) {
  68.         $output .= "<option value=\"$value\"";
  69.         if( $selected == $value ) {
  70.             $output .= " selected ";
  71.         }
  72.         $output .= ">$description</option>\n";
  73.     }
  74.     $output .= "</select>";
  75.     return $output;
  76. }
  77. function makeDropDown2($options, $name, $selected) {
  78.     $output = "<select name=\"studio-select\" id=\"studio-select\">\r\n";
  79.     foreach ( $options as $value => $description ) {
  80.         $output .= "<option selected=\"selected\" value=\"$value\"";
  81.         if( $selected == $value ) {
  82.             $output .= " selected ";
  83.         }
  84.         $output .= ">$description</option>\n";
  85.     }
  86.     $output .= "</select>";
  87.     return $output;
  88. }
  89.  
  90. function SelectSkin($skin) {
  91.     global $lang;
  92.    
  93.     $templates_list = array ();
  94.    
  95.     $handle = opendir( ROOT_DIR . '/templates' );
  96.    
  97.     while ( false !== ($file = readdir( $handle )) ) {
  98.         if( is_dir( ROOT_DIR . "/templates/$file" ) and ($file != "." and $file != ".." and $file != "smartphone") ) {
  99.             $templates_list[] = $file;
  100.         }
  101.     }
  102.     closedir( $handle );
  103.    
  104.     $skin_list = "<select name=skin_name>";
  105.     $skin_list .= "<option value=\"\">" . $lang['cat_skin_sel'] . "</option>";
  106.    
  107.     foreach ( $templates_list as $single_template ) {
  108.         if( $single_template == $skin ) $selected = " selected";
  109.         else $selected = "";
  110.         $skin_list .= "<option value=\"$single_template\"" . $selected . ">$single_template</option>";
  111.     }
  112.     $skin_list .= '</select>';
  113.    
  114.     return $skin_list;
  115. }
  116. // ********************************************************************************
  117. // Сортировка категорий
  118. // ********************************************************************************
  119.  
  120.  
  121. if( $_REQUEST['action'] == 'sort' ) {
  122.    
  123.     foreach ( $_POST["posi"] as $id => $posi ) {
  124.         if( $posi != "" ) {
  125.             $posi = intval( $posi );
  126.             $id = intval( $id );
  127.             $db->query( "UPDATE " . PREFIX . "_category SET posi='{$posi}' WHERE id = '{$id}'" );
  128.         }
  129.     }
  130.     @unlink( ENGINE_DIR . '/cache/system/category.php' );
  131.     header( "Location:$PHP_SELF?mod=categories" );
  132. }
  133.  
  134. // ********************************************************************************
  135. // Добавление категории
  136. // ********************************************************************************
  137. if( $action == "add" ) {
  138.    
  139.     if( $_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash ) {
  140.        
  141.         die( "Hacking attempt! User not found" );
  142.    
  143.     }
  144.    
  145.     include_once ENGINE_DIR . '/classes/parse.class.php';
  146.     $parse = new ParseFilter( Array (), Array (), 1, 1 );
  147.    
  148.     $quotes = array ("\x27", "\x22", "\x60", "\t", "\n", "\r" );
  149.  
  150.     if( $_POST['cat_icon'] == $lang['cat_icon'] ) {
  151.         $_POST['cat_icon'] = "";
  152.     }
  153.    
  154.     $cat_name  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['cat_name'] ) ), ENT_QUOTES) );
  155.     $skin_name = trim( totranslit($_POST['skin_name'], false, false) );
  156.     $cat_icon  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['cat_icon']) ), ENT_QUOTES) );
  157.     if (!isset($_POST['alt_cat_name'])) $_POST['alt_cat_name'] = totranslit($cat_name);
  158.    
  159.     $year = intval($_POST['year']);
  160.     $studio = intval($_POST['studio']);
  161.     $type = intval($_POST['type']);
  162.     $actors  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['actors'] ) ), ENT_QUOTES) );
  163.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['ganre'] ) ), ENT_QUOTES) )) as $key => $value){
  164.         $ganre[totranslit($value)] = $value; }
  165.    
  166.     $ganre = serialize($ganre);
  167.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['translator'] ) ), ENT_QUOTES) )) as $key => $value){
  168.         $translator[totranslit($value)] = $value; }
  169.    
  170.     $translator = serialize($translator);
  171.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['edition'] ) ), ENT_QUOTES) )) as $key => $value){
  172.         $edition[totranslit($value)] = $value; }
  173.    
  174.     $edition = serialize($edition);
  175.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['designer'] ) ), ENT_QUOTES) )) as $key => $value){
  176.         $designer[totranslit($value)] = $value; }
  177.    
  178.     $designer = serialize($designer);
  179.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['lyrics'] ) ), ENT_QUOTES) )) as $key => $value){
  180.         $lyrics[totranslit($value)] = $value; }
  181.    
  182.     $lyrics = serialize($lyrics);
  183.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['dubber'] ) ), ENT_QUOTES) )) as $key => $value){
  184.         $dubber[totranslit($value)] = $value; }
  185.    
  186.     $dubber = serialize($dubber);
  187.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['country'] ) ), ENT_QUOTES) )) as $key => $value){
  188.         $country[totranslit($value)] = $value; }
  189.    
  190.     $country = serialize($country);
  191.     $director  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['director'] ) ), ENT_QUOTES) );
  192.     $manga  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['manga'] ) ), ENT_QUOTES) );
  193.     $original  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['original'] ) ), ENT_QUOTES) );
  194.     $prod  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['prod'] ) ), ENT_QUOTES) );
  195.    
  196.     $alt_cat_name = totranslit( stripslashes( $_POST['alt_cat_name'] ), true, false );
  197.     if ( ! $alt_cat_name ) $alt_cat_name = totranslit($cat_name);
  198.     if( ! $cat_name ) {
  199.         msg( "error", $lang['cat_error'], $lang['cat_ername'], "javascript:history.go(-1)" );
  200.     }
  201.     if( ! $alt_cat_name ) {
  202.         msg( "error", $lang['cat_error'], $lang['cat_erurl'], "javascript:history.go(-1)" );
  203.     }
  204.    
  205.     if ( in_array($_POST['news_sort'], array("date", "rating", "news_read", "title")) ) {
  206.  
  207.         $news_sort = $db->safesql( $_POST['news_sort'] );
  208.  
  209.     } else $news_sort = "";
  210.  
  211.     if ( in_array($_POST['news_msort'], array("ASC", "DESC")) ) {
  212.  
  213.         $news_msort = $db->safesql( $_POST['news_msort'] );
  214.  
  215.     } else $news_msort = "";
  216.  
  217.     if ( $_POST['news_number'] > 0)
  218.         $news_number = intval( $_POST['news_number'] );
  219.     else $news_number = 0;
  220.  
  221.     if ( $_POST['category'] > 0)
  222.         $category = intval( $_POST['category'] );
  223.     else $category = 0;
  224.        
  225.     /*Работа с картинкой блеать*/
  226.    
  227.     if (check_gallery($_FILES['gallery']['tmp_name'])) { //Добавлены ли в форму новые фото или вообще добавлены ли они
  228.    
  229.         /*Небольшой конфиг*/
  230.        
  231.             $config_path_image_upload = ROOT_DIR . "/uploads/stills/"; //Место загрузки картинок
  232.             $screenshot_width = 300; // ширина логотипа
  233.             $screenshot_watermark = 0; // наложение водяного знака       
  234.    
  235.         foreach ($_FILES['gallery']['tmp_name'] as $key => $tmp_name) {
  236.        
  237.             $file_prefix = time () . "_";
  238.  
  239.             if (! is_dir ( $config_path_image_upload )) {
  240.                 @mkdir ( $config_path_image_upload, 0777 );
  241.                 @chmod ( $config_path_image_upload, 0777 );
  242.             }
  243.  
  244.             if (! is_dir ( $config_path_image_upload ))
  245.                 $error .= "- Directory Error. " . $config_path_image_upload . " cannot created. <br />";
  246.  
  247.             $allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
  248.  
  249.             if (! is_dir ( $config_path_image_upload . 'mini/' )) {
  250.                 @mkdir ( $config_path_image_upload . 'mini/', 0777 );
  251.                 @chmod ( $config_path_image_upload . 'mini/', 0777 );
  252.             }
  253.  
  254.             if (! is_dir ( $config_path_image_upload . 'mini/' ))
  255.                 $error .= "- Directory Error. " . $config_path_image_upload . "mini/ cannot created. <br />";
  256.  
  257.             $image = $_FILES['gallery']['tmp_name'][$key];
  258.             $image_name = $_FILES['gallery']['name'][$key];
  259.             $image_size = $_FILES['gallery']['size'][$key];
  260.  
  261.             $img_name_arr = explode ( ".", $image_name );
  262.             $type = totranslit ( end ( $img_name_arr ) );
  263.  
  264.             if ($image_name != "")
  265.             {
  266.                 $curr_key = key ( $img_name_arr );
  267.                 unset ( $img_name_arr [$curr_key] );
  268.                 $image_name = totranslit ( implode ( ".", $img_name_arr ) ) . "." . $type;
  269.             }
  270.            
  271.             $i++;
  272.            
  273.             if ($image_name == "")
  274.                 $error .= "- Не удалось определить изображение. Фото № {$i}";
  275.             elseif (! (in_array ( $type, $allowed_extensions ) or in_array ( strtolower ( $type ), $allowed_extensions )))
  276.                 $error .= "- Данный тип изображения не поддерживается. Фото № {$i}";
  277.             elseif ($image_size > ($config['max_up_size'] * 1024) and ! $config ['max_up_side'])
  278.                 $error .= "- Размер загружаемого изображения превышает максимально допустимые размеры. Фото № {$i}";
  279.             else {
  280.                 @move_uploaded_file ( $image, $config_path_image_upload . $file_prefix . $image_name ) or $img_result = "<div><font color=red>$lang[images_uperr_3]</font></div>";
  281.  
  282.                 if (@file_exists ( $config_path_image_upload . $file_prefix . $image_name ))
  283.                 {
  284.                     @chmod ( $config_path_image_upload . $file_prefix . $image_name, 0666 );
  285.  
  286.                     include_once ENGINE_DIR . '/classes/thumb.class.php';
  287.  
  288.                     $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  289.                     if ($thumb->size_auto ( $screenshot_width, 0 ))
  290.                     {
  291.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  292.                         /*if ($screenshot_watermark == "1")
  293.                             $thumb->insert_watermark ( $config ['max_watermark'] );*/
  294.                         $thumb->save ( $config_path_image_upload . "mini/" . $file_prefix . $image_name );
  295.                     }
  296.                    
  297.                     /*$thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  298.                     if ($thumb->size_auto ( $screenshot_width2, 0 ))
  299.                     {
  300.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  301.                         if ($screenshot_watermark == "1")
  302.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  303.                         $thumb->save ( $config_path_image_upload . "main/" . $file_prefix . $image_name );
  304.                     }*/
  305.  
  306.                     if (@file_exists ( $config_path_image_upload . "mini/" . $file_prefix . $image_name )) {
  307.                         $img_result_th .= "<div><font color=blue>$image_name -> $lang[images_thok]</font></div>";
  308.                         $thumb_img = $image_name;
  309.                     }
  310.  
  311.                     @chmod ( $config_path_image_upload . "mini/" . $file_prefix . $image_name, 0666 );
  312.                     $config ['max_up_side'] = intval ( $config ['max_up_side'] );
  313.  
  314.                     if ($screenshot_watermark == "1" or $config ['max_up_side'])
  315.                     {
  316.                         $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  317.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  318.  
  319.                         if ($config ['max_up_side'])
  320.                             $thumb->size_auto ( $config ['max_up_side'] );
  321.  
  322.                         if ($screenshot_watermark == "1")
  323.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  324.  
  325.                         $thumb->save ( $config_path_image_upload . $file_prefix . $image_name );
  326.                     }
  327.                 }
  328.             }
  329.            
  330.            
  331.             /*Собираем массив новых фоток (Свежих)*/
  332.            
  333.             if ($image_name)
  334.                 $gallery_array[$key] = $file_prefix . $image_name;
  335.            
  336.         }
  337.        
  338.         //Формирование массива загруженных картинок
  339.         if ($error)
  340.             msg( "error", $lang['cat_error'], $error, "javascript:history.go(-1)" );
  341.         else
  342.             $gallery = serialize($gallery_array);
  343.    
  344.     }
  345.    
  346.  
  347.     /*Работа с картинкой*/
  348.  
  349.         $screenshot_width = 250; // ширина логотипа
  350.         $screenshot_width2 = 80; // ширина логотипа
  351.         $screenshot_watermark = 1; // наложение водяного знака
  352.  
  353.     if (intval($_POST['down_poster']) == 1 AND intval($_POST['id_rating']) > 0) {
  354.    
  355.             $image_url = "http://st.kinopoisk.ru/images/film_big/".intval($_POST['id_rating']).".jpg";
  356.             $new_image_url = time () . "_" . strtolower($alt_cat_name) . ".jpg";
  357.             $new_poster_path = ROOT_DIR . "/uploads/posters/";
  358.            
  359.             if (copy($image_url, $new_poster_path . $new_image_url)) {
  360.            
  361.                     @chmod ( $new_poster_path . $new_image_url, 0666 );
  362.            
  363.                     include_once ENGINE_DIR . '/classes/thumb.class.php';
  364.  
  365.                     $thumb = new thumbnail ( $new_poster_path . $new_image_url );
  366.                     if ($thumb->size_auto ( $screenshot_width, 0 ))
  367.                     {
  368.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  369.                         if ($screenshot_watermark == "1")
  370.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  371.                         $thumb->save ( $new_poster_path . "mini/" . $new_image_url );
  372.                     }
  373.                    
  374.                     $thumb = new thumbnail ( $new_poster_path . $new_image_url );
  375.                     if ($thumb->size_auto ( $screenshot_width2, 0 ))
  376.                     {
  377.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  378.                         if ($screenshot_watermark == "1")
  379.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  380.                         $thumb->save ( $new_poster_path . "main/" . $new_image_url );
  381.                     }
  382.  
  383.                     if ($screenshot_watermark == "1" or $config ['max_up_side'])
  384.                     {
  385.                         $thumb = new thumbnail ( $new_poster_path . $new_image_url );
  386.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  387.  
  388.                         if ($config ['max_up_side'])
  389.                             $thumb->size_auto ( $config ['max_up_side'] );
  390.  
  391.                         if ($screenshot_watermark == "1")
  392.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  393.  
  394.                         $thumb->save ( $new_poster_path . $new_image_url );
  395.                     }
  396.  
  397.                 $thumb_img = $new_image_url;
  398.            
  399.             } else
  400.                 msg( "error", $lang['cat_error'], "Извеняй браток, КП не одобряет когда я пытаюсь пиздануть постер. Загрузи ка ты его ручками", "javascript:history.go(-1)" );
  401.     }      
  402.        
  403.         $error = "";
  404.        
  405.         if (isset($_FILES['cat_icon']['name']))
  406.         {
  407.        
  408.             $file_prefix = time () . "_";
  409.             $config_path_image_upload = ROOT_DIR . "/uploads/posters/";
  410.  
  411.             if (! is_dir ( $config_path_image_upload )) {
  412.                 @mkdir ( $config_path_image_upload, 0777 );
  413.                 @chmod ( $config_path_image_upload, 0777 );
  414.             }
  415.  
  416.             if (! is_dir ( $config_path_image_upload ))
  417.                 $error .= "- Directory Error. " . $config_path_image_upload . " cannot created. <br />";
  418.  
  419.             $allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
  420.  
  421.             if (! is_dir ( $config_path_image_upload . 'mini/' )) {
  422.                 @mkdir ( $config_path_image_upload . 'mini/', 0777 );
  423.                 @chmod ( $config_path_image_upload . 'mini/', 0777 );
  424.             }
  425.  
  426.             if (! is_dir ( $config_path_image_upload . 'mini/' ))
  427.                 $error .= "- Directory Error. " . $config_path_image_upload . "mini/ cannot created. <br />";
  428.  
  429.             $current_image = "cat_icon";
  430.             $image = $_FILES [$current_image] ['tmp_name'];
  431.             $image_name = $_FILES [$current_image] ['name'];
  432.             $image_size = $_FILES [$current_image] ['size'];
  433.  
  434.             $img_name_arr = explode ( ".", $image_name );
  435.             $type = totranslit ( end ( $img_name_arr ) );
  436.  
  437.             if ($image_name != "")
  438.             {
  439.                 $curr_key = key ( $img_name_arr );
  440.                 unset ( $img_name_arr [$curr_key] );
  441.                 $image_name = totranslit ( implode ( ".", $img_name_arr ) ) . "." . $type;
  442.             }
  443.  
  444.             if ($image_name == "")
  445.                 $error .= "- Не удалось определить изображение.";
  446.             elseif (! (in_array ( $type, $allowed_extensions ) or in_array ( strtolower ( $type ), $allowed_extensions )))
  447.                 $error .= "- Данный тип изображения не поддерживается.";
  448.             elseif ($image_size > ($config['max_up_size'] * 1024) and ! $config ['max_up_side'])
  449.                 $error .= "- Размер загружаемого изображения превышает максимально допустимые размеры.";
  450.             else {
  451.                 @move_uploaded_file ( $image, $config_path_image_upload . $file_prefix . $image_name ) or $img_result = "<div><font color=red>$lang[images_uperr_3]</font></div>";
  452.  
  453.                 if (@file_exists ( $config_path_image_upload . $file_prefix . $image_name ))
  454.                 {
  455.                     @chmod ( $config_path_image_upload . $file_prefix . $image_name, 0666 );
  456.  
  457.                     include_once ENGINE_DIR . '/classes/thumb.class.php';
  458.  
  459.                     $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  460.                     if ($thumb->size_auto ( $screenshot_width, 0 ))
  461.                     {
  462.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  463.                         if ($screenshot_watermark == "1")
  464.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  465.                         $thumb->save ( $config_path_image_upload . "mini/" . $file_prefix . $image_name );
  466.                     }
  467.                    
  468.                     $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  469.                     if ($thumb->size_auto ( $screenshot_width2, 0 ))
  470.                     {
  471.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  472.                         if ($screenshot_watermark == "1")
  473.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  474.                         $thumb->save ( $config_path_image_upload . "main/" . $file_prefix . $image_name );
  475.                     }
  476.  
  477.                     if (@file_exists ( $config_path_image_upload . "mini/" . $file_prefix . $image_name )) {
  478.                         $img_result_th .= "<div><font color=blue>$image_name -> $lang[images_thok]</font></div>";
  479.                         $thumb_img = $image_name;
  480.                     }
  481.  
  482.                     @chmod ( $config_path_image_upload . "mini/" . $file_prefix . $image_name, 0666 );
  483.                     $config ['max_up_side'] = intval ( $config ['max_up_side'] );
  484.  
  485.                     if ($screenshot_watermark == "1" or $config ['max_up_side'])
  486.                     {
  487.                         $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  488.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  489.  
  490.                         if ($config ['max_up_side'])
  491.                             $thumb->size_auto ( $config ['max_up_side'] );
  492.  
  493.                         if ($screenshot_watermark == "1")
  494.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  495.  
  496.                         $thumb->save ( $config_path_image_upload . $file_prefix . $image_name );
  497.                     }
  498.                 }
  499.             }
  500.             $file_name_thumb = $image_name;
  501.  
  502.             if ($file_name_thumb)
  503.                 $file_name_thumb = $file_prefix . $file_name_thumb;
  504.             else
  505.                 $file_name_thumb = "";
  506.  
  507.             if ($thumb_img)
  508.                 $thumb_img = $file_prefix . $thumb_img;
  509.             else
  510.                 $thumb_img = "";
  511.         }
  512.  
  513.         ##=============================Сохранение данных в базу данных===================================##
  514.  
  515.         if ($error)
  516.             msg( "error", $lang['cat_error'], $error, "javascript:history.go(-1)" );
  517.  
  518.    
  519.     /*Работа с картинкой*/
  520.    
  521.     $short_tpl = totranslit( stripslashes( trim( $_POST['short_tpl'] ) ) );
  522.     $full_tpl = totranslit( stripslashes( trim( $_POST['full_tpl'] ) ) );
  523.    
  524.     $meta_title = $db->safesql( htmlspecialchars ( strip_tags( stripslashes( $_POST['meta_title'] ) ) ) );
  525.     $description = $db->safesql( strip_tags( stripslashes( $_POST['descr'] ) ) );
  526.     $lirika = $db->safesql( strip_tags( stripslashes( $_POST['lir'] ) ) );
  527.     $subs = $db->safesql( strip_tags( stripslashes( $_POST['titry'] ) ) );
  528.     $board = $db->safesql( strip_tags( stripslashes( $_POST['forum'] ) ) );
  529.     $keywords = $db->safesql( str_replace( $quotes, " ", strip_tags( stripslashes( $_POST['keywords'] ) ) ) );
  530.     $vk_poll = $db->safesql( str_replace( $quotes, " ", strip_tags( stripslashes( $_POST['vk_poll'] ) ) ) );
  531.     $date_start = $db->safesql( strip_tags( stripslashes( $_POST['date_start'] ) ) );
  532.     $real_name = $db->safesql( htmlspecialchars ( strip_tags( stripslashes( $_POST['real_name'] ) ) ) );
  533.    
  534.     $descr_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['short_story'], false ) ) );
  535.     $lir_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['lir'], false ) ) );
  536.     $titry_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['titry'], false ) ) );
  537.     $forum_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['forum'], false ) ) );
  538.     //$video = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['treiler'], false ) ) );
  539.     $video = $db->safesql( $parse->BB_Parse($_POST['treiler']) );
  540.     $row = $db->super_query( "SELECT alt_name FROM " . PREFIX . "_category WHERE alt_name ='{$alt_cat_name}'" );
  541.    
  542.     if( $row['alt_name'] ) {
  543.         msg( "error", $lang['cat_error'], $lang['cat_eradd'], "?mod=categories" );
  544.     }
  545.    
  546.     if ($thumb_img)
  547.         $cat_icon = $config['http_home_url'] . "uploads/posters/mini/" . $thumb_img;
  548.     else
  549.         $cat_icon = $config['http_home_url'] . "uploads/posters/" . $thumb_img;
  550.  
  551.    
  552.     $db->query( "INSERT INTO " . PREFIX . "_category (parentid, name, real_name, year, type, studio, country, actors, janre, translate, edit, design, lyric, dub, director, manga, original, prod, alt_name, icon, skin, descr, lir, titry, forum, keywords, news_sort, news_msort, news_number, short_tpl, full_tpl, metatitle, id_rating, descr_content, gallery, video, vk_poll, date_start) values ('$category', '$cat_name', '$real_name', '$year', '$type', '$studio', '$country', '$actors', '$ganre', '$translator', '$edition', '$designer', '$lyrics', '$dubber', '$director', '$manga', '$original', '$prod', '$alt_cat_name', '$cat_icon', '$skin_name', '$description', '$lir', '$titry', '$forum', '$keywords', '$news_sort', '$news_msort', '$news_number', '$short_tpl', '$full_tpl', '$meta_title', '".intval($_POST['id_rating'])."', '$descr_content', '$gallery', '$video', '$vk_poll', '$date_start')" );
  553.    
  554.     $s_id = $db->insert_id();
  555.    
  556.     $p_id = $db->super_query("SELECT parentid FROM " . PREFIX . "_category WHERE id = '$s_id'");
  557.    
  558.     @unlink( ENGINE_DIR . '/cache/system/category.php' );
  559.     clear_cache();
  560.    
  561.     if ($p_id['parentid'] == 0)
  562.         msg( "info", $lang['cat_addok'], "Аниме {$cat_name}, успешно добавлен. Но для дальнейшей работы необходимо <a href=\"/shite.php?mod=categories&action=season_list&serial_id={$s_id}\"><b>добавить</b></a> сезоны", "?mod=categories" );
  563.     else
  564.         msg( "info", $lang['cat_addok'], "Сезон успешно добавлен", "?mod=categories&action=season_list&serial_id=" . $p_id['parentid']);
  565.  
  566. }
  567. // ********************************************************************************
  568. // Удаление категории
  569. // ********************************************************************************
  570. elseif( $action == "remove" ) {
  571.    
  572.  
  573.     if( $_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash ) {
  574.        
  575.         die( "Hacking attempt! User not found" );
  576.    
  577.     }
  578.    
  579.     function DeleteSubcategories($parentid) {
  580.         global $db;
  581.        
  582.         $subcategories = $db->query( "SELECT id FROM " . PREFIX . "_category WHERE parentid = '$parentid'" );
  583.        
  584.         while ( $subcategory = $db->get_row( $subcategories ) ) {
  585.             DeleteSubcategories( $subcategory['id'] );
  586.            
  587.             $db->query( "DELETE FROM " . PREFIX . "_category WHERE id = '" . $subcategory['id'] . "'" );
  588.         }
  589.     }
  590.    
  591.     if( ! $catid ) {
  592.         msg( "error", $lang['cat_error'], $lang['cat_noid'], "$PHP_SELF?mod=categories" );
  593.     }
  594.    
  595.     $row = $db->super_query( "SELECT count(*) as count FROM " . PREFIX . "_post WHERE category regexp '[[:<:]]($catid)[[:>:]]'" );
  596.    
  597.     if( $row['count'] ) {
  598.        
  599.         if( is_array( $_REQUEST['new_category'] ) ) {
  600.             if( ! in_array( $catid, $new_category ) ) {
  601.                
  602.                 $category_list = $db->safesql( htmlspecialchars( strip_tags( stripslashes( implode( ',', $_REQUEST['new_category']))), ENT_QUOTES ) );
  603.                
  604.                 $db->query( "UPDATE " . PREFIX . "_post set category='$category_list' WHERE category regexp '[[:<:]]($catid)[[:>:]]'" );
  605.                
  606.                 $db->query( "DELETE FROM " . PREFIX . "_category WHERE id='$catid'" );
  607.                
  608.                 DeleteSubcategories( $catid );
  609.                
  610.                 @unlink( ENGINE_DIR . '/cache/system/category.php' );
  611.                
  612.                 clear_cache();
  613.                
  614.                 msg( "info", $lang['cat_delok'], $lang['cat_delok_1'], "?mod=categories" );
  615.             }
  616.         }
  617.        
  618.         msg( "info", $lang['all_info'], "<form action=\"\" method=\"post\">{$lang['comm_move']} <select name=\"new_category[]\" class=\"cat_select\" align=\"absmiddle\" multiple>" . CategoryNewsSelection( 0, 0 ) . "</select> <input class=\"edit\" type=\"submit\" value=\"{$lang['b_start']}\"></form>", "$PHP_SELF?mod=categories" );
  619.    
  620.     } else {
  621.        
  622.         $db->query( "DELETE FROM " . PREFIX . "_category WHERE id='$catid'" );
  623.        
  624.         DeleteSubcategories( $catid );
  625.        
  626.         @unlink( ENGINE_DIR . '/cache/system/category.php' );
  627.        
  628.         if ($cat_info[$catid]['parentid'] == 0)
  629.             msg( "info", $lang['cat_delok'], "Сериал был успешно удалён", "?mod=categories" );
  630.         else
  631.             msg( "info", $lang['cat_delok'], "Сезон был успешно удалён", "?mod=categories&action=season_list&serial_id=" . $cat_info[$catid]['parentid'] );
  632.        
  633.         clear_cache();
  634.        
  635.         msg( "info", $lang['cat_delok'], $lang['cat_delok_1'], "?mod=categories" );
  636.     }
  637. }
  638. // ********************************************************************************
  639. // Редактирование категории
  640. // ********************************************************************************
  641. elseif( $action == "edit" ) {
  642.    
  643.     echoheader( "options", $lang['cat_head'] );
  644.    
  645.     $catid = intval( $_GET['catid'] );
  646.    
  647.     if( ! $catid ) {
  648.         msg( "error", $lang['cat_error'], $lang['cat_noid'], "$PHP_SELF?mod=categories" );
  649.     }
  650.    
  651.     $row = $db->super_query( "SELECT * FROM " . PREFIX . "_category WHERE id = '$catid'" );
  652.    
  653.     if( ! $row['id'] ) msg( "error", $lang['cat_error'], $lang['cat_noid'], "$PHP_SELF?mod=categories" );
  654.    
  655.     include_once ENGINE_DIR . '/classes/parse.class.php';
  656.     $parse = new ParseFilter( Array (), Array (), 1, 1 );
  657.    
  658.     $categorylist = cats_main( 0, $row['id'] );
  659.     $skinlist = SelectSkin( $row['skin'] );
  660.    
  661.     foreach (unserialize($row['janre']) as $key => $value ) {
  662.         $ganre[] = $value;
  663.     }
  664.     $row['janre'] = implode(", ", $ganre);
  665.    
  666.     foreach (unserialize($row['translate']) as $key => $value ) {
  667.         $translator[] = $value;
  668.     }
  669.     $row['translate'] = implode(", ", $translator);
  670.    
  671.     foreach (unserialize($row['edit']) as $key => $value ) {
  672.         $edition[] = $value;
  673.     }
  674.     $row['edit'] = implode(", ", $edition);
  675.    
  676.     foreach (unserialize($row['design']) as $key => $value ) {
  677.         $designer[] = $value;
  678.     }
  679.     $row['design'] = implode(", ", $designer);
  680.    
  681.     foreach (unserialize($row['lyric']) as $key => $value ) {
  682.         $lyrics[] = $value;
  683.     }
  684.     $row['lyric'] = implode(", ", $lyrics);
  685.    
  686.     foreach (unserialize($row['dub']) as $key => $value ) {
  687.         $dubber[] = $value;
  688.     }
  689.     $row['dub'] = implode(", ", $dubber);
  690.    
  691.     foreach (unserialize($row['country']) as $key => $value ) {
  692.         $country[] = $value;
  693.     }
  694.     $row['country'] = implode(", ", $country);
  695.    
  696.     $row['name'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['name'] ) );
  697.     $row['metatitle'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['metatitle'] ) );
  698.     $row['descr'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['descr'] ) );
  699.     $row['lir'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['lir'] ) );
  700.     $row['titry'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['titry'] ) );
  701.     $row['forum'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['forum'] ) );
  702.     $row['keywords'] = stripslashes( preg_replace( array ("'\"'", "'\''" ), array ("&quot;", "&#039;" ), $row['keywords'] ) );
  703.    
  704.     $row['news_sort'] = makeDropDown( array ("" => $lang['sys_global'], "date" => $lang['opt_sys_sdate'], "rating" => $lang['opt_sys_srate'], "news_read" => $lang['opt_sys_sview'], "title" => $lang['opt_sys_salph'] ), "news_sort", $row['news_sort'] );
  705.     $row['news_msort'] = makeDropDown( array ("" => $lang['sys_global'], "DESC" => $lang['opt_sys_mminus'], "ASC" => $lang['opt_sys_mplus'] ), "news_msort", $row['news_msort'] );
  706.  
  707.     for ($i = date("Y"); $i >= 1917; $i--)
  708.         $years[$i] = $i;
  709.        
  710.     $year = MakeDropDown($years, 'year', $row['year']);
  711.    
  712.     $type = MakeDropDown(array("TV"=>"TV","OVA"=>"OVA","ONA"=>"ONA","Special"=>"Спешл","Movie"=>"Полнометражка","Hentai"=>"Хентай"), 'type', $row['type']);
  713.        
  714.     $studio = MakeDropDown2(array("8bit"=>"8bit","A-1+Pictures+Inc"=>"A1 Pictures Inc.","Actas+Inc"=>"Actas Inc.","AIC"=>"AIC","AIC+A.S.T.A"=>"AIC A.S.T.A.","AIC+PLUS"=>"AIC PLUS","AIC+Spirits"=>"AIC Spirits","Aniplex"=>"Aniplex","ARMS"=>"ARMS","Artland"=>"Artland","Ashi+Productions"=>"Ashi Productions","asread"=>"asread","Bee+Train"=>"Bee Train","BONES"=>"BONES","Brains+Base"=>"Brains Base","Chaos+Project"=>"Chaos Project","Charaction"=>"Charaction","Cinema+Citrus"=>"Cinema Citrus","CoMix+Wave+Inc"=>"CoMix Wave Inc.","David+Production"=>"David Production","Dogakobo"=>"Dogakobo","Easyfilm"=>"Easyfilm","FEEL"=>"FEEL","Gainax"=>"Gainax","GoHands"=>"GoHands","Gonzo"=>"Gonzo","Group+TAC"=>"Group TAC","Hal+Film+Maker"=>"Hal Film Maker","J.C.+Staff"=>"J.C. Staff","Jinnis+Animation+Studios"=>"Jinnis Animation Studios","Kitty"=>"Kitty","Kyoto+Animation"=>"Kyoto Animation","LMD"=>"LMD","MAD+House"=>"MAD House","Manglobe+Inc"=>"Manglobe Inc.","MAPPA"=>"MAPPA","Milky"=>"Milky","Nippon+Animation"=>"Nippon Animation","Nippon+TV"=>"Nippon TV","Nomad"=>"Nomad","Ordet"=>"Ordet","Oriental+Light+and+Magic"=>"Oriental Light and Magic","P.A.+Works"=>"P.A. Works","Production+I.G"=>"Production I.G","Satelight"=>"Satelight","Seven"=>"Seven","Seven+Arcs"=>"Seven Arcs","Shaft"=>"Shaft","Shochiku"=>"Shochiku","Silver+Link"=>"Silver Link","Studio+4C"=>"Studio 4°C","Studio+Barcelona"=>"Studio Barcelona","Studio+Chizu"=>"Studio Chizu","Studio+Comet"=>"Studio Comet","Studio+DEEN"=>"Studio DEEN","Studio+Gallop"=>"Studio Gallop","Studio+Ghibli"=>"Studio Ghibli","Studio+Pierrot"=>"Studio Pierrot","Sunrise"=>"Sunrise","Synergy+Japan"=>"Synergy Japan","Tatsunoko"=>"Tatsunoko","Telecom+Animation+Film"=>"Telecom Animation Film","The+Answer+Studio"=>"The Answer Studio","TMS"=>"TMS","Toei+Animation"=>"Toei Animation","Triangle+Staff"=>"Triangle Staff","Trigger"=>"Trigger","UFO+Table"=>"UFO Table","Visual+Science+Laboratory"=>"Visual Science Laboratory","WAO+World"=>"WAO! World","White+Fox"=>"White Fox","Xebec"=>"Xebec","ZEXCS"=>"ZEXCS"), 'studio', $row['studio']);
  715.    
  716.     $season_num = sub_cats_numm(intval($_REQUEST['serial_id'])) + 1;
  717.  
  718.     $descr_content = $parse->decodeBBCodes( $row['descr_content'], false );
  719.     $lir_content = $parse->decodeBBCodes( $row['lir_content'], false );
  720.     $titry_content = $parse->decodeBBCodes( $row['titry_content'], false );
  721.     $forum_content = $parse->decodeBBCodes( $row['forum_content'], false );
  722.     $treiler_video = $parse->decodeBBCodes( $row['video'], false );
  723.     $i = 0;
  724.     if ($row['gallery'] AND count(unserialize($row['gallery'])) > 0) { unset($i);
  725.    
  726.         foreach (unserialize($row['gallery']) as $key => $image) { $i++;
  727.        
  728.             if ($i == 1)
  729.                 $gallery = "<div class=\"unterline\"></div>";
  730.            
  731.             $gallery .= <<<HTML
  732.         <table cellpadding="0" cellspacing="5" border="0" style="width:100%;" id="file_block_{$key}">
  733.             <tr align="left">
  734.                 <td width="24%" valign="middle">Фотo {$i}</td>
  735.                 <td>
  736.                     <input name="gallery[{$key}]" type="file"/> <a href="#" class="hintanchor" onmouseover="showhint('<img src=\'/uploads/stills/mini/{$image}\'>', this, event, '250px')">[?]</a>
  737.                     <input name="delete[{$key}]" type="checkbox" value="1"> удалить
  738.                 </td>
  739.             </tr>
  740.         </table>
  741. HTML;
  742.            
  743.         }
  744.    
  745.     }
  746.  
  747. if ($row['icon']) {
  748.  
  749. $poster = <<<HTML
  750.     <tr>
  751.         <td height="29" style="padding-left:5px;">Удалить картинку:</td>
  752.         <td><select name="del_scr"><option value="1">Да</option><option value="0" selected>Нет</option></select></td>
  753.     </tr>
  754.     <tr>
  755.         <td height="29" style="padding-left:5px;">Загруженная картинка:</td>
  756.         <td><a href="{$row['icon']}" target="_blank">Смотреть</a></td>
  757.     </tr>
  758.     <tr>
  759.         <td style="padding:4px;">Постер</td>
  760.         <td><input style="width:400px;" type="file" name="cat_icon" /></td>
  761.     </tr>
  762. HTML;
  763.  
  764.  
  765. } else {
  766.  
  767. $poster = <<<HTML
  768.     <tr>
  769.         <td style="padding:4px;">Постер</td>
  770.         <td><input class="edit bk" type="file" name="cat_icon" /></td>
  771.     </tr>
  772. HTML;
  773. }
  774.     $i = intval($i);
  775.     echo <<<HTML
  776. <script type="text/javascript">
  777. var foto = {$i};
  778. var total = foto;
  779.      
  780. $(document).ready(function() {
  781.     $("#add_file_jq").click(function () {
  782.    
  783.         total++;
  784.         foto++;
  785.        
  786.             $("#add_file_block").before(
  787.             '<table cellpadding="0" cellspacing="5" border="0" style="width:100%;" id="file_block_'+total+'">'
  788.             +'<tr align="left">'
  789.                 +'<td width="24%" valign="middle">Фотo '+foto+'</td>'
  790.                 +'<td><input name="gallery['+total+']" type="file" /></td>'
  791.             +'</tr>'
  792.             +'</table>');
  793.        
  794.  
  795.        
  796.         return false;
  797.     });
  798.    
  799.  
  800.    
  801.     $("#del_file_jq").click(function () {
  802.        
  803.         if (total > $i) {
  804.             $("#file_block_"+total).remove();
  805.             total = total - 1;
  806.             foto = foto - 1;
  807.             return false;
  808.         }
  809.     });
  810.    
  811.    
  812. //$("#add_file_jq").click();
  813.    
  814.    
  815. });
  816.  
  817. </script>
  818. <script type="text/javascript">
  819. function template(temp) {
  820.     $.post("http://shiranaitenshi.tk/engine/modules/news_template.php",
  821.         {edit:temp},
  822.         function(data){
  823.             var obj = $.parseJSON(data);
  824.             $('#lir').val(obj.lir);
  825.             $('#forum').val(obj.forum);
  826.     });
  827. }
  828. </script>
  829. <form ENCTYPE="multipart/form-data" method="post" action="">
  830. <div style="padding-top:5px;padding-bottom:2px;">
  831. <table width="100%">
  832.     <tr>
  833.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  834.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  835.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  836.     </tr>
  837.     <tr>
  838.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  839.         <td style="padding:5px;" bgcolor="#FFFFFF">
  840. <table width="100%">
  841.     <tr>
  842.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang['cat_edit']}</div></td>
  843.     </tr>
  844. </table>
  845. <div class="unterline"></div>
  846. <table width="100%">
  847. {$poster}
  848.     <tr>
  849.         <td width="260" style="padding:4px;">{$lang['cat_name']}</td>
  850.         <td><input style="width:500px;" value="{$row['name']}" type="text" name="cat_name"></td>
  851.     </tr>
  852.  
  853.     <tr>
  854.         <td width="160" style="padding:4px;">Оригинальное название</td>
  855.         <td><input style="width:300px;" type="text" name="real_name" value="{$row['real_name']}"> или на английском языке</td>
  856.     </tr>  
  857.         <td style="padding:4px;">{$lang['cat_url']}</td>
  858.         <td><input style="width:500px;" value="{$row['alt_name']}" type="text" name="alt_cat_name"></td>
  859.     </tr>
  860.     <tr>
  861.         <td style="padding:4px;">Страна</td>
  862.         <td><input type="text" name="country" style="width:500px;" value="{$row['country']}"></td>
  863.     </tr>
  864.     <tr>
  865.         <td style="padding:4px;">Год</td>
  866.         <td>{$year}</td>
  867.     </tr>
  868.     <tr>
  869.         <td style="padding:4px;">Жанр</td>
  870.         <td><input type="text" name="ganre" style="width:500px;" value="{$row['janre']}"></td>
  871.     </tr>
  872.     <tr>
  873.         <td style="padding:4px;">Тип</td>
  874.         <td>{$type}</td>
  875.     </tr>
  876.     <tr>
  877.         <td style="padding:4px;">Продолжительность<br>В виде: 25 мин., (13 эп.)</td>
  878.         <td><input type="text" name="prod" style="width:500px;" value="{$row['prod']}"></td>
  879.      </tr>
  880.     <tr>
  881.         <td style="padding:4px;">Режиссёр</td>
  882.         <td><input type="text" name="director" style="width:500px;" value="{$row['director']}"></td>
  883.      </tr>
  884.     <tr>
  885.         <td style="padding:4px;">Снято по манге</td>
  886.         <td><input type="text" name="manga" style="width:500px;" value="{$row['manga']}"></td>
  887.      </tr>
  888.     <tr>
  889.         <td style="padding:4px;">Автор оригинала</td>
  890.         <td><input type="text" name="original" style="width:500px;" value="{$row['original']}"></td>
  891.      </tr>
  892.     <tr>
  893.         <td style="padding:4px;">Студия</td>
  894.         <td>{$studio}<span id="studio"><img src="http://st.sakuranight.net/8bit.jpg"></span></td>
  895.     </tr>
  896.     <script type="text/javascript">
  897.     //<![CDATA[
  898.        $(function() {
  899.        $("#studio-select").change(function() {
  900.        var graphicFileName = $("#studio-select option:selected").attr("value");
  901.        var newCode = '<img src="http://st.sakuranight.net/' + graphicFileName + '.jpg">';
  902.        $("#studio").html(newCode);
  903.             });
  904.        });
  905.  
  906.     //]]>
  907.     </script>
  908.     <tr>
  909.             <td style="padding:4px;">Переводчик</td>
  910.             <td><input type="text" name="translator" style="width:500px;" value="{$row['translate']}"></td>
  911.     </tr>
  912.     <tr>
  913.             <td style="padding:4px;">Редактор</td>
  914.             <td><input type="text" name="edition" style="width:500px;" value="{$row['edit']}"></td>
  915.     </tr>
  916.     <tr>
  917.             <td style="padding:4px;">Оформление</td>
  918.             <td><input type="text" name="designer" style="width:500px;" value="{$row['design']}"></td>
  919.     </tr>
  920.     <tr>
  921.             <td style="padding:4px;">Лирика</td>
  922.             <td><input type="text" name="lyrics" style="width:500px;" value="{$row['lyric']}"></td>
  923.     </tr>
  924.     <tr>
  925.             <td style="padding:4px;">Озвучиватели</td>
  926.             <td><input type="text" name="dubber" style="width:500px;" value="{$row['dub']}"></td>
  927.     </tr>  
  928. </table>
  929. <div style="padding-left:20px;">
  930. {$gallery}
  931. <span id="add_file_block"></span>
  932. </div>
  933. <table width="100%">
  934. HTML;
  935.    
  936.     if( $config['allow_admin_wysiwyg'] == "yes" ) {
  937.        
  938.         include (ENGINE_DIR . '/editor/shortnews.php');
  939.    
  940.     } else {
  941.  
  942.         $bb_editor = true;
  943.         include (ENGINE_DIR . '/inc/include/inserttag.php');
  944.        
  945.         echo <<<HTML
  946.     <tr>
  947.         <td  width="260" style="padding:4px;">Описание сериала</td>
  948.         <td>{$bb_code}
  949.     <textarea rows="16" style="width:97%; padding:5px;" onclick="setFieldName(this.name)" name="short_story" id="descr" class="bk">{$descr_content}</textarea>
  950.     </td></tr>
  951.     <tr>
  952.         <td  width="260" style="padding:4px;">Лирика (Если лирики нет, пишем: )<br><span style="text-align:left;font-size:8px;" ><b>На данный момент лирики нет, её либо не перевели, либо ещё не добавили. Вы можете обратится в стол заказов и заказать лирику к этому релизу или попросить добавить ваш вариант перевода. Спасибо!</b></span></td>
  953.         <td>{$bb_code}
  954.     <textarea rows="16" style="width:97%; padding:5px;" padding:5px;" onclick="setFieldName(this.name)" name="lir" id="lir" class="f_textarea">{$lir_content}</textarea>
  955.     </td></tr>
  956.     <tr>
  957.         <td width="260" style="padding:4px;">Ссылка на субтитры</td>
  958.         <td><input style="width:500px;" onclick="setFieldName(this.name)" name="titry" id="titry" value="{$titry_content}">
  959.     </td></tr>
  960.     <tr>
  961.         <td width="260" style="padding:4px;">Тема на форуме <a href="#" class="hintanchor" onmouseover="showhint('Если нет темы на форуме, то вводим: http://bit.ly/stforum (ссылка ниже)', this, event, '320px')">[?]</a><br><span style="text-align:left;font-size:8px;" ><b>http://bit.ly/stforum</b></span></td>
  962.         <td><input style="width:500px;" onclick="setFieldName(this.name)" name="forum" id="forum" value="{$forum_content}">
  963.     </td></tr>
  964. HTML;
  965.     }
  966.     echo <<<HTML
  967.     <tr>
  968.         <td style="padding:4px;">Трейлер</td>
  969.         <td><input name="treiler"  style="width:500px;" onclick="setFieldName(this.name)" name="short_story2" id="short_story2" value="{$treiler_video}"></td>
  970.     </tr>
  971.     <tr>
  972.         <td style="padding:4px;">Идентификатор опроса</td>
  973.         <td><input style="width:500px;" value="{$row['vk_poll']}" type="text" name="vk_poll"></td>
  974.     </tr>
  975.     <tr>
  976.             <td style="padding:4px;">Мета-титл</td>
  977.             <td><input type="text" name="meta_title" style="width:500px;" value="{$row['metatitle']}"></td>
  978.         </tr>
  979.     <tr>   
  980.     <tr>
  981.         <td style="padding:4px;">Дескрипшн</td>
  982.         <td><textarea name="descr" style="width:500px;height:50px;" onclick="setFieldName(this.name)" name="short_story2" id="short_story2" class="bk">{$row['descr']}</textarea></td>
  983.     </tr>
  984.         </tr>
  985.         <tr>
  986.             <td style="padding:4px;">{$lang['meta_keys']}</td>
  987.             <td><textarea name="keywords" style="width:500px;height:50px;">{$row['keywords']}</textarea></td>
  988.         </tr>
  989.     <tr>
  990.         <td colspan="2"><div class="hr_line"></div></td>
  991.     </tr>
  992.     <tr>
  993.         <td style="padding:4px;">&nbsp;</td>
  994.         <td><input type="submit" class="buttons" value="&nbsp;&nbsp;{$lang['vote_edit']}&nbsp;&nbsp;">
  995.   <input type=hidden name=action value=doedit>
  996.   <input type="hidden" name="user_hash" value="$dle_login_hash" />
  997.   <input type=hidden name=catid value=$row[id]>
  998.     </tr>
  999. </table>
  1000. </td>
  1001.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  1002.     </tr>
  1003.     <tr>
  1004.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  1005.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  1006.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  1007.     </tr>
  1008. </table>
  1009. </div></form>
  1010. HTML;
  1011.    
  1012.     echofooter();
  1013.     die();
  1014.  
  1015. }
  1016. // ********************************************************************************
  1017. // Запись отредактированной категории
  1018. // ********************************************************************************
  1019. elseif( $action == "doedit" ) {
  1020.    
  1021.     if( $_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash ) {
  1022.        
  1023.         die( "Hacking attempt! User not found" );
  1024.    
  1025.     }
  1026.  
  1027.    
  1028.     include_once ENGINE_DIR . '/classes/parse.class.php';
  1029.     $parse = new ParseFilter( Array (), Array (), 1, 1 );
  1030.    
  1031.     $quotes = array ("\x27", "\x22", "\x60", "\t", "\n", "\r", '"' );
  1032.  
  1033.     $cat_name  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['cat_name'] ) ), ENT_QUOTES) );
  1034.     $skin_name = trim( totranslit($_POST['skin_name'], false, false) );
  1035.     $cat_icon  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['cat_icon']) ), ENT_QUOTES) );
  1036.     $alt_cat_name = totranslit( stripslashes( $_POST['alt_cat_name'] ), true, false );
  1037.    
  1038.     $year = intval($_POST['year']);
  1039.     $type = intval($_POST['type']);
  1040.     $studio = intval($_POST['studio']);
  1041.     $actors  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['actors'] ) ), ENT_QUOTES) );
  1042.     //$ganre  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['ganre'] ) ), ENT_QUOTES) );
  1043.     //$translator  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['translator'] ) ), ENT_QUOTES) );
  1044.     //$edition  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['edition'] ) ), ENT_QUOTES) );
  1045.     //$designer  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['designer'] ) ), ENT_QUOTES) );
  1046.     //$lyrics  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['lyrics'] ) ), ENT_QUOTES) );
  1047.     //$dubber  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['dubber'] ) ), ENT_QUOTES) );
  1048.     $director  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['director'] ) ), ENT_QUOTES) );
  1049.     $manga  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['manga'] ) ), ENT_QUOTES) );
  1050.     $original  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['original'] ) ), ENT_QUOTES) );
  1051.     $prod  = $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['prod'] ) ), ENT_QUOTES) );
  1052.  
  1053.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['ganre'] ) ), ENT_QUOTES) )) as $key => $value){
  1054.         $ganre[totranslit($value)] = $value; }
  1055.    
  1056.     $ganre = serialize($ganre);
  1057.  
  1058.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['translator'] ) ), ENT_QUOTES) )) as $key => $value){
  1059.         $translator[totranslit($value)] = $value; }
  1060.    
  1061.     $translator = serialize($translator);
  1062.  
  1063.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['edition'] ) ), ENT_QUOTES) )) as $key => $value){
  1064.         $edition[totranslit($value)] = $value; }
  1065.    
  1066.     $edition = serialize($edition);
  1067.  
  1068.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['designer'] ) ), ENT_QUOTES) )) as $key => $value){
  1069.         $designer[totranslit($value)] = $value; }
  1070.    
  1071.     $designer = serialize($designer);
  1072.  
  1073.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['lyrics'] ) ), ENT_QUOTES) )) as $key => $value){
  1074.         $lyrics[totranslit($value)] = $value; }
  1075.    
  1076.     $lyrics = serialize($lyrics);
  1077.    
  1078.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['dubber'] ) ), ENT_QUOTES) )) as $key => $value){
  1079.         $dubber[totranslit($value)] = $value; }
  1080.    
  1081.     $dubber = serialize($dubber);
  1082.    
  1083.     foreach (explode(", ", $db->safesql(  htmlspecialchars( strip_tags( stripslashes($_POST['country'] ) ), ENT_QUOTES) )) as $key => $value){
  1084.         $country[totranslit($value)] = $value; }
  1085.    
  1086.     $country = serialize($country);
  1087.        
  1088.     $catid = intval( $_REQUEST['catid'] );
  1089.     $parentid = intval( $_POST['parentid'] );  
  1090.  
  1091.     $meta_title = $db->safesql( htmlspecialchars ( strip_tags( stripslashes( $_POST['meta_title'] ) ) ) );
  1092.     $description = $db->safesql( strip_tags( stripslashes( $_POST['descr'] ) ) );
  1093.     $lirika = $db->safesql( strip_tags( stripslashes( $_POST['lir'] ) ) );
  1094.     $subs = $db->safesql( strip_tags( stripslashes( $_POST['titry'] ) ) );
  1095.     $board = $db->safesql( strip_tags( stripslashes( $_POST['forum'] ) ) );
  1096.     $keywords = $db->safesql( str_replace( $quotes, " ", strip_tags( stripslashes( $_POST['keywords'] ) ) ) );
  1097.    
  1098.     $short_tpl = totranslit( stripslashes( trim( $_POST['short_tpl'] ) ) );
  1099.     $full_tpl = totranslit( stripslashes( trim( $_POST['full_tpl'] ) ) );
  1100.     $date_start = $db->safesql( strip_tags( stripslashes( $_POST['date_start'] ) ) );
  1101.  
  1102.     if ( in_array($_POST['news_sort'], array("date", "rating", "news_read", "title")) ) {
  1103.  
  1104.         $news_sort = $db->safesql( $_POST['news_sort'] );
  1105.  
  1106.     } else $news_sort = "";
  1107.  
  1108.     if ( in_array($_POST['news_msort'], array("ASC", "DESC")) ) {
  1109.  
  1110.         $news_msort = $db->safesql( $_POST['news_msort'] );
  1111.  
  1112.     } else $news_msort = "";
  1113.  
  1114.     if ( $_POST['news_number'] > 0)
  1115.         $news_number = intval( $_POST['news_number'] );
  1116.     else $news_number = 0;
  1117.    
  1118.     if( ! $catid ) {
  1119.         msg( "error", $lang['cat_error'], $lang['cat_noid'], "$PHP_SELF?mod=categories" );
  1120.     }
  1121.     if( $cat_name == "" ) {
  1122.         msg( "error", $lang['cat_error'], $lang['cat_noname'], "javascript:history.go(-1)" );
  1123.     }
  1124.    
  1125.     $row = $db->super_query( "SELECT id, alt_name, icon, gallery FROM " . PREFIX . "_category WHERE alt_name = '$alt_cat_name'" );
  1126.    
  1127.     if( $row['id'] and $row['id'] != $catid ) {
  1128.         msg( "error", $lang['cat_error'], $lang['cat_eradd'], "javascript:history.go(-1)" );
  1129.     }
  1130.    
  1131.     if( in_array( $parentid, get_sub_cats( $catid ) ) ) {
  1132.         msg( "error", $lang['cat_error'], $lang['cat_noparentid'], "$PHP_SELF?mod=categories" );
  1133.     }
  1134.    
  1135.     /*Работа с картинкой блеать*/
  1136.    
  1137.     $images_gallery = unserialize($row['gallery']); //Наполняем массив списком загруженных фоток
  1138.    
  1139.     if (isset($_POST['delete']) AND count($_POST['delete']) > 0) {
  1140.        
  1141.         foreach ($_POST['delete'] as $id => $val) {
  1142.             @unlink(ROOT_DIR . "uploads/stills/" . $images_gallery[$id]);
  1143.             @unlink(ROOT_DIR . "uploads/stills/mini/" . $images_gallery[$id]);
  1144.             unset($images_gallery[$id]);
  1145.  
  1146.         }
  1147.     }
  1148.    
  1149.     if (check_gallery($_FILES['gallery']['tmp_name'])) { //Добавлены ли в форму новые фото или вообще добавлены ли они
  1150.    
  1151.         /*Небольшой конфиг*/
  1152.        
  1153.             $config_path_image_upload = ROOT_DIR . "/uploads/stills/"; //Место загрузки картинок
  1154.             $screenshot_width = 300; // ширина логотипа
  1155.             $screenshot_watermark = 1; // наложение водяного знака       
  1156.    
  1157.         foreach ($_FILES['gallery']['tmp_name'] as $key => $tmp_name) {
  1158.        
  1159.             $file_prefix = time () . "_";
  1160.  
  1161.             if (! is_dir ( $config_path_image_upload )) {
  1162.                 @mkdir ( $config_path_image_upload, 0777 );
  1163.                 @chmod ( $config_path_image_upload, 0777 );
  1164.             }
  1165.  
  1166.             if (! is_dir ( $config_path_image_upload ))
  1167.                 $error .= "- Directory Error. " . $config_path_image_upload . " cannot created. <br />";
  1168.  
  1169.             $allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
  1170.  
  1171.             if (! is_dir ( $config_path_image_upload . 'mini/' )) {
  1172.                 @mkdir ( $config_path_image_upload . 'mini/', 0777 );
  1173.                 @chmod ( $config_path_image_upload . 'mini/', 0777 );
  1174.             }
  1175.  
  1176.             if (! is_dir ( $config_path_image_upload . 'mini/' ))
  1177.                 $error .= "- Directory Error. " . $config_path_image_upload . "mini/ cannot created. <br />";
  1178.  
  1179.             $image = $_FILES['gallery']['tmp_name'][$key];
  1180.             $image_name = $_FILES['gallery']['name'][$key];
  1181.             $image_size = $_FILES['gallery']['size'][$key];
  1182.  
  1183.             $img_name_arr = explode ( ".", $image_name );
  1184.             $type = totranslit ( end ( $img_name_arr ) );
  1185.  
  1186.             if ($image_name != "")
  1187.             {
  1188.                 $curr_key = key ( $img_name_arr );
  1189.                 unset ( $img_name_arr [$curr_key] );
  1190.                 $image_name = totranslit ( implode ( ".", $img_name_arr ) ) . "." . $type;
  1191.             }
  1192.            
  1193.             $i++;
  1194.            
  1195.             /*if ($image_name == "")
  1196.                 $error .= "- Не удалось определить изображение. Фото № {$i}";
  1197.             else*/
  1198.             if (($image_name != "") AND !(in_array ( $type, $allowed_extensions ) or in_array ( strtolower ( $type ), $allowed_extensions )))
  1199.                 $error .= "- Данный тип изображения не поддерживается. Фото № {$i}";
  1200.             elseif ($image_size > ($config['max_up_size'] * 1024) and ! $config ['max_up_side'] AND $image_name !== "")
  1201.                 $error .= "- Размер загружаемого изображения превышает максимально допустимые размеры. Фото № {$i}";
  1202.             else {
  1203.                 @move_uploaded_file ( $image, $config_path_image_upload . $file_prefix . $image_name ) or $img_result = "<div><font color=red>$lang[images_uperr_3]</font></div>";
  1204.  
  1205.                 if (@file_exists ( $config_path_image_upload . $file_prefix . $image_name ))
  1206.                 {
  1207.                     @chmod ( $config_path_image_upload . $file_prefix . $image_name, 0666 );
  1208.  
  1209.                     include_once ENGINE_DIR . '/classes/thumb.class.php';
  1210.  
  1211.                     $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  1212.                     if ($thumb->size_auto ( $screenshot_width, 0 ))
  1213.                     {
  1214.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  1215.                         /*if ($screenshot_watermark == "1")
  1216.                             $thumb->insert_watermark ( $config ['max_watermark'] );*/
  1217.                         $thumb->save ( $config_path_image_upload . "mini/" . $file_prefix . $image_name );
  1218.                     }
  1219.                    
  1220.                     /*$thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  1221.                     if ($thumb->size_auto ( $screenshot_width2, 0 ))
  1222.                     {
  1223.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  1224.                         if ($screenshot_watermark == "1")
  1225.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  1226.                         $thumb->save ( $config_path_image_upload . "main/" . $file_prefix . $image_name );
  1227.                     }*/
  1228.  
  1229.                     if (@file_exists ( $config_path_image_upload . "mini/" . $file_prefix . $image_name )) {
  1230.                         $img_result_th .= "<div><font color=blue>$image_name -> $lang[images_thok]</font></div>";
  1231.                         $thumb_img = $image_name;
  1232.                     }
  1233.  
  1234.                     @chmod ( $config_path_image_upload . "mini/" . $file_prefix . $image_name, 0666 );
  1235.                     $config ['max_up_side'] = intval ( $config ['max_up_side'] );
  1236.  
  1237.                     if ($screenshot_watermark == "1" or $config ['max_up_side'])
  1238.                     {
  1239.                         $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  1240.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  1241.  
  1242.                         if ($config ['max_up_side'])
  1243.                             $thumb->size_auto ( $config ['max_up_side'] );
  1244.  
  1245.                         if ($screenshot_watermark == "1")
  1246.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  1247.  
  1248.                         $thumb->save ( $config_path_image_upload . $file_prefix . $image_name );
  1249.                     }
  1250.                 }
  1251.             }
  1252.            
  1253.            
  1254.             /*Собираем массив новых фоток (Свежих)*/
  1255.            
  1256.             if ($image_name)
  1257.                 $gallery_array[$key] = $file_prefix . $image_name;
  1258.            
  1259.         }
  1260.        
  1261.         if (count($gallery_array)) {
  1262.        
  1263.             foreach ($gallery_array as $id => $name) {
  1264.            
  1265.                 @unlink(ROOT_DIR . "uploads/stills/" . $images_gallery[$id]);
  1266.                 @unlink(ROOT_DIR . "uploads/stills/mini/" . $images_gallery[$id]);
  1267.  
  1268.                 $images_gallery[$id] = $name;
  1269.                
  1270.             }
  1271.            
  1272.            
  1273.         }
  1274.        
  1275.         //Формирование массива загруженных картинок
  1276.         if ($error)
  1277.             msg( "error", $lang['cat_error'], $error, "javascript:history.go(-1)" );
  1278.    
  1279.     }
  1280.    
  1281.         if (count($images_gallery) > 0)
  1282.             $images_gallery = serialize($images_gallery);
  1283.        
  1284.         $icon_name = end(explode("/", $row['icon']));
  1285.        
  1286.         $cat_icon = $row['icon'];
  1287.  
  1288.        
  1289.         $del_scr =  intval($_POST['del_scr']);
  1290.         if ($del_scr)
  1291.         {
  1292.            
  1293.                 @unlink ( ROOT_DIR . "/uploads/posters/" . $icon_name );
  1294.                 @unlink ( ROOT_DIR . "/uploads/posters/mini/".$icon_name );
  1295.                 @unlink ( ROOT_DIR . "/uploads/posters/main/".$icon_name );
  1296.            
  1297.             $thumb_img = "";
  1298.         }
  1299.         else
  1300.         {
  1301.             $file_name_thumb = $icon_name;
  1302.             $thumb_img = $icon_name;
  1303.         }
  1304.  
  1305.         $screenshot_width = 300; // ширина логотипа
  1306.         $screenshot_width2 = 60; // ширина логотипа
  1307.         $screenshot_watermark = 1; // наложение водяного знака
  1308.  
  1309.         $error = "";
  1310.        
  1311.         if (!empty($_FILES['cat_icon']['name']))
  1312.         {
  1313.        
  1314.             $file_prefix = time () . "_";
  1315.             $config_path_image_upload = ROOT_DIR . "/uploads/posters/";
  1316.  
  1317.             if (! is_dir ( $config_path_image_upload )) {
  1318.                 @mkdir ( $config_path_image_upload, 0777 );
  1319.                 @chmod ( $config_path_image_upload, 0777 );
  1320.             }
  1321.  
  1322.             if (! is_dir ( $config_path_image_upload ))
  1323.                 $error .= "- Directory Error. " . $config_path_image_upload . " cannot created. <br />";
  1324.  
  1325.             $allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
  1326.  
  1327.             if (! is_dir ( $config_path_image_upload . 'mini/' )) {
  1328.                 @mkdir ( $config_path_image_upload . 'mini/', 0777 );
  1329.                 @chmod ( $config_path_image_upload . 'mini/', 0777 );
  1330.             }
  1331.  
  1332.             if (! is_dir ( $config_path_image_upload . 'mini/' ))
  1333.                 $error .= "- Directory Error. " . $config_path_image_upload . "mini/ cannot created. <br />";
  1334.  
  1335.             $current_image = "cat_icon";
  1336.             $image = $_FILES [$current_image] ['tmp_name'];
  1337.             $image_name = $_FILES [$current_image] ['name'];
  1338.             $image_size = $_FILES [$current_image] ['size'];
  1339.  
  1340.             $img_name_arr = explode ( ".", $image_name );
  1341.             $type = totranslit ( end ( $img_name_arr ) );
  1342.  
  1343.             if ($image_name != "")
  1344.             {
  1345.                 $curr_key = key ( $img_name_arr );
  1346.                 unset ( $img_name_arr [$curr_key] );
  1347.                 $image_name = totranslit ( implode ( ".", $img_name_arr ) ) . "." . $type;
  1348.             }
  1349.  
  1350.             if ($image_name == "")
  1351.                 $error .= "- Не удалось определить изображение.";
  1352.             elseif (! (in_array ( $type, $allowed_extensions ) or in_array ( strtolower ( $type ), $allowed_extensions )))
  1353.                 $error .= "- Данный тип изображения не поддерживается.";
  1354.             elseif ($image_size > ($config['max_up_size'] * 1024) and ! $config ['max_up_side'])
  1355.                 $error .= "- Размер загружаемого изображения превышает максимально допустимые размеры.";
  1356.             else {
  1357.                 @move_uploaded_file ( $image, $config_path_image_upload . $file_prefix . $image_name ) or $img_result = "<div><font color=red>$lang[images_uperr_3]</font></div>";
  1358.  
  1359.                 if (@file_exists ( $config_path_image_upload . $file_prefix . $image_name ))
  1360.                 {
  1361.                     @chmod ( $config_path_image_upload . $file_prefix . $image_name, 0666 );
  1362.  
  1363.                     include_once ENGINE_DIR . '/classes/thumb.class.php';
  1364.  
  1365.                     $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  1366.                     if ($thumb->size_auto ( $screenshot_width, 0 ))
  1367.                     {
  1368.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  1369.                         if ($screenshot_watermark == "1")
  1370.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  1371.                         $thumb->save ( $config_path_image_upload . "mini/" . $file_prefix . $image_name );
  1372.                     }
  1373.                    
  1374.                     $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  1375.                     if ($thumb->size_auto ( $screenshot_width2, 0 ))
  1376.                     {
  1377.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  1378.                         if ($screenshot_watermark == "1")
  1379.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  1380.                         $thumb->save ( $config_path_image_upload . "main/" . $file_prefix . $image_name );
  1381.                     }
  1382.  
  1383.                     if (@file_exists ( $config_path_image_upload . "mini/" . $file_prefix . $image_name )) {
  1384.                         $img_result_th .= "<div><font color=blue>$image_name -> $lang[images_thok]</font></div>";
  1385.                         $thumb_img = $image_name;
  1386.                     }
  1387.  
  1388.                     @chmod ( $config_path_image_upload . "mini/" . $file_prefix . $image_name, 0666 );
  1389.                     $config ['max_up_side'] = intval ( $config ['max_up_side'] );
  1390.  
  1391.                     if ($screenshot_watermark == "1" or $config ['max_up_side'])
  1392.                     {
  1393.                         $thumb = new thumbnail ( $config_path_image_upload . $file_prefix . $image_name );
  1394.                         $thumb->jpeg_quality ( $config ['jpeg_quality'] );
  1395.  
  1396.                         if ($config ['max_up_side'])
  1397.                             $thumb->size_auto ( $config ['max_up_side'] );
  1398.  
  1399.                         if ($screenshot_watermark == "1")
  1400.                             $thumb->insert_watermark ( $config ['max_watermark'] );
  1401.  
  1402.                         $thumb->save ( $config_path_image_upload . $file_prefix . $image_name );
  1403.                     }
  1404.                 }
  1405.             }
  1406.             $file_name_thumb = $image_name;
  1407.  
  1408.             if ($file_name_thumb)
  1409.                 $file_name_thumb = $file_prefix . $file_name_thumb;
  1410.             else
  1411.                 $file_name_thumb = "";
  1412.  
  1413.             if ($thumb_img)
  1414.                 $thumb_img = $file_prefix . $thumb_img;
  1415.             else
  1416.                 $thumb_img = "";
  1417.                
  1418.             if ($thumb_img)
  1419.                 $cat_icon = $config['http_home_url'] . "uploads/posters/mini/" . $thumb_img;
  1420.             else
  1421.                 $cat_icon = $config['http_home_url'] . "uploads/posters/" . $thumb_img;
  1422.        
  1423.         }
  1424.  
  1425.         ##=============================Сохранение данных в базу данных===================================##
  1426.  
  1427.         if ($error)
  1428.             msg( "error", $lang['cat_error'], $error, "javascript:history.go(-1)" );
  1429.            
  1430.     $vk_poll = $db->safesql( str_replace( $quotes, " ", strip_tags( stripslashes( $_POST['vk_poll'] ) ) ) );
  1431.     $descr_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['short_story'], false ) ) );
  1432.     $lir_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['lir'], true ) ) );
  1433.     $titry_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['titry'], true ) ) );
  1434.     $forum_content = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['forum'], true ) ) );
  1435.     //$video = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['treiler'], false ) ) );
  1436.     $video = $db->safesql( $parse->BB_Parse($_POST['treiler']) );
  1437.     $real_name = $db->safesql( htmlspecialchars ( strip_tags( stripslashes( $_POST['real_name'] ) ) ) );
  1438.    
  1439.     //echo $video;
  1440.    
  1441.     $db->query( "UPDATE " . PREFIX . "_category set parentid='$parentid', real_name = '$real_name', date_start = '$date_start', vk_poll = '$vk_poll', descr_content = '$descr_content', lir_content='$lir_content', titry_content='$titry_content', forum_content='$forum_content', video = '$video', gallery = '$images_gallery', name='$cat_name', year='$year', type='$type', studio='$studio', country='$country', actors='$actors', janre='$ganre', translate='$translator', edit='$edition', design='$designer', lyric='$lyrics', dub='$dubber',  director='$director', manga='$manga', original='$original', prod='$prod', id_rating='".intval($_POST['id_rating'])."', alt_name='$alt_cat_name', icon='$cat_icon', skin='$skin_name', descr='$description', lir='$lirika', titry='$subs', forum='$board', keywords='$keywords', news_sort='$news_sort', news_msort='$news_msort', news_number='$news_number', short_tpl='$short_tpl', full_tpl='$full_tpl', metatitle='$meta_title' WHERE id='$catid'" );
  1442.    
  1443.     @unlink( ENGINE_DIR . '/cache/system/category.php' );
  1444.     clear_cache();
  1445.    
  1446.     msg( "info", $lang['cat_editok'], $lang['cat_editok_1'], "$PHP_SELF?mod=categories" );
  1447.    
  1448. } elseif ($action = "season_list" AND intval($_REQUEST['serial_id'])) {
  1449.  
  1450. echoheader( "options", $cat_info[intval($_REQUEST['serial_id'])]['name'] );
  1451.  
  1452. for ($i = date("Y"); $i >= 1917; $i--)
  1453.     $years[$i] = $i;
  1454.    
  1455. $year = MakeDropDown($years, 'year', $cat_info[intval($_REQUEST['serial_id'])]['year']);
  1456.  
  1457. $type = MakeDropDown(array("TV"=>"TV","OVA"=>"OVA","ONA"=>"ONA","Special"=>"Спешл","Movie"=>"Полнометражка","Hentai"=>"Хентай"), 'type', $cat_info[intval($_REQUEST['serial_id'])]['type']);
  1458.    
  1459. $studio = MakeDropDown2(array("8bit"=>"8bit","A-1+Pictures+Inc"=>"A1 Pictures Inc.","Actas+Inc"=>"Actas Inc.","AIC"=>"AIC","AIC+A.S.T.A"=>"AIC A.S.T.A.","AIC+PLUS"=>"AIC PLUS","AIC+Spirits"=>"AIC Spirits","Aniplex"=>"Aniplex","ARMS"=>"ARMS","Artland"=>"Artland","Ashi+Productions"=>"Ashi Productions","Bee+Train"=>"Bee Train","BONES"=>"BONES","Brains+Base"=>"Brains Base","Chaos+Project"=>"Chaos Project","Charaction"=>"Charaction","Cinema+Citrus"=>"Cinema Citrus","CoMix+Wave+Inc"=>"CoMix Wave Inc.","David+Production"=>"David Production","Dogakobo"=>"Dogakobo","Easyfilm"=>"Easyfilm","FEEL"=>"FEEL","Gainax"=>"Gainax","GoHands"=>"GoHands","Gonzo"=>"Gonzo","Group+TAC"=>"Group TAC","Hal+Film+Maker"=>"Hal Film Maker","J.C.+Staff"=>"J.C. Staff","Jinnis+Animation+Studios"=>"Jinnis Animation Studios","Kitty"=>"Kitty","Kyoto+Animation"=>"Kyoto Animation","LMD"=>"LMD","MAD+House"=>"MAD House","Manglobe+Inc"=>"Manglobe Inc.","MAPPA"=>"MAPPA","Milky"=>"Milky","Nippon+Animation"=>"Nippon Animation","Nippon+TV"=>"Nippon TV","Nomad"=>"Nomad","Ordet"=>"Ordet","Oriental+Light+and+Magic"=>"Oriental Light and Magic","P.A.+Works"=>"P.A. Works","Production+I.G"=>"Production I.G","Satelight"=>"Satelight","Seven"=>"Seven","Seven+Arcs"=>"Seven Arcs","Shaft"=>"Shaft","Shochiku"=>"Shochiku","Silver+Link"=>"Silver Link","Studio+4C"=>"Studio 4°C","Studio+Barcelona"=>"Studio Barcelona","Studio+Chizu"=>"Studio Chizu","Studio+Comet"=>"Studio Comet","Studio+DEEN"=>"Studio DEEN","Studio+Gallop"=>"Studio Gallop","Studio+Ghibli"=>"Studio Ghibli","Studio+Pierrot"=>"Studio Pierrot","Sunrise"=>"Sunrise","Synergy+Japan"=>"Synergy Japan","Tatsunoko"=>"Tatsunoko","Telecom+Animation+Film"=>"Telecom Animation Film","The+Answer+Studio"=>"The Answer Studio","TMS"=>"TMS","Toei+Animation"=>"Toei Animation","Triangle+Staff"=>"Triangle Staff","Trigger"=>"Trigger","UFO+Table"=>"UFO Table","Visual+Science+Laboratory"=>"Visual Science Laboratory","WAO+World"=>"WAO! World","White+Fox"=>"White Fox","Xebec"=>"Xebec","ZEXCS"=>"ZEXCS"), 'studio', $cat_info[intval($_REQUEST['serial_id'])]['studio']);
  1460.  
  1461. $season_num = sub_cats_numm(intval($_REQUEST['serial_id'])) + 1;
  1462. $parentid = intval($_REQUEST['serial_id']);
  1463. echo <<<HTML
  1464. <script type="text/javascript">
  1465.     function auto_keywords ( key )
  1466.     {
  1467.  
  1468.         //var wysiwyg = '{$config['allow_admin_wysiwyg']}';
  1469.  
  1470.         //if (wysiwyg == "1") {
  1471.         //  submit_all_data();
  1472.         //}
  1473.  
  1474.         var short_txt = '{$cat_info[intval($_REQUEST['serial_id'])]['name']} ' + '{$cat_info[intval($_REQUEST['serial_id'])]['metatitle']} ' + document.getElementById('s_n').value + ' ';
  1475.         var full_txt = document.getElementById('descr').value;
  1476.  
  1477.  
  1478.         ShowLoading('');
  1479.  
  1480.         $.post("engine/ajax/keywords.php", { short_txt: short_txt, full_txt: full_txt, key: key }, function(data){
  1481.    
  1482.             HideLoading('');
  1483.    
  1484.             if (key == 1) { $('#autodescr').val(data); }
  1485.             else { $('#autokeywords').val(data); }
  1486.    
  1487.         });
  1488.  
  1489.         return false;
  1490.     }
  1491. </script>
  1492. <form ENCTYPE="multipart/form-data" method="post" action="" >
  1493. <div style="padding-top:5px;padding-bottom:2px;">
  1494. <table width="100%">
  1495.     <tr>
  1496.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  1497.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  1498.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  1499.     </tr>
  1500.     <tr>
  1501.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  1502.         <td style="padding:5px;" bgcolor="#FFFFFF">
  1503. <table width="100%">
  1504.     <tr>
  1505.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">Новый сезон</div></td>
  1506.     </tr>
  1507. </table>
  1508. <div class="unterline"></div>
  1509. <table width="100%">
  1510.     <tr>
  1511.         <td width="160" style="padding:4px;">Название</td>
  1512.         <td><input style="width:300px;" type="text" name="cat_name" id="s_n" value="сезон {$season_num}"> или номер сезона</td>
  1513.     </tr>
  1514.     <tr>
  1515.         <td style="padding:4px;">{$lang['cat_url']}</td>
  1516.         <td><input style="width:300px;" type="text" name="alt_cat_name" value="{$cat_info[intval($_REQUEST['serial_id'])]['alt_name']}_{$season_num}"></td>
  1517.     </tr>
  1518.     <tr>
  1519.         <td width="160" style="padding:4px;">Доп. название</td>
  1520.         <td><input style="width:300px;" type="text" name="real_name" id="real_name" value=""> или на английском</td>
  1521.     </tr>  
  1522.     <tr>
  1523.         <td style="padding:4px;">Постер</td>
  1524.         <td><input style="width:400px;" type="file" name="cat_icon" /></td>
  1525.     </tr>
  1526.     <tr>
  1527.         <td style="padding:4px;">Год</td>
  1528.         <td>{$year}</td>
  1529.     </tr>
  1530.         <tr>
  1531.            <td style="padding:4px;">Дата выхода</td>
  1532.             <td><input style="width:100px;" type="text" name="date_start" style="width:500px;" value=""> ГГГГ-ММ-ДД</td>
  1533.         </tr>
  1534.     <tr>
  1535.         <td colspan="2"><div class="hr_line"></div></td>
  1536.     </tr>
  1537.  
  1538. HTML;
  1539.  
  1540.    
  1541.     if( $config['allow_admin_wysiwyg'] == "yes" ) {
  1542.        
  1543.         include (ENGINE_DIR . '/editor/shortnews.php');
  1544.    
  1545.     } else {
  1546.  
  1547.         $bb_editor = true;
  1548.         include (ENGINE_DIR . '/inc/include/inserttag.php');
  1549.        
  1550.         echo <<<HTML
  1551.     <tr>
  1552.         <td style="padding:4px;">Описание сезона</td>
  1553.         <td>{$bb_code}<textarea rows="16" style="width:97%; padding:5px;" onclick="setFieldName(this.name)" name="descr" id="short_story" class="bk"></textarea>
  1554.     </td></tr>
  1555. HTML;
  1556.     }
  1557. echo <<<HTML
  1558.     <tr>
  1559.         <td colspan="2"><div class="hr_line"></div></td>
  1560.     </tr>
  1561.     <tr>
  1562.         <td style="padding:4px;">Мета-титл</td>
  1563.         <td><textarea name="meta_title" style="width:97%;height:20px;" class="bk"></textarea></td>
  1564.     </tr>  
  1565.     <tr>
  1566.         <td style="padding:4px;">{$lang['meta_keys']}</td>
  1567.         <td><textarea name="keywords" id="autokeywords" style="width:97%;height:20px;" class="bk"></textarea></td>
  1568.     </tr>  
  1569.     <tr>
  1570.         <td style="padding:4px;">Дескрипшн</td>
  1571.         <td><textarea name="descr" style="width:97%;height:50px;" onclick="setFieldName(this.name)" name="short_story2" id="autodescr" class="bk">{$row['descr']}</textarea><br />
  1572.             <input onClick="auto_keywords(1)" type="button" class="btn" value="{$lang['btn_descr']}" style="width:170px;">&nbsp;
  1573.             <input onClick="auto_keywords(2)" type="button" class="btn" value="{$lang['btn_keyword']}" style="width:216px;"></td>
  1574.     </tr>
  1575.    
  1576.     <tr>
  1577.         <td colspan="2"><div class="hr_line"></div></td>
  1578.     </tr>  
  1579.     <tr>
  1580.         <td style="padding:4px;">&nbsp;</td>
  1581.         </td>
  1582.         <td><input type="submit" class="buttons" value="&nbsp;&nbsp;{$lang['vote_new']}&nbsp;&nbsp;">
  1583. <input type=hidden name=mod value=categories>
  1584. <input type="hidden" name="category" value="{$parentid}" />
  1585. <input type="hidden" name="user_hash" value="$dle_login_hash" />
  1586. <input type=hidden name=action value=add></td>
  1587.     </tr>
  1588. </table>
  1589. </td>
  1590.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  1591.     </tr>
  1592.     <tr>
  1593.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  1594.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  1595.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  1596.     </tr>
  1597. </table>
  1598. </div></form>
  1599. HTML;
  1600.  
  1601.     if (sub_cats_numm(intval($_REQUEST['serial_id'])) > 0) {
  1602.  
  1603. echo <<<HTML
  1604. <div style="padding-top:5px;padding-bottom:2px;">
  1605. <table width="100%">
  1606.     <tr>
  1607.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  1608.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  1609.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  1610.     </tr>
  1611.     <tr>
  1612.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  1613.         <td style="padding:5px;" bgcolor="#FFFFFF">
  1614. <table width="100%">
  1615.     <tr>
  1616.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$cat_info[intval($_REQUEST['serial_id'])]['name']}: Список сезонов</div></td>
  1617.     </tr>
  1618. </table>
  1619. <div class="unterline"></div>
  1620. <table width="100%">
  1621.     <tr>
  1622.         <td style="padding:2px;">ID</td>
  1623.         <td>Название</td>
  1624.         <td>{$lang['cat_url']}</td>
  1625.         <td>Постер</td>
  1626.         <td width="120">{$lang['cat_action']}</td>
  1627.     </tr>
  1628.     <tr>
  1629.         <td colspan="5"><div class="hr_line"></div></td>
  1630.     </tr>
  1631. HTML;
  1632.  
  1633.                 foreach ( $cat_info as $id => $value ) {
  1634.                    
  1635.                     if ($value['parentid'] == intval($_REQUEST['serial_id'])) {
  1636.                    
  1637.                     $category_name = $cat[$id];
  1638.                    
  1639.                     if( $config['allow_alt_url'] == "yes" ) $link = "<a class=\"list\" href=\"" . $config['http_home_url'] . get_url( $id ) . "/\" target=\"_blank\">" . stripslashes( $cat_info[$id]['name'] ) . "</a>";
  1640.                     else $link = "<a class=\"list\" href=\"{$config['http_home_url']}index.php?do=cat&category=" . $cat_info[$id]['alt_name'] . "\" target=\"_blank\">" . stripslashes( $cat_info[$id]['name'] ) . "</a>";
  1641.                    
  1642.                     echo "<tr>
  1643.                         <td height=\"14\">&nbsp;<b>" . $cat_info[$id]['id'] . "</b></td>
  1644.                         <td>&nbsp;$sublevelmarker&nbsp;" . $link . "</td>
  1645.                         <td>";
  1646.                     if( $cat_info[$id]['alt_name'] != "" ) {
  1647.                         echo $cat_info[$id]['alt_name'];
  1648.                     } else {
  1649.                         echo "---";
  1650.                     }
  1651.                     echo "</td><td>";
  1652.                     if( $cat_info[$id]['icon'] != "" ) {
  1653.                         echo "<img border=0 src=\"" . $cat_info[$id]['icon'] . "\" height=40 width=40 alt=\"" . $cat_info[$id]['icon'] . "\">";
  1654.                     } else {
  1655.                         echo "---";
  1656.                     }
  1657.  
  1658.                     echo "</td>
  1659.                         <td class=\"list\"><nobr>[<a href=\"?mod=categories&action=season_edit&season_id=" . $cat_info[$id]['id'] . "\">$lang[cat_ed]</a>] [<a class=maintitle href=\"?mod=categories&user_hash=" . $dle_login_hash . "&action=remove&catid=" . $cat_info[$id]['id'] . "\">$lang[cat_del]</a>]</nobr></td>
  1660.                         </tr>
  1661.                         <tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=5></td></tr>";
  1662.                    
  1663.                     }
  1664.                 }
  1665.  
  1666. echo <<<HTML
  1667. </table>
  1668. </td>
  1669.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  1670.     </tr>
  1671.     <tr>
  1672.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  1673.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  1674.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  1675.     </tr>
  1676. </table>
  1677. </div>
  1678. HTML;
  1679.    
  1680.     } else {
  1681.  
  1682.     echo <<<HTML
  1683. <div style="padding-top:5px;padding-bottom:2px;">
  1684. <table width="100%">
  1685.     <tr>
  1686.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  1687.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  1688.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  1689.     </tr>
  1690.     <tr>
  1691.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  1692.         <td style="padding:5px;" bgcolor="#FFFFFF">
  1693. <table width="100%">
  1694.     <tr>
  1695.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang['cat_list']}</div></td>
  1696.     </tr>
  1697. </table>
  1698. <div class="unterline"></div>
  1699. <table width="100%">
  1700.     <tr>
  1701.         <td height="100" align="center">Сезонов нет</td>
  1702.     </tr>
  1703. </table>
  1704. </td>
  1705.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  1706.     </tr>
  1707.     <tr>
  1708.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  1709.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  1710.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  1711.     </tr>
  1712. </table>
  1713. </div>
  1714. HTML;
  1715.    
  1716.     }
  1717.    
  1718. } elseif ($action = "season_edit" AND intval($_REQUEST['season_id'])) {
  1719.  
  1720. $row = $db->super_query("SELECT * FROM ".PREFIX."_category WHERE id = '".intval($_REQUEST['season_id'])."'");
  1721.     include_once ENGINE_DIR . '/classes/parse.class.php';
  1722.     $parse = new ParseFilter( Array (), Array (), 1, 1 );
  1723.     $row['descr_content'] = $parse->decodeBBCodes( $row['descr_content'], false );
  1724.     $row['lir_content'] = $parse->decodeBBCodes( $row['lir_content'], true );
  1725.     $row['titry_content'] = $parse->decodeBBCodes( $row['titry_content'], true );
  1726.     $row['forum_content'] = $parse->decodeBBCodes( $row['forum_content'], true );
  1727. if (!$row['id'])
  1728.     msg( "error", $lang['cat_error'], $lang['cat_eradd'], "javascript:history.go(-1)" );
  1729.  
  1730. echoheader( "options", $cat_info[intval($_REQUEST['serial_id'])]['name'] );
  1731.  
  1732. for ($i = date("Y"); $i >= 1917; $i--)
  1733.     $years[$i] = $i;
  1734.    
  1735. $year = MakeDropDown($years, 'year', $row['year']);
  1736. $type = MakeDropDown(array("TV"=>"TV","OVA"=>"OVA","ONA"=>"ONA","Special"=>"Спешл","Movie"=>"Полнометражка","Hentai"=>"Хентай"), 'type', $row['type']);
  1737. $studio = MakeDropDown2(array("8bit"=>"8bit","A-1+Pictures+Inc"=>"A1 Pictures Inc.","Actas+Inc"=>"Actas Inc.","AIC"=>"AIC","AIC+A.S.T.A"=>"AIC A.S.T.A.","AIC+PLUS"=>"AIC PLUS","AIC+Spirits"=>"AIC Spirits","Aniplex"=>"Aniplex","ARMS"=>"ARMS","Artland"=>"Artland","Ashi+Productions"=>"Ashi Productions","Bee+Train"=>"Bee Train","BONES"=>"BONES","Brains+Base"=>"Brains Base","Chaos+Project"=>"Chaos Project","Charaction"=>"Charaction","Cinema+Citrus"=>"Cinema Citrus","CoMix+Wave+Inc"=>"CoMix Wave Inc.","David+Production"=>"David Production","Dogakobo"=>"Dogakobo","Easyfilm"=>"Easyfilm","FEEL"=>"FEEL","Gainax"=>"Gainax","GoHands"=>"GoHands","Gonzo"=>"Gonzo","Group+TAC"=>"Group TAC","Hal+Film+Maker"=>"Hal Film Maker","J.C.+Staff"=>"J.C. Staff","Jinnis+Animation+Studios"=>"Jinnis Animation Studios","Kitty"=>"Kitty","Kyoto+Animation"=>"Kyoto Animation","LMD"=>"LMD","MAD+House"=>"MAD House","Manglobe+Inc"=>"Manglobe Inc.","MAPPA"=>"MAPPA","Milky"=>"Milky","Nippon+Animation"=>"Nippon Animation","Nippon+TV"=>"Nippon TV","Nomad"=>"Nomad","Ordet"=>"Ordet","Oriental+Light+and+Magic"=>"Oriental Light and Magic","P.A.+Works"=>"P.A. Works","Production+I.G"=>"Production I.G","Satelight"=>"Satelight","Seven"=>"Seven","Seven+Arcs"=>"Seven Arcs","Shaft"=>"Shaft","Shochiku"=>"Shochiku","Silver+Link"=>"Silver Link","Studio+4C"=>"Studio 4°C","Studio+Barcelona"=>"Studio Barcelona","Studio+Chizu"=>"Studio Chizu","Studio+Comet"=>"Studio Comet","Studio+DEEN"=>"Studio DEEN","Studio+Gallop"=>"Studio Gallop","Studio+Ghibli"=>"Studio Ghibli","Studio+Pierrot"=>"Studio Pierrot","Sunrise"=>"Sunrise","Synergy+Japan"=>"Synergy Japan","Tatsunoko"=>"Tatsunoko","Telecom+Animation+Film"=>"Telecom Animation Film","The+Answer+Studio"=>"The Answer Studio","TMS"=>"TMS","Toei+Animation"=>"Toei Animation","Triangle+Staff"=>"Triangle Staff","Trigger"=>"Trigger","UFO+Table"=>"UFO Table","Visual+Science+Laboratory"=>"Visual Science Laboratory","WAO+World"=>"WAO! World","White+Fox"=>"White Fox","Xebec"=>"Xebec","ZEXCS"=>"ZEXCS"), 'studio', $row['studio']);
  1738. $season_num = sub_cats_numm(intval($_REQUEST['serial_id'])) + 1;
  1739.  
  1740. if ($row['icon']) {
  1741.  
  1742. $season_poster = <<<HTML
  1743.     <tr>
  1744.         <td height="29" style="padding-left:5px;">Удалить картинку:</td>
  1745.         <td><select name="del_scr"><option value="1">Да</option><option value="0" selected>Нет</option></select></td>
  1746.     </tr>
  1747.     <tr>
  1748.         <td height="29" style="padding-left:5px;">Загруженная картинка:</td>
  1749.         <td><a href="{$row['icon']}" target="_blank">Смотреть</a></td>
  1750.     </tr>
  1751.     <tr>
  1752.         <td style="padding:4px;">Постер</td>
  1753.         <td><input style="width:400px;" type="file" name="cat_icon" /></td>
  1754.     </tr>
  1755. HTML;
  1756.  
  1757.  
  1758. } else {
  1759.  
  1760. $season_poster = <<<HTML
  1761.     <tr>
  1762.         <td style="padding:4px;">Постер</td>
  1763.         <td><input class="edit bk" type="file" name="cat_icon" /></td>
  1764.     </tr>
  1765. HTML;
  1766. }
  1767.  
  1768. echo <<<HTML
  1769. <script type="text/javascript">
  1770.     function auto_keywords ( key )
  1771.     {
  1772.  
  1773.         //var wysiwyg = '{$config['allow_admin_wysiwyg']}';
  1774.  
  1775.         //if (wysiwyg == "1") {
  1776.         //  submit_all_data();
  1777.         //}
  1778.  
  1779.         var short_txt = '{$cat_info[intval($_REQUEST['serial_id'])]['name']} ' + '{$cat_info[intval($_REQUEST['serial_id'])]['metatitle']} ' + document.getElementById('s_n').value + ' ';
  1780.         var full_txt = document.getElementById('descr').value;
  1781.  
  1782.  
  1783.         ShowLoading('');
  1784.  
  1785.         $.post("engine/ajax/keywords.php", { short_txt: short_txt, full_txt: full_txt, key: key }, function(data){
  1786.    
  1787.             HideLoading('');
  1788.    
  1789.             if (key == 1) { $('#autodescr').val(data); }
  1790.             else { $('#autokeywords').val(data); }
  1791.    
  1792.         });
  1793.  
  1794.         return false;
  1795.     }
  1796. </script>
  1797. <form ENCTYPE="multipart/form-data" method="post" action="">
  1798. <div style="padding-top:5px;padding-bottom:2px;">
  1799. <table width="100%">
  1800.     <tr>
  1801.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  1802.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  1803.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  1804.     </tr>
  1805.     <tr>
  1806.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  1807.         <td style="padding:5px;" bgcolor="#FFFFFF">
  1808. <table width="100%">
  1809.     <tr>
  1810.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">Редактирование: <a href="/shite.php?mod=categories&action=season_list&serial_id={$row['parentid']}"><b>{$cat_info[$row['parentid']]['name']}</b></a> {$row['name']}</div></td>
  1811.     </tr>
  1812. </table>
  1813. <div class="unterline"></div>
  1814. <table width="100%">
  1815.     <tr>
  1816.         <td width="160" style="padding:4px;">Название</td>
  1817.         <td><input style="width:300px;" type="text" name="cat_name" value="{$row['name']}"> Ну или просто номер сезона</td>
  1818.     </tr>
  1819.     <tr>
  1820.         <td style="padding:4px;">{$lang['cat_url']}</td>
  1821.         <td><input style="width:300px;" type="text" name="alt_cat_name" value="{$row['alt_name']}"><a href="#" class="hintanchor" onMouseover="showhint('{$lang[hint_cataltname]}', this, event, '250px')">[?]</a></td>
  1822.     </tr>
  1823.     <tr>
  1824.         <td width="160" style="padding:4px;">Дополнительное название</td>
  1825.         <td><input style="width:300px;" type="text" name="real_name" value="{$row['real_name']}"> или на английском языке</td>
  1826.     </tr>  
  1827.     {$season_poster}
  1828.     <tr>
  1829.         <td style="padding:4px;">Год</td>
  1830.         <td>{$year}</td>
  1831.     </tr>
  1832.         <tr>
  1833.            <td style="padding:4px;">Дата выхода</td>
  1834.             <td><input style="width:100px;" type="text" name="date_start" style="width:500px;" value="{$row['date_start']}"> ГГГГ-ММ-ДД</td>
  1835.         </tr>
  1836.     <tr>
  1837.         <td colspan="2"><div class="hr_line"></div></td>
  1838.     </tr>
  1839.  
  1840. HTML;
  1841.  
  1842.    
  1843.     if( $config['allow_admin_wysiwyg'] == "yes" ) {
  1844.        
  1845.         include (ENGINE_DIR . '/editor/shortnews.php');
  1846.    
  1847.     } else {
  1848.  
  1849.         $bb_editor = true;
  1850.         include (ENGINE_DIR . '/inc/include/inserttag.php');
  1851.        
  1852.         echo <<<HTML
  1853.     <tr>
  1854.         <td style="padding:4px;">Описание сезона</td>
  1855.         <td>{$bb_code}<textarea rows="16" style="width:97%; padding:5px;" onclick="setFieldName(this.name)" name="descr" id="short_story" class="bk">{$row['descr_content']}</textarea>
  1856.     </td></tr>
  1857. HTML;
  1858.     }
  1859. echo <<<HTML
  1860.     <tr>
  1861.         <td colspan="2"><div class="hr_line"></div></td>
  1862.     </tr>
  1863.     <tr>
  1864.         <td style="padding:4px;">Мета-титл</td>
  1865.         <td><textarea name="meta_title" style="width:97%;height:20px;" class="bk">{$row['metatitle']}</textarea></td>
  1866.     </tr>  
  1867.     <tr>
  1868.         <td style="padding:4px;">{$lang['meta_keys']}</td>
  1869.         <td><textarea name="keywords" id="autokeywords" style="width:97%;height:20px;" class="bk">{$row['keywords']}</textarea></td>
  1870.     </tr>  
  1871.     <tr>
  1872.         <td style="padding:4px;">Дескрипшн</td>
  1873.         <td><textarea name="descr" style="width:97%;height:50px;" onclick="setFieldName(this.name)" name="short_story2" id="autodescr" class="bk">{$row['descr']}</textarea><br />
  1874.             <input onClick="auto_keywords(1)" type="button" class="btn" value="{$lang['btn_descr']}" style="width:170px;">&nbsp;
  1875.             <input onClick="auto_keywords(2)" type="button" class="btn" value="{$lang['btn_keyword']}" style="width:216px;"></td>
  1876.     </tr>
  1877.    
  1878.     <tr>
  1879.         <td colspan="2"><div class="hr_line"></div></td>
  1880.     </tr>  
  1881.     <tr>
  1882.         <td style="padding:4px;">&nbsp;</td>
  1883.         <input type=hidden name="parentid" value="{$season_num}"></td>
  1884.         <td><input type="submit" class="buttons" value="&nbsp;&nbsp;{$lang['vote_new']}&nbsp;&nbsp;">
  1885. <input type="hidden" name="parentid" value="{$row['parentid']}">       
  1886. <input type=hidden name=mod value=categories>
  1887.   <input type=hidden name=action value=doedit>
  1888.   <input type="hidden" name="user_hash" value="$dle_login_hash" />
  1889.   <input type=hidden name=catid value=$row[id]>
  1890.     </tr>
  1891. </table>
  1892. </td>
  1893.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  1894.     </tr>
  1895.     <tr>
  1896.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  1897.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  1898.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  1899.     </tr>
  1900. </table>
  1901. </div></form>
  1902. HTML;
  1903.  
  1904.  
  1905. } else {
  1906.  
  1907. // ********************************************************************************
  1908. // List all Categories
  1909. // ********************************************************************************
  1910. echoheader( "options", $lang['cat_head'] );
  1911.  
  1912. $categorylist = cats_main( 0, 0 );
  1913. $skinlist = SelectSkin( '' );
  1914.  
  1915. for ($i = date("Y"); $i >= 1917; $i--)
  1916.     $years[$i] = $i;
  1917.    
  1918. $year = MakeDropDown($years, 'year" id="year', $cat_info[$row['id']]['year']);
  1919. $type = MakeDropDown(array("TV"=>"TV","OVA"=>"OVA","ONA"=>"ONA","Special"=>"Спешл","Movie"=>"Полнометражка","Hentai"=>"Хентай"), 'type" id="type', $cat_info[$row['id']]['type']); 
  1920. $studio = MakeDropDown2(array("8bit"=>"8bit","A-1+Pictures+Inc"=>"A1 Pictures Inc.","Actas+Inc"=>"Actas Inc.","AIC"=>"AIC","AIC+A.S.T.A"=>"AIC A.S.T.A.","AIC+PLUS"=>"AIC PLUS","AIC+Spirits"=>"AIC Spirits","Aniplex"=>"Aniplex","ARMS"=>"ARMS","Artland"=>"Artland","Ashi+Productions"=>"Ashi Productions","asread"=>"asread","Bee+Train"=>"Bee Train","BONES"=>"BONES","Brains+Base"=>"Brains Base","Chaos+Project"=>"Chaos Project","Charaction"=>"Charaction","Cinema+Citrus"=>"Cinema Citrus","CoMix+Wave+Inc"=>"CoMix Wave Inc.","David+Production"=>"David Production","Dogakobo"=>"Dogakobo","Easyfilm"=>"Easyfilm","FEEL"=>"FEEL","Gainax"=>"Gainax","GoHands"=>"GoHands","Gonzo"=>"Gonzo","Group+TAC"=>"Group TAC","Hal+Film+Maker"=>"Hal Film Maker","J.C.+Staff"=>"J.C. Staff","Jinnis+Animation+Studios"=>"Jinnis Animation Studios","Kitty"=>"Kitty","Kyoto+Animation"=>"Kyoto Animation","LMD"=>"LMD","MAD+House"=>"MAD House","Manglobe+Inc"=>"Manglobe Inc.","MAPPA"=>"MAPPA","Milky"=>"Milky","Nippon+Animation"=>"Nippon Animation","Nippon+TV"=>"Nippon TV","Nomad"=>"Nomad","Ordet"=>"Ordet","Oriental+Light+and+Magic"=>"Oriental Light and Magic","P.A.+Works"=>"P.A. Works","Production+I.G"=>"Production I.G","Satelight"=>"Satelight","Seven"=>"Seven","Seven+Arcs"=>"Seven Arcs","Shaft"=>"Shaft","Shochiku"=>"Shochiku","Silver+Link"=>"Silver Link","Studio+4C"=>"Studio 4°C","Studio+Barcelona"=>"Studio Barcelona","Studio+Chizu"=>"Studio Chizu","Studio+Comet"=>"Studio Comet","Studio+DEEN"=>"Studio DEEN","Studio+Gallop"=>"Studio Gallop","Studio+Ghibli"=>"Studio Ghibli","Studio+Pierrot"=>"Studio Pierrot","Sunrise"=>"Sunrise","Synergy+Japan"=>"Synergy Japan","Tatsunoko"=>"Tatsunoko","Telecom+Animation+Film"=>"Telecom Animation Film","The+Answer+Studio"=>"The Answer Studio","TMS"=>"TMS","Toei+Animation"=>"Toei Animation","Triangle+Staff"=>"Triangle Staff","Trigger"=>"Trigger","UFO+Table"=>"UFO Table","Visual+Science+Laboratory"=>"Visual Science Laboratory","WAO+World"=>"WAO! World","White+Fox"=>"White Fox","Xebec"=>"Xebec","ZEXCS"=>"ZEXCS"), 'studio" id="studio', $cat_info[$row['id']]['studio']);
  1921.  
  1922. echo <<<HTML
  1923. <script type="text/javascript">
  1924. var foto = 0;
  1925. var total = 0;
  1926.      
  1927. $(document).ready(function() {
  1928.     $("#add_file_jq").click(function () {
  1929.    
  1930.         total++;
  1931.         foto++;
  1932.              
  1933.         if (foto == 1) {
  1934.  
  1935.             $("#add_file_block").before(
  1936.             '<div class="hr_line"></div>'
  1937.             +'<table cellpadding="0" cellspacing="5" border="0" style="width:100%;" id="file_block_'+total+'">'
  1938.             +'<tr align="left">'
  1939.                 +'<td width="24%" valign="middle">Фотo '+foto+'</td>'
  1940.                 +'<td><input name="gallery['+total+']" type="file" /></td>'
  1941.             +'</tr>'
  1942.             +'</table>');
  1943.  
  1944.         } else {
  1945.        
  1946.             $("#add_file_block").before(
  1947.             '<table cellpadding="0" cellspacing="5" border="0" style="width:100%;" id="file_block_'+total+'">'
  1948.             +'<tr align="left">'
  1949.                 +'<td width="24%" valign="middle">Фотo '+foto+'</td>'
  1950.                 +'<td><input name="gallery['+total+']" type="file" /></td>'
  1951.             +'</tr>'
  1952.             +'</table>');
  1953.        
  1954.         }
  1955.        
  1956.         return false;
  1957.     });
  1958.    
  1959.  
  1960.    
  1961.     $("#del_file_jq").click(function () {
  1962.        
  1963.        
  1964.         $("#file_block_"+total).remove();
  1965.         total = total - 1;
  1966.         foto = foto - 1;
  1967.         return false;
  1968.     });
  1969.    
  1970.    
  1971. //$("#add_file_jq").click();
  1972.    
  1973.    
  1974. });
  1975.  
  1976.     function kp_info ( )
  1977.     {
  1978.         var url = document.getElementById("kp_url").value;
  1979.         ShowLoading("");
  1980.  
  1981.             $.ajax({
  1982.                 type: "POST",
  1983.                 url: "engine/ajax/kp_parser.php",
  1984.                 data: "url="+url,
  1985.                 dataType: "xml",
  1986.                 success: function(xml) {
  1987.                
  1988.                 jQuery(xml).find("site").each(
  1989.                            
  1990.                     function() {
  1991.                            
  1992.                         year = jQuery(this).find("year").text(),
  1993.                         country = jQuery(this).find("country").text(),
  1994.                         actors = jQuery(this).find("actors").text();
  1995.                         ganre = jQuery(this).find("ganre").text();
  1996.                         translator = jQuery(this).find("translator").text();
  1997.                         edition = jQuery(this).find("edition").text();
  1998.                         designer = jQuery(this).find("designer").text();
  1999.                         lyrics = jQuery(this).find("lyrics").text();
  2000.                         dubber = jQuery(this).find("dubber").text();
  2001.                         descr = jQuery(this).find("descr").text();
  2002.                         lir = jQuery(this).find("lir").text();
  2003.                         titry = jQuery(this).find("titry").text();
  2004.                         forum = jQuery(this).find("forum").text();
  2005.                         director = jQuery(this).find("director").text();
  2006.                         name = jQuery(this).find("name").text();
  2007.                         or_name = jQuery(this).find("or_name").text();
  2008.                        
  2009.                         $('#name').val(name);
  2010.                         $('#year').val(year);
  2011.                         $('#country').val(country);
  2012.                         $('#or_name').val(or_name);                        
  2013.                         $('#ganre').val(ganre);
  2014.                         $('#translator').val(translator);
  2015.                         $('#edition').val(edition);
  2016.                         $('#designer').val(designer);
  2017.                         $('#lyrics').val(lyrics);
  2018.                         $('#dubber').val(dubber);
  2019.                         $('#director').val(director);
  2020.                         $('#actors').append(actors);
  2021.                         $('#descr').append(descr);                     
  2022.                         $('#lir').append(lir);                     
  2023.                         $('#titry').append(titry);                     
  2024.                         $('#forum').append(forum);                     
  2025.                         $('#poster').html('<td width="260" style="padding:4px;">Постер в КП</td>');       
  2026.                         $('#poster').append('<td><img src="http://st.kinopoisk.ru/images/film/'+ url +'.jpg" heght="80"><br /><input type="checkbox" name="down_poster" value="1"/> Постер с КП</td>');                       
  2027.                    }
  2028.                 );      
  2029.  
  2030.                 }
  2031.                
  2032.             });
  2033.        
  2034.         HideLoading("");
  2035.  
  2036.         return false;
  2037.  
  2038.     }
  2039.  
  2040. </script>
  2041. <form ENCTYPE="multipart/form-data" method="post" name=\"serials\" id=\"serials\" action="">
  2042. <div style="padding-top:5px;padding-bottom:2px;">
  2043. <table width="100%">
  2044.     <tr>
  2045.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  2046.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  2047.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  2048.     </tr>
  2049.     <tr>
  2050.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  2051.         <td style="padding:5px;" bgcolor="#FFFFFF">
  2052. <table width="100%">
  2053.     <tr>
  2054.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">Добавление сериала</div></td>
  2055.     </tr>
  2056. </table>
  2057. <div class="unterline"></div>
  2058. <table width="100%">
  2059.     <tr id="poster"></tr>
  2060.     <tr>
  2061.         <td style="padding:4px;">Постер</td>
  2062.         <td><input style="width:500px;" type="file" name="cat_icon" /></td>
  2063.     </tr>
  2064.     <tr>
  2065.         <td width="260" style="padding:4px;">{$lang['cat_name']}</td>
  2066.         <td><input style="width:500px;" type="text" id="name" name="cat_name"></td>
  2067.     </tr>
  2068.     <tr>
  2069.         <td style="padding:4px;">Оригинальное название:</td>
  2070.         <td><input type="text" name="real_name" id="or_name" style="width:500px;"></td>
  2071.         </tr>
  2072.    
  2073.     <tr>
  2074.         <td style="padding:4px;">{$lang['cat_url']}</td>
  2075.         <td><input style="width:500px;" type="text" name="alt_cat_name"></td>
  2076.     </tr>
  2077.    
  2078.     <tr>
  2079.         <td style="padding:4px;">Страна</td>
  2080.         <td><input type="text" name="country" style="width:500px;" value="{$row['country']}"></td>
  2081.     </tr>
  2082.     <tr>
  2083.         <td style="padding:4px;">Год</td>
  2084.         <td>{$year}</td>
  2085.     </tr>
  2086.     <tr>
  2087.         <td style="padding:4px;">Жанр</td>
  2088.         <td><input type="text" name="ganre" style="width:500px;" value="{$row['janre']}"></td>
  2089.     </tr>
  2090.     <tr>
  2091.         <td style="padding:4px;">Тип</td>
  2092.         <td>{$type}</td>
  2093.     </tr>
  2094.     <tr>
  2095.         <td style="padding:4px;">Продолжительность<br>В виде: 25 мин., (13 эп.)</td>
  2096.         <td><input type="text" name="prod" style="width:500px;" value="{$row['prod']}"></td>
  2097.      </tr>
  2098.     <tr>
  2099.         <td style="padding:4px;">Режиссёр</td>
  2100.         <td><input type="text" name="director" style="width:500px;" value="{$row['director']}"></td>
  2101.      </tr>
  2102.     <tr>
  2103.         <td style="padding:4px;">Снято по манге</td>
  2104.         <td><input type="text" name="manga" style="width:500px;" value="{$row['manga']}"></td>
  2105.      </tr>
  2106.     <tr>
  2107.         <td style="padding:4px;">Автор оригинала</td>
  2108.         <td><input type="text" name="original" style="width:500px;" value="{$row['original']}"></td>
  2109.      </tr>
  2110.     <tr>
  2111.         <td style="padding:4px;">Студия</td>
  2112.         <td>{$studio}<span id="studio"><img src="http://st.sakuranight.net/8bit.jpg"></span></td>
  2113.     </tr>
  2114.     <script type="text/javascript">
  2115.     //<![CDATA[
  2116.        $(function() {
  2117.        $("#studio-select").change(function() {
  2118.        var graphicFileName = $("#studio-select option:selected").attr("value");
  2119.        var newCode = '<img src="http://st.sakuranight.net/' + graphicFileName + '.jpg">';
  2120.        $("#studio").html(newCode);
  2121.             });
  2122.        });
  2123.  
  2124.     //]]>
  2125.     </script>
  2126.     <tr>
  2127.             <td style="padding:4px;">Переводчик</td>
  2128.             <td><input type="text" name="translator" style="width:500px;" value="{$row['translate']}"></td>
  2129.     </tr>
  2130.     <tr>
  2131.             <td style="padding:4px;">Редактор</td>
  2132.             <td><input type="text" name="edition" style="width:500px;" value="{$row['edit']}"></td>
  2133.     </tr>
  2134.     <tr>
  2135.             <td style="padding:4px;">Оформление</td>
  2136.             <td><input type="text" name="designer" style="width:500px;" value="{$row['design']}"></td>
  2137.     </tr>
  2138.     <tr>
  2139.             <td style="padding:4px;">Лирика</td>
  2140.             <td><input type="text" name="lyrics" style="width:500px;" value="{$row['lyric']}"></td>
  2141.     </tr>
  2142.     <tr>
  2143.             <td style="padding:4px;">Озвучиватели</td>
  2144.             <td><input type="text" name="dubber" style="width:500px;" value="{$row['dub']}"></td>
  2145.     </tr>  
  2146. </table>
  2147. <span id="add_file_block"></span>
  2148. <div class="hr_line"></div>
  2149. <table width="100%">
  2150. HTML;
  2151.    
  2152.     if( $config['allow_admin_wysiwyg'] == "yes" ) {
  2153.        
  2154.         include (ENGINE_DIR . '/editor/shortnews.php');
  2155.    
  2156.     } else {
  2157.  
  2158.         $bb_editor = true;
  2159.         include (ENGINE_DIR . '/inc/include/inserttag.php');
  2160.        
  2161.         echo <<<HTML
  2162.        
  2163.     <tr>
  2164.         <td  width="260" style="padding:4px;">Описание сериала</td>
  2165.         <td><textarea rows="16" style="width:490px; padding:5px;" onclick="setFieldName(this.name)" name="short_story" id="descr" class="bk"></textarea>
  2166.     </td></tr>
  2167. HTML;
  2168.     }
  2169.     echo <<<HTML
  2170.     <tr>
  2171.         <td style="padding:4px;">Трейлер</td>
  2172.         <td><input name="treiler" onclick="setFieldName(this.name)" name="short_story2" id="short_story2" style="width:500px;" value="[media=]"></td>
  2173.     </tr>
  2174.     <tr style="display:none;">
  2175.         <td style="padding:4px;">Идентификатор опроса</td>
  2176.         <td><input style="width:500px;" value="{$row['vk_poll']}" type="text" name="vk_poll"></td>
  2177.     </tr>
  2178.     <tr>
  2179.         <td style="padding:4px;">Метатитл</td>
  2180.         <td><input type="text" name="meta_title" style="width:500px;"></td>
  2181.         </tr>  
  2182.     <tr>
  2183.         <td style="padding:4px;">{$lang['meta_keys']}</td>
  2184.         <td><textarea name="keywords" style="width:500px;height:50px;" class="bk"></textarea></td>
  2185.     </tr>      
  2186.     <tr>
  2187.         <td style="padding:4px;">Дескрипшн</td>
  2188.         <td><textarea name="descr" style="width:500px;height:50px;" onclick="setFieldName(this.name)" name="short_story2" id="short_story2" class="bk">{$row['descr']}</textarea></td>
  2189.     </tr>
  2190.  
  2191.     <tr>
  2192.         <td colspan="2"><div class="hr_line"></div></td>
  2193.     </tr>
  2194.     <tr>
  2195.         <td style="padding:4px;">&nbsp;</td>
  2196.         <td><input type="submit" class="buttons" value="&nbsp;&nbsp;{$lang['vote_new']}&nbsp;&nbsp;">
  2197. <input type=hidden name=mod value=categories>
  2198. <input type="hidden" name="user_hash" value="$dle_login_hash" />
  2199. <input type=hidden name=action value=add></td>
  2200.     </tr>
  2201. </table>
  2202. </td>
  2203.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  2204.     </tr>
  2205.     <tr>
  2206.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  2207.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  2208.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  2209.     </tr>
  2210. </table>
  2211. </div></form>
  2212. HTML;
  2213.  
  2214. if( ! count( $cat_info ) ) {
  2215.    
  2216.     echo <<<HTML
  2217. <div style="padding-top:5px;padding-bottom:2px;">
  2218. <table width="100%">
  2219.     <tr>
  2220.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  2221.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  2222.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  2223.     </tr>
  2224.     <tr>
  2225.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  2226.         <td style="padding:5px;" bgcolor="#FFFFFF">
  2227. <table width="100%">
  2228.     <tr>
  2229.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang['cat_list']}</div></td>
  2230.     </tr>
  2231. </table>
  2232. <div class="unterline"></div>
  2233. <table width="100%">
  2234.     <tr>
  2235.         <td height="100" align="center">{$lang['cat_nocat']}</td>
  2236.     </tr>
  2237. </table>
  2238. </td>
  2239.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  2240.     </tr>
  2241.     <tr>
  2242.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  2243.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  2244.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  2245.     </tr>
  2246. </table>
  2247. </div>
  2248. HTML;
  2249.  
  2250. } else {
  2251.    
  2252.     function DisplayCategories($parentid = 0, $sublevelmarker = '') {
  2253.         global $lang, $cat_info, $config, $dle_login_hash;
  2254.        
  2255.         // start table
  2256.         if( $parentid == 0 ) {
  2257.            
  2258.             echo <<<HTML
  2259. <form method="post" action="">
  2260. <div style="padding-top:5px;padding-bottom:2px;">
  2261. <table width="100%">
  2262.     <tr>
  2263.         <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
  2264.         <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
  2265.         <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
  2266.     </tr>
  2267.     <tr>
  2268.         <td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
  2269.         <td style="padding:5px;" bgcolor="#FFFFFF">
  2270. <table width="100%">
  2271.     <tr>
  2272.         <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">Список сериалов</div></td>
  2273.     </tr>
  2274. </table>
  2275. <div class="unterline"></div>
  2276. <table width="100%">
  2277.     <tr>
  2278.         <td style="padding:2px;">ID</td>
  2279.         <td style="padding:2px;">Position</td>
  2280.         <td>{$lang['cat_cat']}</td>
  2281.         <td>{$lang['cat_url']}</td>
  2282.         <td>Постер</td>
  2283.         <td>Сезонов</td>
  2284.         <td width="120">{$lang['cat_action']}</td>
  2285.     </tr>
  2286.     <tr>
  2287.         <td colspan="7"><div class="hr_line"></div></td>
  2288.     </tr>
  2289. HTML;
  2290.        
  2291.         } else {
  2292.             $sublevelmarker .= '--';
  2293.         }
  2294.        
  2295.         if( count( $cat_info ) ) {
  2296.            
  2297.             foreach ( $cat_info as $cats ) {
  2298.                 if( $cats['parentid'] == $parentid ) $root_category[] = $cats['id'];
  2299.             }
  2300.            
  2301.             if( count( $root_category ) ) {
  2302.                
  2303.                 foreach ( $root_category as $id ) {
  2304.                    
  2305.                     $category_name = $cat[$id];
  2306.                    
  2307.                     if( $config['allow_alt_url'] == "yes" ) $link = "<a class=\"list\" href=\"" . $config['http_home_url'] . get_url( $id ) . "/\" target=\"_blank\">" . stripslashes( $cat_info[$id]['name'] ) . "</a>";
  2308.                     else $link = "<a class=\"list\" href=\"{$config['http_home_url']}index.php?do=cat&category=" . $cat_info[$id]['alt_name'] . "\" target=\"_blank\">" . stripslashes( $cat_info[$id]['name'] ) . "</a>";
  2309.                    
  2310.                     echo "<tr>
  2311.                         <td height=\"14\">&nbsp;<b>" . $cat_info[$id]['id'] . "</b></td>
  2312.                         <td height=\"20\"><input class=\"edit\" type=\"text\" size=\"5\" name=\"posi[{$cat_info[$id]['id']}]\" maxlength=\"5\" value=\"{$cat_info[$id]['posi']}\"></td>
  2313.                         <td>&nbsp;$sublevelmarker&nbsp;" . $link . "</td>
  2314.                         <td>";
  2315.                     if( $cat_info[$id]['alt_name'] != "" ) {
  2316.                         echo $cat_info[$id]['alt_name'];
  2317.                     } else {
  2318.                         echo "---";
  2319.                     }
  2320.                     echo "</td><td>";
  2321.                     if( $cat_info[$id]['icon'] != "" ) {
  2322.                         echo "<img border=0 src=\"" . $cat_info[$id]['icon'] . "\" height=40 width=40 alt=\"" . $cat_info[$id]['icon'] . "\">";
  2323.                     } else {
  2324.                         echo "---";
  2325.                     }
  2326.                     $sub_cats_num = sub_cats_numm($id);
  2327.                     echo "</td><td>";
  2328.                    
  2329.                     echo "<a href=\"?mod=categories&action=season_list&serial_id={$id}\" title=\"Управление сезонами сериала {$cat_info[$id]['name']}\">{$sub_cats_num}</a>";
  2330.                    
  2331.                     echo "</td>
  2332.                         <td class=\"list\"><nobr>[<a href=\"?mod=categories&action=edit&catid=" . $cat_info[$id]['id'] . "\">$lang[cat_ed]</a>] [<a class=maintitle href=\"?mod=categories&user_hash=" . $dle_login_hash . "&action=remove&catid=" . $cat_info[$id]['id'] . "\">$lang[cat_del]</a>]</nobr></td>
  2333.                         </tr>
  2334.                         <tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=7></td></tr>";
  2335.                    
  2336.                     //DisplayCategories( $id, $sublevelmarker );
  2337.                 }
  2338.             }
  2339.         }
  2340.        
  2341.         // end table
  2342.         if( $parentid == 0 ) {
  2343.            
  2344.             echo <<<HTML
  2345.     <tr>
  2346.         <td colspan="7" style="padding:5px;"><input type=hidden name=action value=sort><input type="submit" id="posi" class="edit" value="$lang[cat_posi]" /></td>
  2347.     </tr>
  2348.      </table>
  2349. </td>
  2350.         <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
  2351.     </tr>
  2352.     <tr>
  2353.         <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
  2354.         <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
  2355.         <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
  2356.     </tr>
  2357. </table>
  2358. </div></form>
  2359. HTML;
  2360.        
  2361.         }
  2362.     }
  2363.    
  2364.     DisplayCategories();
  2365. }
  2366. }
  2367. function sub_cats_numm($id) {
  2368.     global $cat_info;
  2369.    
  2370.     foreach ($cat_info as $key => $value) {
  2371.         if ($id == $value['parentid'])
  2372.             $i++;
  2373.     }
  2374.    
  2375.     return intval($i);
  2376. }
  2377.  
  2378. echofooter();
  2379. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement