Location: PHPKode > scripts > GalleryShuffle > v1.0/php/controlerFront.php
<?php


// Specials actions
// if($_GET['action'] == 'upload') {
	
	// return;
	
// }

// Defaults actions handler

$view_frontNav = new view_frontNav();
	
switch($actions[0][0]) {
	
	case "admin" :
	
		switch($actions[0][1]){
			
			case "connection" : echo $view_frontNav->getPopupConnect('adminconnection', NULL, true); break;
			
		}
		
	break;
	case "album" :
		
		switch($actions[0][1]){
			
			case "connection" : echo $view_frontNav->getPopupConnect('album_connectionfinish:' . $values[0][0], $LANG->traduc['albumPasswordProtected']); break;
			
			case "connectionfinish" : 
				$model_albums = new model_albums();
				$model_buffer = $model_albums->getLineById($values[0][0]);
				echo $view_frontNav->getPopupConnectRespond($model_buffer['password'], 'clientLogUID', $values[0][0]); 
			break;
			
		}
		
	break;
	case "gallery" :
		
		switch($actions[0][1]){
			
			case "connection" : echo $view_frontNav->getPopupConnect('gallery_connectionfinish', $LANG->traduc['galleryPasswordProtected']); break;
			
			case "connectionfinish" : echo $view_frontNav->getPopupConnectRespond(CONFIG::galleryPassword, 'clientLogGalleryUID', NULL, 1); break;
			
		}
		
	break;
	default:
		
		$model_clientsLogs = new model_clientsLogs();
		
		$model_albums = new model_albums();
		$model_albums_buffer = $model_albums->getAllActive();
		
		$galleryIsLocked = false;
		$albumIsLocked = false;
		$albumId = 0;
		
		// Gallery protection
		if(CONFIG::galleryIsLocked == 1) {
		
			$galleryIsLocked = true;
			
			if(isset($_SESSION['clientLogGalleryUID']) && $_SESSION['clientLogGalleryUID'] != NULL){
		
				if($model_clientsLogs->verifyIsActiveLineByUidForGallery($_SESSION['clientLogGalleryUID'])){
				
					$galleryIsLocked = false;
					$model_clientsLogs->updateLineByUid($_SESSION['clientLogGalleryUID']);
				
				}
				
			}
		
		}
		
		// Album protection
		if(count($model_albums_buffer) != 0){
		
			$firstAlbumId = $model_albums_buffer[0]['ID'];
			
			if(isset($_GET['albumId']) && $_GET['albumId'] != NULL) $albumId = $_GET['albumId'];
			else $albumId = $firstAlbumId;
			
			foreach($model_albums_buffer as $value){
				
				if($albumId == $value['ID']){
					
					if($value['is_private'] == 1){
					
						$albumIsLocked = true;
						
						if(isset($_SESSION['clientLogUID']) && $_SESSION['clientLogUID'] != NULL){
							
							if($model_clientsLogs->verifyIsActiveLineByUid($_SESSION['clientLogUID'], $albumId))
								$albumIsLocked = false;
							
							$model_clientsLogs->updateNoActiveLineByUid($_SESSION['clientLogUID']);
							
						}
						
					}
					
					break;
				}
			
			}
		
		}
		
		if(!$albumIsLocked && !$galleryIsLocked) $_SESSION['imageAccessUID'] = CONFIG::imageAccessUID;
		
		$view = new view_front($model_albums_buffer, $albumId, $albumIsLocked, $galleryIsLocked);
		echo $view->buffer;
		
	break;
	
}
	
	
?>
Return current item: GalleryShuffle