Dalexhd

channelsinfo.php

Oct 25th, 2017
661
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2. include_once 'include/config.php';
  3. include_once 'include/ts3admin.class.php';
  4.  
  5. function channelinfo()
  6. {
  7.     global $config;
  8.     global $query;
  9.  
  10.     $stats['suma'] = 0;
  11.     $stats['wolnych'] = 0;
  12.     $stats['zajetych'] =0;
  13.  
  14.     $firs_wolny = true;
  15.     $wolne_desc = '[COLOR=GREEN][B]Lista wolnych kanałów:[/B][/COLOR]';
  16.  
  17.     $firs_zajety = true;
  18.     $zajety_desc = '[COLOR=RED][B]Lista kanałów do usunięcia w ciągu 24h:[/B][/COLOR]';
  19.  
  20.     $channel = $query->getElement('data', $query->channelList('-topic -limits'));
  21.     foreach($channel as $channels)
  22.     {
  23.         if($channels['pid'] == $config['channelinfo']['pid'])
  24.         {
  25.             $number = (integer)$channels['channel_name'];
  26.             $stats['suma']++;
  27.             if($channels['channel_topic'] == 'wolny')
  28.             {
  29.                 $stats['wolnych']++;
  30.                 if(!$firs_wolny)
  31.                 {
  32.                     $wolne_desc.= ', '.$number;
  33.                 }
  34.                 else
  35.                 {
  36.                     $firs_wolny = false;
  37.                     $wolne_desc.= ' '.$number;
  38.                 }
  39.             }
  40.             else
  41.             {
  42.                 $stats['zajetych']++;
  43.                 $waznydo = (int)$channels['channel_topic'];
  44.                 if(($waznydo - time()) < (24 * 60 * 60))
  45.                 {
  46.                     if(!$firs_zajety)
  47.                     {
  48.                         $zajety_desc.= ', '.$number;
  49.                     }
  50.                     else
  51.                     {
  52.                         $firs_zajety = false;
  53.                         $zajety_desc.= ' '.$number;
  54.                     }
  55.                 }
  56.             }
  57.         }
  58.     }
  59.  
  60.     $desc = "[B]Kanałów prywatnych:[/B] ".$stats['suma']."\n";
  61.     $desc .= "[B]Kanałów prywatnych zajętych:[/B] ".$stats['zajetych']."\n";
  62.     $desc .= "[B]Kanałów prywatnych wolnych:[/B] ".$stats['wolnych']."\n";
  63.     $desc .= "\n".$wolne_desc;
  64.     $desc .= "\n\n".$zajety_desc;
  65.  
  66.     $query->channelEdit($config['channelinfo']['channel'], array('channel_description' => $desc));
  67.  
  68.     unset($config);
  69.     unset($query);
  70. }
  71. ?>
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment