2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$Id $  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  This  code  is  part  of  LDAP  Account  Manager  ( http :// www . sourceforge . net / projects / lam ) 
							 
						 
					
						
							
								
									
										
										
										
											2006-03-03 17:30:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  Copyright  ( C )  2003  -  2006   Tilo  Lutz 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  This  program  is  free  software ;  you  can  redistribute  it  and / or  modify 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it  under  the  terms  of  the  GNU  General  Public  License  as  published  by 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  the  Free  Software  Foundation ;  either  version  2  of  the  License ,  or 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  This  program  is  distributed  in  the  hope  that  it  will  be  useful , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  but  WITHOUT  ANY  WARRANTY ;  without  even  the  implied  warranty  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE .   See  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  GNU  General  Public  License  for  more  details . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  You  should  have  received  a  copy  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  along  with  this  program ;  if  not ,  write  to  the  Free  Software 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  Foundation ,  Inc . ,  59  Temple  Place ,  Suite  330 ,  Boston ,  MA   02111 - 1307   USA 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-07-21 10:33:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  Manages  quotas  for  users  and  groups .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  @ package  modules  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  @ author  Tilo  Lutz  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  @ author  Roland  Gruber  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  @ author  Michael  Duergner  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  Manages  quotas  for  users  and  groups .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  @ package  modules  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*/  
						 
					
						
							
								
									
										
										
										
											2004-06-08 18:54:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  quota  extends  baseModule  {  
						 
					
						
							
								
									
										
										
										
											2004-06-13 19:58:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-09-26 13:48:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/**  this  functin  fills  the  error  message  array  with  messages 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									**/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  load_Messages ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// error messages for input checks
 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-25 18:40:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'softblock' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Block soft quota' ),  _ ( 'Block soft quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'softblock' ][ 1 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Block soft quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-25 18:40:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'hardblock' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Block hard quota' ),  _ ( 'Block hard quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'hardblock' ][ 1 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Block hard quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-25 18:40:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'softinode' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Inode soft quota' ),  _ ( 'Inode soft quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'softinode' ][ 1 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Inode soft quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-25 18:40:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'hardinode' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Inode hard quota' ),  _ ( 'Inode hard quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'hardinode' ][ 1 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Inode hard quota contains invalid characters. Only natural numbers are allowed.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-25 18:40:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'block_cmp' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Block quota' ),  _ ( 'Block soft quota must be smaller than block hard quota.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'block_cmp' ][ 1 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Block soft quota must be smaller than block hard quota.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-25 18:40:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'inode_cmp' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Inode quota' ),  _ ( 'Inode soft quota must be smaller than inode hard quota.' )); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$this -> messages [ 'inode_cmp' ][ 1 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Inode soft quota must be smaller than inode hard quota.' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									$this -> messages [ 'upload' ][ 0 ]  =  array ( 'ERROR' ,  _ ( 'Account %s:' )  .  ' %s' ,  _ ( 'Quota has wrong format!' )); 
							 
						 
					
						
							
								
									
										
										
										
											2004-09-26 13:48:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-13 12:58:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 19:58:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Returns  meta  data  that  is  interpreted  by  parent  class 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ return  array  array  with  meta  data 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  get_metaData ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// manages user and group accounts
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ " account_types " ]  =  array ( " user " ,  " group " ); 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-14 16:05:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// alias name
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ " alias " ]  =  _ ( 'Quota' ); 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-20 17:32:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $this -> get_scope ()  ==  'group' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// module dependencies
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return [ 'dependencies' ]  =  array ( 'depends'  =>  array ( 'posixGroup' ),  'conflicts'  =>  array ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $this -> get_scope ()  ==  'user' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// module dependencies
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return [ 'dependencies' ]  =  array ( 'depends'  =>  array ( 'posixAccount' ),  'conflicts'  =>  array ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// managed attributes
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ 'attributes' ]  =  array ( 'uid' ); 
							 
						 
					
						
							
								
									
										
										
										
											2004-08-17 15:16:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// available PDF fields
 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-30 16:46:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'PDF_fields' ]  =   array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											'quotas' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										); 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-02 17:41:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// help entries
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ 'help' ]  =  array ( 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-30 16:46:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" Mountpoint "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Mountpoint " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Mountpoint of device with enabled quotas. " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" UsedBlocks "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Used blocks " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Used blocks. 1000 blocks are usually 1MB " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" SoftBlockLimit "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Soft block limit " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Soft block limit. " ),  " SeeAlso "  =>  '<a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4">' . 'Quota How-To</a>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" HardBlockLimit "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Hard block limit " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Hard block limit " ) . '.' ,  " SeeAlso "  =>  '<a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5">' . 'Quota How-To</a>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" GraceBlockPeriod "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Grace block period " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Grace block period. Most filesystems use a fixed maximum value of 7 days. " ),  " SeeAlso "  =>  '<a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.6">' . 'Quota How-To</a>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" UsedInodes "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Used inodes " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Used inodes (files) " ) . '.' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" SoftInodeLimit "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Soft inode limit " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Soft inode (files) limit. " ),  " SeeAlso "  =>  '<a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4">' . 'Quota How-To</a>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" HardInodeLimit "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Hard inode limit " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Hard inode (files) limit " ) . '.' ,  " SeeAlso "  =>  '<a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5">' . 'Quota How-To</a>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" GraceInodePeriod "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Grace inode period " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Grace inode (files) period. Most filesystems use a fixed maximum value of 7 days. " ),  " SeeAlso "  =>  '<a href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.6">' . 'Quota How-To</a>' 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" upload "  =>  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Headline "  =>  _ ( " Quota " ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												" Text "  =>  _ ( " Please enter the quota settings for this mount point. The syntax is:  { soft block limit}, { hard block limit}, { soft inode limit}, { hard inode limit} " ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-30 16:46:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											) 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-02 17:41:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										); 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 19:58:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  $return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** Saves the quota settings */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  $quota ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Initializes  the  quota  values . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  initQuotas ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( isset ( $this -> quota ))  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$userName  =  '+' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( isset ( $_SESSION [ $this -> base ])  &&  ! $_SESSION [ $this -> base ] -> isNewAccount )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! isset ( $this -> attributes [ 'uid' ][ 0 ]))  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$userName  =  $this -> attributes [ 'uid' ][ 0 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-09 11:46:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $temp [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// get quotas
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$quotas  =  lamdaemon ( array ( $userName  .  "  quota get  "  .  $this -> get_scope ()),  $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$allQuotas  =  explode ( " : " ,  $quotas [ 0 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array_pop ( $allQuotas );  // remove empty element at the end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $allQuotas );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$singleQuota  =  explode ( " , " ,  $allQuotas [ $i ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> quota [ $server ][ $i ]  =  $singleQuota ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( $this -> quota [ $server ][ $i ][ 4 ]  <  time ())  $this -> quota [ $server ][ $i ][ 4 ]  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  $this -> quota [ $server ][ $i ][ 4 ]  =  strval ( intval (( $this -> quota [ $server ][ $i ][ 4 ]  -  time ()) / 3600 ))  . ' ' .  _ ( 'hours' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( $this -> quota [ $server ][ $i ][ 8 ]  <  time ())  $this -> quota [ $server ][ $i ][ 8 ]  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  $this -> quota [ $server ][ $i ][ 8 ]  =  strval ( intval (( $this -> quota [ $server ][ $i ][ 8 ]  -  time ()) / 3600 ))  . ' ' .  _ ( 'hours' ); 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  module_ready ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $_SESSION [ $this -> base ] -> type == 'user'  &&  $_SESSION [ $this -> base ] -> module [ 'posixAccount' ] -> attributes [ 'uid' ][ 0 ] == '' )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $_SESSION [ $this -> base ] -> type == 'group'  &&  $_SESSION [ $this -> base ] -> module [ 'posixGroup' ] -> attributes [ 'cn' ][ 0 ] == '' )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-13 17:20:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-02-09 18:11:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/*  This  functions  return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  if  all  needed  settings  are  done 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  module_complete ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! $this -> module_ready ())  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-13 17:20:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-13 12:58:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Allows  the  module  to  run  commands  after  the  LDAP  entry  is  changed  or  created . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  @ param  boolean  $newAccount  new  account 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  postModifyActions ( $newAccount )  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-05 16:56:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! isset ( $this -> quota )  ||  ! is_array ( $this -> quota ))  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// determine if this is a user or group account
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $_SESSION [ $this -> base ] -> type == 'user' )  $id  =  $_SESSION [ $this -> base ] -> module [ 'posixAccount' ] -> attributes [ 'uid' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $_SESSION [ $this -> base ] -> type == 'group' )  $id  =  $_SESSION [ $this -> base ] -> module [ 'posixGroup' ] -> attributes [ 'cn' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$serverDescriptions  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( isset ( $temp [ 1 ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$serverDescriptions [ $temp [ 0 ]]  =  $temp [ 1 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$servers  =  array_keys ( $this -> quota ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $q  =  0 ;  $q  <  sizeof ( $servers );  $q ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $servers [ $q ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$i = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$quotastring  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $this -> quota [ $server ]);  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$quotastring  =  $quotastring  .  $this -> quota [ $server ][ $i ][ 0 ]  .  ','  .  $this -> quota [ $server ][ $i ][ 2 ]  .  ','  .  $this -> quota [ $server ][ $i ][ 3 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													.  ','  .  $this -> quota [ $server ][ $i ][ 6 ]  .  ','  .  $this -> quota [ $server ][ $i ][ 7 ]  .  ':' ; 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$ret  =  lamdaemon ( array ( $id  .  "  quota set  "  .  $_SESSION [ $this -> base ] -> type  .  "   $quotastring\n " ),  $server ); 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Allows  the  module  to  run  commands  before  the  LDAP  entry  is  deleted . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  An  error  message  should  be  printed  if  the  function  returns  false . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  @ return  true ,  if  no  problems  occured 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  preDeleteActions ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> initQuotas (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-05 16:56:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! isset ( $this -> quota )  ||  ! is_array ( $this -> quota ))  return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// determine if this is a user or group account
 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( $_SESSION [ $this -> base ] -> type == 'user' )  $id  =  $_SESSION [ $this -> base ] -> module [ 'posixAccount' ] -> attributes [ 'uid' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $_SESSION [ $this -> base ] -> type == 'group' )  $id  =  $_SESSION [ $this -> base ] -> module [ 'posixGroup' ] -> attributes [ 'cn' ][ 0 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$serverDescriptions  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( isset ( $temp [ 1 ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$serverDescriptions [ $temp [ 0 ]]  =  $temp [ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$servers  =  array_keys ( $this -> quota ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $q  =  0 ;  $q  <  sizeof ( $servers );  $q ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $servers [ $q ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$i = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$quotastring  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( $this -> quota [ $server ][ $i ][ 0 ])  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$quotastring  =  $quotastring  .  $this -> quota [ $server ][ $i ][ 0 ]  .  ',0,0,0,0:' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$i ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ret  =  lamdaemon ( array ( $id  .  "  quota set  "  .  $_SESSION [ $this -> base ] -> type  .  "   $quotastring\n " ),  $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-09-07 12:58:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Processes  user  input  of  the  primary  module  page . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  It  checks  if  all  input  values  are  correct  and  updates  the  associated  LDAP  attributes . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ return  array  list  of  info / error  messages 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-13 12:58:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  process_attributes ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-05 16:56:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! isset ( $this -> quota )  ||  ! is_array ( $this -> quota ))  return  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2006-05-17 17:40:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$errors  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$serverDescriptions  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( isset ( $temp [ 1 ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$serverDescriptions [ $temp [ 0 ]]  =  $temp [ 1 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-30 15:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$servers  =  array_keys ( $this -> quota ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $q  =  0 ;  $q  <  sizeof ( $servers );  $q ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $servers [ $q ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$id  =  $this -> replaceSpecialChars ( $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$i = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// loop for every mointpoint with quotas
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( $this -> quota [ $server ][ $i ][ 0 ])  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> quota [ $server ][ $i ][ 2 ]  =  $_POST [ $i  .  '_2_'  .  $id ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> quota [ $server ][ $i ][ 3 ]  =  $_POST [ $i  .  '_3_'  .  $id ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> quota [ $server ][ $i ][ 6 ]  =  $_POST [ $i  .  '_6_'  .  $id ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> quota [ $server ][ $i ][ 7 ]  =  $_POST [ $i  .  '_7_'  .  $id ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Check if values are OK and set automatic values. if not error-variable will be set
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $this -> quota [ $server ][ $i ][ 2 ],  'digit' )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$errors []  =  $this -> messages [ 'softblock' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $this -> quota [ $server ][ $i ][ 3 ],  'digit' )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$errors []  =  $this -> messages [ 'hardblock' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $this -> quota [ $server ][ $i ][ 6 ],  'digit' )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$errors []  =  $this -> messages [ 'softinode' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $this -> quota [ $server ][ $i ][ 7 ],  'digit' )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$errors []  =  $this -> messages [ 'hardinode' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( intval ( $this -> quota [ $server ][ $i ][ 2 ])  >  intval ( $this -> quota [ $server ][ $i ][ 3 ])) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$errors []  =  $this -> messages [ 'block_cmp' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( intval ( $this -> quota [ $server ][ $i ][ 6 ])  >  intval ( $this -> quota [ $server ][ $i ][ 7 ])) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$errors []  =  $this -> messages [ 'inode_cmp' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$i ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2006-05-17 17:40:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  $errors ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/*  This  function  will  create  the  html - page 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  to  show  a  page  with  all  attributes . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  It  will  output  a  complete  html - table 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-13 12:58:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  display_html_attributes ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> initQuotas (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! is_array ( $this -> quota ))  return  $return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$serverDescriptions  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( isset ( $temp [ 1 ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$serverDescriptions [ $temp [ 0 ]]  =  $temp [ 1 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$servers  =  array_keys ( $this -> quota ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $q  =  0 ;  $q  <  sizeof ( $servers );  $q ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $servers [ $q ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$id  =  $this -> replaceSpecialChars ( $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$fieldContent  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$fieldContent []  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Mountpoint' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Used blocks' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Soft block limit' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Hard block limit' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Grace block period' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Used inodes' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Soft inode limit' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Hard inode limit' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  _ ( 'Grace inode period' ))); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$fieldContent []  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'Mountpoint' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'UsedBlocks' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'SoftBlockLimit' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'HardBlockLimit' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'GraceBlockPeriod' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'UsedInodes' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'SoftInodeLimit' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'HardInodeLimit' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'help' ,  'value'  =>  'GraceInodePeriod' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$i = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// loop for every mointpoint with enabled quotas
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( $this -> quota [ $server ][ $i ][ 0 ])  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$fieldContent []  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  $this -> quota [ $server ][ $i ][ 0 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  $this -> quota [ $server ][ $i ][ 1 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'name'  =>  $i  .  '_2_'  .  $id ,  'type'  =>  'text' ,  'size'  =>  '12' ,  'maxlength'  =>  '20' ,  'value'  =>  $this -> quota [ $server ][ $i ][ 2 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'name'  =>  $i  .  '_3_'  .  $id ,  'type'  =>  'text' ,  'size'  =>  '12' ,  'maxlength'  =>  '20' ,  'value'  =>  $this -> quota [ $server ][ $i ][ 3 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  $this -> quota [ $server ][ $i ][ 4 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  $this -> quota [ $server ][ $i ][ 5 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'name'  =>  $i  .  '_6_'  .  $id ,  'type'  =>  'text' ,  'size'  =>  '12' ,  'maxlength'  =>  '20' ,  'value'  =>  $this -> quota [ $server ][ $i ][ 6 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'name'  =>  $i  .  '_7_'  .  $id ,  'type'  =>  'text' ,  'size'  =>  '12' ,  'maxlength'  =>  '20' ,  'value'  =>  $this -> quota [ $server ][ $i ][ 7 ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  $this -> quota [ $server ][ $i ][ 8 ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$i ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$legend  =  $server ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( isset ( $serverDescriptions [ $server ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$legend  =  $serverDescriptions [ $server ]  .  "  ( "  .  $server  .  " ) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return []  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'fieldset' ,  'legend'  =>  $legend ,  'value'  =>  $fieldContent ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Replaces  special  characters  in  HTML  name  values . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  @ param  string  $input  input  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  @ return  string  output  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  replaceSpecialChars ( $input )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$ret  =  str_replace ( " . " ,  " _ " ,  $input ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-09-19 08:34:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Returns  a  list  of  elements  for  the  account  profiles . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ return  profile  elements 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
									
										
										
										
											2004-04-03 14:47:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get_profileOptions ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2004-03-09 12:03:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $temp [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$id  =  $this -> replaceSpecialChars ( $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$description  =  $temp [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( isset ( $temp [ 1 ]))  $description  =  $temp [ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Get quotas
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$quotas  =  lamdaemon ( array ( " + quota get  "  .  $this -> get_scope ()),  $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$dirs  =  split ( " : " ,  $quotas [ 0 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array_pop ( $dirs );  // remove empty element at the end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $dirs );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dirs [ $i ]  =  split ( " , " ,  $dirs [ $i ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dirs [ $i ]  =  $dirs [ $i ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( sizeof ( $dirs )  <  1 )  continue ;  // stop if no quota directories were found
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$fieldContent  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$fieldContent []  =  array  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'text' ,  'text'  =>  '<b>'  .  _ ( 'Mountpoint' )  .  '  </b>' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'text' ,  'text'  =>  '<b>'  .  _ ( 'Soft block limit' )  .  '  </b>' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'text' ,  'text'  =>  '<b>'  .  _ ( 'Hard block limit' )  .  '  </b>' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'text' ,  'text'  =>  '<b>'  .  _ ( 'Soft inode limit' )  .  '  </b>' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'text' ,  'text'  =>  '<b>'  .  _ ( 'Hard inode limit' )  .  '  </b>' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$fieldContent []  =  array  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'help' ,  'value'  =>  'Mountpoint' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'help' ,  'value'  =>  'SoftBlockLimit' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'help' ,  'value'  =>  'HardBlockLimit' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'help' ,  'value'  =>  'SoftInodeLimit' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array ( 'kind'  =>  'help' ,  'value'  =>  'HardInodeLimit' ,  'align'  =>  'center' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $dirs );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$fieldContent []  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'text' ,  'text'  =>  $dirs [ $i ],  'align'  =>  'left' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'type'  =>  'text' ,  'align'  =>  'center' ,  'size'  =>  '12' ,  'name'  =>  " quota_softblock_ "  .  $id  .  " _ "  .  $dirs [ $i ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'type'  =>  'text' ,  'align'  =>  'center' ,  'size'  =>  '12' ,  'name'  =>  " quota_hardblock_ "  .  $id  .  " _ "  .  $dirs [ $i ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'type'  =>  'text' ,  'align'  =>  'center' ,  'size'  =>  '12' ,  'name'  =>  " quota_softinode_ "  .  $id  .  " _ "  .  $dirs [ $i ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													array ( 'kind'  =>  'input' ,  'type'  =>  'text' ,  'align'  =>  'center' ,  'size'  =>  '12' ,  'name'  =>  " quota_hardinode_ "  .  $id  .  " _ "  .  $dirs [ $i ]), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-23 19:10:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$return []  =  array ( 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												array ( 'kind'  =>  'fieldset' ,  'legend'  =>  $description  .  "  ( "  .  $server  .  " ) " ,  'value'  =>  $fieldContent ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-23 19:10:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2004-03-09 12:03:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  $return ; 
							 
						 
					
						
							
								
									
										
										
										
											2003-12-27 11:21:00 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-09-19 08:34:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Checks  input  values  of  account  profiles . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ param  array  $options  a  hash  array  ( name  =>  value )  containing  the  options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ return  array  list  of  error  messages  ( array ( type ,  title ,  text ))  to  generate  StatusMessages ,  if  any 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
									
										
										
										
											2004-07-01 15:54:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  check_profileOptions ( $options )  { 
							 
						 
					
						
							
								
									
										
										
										
											2004-07-02 18:01:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $temp [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$id  =  $this -> replaceSpecialChars ( $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Get quotas
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$quotas  =  lamdaemon ( array ( " + quota get  "  .  $this -> get_scope ()),  $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$dirs  =  split ( " : " ,  $quotas [ 0 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array_pop ( $dirs );  // remove empty element at the end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $dirs );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dirs [ $i ]  =  split ( " , " ,  $dirs [ $i ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dirs [ $i ]  =  $dirs [ $i ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $dirs );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $options [ " quota_softblock_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ],  'digit' ))  $return []  =  $this -> messages [ 'softblock' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $options [ " quota_hardblock_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ],  'digit' ))  $return []  =  $this -> messages [ 'hardblock' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $options [ " quota_softinode_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ],  'digit' ))  $return []  =  $this -> messages [ 'softinode' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_preg ( $options [ " quota_hardinode_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ],  'digit' ))  $return []  =  $this -> messages [ 'hardinode' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( intval ( $options [ " quota_softblock_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ])  >  intval ( $options [ " quota_hardblock_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ]))  $return []  =  $this -> messages [ 'block_cmp' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( intval ( $options [ " quota_softinode_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ])  >  intval ( $options [ " quota_hardinode_ "  .  $id  .  " _ "  .  $dirs [ $i ]][ 0 ]))  $return []  =  $this -> messages [ 'inode_cmp' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$i ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2004-07-02 18:01:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $return ; 
							 
						 
					
						
							
								
									
										
										
										
											2004-03-14 17:33:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-13 12:58:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-01-22 10:50:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Loads  the  values  of  an  account  profile  into  internal  variables . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ param  array  $profile  hash  array  with  profile  values  ( identifier  =>  value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  load_profile ( $profile )  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> initQuotas (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-05 16:56:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! isset ( $this -> quota )  ||  ! is_array ( $this -> quota ))  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$servers  =  array_keys ( $this -> quota ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( $s  =  0 ;  $s  <  sizeof ( $servers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$server  =  $servers [ $s ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$id  =  $this -> replaceSpecialChars ( $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $this -> quota [ $server ]);  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dir  =  $this -> quota [ $server ][ $i ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( isset ( $profile [ " quota_softblock_ "  .  $id  .  " _ "  .  $dir ]))  $this -> quota [ $server ][ $i ][ 2 ]  =  $profile [ " quota_softblock_ "  .  $id  .  " _ "  .  $dir ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( isset ( $profile [ " quota_hardblock_ "  .  $id  .  " _ "  .  $dir ]))  $this -> quota [ $server ][ $i ][ 3 ]  =  $profile [ " quota_hardblock_ "  .  $id  .  " _ "  .  $dir ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( isset ( $profile [ " quota_softinode_ "  .  $id  .  " _ "  .  $dir ]))  $this -> quota [ $server ][ $i ][ 6 ]  =  $profile [ " quota_softinode_ "  .  $id  .  " _ "  .  $dir ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( isset ( $profile [ " quota_hardinode_ "  .  $id  .  " _ "  .  $dir ]))  $this -> quota [ $server ][ $i ][ 7 ]  =  $profile [ " quota_hardinode_ "  .  $id  .  " _ "  .  $dir ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2005-01-22 10:50:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-10-09 18:05:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Returns  the  PDF  entries  for  this  module . 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-13 12:58:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
									
										
										
										
											2005-10-09 18:05:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									*  @ return  array  list  of  possible  PDF  entries 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  get_pdfEntries ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> initQuotas (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-05 16:56:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! isset ( $this -> quota )  ||  ! is_array ( $this -> quota ))  return  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-16 12:43:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( sizeof ( $this -> quota )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$quotas  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$server  =  $temp [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$description  =  $server ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( isset ( $temp [ 1 ]))  $description  =  $temp [ 1 ]  .  "  ( "  .  $server  .  " ) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! isset ( $this -> quota [ $server ])  ||  ( sizeof ( $this -> quota [ $server ])  <  1 ))  continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2005-07-28 09:01:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$quotas []  =  '<block><tr>'  . 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														'<td width="80%"><b>'  .  $description  .  '</b></td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'</tr></block>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$quotas []  =  '<block><tr>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%"><b>'  .  _ ( 'Mountpoint' )  .  '</b></td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%"><b>'  .  _ ( 'Soft block' )  .  '</b></td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%"><b>'  .  _ ( 'Hard block' )  .  '</b></td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%"><b>'  .  _ ( 'Soft inode' )  .  '</b></td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%"><b>'  .  _ ( 'Hard inode' )  .  '</b></td></tr></block>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( $i  =  0 ;  $i  <  sizeof ( $this -> quota [ $server ]);  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$quotas []  =  '<block><tr>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%" align=\"L\">'  .  $this -> quota [ $server ][ $i ][ 0 ]  .  '</td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%" align=\"L\">'  .  $this -> quota [ $server ][ $i ][ 2 ]  .  '</td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%" align=\"L\">'  .  $this -> quota [ $server ][ $i ][ 3 ]  .  '</td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%" align=\"L\">'  .  $this -> quota [ $server ][ $i ][ 6 ]  .  '</td>'  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'<td width="20%" align=\"L\">'  .  $this -> quota [ $server ][ $i ][ 7 ]  .  '</td></tr></block>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$quotas []  =  '<block><tr><td width="80%"> </td></tr></block>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-16 12:43:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  array ( 'quota_quotas'  =>  $quotas ); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-16 12:43:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-19 18:43:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2004-05-24 21:39:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2004-03-14 17:33:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Returns  an  array  containing  all  input  columns  for  the  file  upload . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  Syntax : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   string :  name ,   // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   string :  description ,   // short descriptive name
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   string :  help ,   // help ID
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   string :  example ,   // example value
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   boolean :  required   // true, if user must set a value for this column
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ return  array  column  list 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  get_uploadColumns ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> initQuotas (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-05 16:56:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! isset ( $this -> quota )  ||  ! is_array ( $this -> quota ))  return  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( sizeof ( $this -> quota )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// get list of lamdaemon servers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$lamdaemonServers  =  explode ( " ; " ,  $_SESSION [ 'config' ] -> get_scriptServers ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $s  =  0 ;  $s  <  sizeof ( $lamdaemonServers );  $s ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$temp  =  explode ( " : " ,  $lamdaemonServers [ $s ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$server  =  $temp [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Get quotas
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$quotas  =  lamdaemon ( array ( " + quota get  "  .  $this -> get_scope ()),  $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dirs  =  split ( " : " ,  $quotas [ 0 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												array_pop ( $dirs );  // remove empty element at the end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( $i  =  0 ;  $i  <  sizeof ( $dirs );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$dirs [ $i ]  =  split ( " , " ,  $dirs [ $i ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$dirs [ $i ]  =  $dirs [ $i ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( $i  =  0 ;  $i  <  sizeof ( $dirs );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$return []  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'name'  =>  'quota_'  .  $server  .  ':'  .  $dirs [ $i ], 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'description'  =>  sprintf ( _ ( 'Quota for %s on %s' ),  $dirs [ $i ],  $server ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'help'  =>  'upload' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'example'  =>  '2000,2500,3000,3500' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  This  function  executes  one  post  upload  action . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ param  array  $data  array  containing  one  account  in  each  element 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ param  array  $ids  array ( < column_name >  =>  < column  number > ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ param  array  $failed  list  of  accounts  which  were  not  created  successfully 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ param  array  $temp  variable  to  store  temporary  data  between  two  post  actions 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  @ return  array  current  status 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >  array  ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   'status'  =>  'finished'  |  'inProgress' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   'progress'  =>  0. . 100 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >   'errors'  =>  array  ( < array  of  parameters  for  StatusMessage > ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*  < br >  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  doUploadPostActions ( $data ,  $ids ,  $failed ,  & $temp )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$errors  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// first call, get list of user names and quota values
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! isset ( $temp [ 'counter' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp [ 'counter' ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// create list of quota columns
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp [ 'quotas' ]  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$columns  =  array_keys ( $ids ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $columns );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( strpos ( $columns [ $i ],  'quota_' )  ===  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$temp [ 'quotas' ][]  =  substr ( $columns [ $i ],  6 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// select user/group name depending on current scope
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp [ 'accounts' ]  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$col  =  'invalid' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( $this -> get_scope ()  ==  'user' )  $col  =  $ids [ 'posixAccount_userName' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											elseif  ( $this -> get_scope ()  ==  'group' )  $col  =  $ids [ 'posixGroup_cn' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// create list of account names and their quota values
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $i  =  0 ;  $i  <  sizeof ( $data );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( in_array ( $i ,  $failed ))  continue ;  // ignore failed accounts
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$name  =  $data [ $i ][ $col ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( $m  =  0 ;  $m  <  sizeof ( $temp [ 'quotas' ]);  $m ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( $data [ $i ][ $ids [ 'quota_'  .  $temp [ 'quotas' ][ $m ]]]  !=  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$parts  =  explode ( ',' ,  $data [ $i ][ $ids [ 'quota_'  .  $temp [ 'quotas' ][ $m ]]]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// check syntax
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( sizeof ( $parts )  !=  4 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'upload' ][ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! get_preg ( $parts [ 0 ],  'digit' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'softblock' ][ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! get_preg ( $parts [ 1 ],  'digit' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'hardblock' ][ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! get_preg ( $parts [ 2 ],  'digit' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'softinode' ][ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! get_preg ( $parts [ 3 ],  'digit' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'hardinode' ][ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2005-10-04 15:25:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( $parts [ 0 ]  >  $parts [ 1 ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'block_cmp' ][ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2005-10-04 15:25:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( $parts [ 2 ]  >  $parts [ 3 ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$errMsg  =  $this -> messages [ 'inode_cmp' ][ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															array_push ( $errMsg ,  array ( $i ,  'quota_'  .  $temp [ 'quotas' ][ $m ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  $errMsg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// save quota settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$temp [ 'accounts' ][ $name ][ $temp [ 'quotas' ][ $m ]]  =  $parts ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  array ( 'status'  =>  'inProgress' ,  'progress'  =>  5 ,  'errors'  =>  $errors ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// quotas are ready to set
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										elseif  ( $temp [ 'counter' ]  <  sizeof ( $temp [ 'accounts' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$names  =  array_keys ( $temp [ 'accounts' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$name  =  $names [ $temp [ 'counter' ]]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$mountPoints  =  array_keys ( $temp [ 'accounts' ][ $name ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// set quota
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( $m  =  0 ;  $m  <  sizeof ( $mountPoints );  $m ++ )  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-04 16:07:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$mpParts  =  split ( " : " ,  $mountPoints [ $m ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$server  =  $mpParts [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$dir  =  $mpParts [ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$quotaString  =  $name  .  "  quota set  "  .  $this -> scope  .  "   "  .  $dir  .  ','  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													implode ( ',' ,  $temp [ 'accounts' ][ $name ][ $mountPoints [ $m ]])  .  " \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$result  =  lamdaemon ( array ( $quotaString ),  $server ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( is_array ( $result ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( $i  =  0 ;  $i  <  sizeof ( $result );  $i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$parts  =  explode ( " , " ,  $result ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( $parts [ 0 ]  ==  'ERROR' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$errors []  =  array ( 'ERROR' ,  $parts [ 1 ],  $parts [ 2 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 12:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// set counters to next account/mount point
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$temp [ 'counter' ] ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												'status'  =>  'inProgress' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												'progress'  =>  5  +  ( 95  *  ( $temp [ 'counter' ]  /  sizeof ( $temp [ 'accounts' ]))), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												'errors'  =>  $errors ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  array ( 'status'  =>  'finished' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-03-09 12:03:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2003-12-30 15:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								?>