c_output Class Reference

Generates output. More...

List of all members.

Public Member Functions

 cancel ($string)
 Cancels all pending operations.
 commit ()
 Commits (posts) all pending operations.
 execute ($procedure, $arguments)
 Generates execution of procedure.
 filesys ($object)
 Modifies filesystem object.
 init ()
 Initialization.
 log ($string)
 Generates a log message.
 put ($priority_class, $raw)
 Puts raw message to IRC server.
 put_lines ($priority_class, $prefix, $lines, $allow_empty)
 Puts raw message(s)/line(s) to IRC server.

Public Attributes

 $commited
 $lines
 Holds lines of output.


Detailed Description

Generates output.

Version:
1
Author:
VooDooMan
Date:
2005

Definition at line 526 of file library_php_2.inc.php.


Member Function Documentation

c_output::cancel string  ) 
 

Cancels all pending operations.

Version:
1
Author:
VooDooMan
Date:
2005

Definition at line 711 of file library_php_2.inc.php.

00712     {
00713         $this->lines="";
00714     }

c_output::commit  ) 
 

Commits (posts) all pending operations.

Version:
1
Author:
VooDooMan
Date:
2005

Definition at line 722 of file library_php_2.inc.php.

00723     {
00724         if($this->commited) {
00725             echo "Warning: ".__CLASS__."::".__FUNCTION__."() You have already done commit - this can confuse bot!\n";
00726         }
00727         $this->commited=TRUE;
00728         echo "\n#####\n".$this->lines."#####\n"; // NB: we got \n at the end of $this->lines
00729         $this->lines="";
00730     }

c_output::execute procedure,
arguments
 

Generates execution of procedure.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
procedure Name of procedure
arguments Array of strings as arguments
Bug:
Processing by bot will fail if procedure and/or arguments' elements contain CR or LF

Definition at line 601 of file library_php_2.inc.php.

00602     {
00603         $x="EXECUTE ".$procedure."(";
00604         $first=TRUE;
00605         foreach($arguments as $e) {
00606             if(!$first)
00607                 $x.=",";
00608             $first=FALSE;
00609             $x.="\"";
00610             $x.=addslashes($e);
00611             $x.="\"";
00612         }
00613         $x.=")";
00614         
00615         $this->lines.=$x."\n";
00616     }

c_output::filesys object  ) 
 

Modifies filesystem object.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
object c_filesys_object object
Warning:
In notify messages string "hello\nworld\x07!" should be represented as "hello\\nworld\\x07!"
Bug:
Event modifying not supported yet

Definition at line 627 of file library_php_2.inc.php.

00628     {
00629         $r="FILESYS InternalName ".$object->internal_name;
00630         $this->lines.=$r."\n";
00631 
00632         $r="FILESYS SET type ".$object->type;
00633         $this->lines.=$r."\n";
00634 
00635         $r="FILESYS SET PublicName ".$object->public_name;
00636         $this->lines.=$r."\n";
00637 
00638         $r="FILESYS SET Time ".$object->time;
00639         $this->lines.=$r."\n";
00640 
00641         $r="FILESYS SET Published ".($object->published?"1":"0");
00642         $this->lines.=$r."\n";
00643 
00644         $r="FILESYS SET Complete ".($object->complete?"1":"0");
00645         $this->lines.=$r."\n";
00646 
00647         $r="FILESYS SET Expiration ".$object->expiration;
00648         $this->lines.=$r."\n";
00649 
00650         foreach($object->access as $e) {
00651             // begin of access rights
00652             $r="FILESYS ACCESS_BEGIN";
00653             $this->lines.=$r."\n";
00654 
00655             $r="FILESYS SET AllUsers ".($e->all_users?"1":"0");
00656             $this->lines.=$r."\n";
00657 
00658             $r="FILESYS SET UserName ".$e->user_name;
00659             $this->lines.=$r."\n";
00660 
00661             $r="FILESYS SET Owner ".($e->owner?"1":"0");
00662             $this->lines.=$r."\n";
00663 
00664             $r="FILESYS SET Read ".($e->read?"1":"0");
00665             $this->lines.=$r."\n";
00666 
00667             $r="FILESYS SET Delete ".($e->delete?"1":"0");
00668             $this->lines.=$r."\n";
00669 
00670             $r="FILESYS SET NotifyOwner ".($e->notify_owner?"1":"0");
00671             $this->lines.=$r."\n";
00672             
00673             $r="FILESYS SET NotifyUser ".($e->notify_user?"1":"0");
00674             $this->lines.=$r."\n";
00675 
00676             $r="FILESYS SET Secure ".($e->secure?"1":"0");
00677             $this->lines.=$r."\n";
00678 
00679             $r="FILESYS SET AllOnChannel ".$e->all_on_channel;
00680             $this->lines.=$r."\n";
00681 
00682             $r="FILESYS SET AlsoUnknown ".($e->also_unknown?"1":"0");
00683             $this->lines.=$r."\n";
00684 
00685             // warning: string "hello\nworld\x07!" should be represented as "hello\\nworld\\x07!"
00686             $r="FILESYS SET NotifyOwnerMessage ".$e->notify_owner_message;
00687             $this->lines.=$r."\n";
00688 
00689             // warning: string "hello\nworld\x07!" should be represented as "hello\\nworld\\x07!"
00690             $r="FILESYS SET NotifyUserMessage ".$e->notify_user_message;
00691             $this->lines.=$r."\n";
00692 
00693             // end of access rights
00694             $r="FILESYS ACCESS_END";
00695             $this->lines.=$r."\n";
00696         }
00697         
00698         // event modifying not supported yet
00699 
00700         // commit
00701         $r="FILESYS COMMIT";
00702         $this->lines.=$r."\n";
00703     }

c_output::init  ) 
 

Initialization.

Version:
1
Author:
VooDooMan
Date:
2005

Definition at line 537 of file library_php_2.inc.php.

00537                     {
00538         $this->lines="";
00539         $this->commited=FALSE;
00540     }

c_output::log string  ) 
 

Generates a log message.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
string Log message

Definition at line 586 of file library_php_2.inc.php.

00587     {
00588         $x="LOG ".addcslashes($string,"\000..\037\177..\377");
00589         $this->lines.=$x."\n";
00590     }

c_output::put priority_class,
raw
 

Puts raw message to IRC server.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
priority_class Priority class (e.g. "LOW", "HIGH", "CRITICAL")
raw Raw message
Bug:
Processing by bot will fail if string contains CR or LF (consider using put_lines())

Definition at line 551 of file library_php_2.inc.php.

00552     {
00553         $x="PUT ".$priority_class." ".$raw;
00554         $this->lines.=$x."\n";
00555     }

c_output::put_lines priority_class,
prefix,
lines,
allow_empty
 

Puts raw message(s)/line(s) to IRC server.

Version:
1
Author:
VooDooMan
Date:
2005
Parameters:
priority_class Priority class (e.g. "LOW", "HIGH", "CRITICAL")
prefix For example "PRIVMSG #channel :"
lines String with multiple lines separated by "\n" (they will be prefixed with $prefix)
allow_empty Set to true if to allow empty lines; if set to false, empty lines will be excluded

Definition at line 567 of file library_php_2.inc.php.

00568     {
00569         $lns=explode("\n",$lines);
00570         foreach($lns as $element) {
00571             $str=str_replace("\r","",$element);
00572             if(!$allow_empty && $str=="")
00573                 continue;
00574             $x="PUT ".$priority_class." ".$prefix.$str;
00575             $this->lines.=$x."\n";
00576         }
00577     }


Member Data Documentation

c_output::$commited
 

Definition at line 529 of file library_php_2.inc.php.

c_output::$lines
 

Holds lines of output.

Definition at line 527 of file library_php_2.inc.php.


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 16:21:26 2005 for Library for "php_2" scripting by  doxygen 1.4.3