403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.216.231
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/icd/components/com_staffmaster/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/icd/components/com_staffmaster/controller.php
<?php
/**
 * File: controller.php
 *
 * Staff Master 0_7_5_5
 *
 * Staff Master - Staff Members and Departments Manager
 *
 * @version 0.7.5.5
 * @package StaffMaster_0_7_5_5
 * @subpackage: frontend
 * @copyright (C) 2007-2008 Travis Hubbard
 * @license http://www.gnu.org/licenses/  GNU/GPL v3
 * @link http://www.systemsunited.net/
 **/
defined( '_JEXEC' ) or die( 'Restricted access' );

// Import Joomla's Controller Class
jimport( 'joomla.application.component.controller' );

// Import Joomla's Model Class
jimport( 'joomla.application.component.model' );

/**
 * Staff Controller Class
 */
class StaffController extends JController  {

	/**
	 * Default Display for the controller
	 * if something goes wrong, default to this, which redirects to all()
	 *
	 */
	function display()  {

		$this->all();

	}

	/**
	 * setHeader takes params then outputs appropriate stylesheets and javascripts for the specific view
	 *
	 * @param int 		$use_js			use js on front end?
	 * @param int 		$contact		use js for contact?
	 * @param int 		$roundedCorners use rounded corners?
	 * @param string 	$view			what view is this?  eventually to make custom views easier to include
	 * @param boolean 	$isStaff		is this the staff view?
	 */
	function setHeader( $use_js , $contact , $roundedCorners , $view , $isStaff = false )  {

		global $option;

		jimport( 'joomla.environment.browser' );

		$browser 			= new JBrowser();

		$currentBrowser 	= $browser->getBrowser();

		$css_file_path =  'components/' . $option . '/css/' ;

		$css_file_name =  'staffmaster_default.css';

		JHTML::stylesheet( $css_file_name , $css_file_path );

		if( $view == 'clean' )  {

			$css_file_name =  'staffmaster_' . $view .  '.css';

			JHTML::stylesheet( $css_file_name , $css_file_path );

		}

		if( $currentBrowser == "msie" )  {

			$stylesheet_browser  	= 'staffmaster_' . $currentBrowser . '.css';

			JHTML::stylesheet( $stylesheet_browser , $css_file_path );

			// Check which IE Version we are dealing with
			$browserVersion 	= $browser->getMajor();

			if( $browserVersion <= 7 )  {

				$stylesheet_browser  	= 'staffmaster_' . $currentBrowser . '_lte7.css';

				JHTML::stylesheet( $stylesheet_browser , $css_file_path );

			}

			// to cover IE5/6 styles
			if( $browserVersion <= 6 )  {

				$stylesheet_browser  	= 'staffmaster_' . $currentBrowser . '_lte6.css';

				JHTML::stylesheet( $stylesheet_browser , $css_file_path );

			}

		}

		if( $currentBrowser == "opera" )  {

			$stylesheet_browser  	= 'staffmaster_' . $currentBrowser . '.css';

			JHTML::stylesheet( $stylesheet_browser , $css_file_path );

		}
		if( $currentBrowser == "konqueror" )  {

			$stylesheet_browser  	= 'staffmaster_' . $currentBrowser . '.css';

			JHTML::stylesheet( $stylesheet_browser , $css_file_path );

		}

		if( $isStaff )  {

			$css_file_name =  'staffmaster_staff.css';

			JHTML::stylesheet( $css_file_name , $css_file_path );

			if( $currentBrowser == 'opera' )  {

				$css_file_name =  'staffmaster_staff_opera.css';

				JHTML::stylesheet( $css_file_name , $css_file_path );

			}

		}

		if( $use_js )  {

			$document 			=& JFactory::getDocument();

			$headerstuff		= $document->getHeadData();

			$jquery_exists 		= false;

			$match_jquery		= false;

			$match_jquery_ver	= false;

			foreach( $headerstuff['scripts'] as $script => $useless )  {

				ereg( "jquery" , $script , $match_jquery );

				if( $match_jquery )  {

					ereg( "126|1\.2\.6" , $script , $match_jquery_ver );

					if( $match_jquery_ver )  {

						$jquery_exists = true;

						unset( $match_jquery_ver );

						unset( $headerstuff['scripts'][$script] );
					}

					unset( $match_jquery );

				}

			}

			if( !$jquery_exists )
				JHTML::script( 'jquery-1.2.6.min.js'			  , 'components/'. $option .'/js/', false );

			JHTML::script( 'staffmaster_jquery_noconflict.js' , 'components/'. $option .'/js/', false );

		}

		if( $roundedCorners )  {

			JHTML::script( 'jquery.corners.js'				  , 'components/'. $option .'/js/', false );

			JHTML::script( 'jquery.newExcanvas.js'			  , 'components/'. $option .'/js/', false );

			JHTML::script( 'staffmaster_corners.js'			  , 'components/'. $option .'/js/', false );

		}

		if( $contact )  {

			JHTML::script( 'staffmaster_front.js'			  , 'components/'. $option .'/js/', false );

		}

	}

	/**
    * View All Staff All Departments
    **/
	function all()  {

		global $mainframe;

		$menu =&JSite::getMenu();

		$item = $menu->getActive();


		if( !is_null( $item ) )  {

			$cparams =& $menu->getParams( $item->id );

			$menuView = $cparams->get('menuView', '0');

			$imageSide = $cparams->get('imageSide', '0');

			$path_title = $cparams->get( 'page_title' );

		}

		$staff_model  		= &JModel::getInstance( 'staff', 'staffmodel');

		$departments_model 	= &JModel::getInstance( 'departments', 'staffmodel');

		$settings_model 	= &JModel::getInstance( 'settings', 'staffmodel');

		$document 			=& JFactory::getDocument();

		$viewName 			= $this->getTask();

		$viewType 			= $document->getType();

		$view 				= &$this->getView( $viewName , $viewType );

		if (!JError::isError( $staff_model )) {

			$view->setModel( $staff_model, true );

		}

		if (!JError::isError( $departments_model )) {

			$view->setModel( $departments_model, true );

		}

		if (!JError::isError( $settings_model )) {

			$view->setModel( $settings_model, true );

		}

		//Returns all of our staff members into staff_list
		$staff_list = $staff_model->getList();

		//Returns all of our departments into departments_list
		$departments_list = $departments_model->getList();

		//Returns all of our settings into params
		$params 		= $settings_model->getList();

		if( isset( $menuView ) && $menuView == '0' )
			$menuView = $params->view_all;

		if( isset( $imageSide ) && $imageSide != '0' )
			$params->staff_image_pos = $imageSide;

		$contact_html = array();

		foreach( $staff_list as $s ) {

			foreach( $s as $staff_member )  {

				$contact_html[ $staff_member->alias ] = $this->_createContactInfo( $params , $staff_member , $params->staff_image_pos );

			}

		}

		$pathway = &$mainframe->getPathway();

		if( !empty( $path_title ) ){

			$pathway->addItem( $path_title );

		}

		$parsed_acl = $this->_parseAcl( $params->acl );

		$this->setHeader( $params->use_js_frontend , $params->use_js_contact , $params->use_js_corners , $menuView );

		$view->setLayout( 'default' );

		$view->display( null , $staff_list , $departments_list , $params , $contact_html , $parsed_acl );

	}


	/**
    * View Single Staff No Departments
    *
    **/
	function staff()  {

		global $option , $mainframe;

		$menu =&JSite::getMenu();

		$item = $menu->getActive();

		if( !is_null( $item ) )  {

			$cparams =& $menu->getParams( $item->id );

			$menuView = $cparams->get('menuView', '0');

			$menuName = (int)$cparams->get('name', '0');

			$imageSide = $cparams->get('imageSide', '0');

			$path_title = $cparams->get( 'page_title' , '0');

		}

		$staff_model  		= &JModel::getInstance( 'staff', 'staffmodel');

		$departments_model 	= &JModel::getInstance( 'departments', 'staffmodel');

		$settings_model 	= &JModel::getInstance( 'settings', 'staffmodel');

		$staff_name 		= JRequest::getVar( 'name' );

		if( !is_null( $staff_name ) )  {

			$staff_name 		= str_replace( ':' , '-' , $staff_name );

		}
		else {

			if( isset( $menuName ) )  {

				$staff_name = $menuName;

			}

		}

		$document 			=& JFactory::getDocument();

		$viewName 			= $this->getTask();

		$viewType 			= $document->getType();

		$view 				= &$this->getView( $viewName , $viewType );

		if (!JError::isError( $staff_model )) {

			$view->setModel( $staff_model, true );

		}

		if (!JError::isError( $departments_model )) {

			$view->setModel( $departments_model, true );

		}

		if (!JError::isError( $settings_model )) {

			$view->setModel( $settings_model, true );

		}

		if( $staff_name == '0' )  {

			$staff_member = $staff_model->getOneById( '1' );

			if( $staff_member )  {

				$staff_member = $staff_member[0];

			}

		}
		elseif( !is_null( $staff_name ) )  {

			if( is_int( $staff_name ) )  {
				$staff_member = $staff_model->getOneById( $staff_name );
				$staff_member = $staff_member[0];
			}
			else  {
				$staff_member = $staff_model->getOneByAlias( $staff_name );
			}

		}

		//Returns all of our settings into params
		$params 		= $settings_model->getList();

		if( !isset( $menuView ) || $menuView == '0' )
			$menuView = $params->view_staff;

		if( isset( $imageSide ) && $imageSide != '0' )
			$params->staff_image_pos = $imageSide;

		if( $staff_member )  {

			//Returns all of our departments into departments_list
			$department = $departments_model->getOne( $staff_member->dept_id );

			$department_link = JRoute::_( 'index.php?option=' . $option . '&view=department&name=' . $department->alias );

			$pathway = &$mainframe->getPathway();

			$pathway->addItem($department->name, $department_link );

			if( !empty( $path_title ) ){

				$pathway->addItem( $path_title , '' );

			}
			else {
				$pathway->addItem( $staff_member->name );
			}

			$contact_html = array();

			$contact_html[ $staff_member->alias ] = $this->_createContactInfo( $params , $staff_member , $params->staff_image_pos );

		}

		$parsed_acl = $this->_parseAcl( $params->acl );

		$this->setHeader( $params->use_js_frontend , $params->use_js_contact , $params->use_js_corners , $menuView , true );

		$view->setLayout( 'default' );

		$view->display( null , $staff_member , $params , $contact_html , $parsed_acl );

	}

	/**
    * View All Staff All Departments - List View via Tables
    *
    **/
	function listall()  {

		global $mainframe;

		$menu 				=&JSite::getMenu();

		$item 				= $menu->getActive();

		$cparams 			=& $menu->getParams( $item->id );

		$displayImage 		= $cparams->get('displayImage', '0');

		$menuView 			= $cparams->get('menuView', '0');

		$bioCrop 			= $cparams->get( 'bioCrop' , '0' );

		$bioLen				= $cparams->get('bioLen', '100');

		$staff_model  		= &JModel::getInstance( 'staff', 'staffmodel');

		$departments_model 	= &JModel::getInstance( 'departments', 'staffmodel');

		$settings_model 	= &JModel::getInstance( 'settings', 'staffmodel');

		$document 			=& JFactory::getDocument();

		$viewName 			= $this->getTask();

		$viewType 			= $document->getType();

		$view 				= &$this->getView( $viewName , $viewType );

		$staff_model  		= new StaffModelStaff();

		$departments_model 	= new StaffModelDepartments();

		$settings_model 	= new StaffModelSettings();

		if (!JError::isError( $staff_model )) {

			$view->setModel( $staff_model, true );

		}

		if (!JError::isError( $departments_model )) {

			$view->setModel( $departments_model, true );

		}

		if (!JError::isError( $settings_model )) {

			$view->setModel( $settings_model, true );

		}

		//Returns all of our staff members into staff_list
		$staff_list = $staff_model->getList();

		//Returns all of our departments into departments_list
		$department = $departments_model->getList();

		//Returns all of our settings into params
		$params 		= $settings_model->getList();

		if( $menuView == '0' )
			$menuView = $params->view_list;

		$cropped_bios = null;

		$use_bio = false;


		foreach( $staff_list as $s ) {

			foreach( $s as $staff_member )  {

				if( !is_null( $staff_member->bio ) &&  !empty( $staff_member->bio ) )  { // Is staff member's bio empty?

					$use_bio = true;

					if( $bioCrop )
						$cropped_bios[ $staff_member->alias ] = $this->_cropBios( $staff_member , $bioLen );
					else
						$cropped_bios[ $staff_member->alias ] = $staff_member->bio;

				}
				elseif( !is_null( $params->staff_bio_default ) && !empty( $params->staff_bio_default ) ) {  //is the default bio parameter empty?

						$use_bio = true;

						$staff_member->bio = $params->staff_bio_default;

						if( $bioCrop == '1' )
							$cropped_bios[ $staff_member->alias ] = $this->_cropBios( $staff_member , $bioLen );
						else
							$cropped_bios[ $staff_member->alias ] = $staff_member->bio;

				}
				else  {

					$cropped_bios[ $staff_member->alias ] = '';

				}

			}

		}

		//if we did not set any bio text
		if( !$use_bio )
			$cropped_bios = false;

		$path_title = $cparams->get( 'page_title' );

		if( !empty( $path_title ) ){

			$pathway = &$mainframe->getPathway();

			$pathway->addItem( $path_title , '' );
		}

		$parsed_acl = $this->_parseAcl( $params->acl );

		$this->setHeader( $params->use_js_frontend , $params->use_js_contact , $params->use_js_corners , $menuView );

		$view->setLayout( 'default' );

		$view->display( null , $staff_list , $department , $params , $displayImage , $cropped_bios , $parsed_acl );

	}

	/**
    * View All Staff in One Department
    *
    **/
	function department()  {

		global $option, $mainframe;

		$menu =&JSite::getMenu();

		$item = $menu->getActive();

		if( !is_null( $item ) )  {

			$cparams =& $menu->getParams( $item->id );

			$menuView = $cparams->get('menuView', '0');

			$menuName = (int)$cparams->get('name', '0');

			$imageSide = $cparams->get('imageSide', '0');

			$path_title = $cparams->get( 'page_title' );

		}

		$staff_model  		= &JModel::getInstance( 'staff', 'staffmodel');

		$departments_model 	= &JModel::getInstance( 'departments', 'staffmodel');

		$settings_model 	= &JModel::getInstance( 'settings', 'staffmodel');

		$document 			=& JFactory::getDocument();

		$viewName 			= $this->getTask();

		$viewType 			= $document->getType();

		$view 				= &$this->getView( $viewName , $viewType );

		$dept_id 			= JRequest::getCmd( 'name' );

		if( !empty( $dept_id ) )  {

			$dept_id			= str_replace( ':' , '-' , $dept_id );

		}
		else {

			if( isset( $menuName ) )  {

				$dept_id = $menuName;

			}

		}

		if (!JError::isError( $staff_model )) {

			$view->setModel( $staff_model, true );

		}

		if (!JError::isError( $departments_model )) {

			$view->setModel( $departments_model, true );

		}

		if (!JError::isError( $settings_model )) {

			$view->setModel( $settings_model, true );

		}

		if( is_int( $dept_id ) ) {

			$department = $departments_model->getOne( $dept_id );

		}
		else {

			if( $menuName == '0')
				$department = $departments_model->getOneByAlias( $dept_id );
			else
				$department = $departments_model->getOneByAlias( $menuName );

		}

		//Returns all of our staff members into staff_list
		$staff_list = $staff_model->getListByDepartment( $department->id );

		//Returns all of our settings into params
		$params 		= $settings_model->getList();

		if( isset( $menuView ) && $menuView == '0' )
			$menuView = $params->view_all;

		if( isset( $imageSide ) && $imageSide != '0' )
			$params->staff_image_pos = $imageSide;

		$pathway = &$mainframe->getPathway();

		if( !empty( $path_title ) ){

			$pathway->addItem( $path_title );

		}

		$department_link = JRoute::_( 'index.php?option=' . $option . '&view=department&name=' . $department->alias );

		$pathway->addItem($department->name, $department_link );

		$contact_html = array();

		if( count( $staff_list ) >= 1 )  {

			foreach( $staff_list as $staff_member )  {

				$contact_html[ $staff_member->alias ] = $this->_createContactInfo( $params , $staff_member , $params->staff_image_pos );

			}

		}

		$parsed_acl = $this->_parseAcl( $params->acl );

		$this->setHeader( $params->use_js_frontend , $params->use_js_contact , $params->use_js_corners , $menuView );

		$view->setLayout( 'default' );

		$view->display( null , $staff_list , $department , $params , $contact_html , $parsed_acl );
	}


	/**
    * Helper Function: Create HTML necessary for contact info to slide into View
    *
    * @param stdObject		Complete params object comes in
 	* @param stdObjectRow  	One row from the staff list comes in by reference
 	* @param string			One row from the staff list comes in by reference
 	*
	* @return nothing		By Reference; HTML for Contact Info passed back to function via $staff_list->address4
	* @access private
*/
function _createContactInfo( $params , $staff_list , $side = ''  ) {

		$has_data 	  = false;
		$contact_html = '';

		if( !empty( $params->cl_phone1  ) )  {  $contact_html .= '<li class="contact_label"><img src="images/M_images/con_tel.png" title="Phone" alt="Phone"></img> ';  }

		if( !empty( $staff_list->phone1 ) )  {

			$contact_html .='<class="contact_data">' . $staff_list->phone1;

			if( !empty( $staff_list->ext1 ) )  {

				$contact_html .= ' ' . $params->cl_phone_ext . ' ' .$staff_list->ext1;

			}

			$contact_html .= '</li>';

			$has_data = true;

		}

		if( !empty( $params->cl_phone2  ) )  {  $contact_html .= '<li class="contact_label"><img src="images/M_images/con_fax.png" title="Fax" alt="Fax"></img>';  }

		if( !empty( $staff_list->phone2 ) )  {

			$contact_html .= '<class="contact_data">' . $staff_list->phone2;
			

			if( !empty( $staff_list->ext2 ) )  {

				$contact_html .= ' ' . $params->cl_phone_ext . ' ' .$staff_list->ext2;

			}

			$contact_html .= '</li>';

			$has_data = true;

		}

		if( !empty( $params->cl_email  ) )  {  $contact_html .= '<li class="contact_label"><img src="templates/ja_purity/images/emailButton.png" title="Email" alt="Email"></img>';  }

		if( !empty( $staff_list->email ) )  {

			$contact_html .= '<class="contact_data">' . $staff_list->email . '</li>';

			$has_data = true;

		}

		if( !empty( $params->cl_address1  ) )  {  $contact_html .= '<li class="contact_label"><img src="images/M_images/con_address.png" title="Personall Website" alt="Personall Website"></img>' ;  }

		if( !empty( $staff_list->address1 ) )  {

			$contact_html .= '<class="contact_data"><a href="' . $staff_list->address1 . '">Προσωπική Ιστοσελίδα</a></li>';

			$has_address = true;

		}

		if( !empty( $params->cl_address2  ) )  {  $contact_html .= '<li class="contact_label"> ' . $params->cl_address2 . ' ';  }

		if( !empty( $staff_list->address2 ) )  {

			$contact_html .= '<class="contact_data">' . $staff_list->address2 . '</li>';

			$has_data = true;

		}

		if( !empty( $params->cl_address3  ) )  {  $contact_html .= '<li class="contact_label">' . $params->cl_address3 ;  }

		if( !empty( $staff_list->address3 ) )  {

			$contact_html .= '<li class="contact_data">' . $staff_list->address3 . '</li>';

			$has_data = true;

		}

		if( !empty( $params->cl_address4  ) )  {  $contact_html .= '<li class="contact_label">' . $params->cl_address4 ;  }

		if( !empty( $staff_list->address4 ) )  {

			$contact_html .= '<class="contact_data">' . $staff_list->address4 . '</li>';

			$has_data = true;

		}

		if( $has_data )  {
			$contact_html = '<ul class="contact_info ' . $side . '">' . $contact_html . '</ul>';
		}

		return $contact_html;
	}

	/**
    * Helper Function: Truncate Staff Bio passed in By Reference via &$staff, truncated down to $bioLen
    *
    * @param stdObject		One row from the staff list comes in by reference
 	* @param int			bioLen = length to stop staff bio and add Read More
 	*
	* @return string		By Reference; HTML for Staff Bio passed back to function via $staff->bio
	* @access private
    **/
	function _cropBios( $staff , $bioLen )  {

		global $option;

		$bio = $staff->bio;


		if( strlen( $bio ) > $bioLen )  {

			$bio = substr( $bio , 0 , $bioLen );

			$bio_readmore_link = JRoute::_( 'index.php?option=' . $option . '&view=staff&name=' .  $staff->alias );

			$bio_readmore_html = '<br /><br /><a href="' . $bio_readmore_link .'" >' . JText::_("SM_READ_MORE") . '</a>';

			$bio .= $bio_readmore_html;

		}

		return $bio;

	}

	function _parseAcl( $parse_acl )  {

		$acl_arr = explode( ';' , $parse_acl );

		$parsed_acl = array();

		foreach( $acl_arr as $acl_str )  {

			$acl_str = explode( '=' , $acl_str );

			if( isset( $acl_str[1] ) )
				$parsed_acl[ trim( $acl_str[0] ) ] = $acl_str[1];

		}

		return $parsed_acl;
	}
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit