Advertisement
Guest User

Untitled

a guest
Jan 4th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.19 KB | None | 0 0
  1. <?php
  2.  
  3. //require_once( config_get( 'class_path' ) . 'MantisPlugin.class.php' );
  4. //require_once( 'core.php' );
  5. //echo '<p>Here is a link to <a href="', plugin_page( 'dyzurny' ), '">page foo</a>.</p>';
  6.  
  7. class dyzurnyPlugin extends MantisPlugin {
  8.    
  9.     function register() {
  10.        
  11.         $this->name = 'dyzurny';
  12.         $this->description = 'niestrudzony dyzurny';
  13.         $this->page = 'config';
  14.         $this->version = '1.0';
  15.         $this->requires = array(
  16.             'MantisCore' => '1.2',
  17.         );
  18.        
  19.         $this->author = 'XXX';
  20.         $this->contact = 'XXX';
  21.         $this->url = 'XXX';
  22.        
  23.     }
  24.    
  25.     function init() {
  26.        
  27.         plugin_event_hook( 'EVENT_PLUGIN_INIT', 'header' );
  28.        
  29.     }
  30.    
  31.     function config() {
  32.        
  33.         return array(
  34.                 'plugin_dyzurny_do' => 'XXX',
  35.                 'plugin_dyzurny_ukopia' => 'XXX',
  36.                 );
  37.        
  38.     }
  39.    
  40.     function header() {
  41.        
  42.         header( 'X-Mantis: This Mantis has super cow powers.');
  43.        
  44.     }
  45.    
  46.     function install() {
  47.        
  48.         plugin_config_set('plugin_dyzurny_do','XXX');
  49.         plugin_config_set('plugin_dyzurny_ukopia','XXX');
  50.         return (TRUE);
  51.        
  52.     }
  53.    
  54.     function events() {
  55.        
  56.         return array(
  57.                
  58.                 'EVENT_DYZURNY_FOO' => EVENT_TYPE_EXECUTE,
  59.                
  60.                 );
  61.     }
  62.    
  63.     function hooks()
  64.     {
  65.         $hooks = array(
  66.             //'EVENT_CORE_READY'    => 'dyzurny_fun',
  67.             'EVENT_UPDATE_BUG' => 'bug_fun',
  68.         );
  69.  
  70.         return $hooks;
  71.     }
  72.    
  73.     function dyzurny_fun() {
  74.        
  75.         echo '<br/>';
  76.         echo 'dupa!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
  77.         echo '<br/>';
  78.        
  79.     }
  80.    
  81.     //function bug_fun( $p_event, $p_bug_data, $p_bug_id ) {
  82.     function bug_fun($p_event, $p_params) {
  83.        
  84.         //require_once( 'core.php' );
  85.        
  86.         require_once( 'bug_api.php' );
  87.         require_once( 'custom_field_api.php' );
  88.         require_once( 'file_api.php' );
  89.         require_once( 'date_api.php' );
  90.         require_once( 'relationship_api.php' );
  91.         require_once( 'last_visited_api.php' );
  92.         require_once( 'tag_api.php' );
  93.        
  94.         //$f_bug_id = gpc_get_int( 'id' );
  95.        
  96.         //bug_ensure_exists( $f_bug_id );
  97.        
  98.         //$tpl_bug = bug_get( $f_bug_id, true );
  99.         $f_bug_id = gpc_get_int( 'bug_id' );
  100.         $f_mail_test = gpc_get_bool( 'mail_test' );
  101.        
  102.         require_once( 'current_user_api.php' );
  103.        
  104.         # grab the user id currently logged in
  105.         $t_user_id = auth_get_current_user_id();
  106.        
  107.         # get the bugnote data
  108.         $t_bugnote_order = current_user_get_pref( 'bugnote_order' );
  109.         $t_bugnotes = bugnote_get_all_visible_bugnotes( $f_bug_id, $t_bugnote_order, 0, $t_user_id );
  110.        
  111.         $ourFileName = "dyzurny.txt";
  112.         $fh = fopen($ourFileName, 'w') or die("can't open file");
  113.        
  114.         //fwrite($fh, $p_params->project_id . "\n");
  115.         fwrite($fh, project_get_name($p_params->project_id) . "\n");
  116.         fwrite($fh, $p_params->reporter_id . "\n");
  117.         fwrite($fh, $p_params->build . "\n");
  118.         fwrite($fh, $p_params->platform . "\n");
  119.         fwrite($fh, $p_params->os . "\n");
  120.         fwrite($fh, $p_params->os_build . "\n");
  121.         fwrite($fh, $p_params->version . "\n");
  122.         fwrite($fh, $p_params->profile_id . "\n");
  123.         fwrite($fh, $p_params->handler_id . "\n");
  124.         fwrite($fh, $p_params->view_state . "\n");
  125.         fwrite($fh, $p_params->category_id . "\n");
  126.         fwrite($fh, $p_params->reproductibility . "\n");
  127.         fwrite($fh, get_enum_element( 'status',$p_params->severity) . "\n");
  128.         fwrite($fh, get_enum_element( 'status',$p_params->priority) . "\n");
  129.         fwrite($fh, $p_params->projection . "\n");
  130.         fwrite($fh, $p_params->eta . "\n");
  131.         fwrite($fh, $p_params->resolution . "\n");
  132.         fwrite($fh, get_enum_element( 'status',$p_params->status) . "\n");
  133.         fwrite($fh, $p_params->summary . "\n");
  134.         fwrite($fh, $p_params->description . "\n");
  135.         fwrite($fh, $p_params->steps_to_reproduce . "\n");
  136.         fwrite($fh, $p_params->additional_information . "\n");
  137.        
  138.         foreach ($t_bugnotes as $t_bugnote) {
  139.            
  140.             fwrite($fh, $t_bugnote->note . "\n");
  141.            
  142.         }
  143.        
  144.         fclose($fh);
  145.        
  146.         $t_email_data = new EmailData;
  147.         //$t_email_data->email = config_get_global( 'administrator_email' );
  148.         $t_email_data->email = 'XXX';
  149.         $t_email_data->subject = 'Testing PHP mail() function';
  150.         $t_email_data->body = 'Your PHP mail settings appear to be correctly set.';
  151.         //$t_email_data->metadata['priority'] = config_get( 'mail_priority' );
  152.         $t_email_data->metadata['charset'] = 'utf-8';
  153.         $result = email_send( $t_email_data );
  154.        
  155.     }
  156.    
  157. }
  158.  
  159. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement