Пример #1
0
 /**
  * Log the customer in
  * @Developer brandon
  * @Date Oct 12, 2010
  */
 public function create()
 {
     if (Auth::instance()->login($this->input->post('customername'), $this->input->post('password'))) {
         url::redirect($this->input->post('redirect_override', request::referrer()));
     } else {
         flash::set_error('Unable to log in');
         url::redirect(request::referrer());
     }
 }
Пример #2
0
 /**
  * Create a session
  * @Developer brandon
  * @Date May 17, 2010
  */
 public function create()
 {
     if (user::logged_in()) {
         url::redirect('');
     }
     if (ORM::factory('user')->login($this->input->post())) {
         url::redirect(Session::instance()->get('redirect', ''));
     } else {
         flash::set_error('The username or password could not be verified');
         url::redirect('login');
     }
 }
Пример #3
0
 /**
  * Send out the e-mail to the user if we can find their email
  * @developer Brandon Hansen
  * @date May 31, 2010
  */
 public function send_email()
 {
     $user = ORM::factory('user')->find_by_email($this->input->post('email'));
     if ($user->loaded) {
         $email = new Email();
         $email->reset_password($user);
         flash::set_message('We have sent you an e-mail with password reset instructions');
         url::redirect('login');
     } else {
         flash::set_message('We were unable to locate an account with that e-mail address');
         url::redirect(request::referrer());
     }
 }
Пример #4
0
 * @subpackage Flash
 * @copyright  Copyright (c) 2005-2015 Kumbia Team (http://www.kumbiaphp.com)
 * @license    http://wiki.kumbiaphp.com/Licencia     New BSD License
 */
stylesheet_link_tag('style');
ob_start();
Flash::show('cuidado', 'Kumbia puede ser adictivo.');
flash::error('Test de flash::error');
flash::notice('Test de flash::notice');
flash::success('Test de flash::success');
flash::warning('Test de flash::warning');
flash::interactive('Test de flash::interactive');
flash::kumbia_error('Test de flash::kumbia_error');
$salida = ob_get_contents();
ob_end_clean();
$correcto = '<div class="flash_show cuidado">Kumbia puede ser adictivo.</div>
<div class="flash_show error_message">Test de flash::error</div>
<div class="flash_show notice_message">Test de flash::notice</div>
<div class="flash_show success_message">Test de flash::success</div>
<div class="flash_show warning_message">Test de flash::warning</div>
<div class="flash_show interactive_message">Test de flash::interactive</div>
<div class="flash_show error_message"><em>KumbiaError:</em> Test de flash::kumbia_error</div>
';
if ($salida == $correcto) {
    flash::success('Test pasado correctamente.');
    echo 'Salida:', "\n", $salida;
} else {
    flash::error('FALLO el test.');
    echo 'Salida correcta debe ser:', "\n", $correcto;
    echo 'Pero la salida es:', "\n", $salida;
}
Пример #5
0
 /**
  * Delete a $this->model_name
  * @Developer brandon
  * @Date Apr 21, 2010
  */
 public function delete()
 {
     ORM::factory($this->model_name, $this->input->post('id'))->delete();
     if (request::is_ajax()) {
         View::factory($this->directory . '/delete_ajax')->set('id', $this->input->post('id'))->render(true);
     } else {
         flash::set_message('The ' . format::friendly_model_name($this->model_name) . ' was deleted');
         if ($this->input->post('redirect_override')) {
             url::redirect($this->input->post('redirect_override'));
         } else {
             url::redirect($this->directory . '/');
         }
     }
 }
Пример #6
0
		
		<?php 
echo nav::output();
?>
	</div>
	<div class="clear"></div>
</div>

<div class="container white">
	<div class="margining">
		<div id="error_container"></div>
		<?php 
if (flash::get_message()) {
    ?>
			<div class="user_message" id="flash_message"><?php 
    echo flash::get_message();
    ?>
</div>
		<?php 
}
?>
	
		<?php 
if (flash::get_error()) {
    ?>
			<div class="user_message" id="flash_error"><?php 
    echo flash::get_error();
    ?>
</div>
		<?php 
}
	private function __upload($tagname,$filename,$overwrite=false) {
	
		//	if there is no uploaded file return false
		if (!is_uploaded_file($_FILES[$tagname]['tmp_name'])) {
			$this->__log(__('error encountered uploading file').'; '.__('no file was uploaded'),self::LOG_ERROR);
			Flash::set('error',__('No file was uploaded!'));
			return false;
		}
		
		//	if the uploaded file is not unique return false
		if (!$hash = $this->__unique($_FILES[$tagname]['tmp_name'])) {
			$this->__log(__('error encountered uploading file').'; '.__('the file was not unique; the file already exists'),self::LOG_ERROR );
			Flash::set('error',__('the file was not unique; the file already exists') . print_r($_FILES,1) );
			return false;
		}
		
		//	determine the uploaded file extension
		$ext = strtolower(pathinfo($_FILES[$tagname]['name'],PATHINFO_EXTENSION));
		
		//	check to make sure uploaded filetype is ok
		$valid_exts = explode(',',Plugin::getSetting('filetypes','downloads'));
		if (!in_array($ext,$valid_exts)) {
			$this->__log(__('error encountered uploading file').'; '.__('file was not an allowed type'),self::LOG_ERROR);
			Flash::set('error',__('Uploaded file not an allowed file type.'));
			return false;
		}
		
		//	setup the filename
		$filename = $this->__filename($filename,$ext);
				
		//	determine the destination directory
		$dstdir = CMS_ROOT."/{$this->settings['download_path']}/";
		
		//	if overwrite isn't allowed check to see if file exists
		if (!$overwrite && file_exists($dstdir.$filename)) {
			$this->__log(__('error encountered uploading file').'; '.__('file already exists'),self::LOG_ERROR);
			Flash::set('error',__('file already exists'));
			return false;
		}
		
		//	set the umask and move the uploaded file
		//	if there is a problem set the error, put the old file back and set an error
		umask(octdec($this->settings['umask']));
		if (!@move_uploaded_file($_FILES[$tagname]['tmp_name'],$dstdir.$filename)) {
			$this->__log(__('error encountered uploading file').'; '.__('could not move uploaded file'),self::LOG_ERROR);
			Flash::set('error',__('Could not move uploaded file!'));
			return false;
		}
		
		//	check to see if the file was uploaded and try to chmod the file
		//	if there is a problem with chmod output an error but don't stop since the
		//	file was already uploaded
		if (@!chmod($dstdir.$filename, octdec($this->settings['filemode']))) {
			$this->__log(__('error encountered uploading file').'; '.__('unable to change permissions'),self::LOG_WARNING);
			flash::set('error', __('File uploaded, however file permissions could not be changed.'));
		}
		
		//	return the image name
		$this->__log(__('uploaded file').' - '.$filename);
		return array('filename'=>$filename,'hash'=>$hash);

	}//*/
Пример #8
0
 /**
  * Submit Contact Form
  * @Developer brandon
  * @Date May 19, 2010
  */
 public function contact_submit()
 {
     flash::set_message('Thanks!  We will get back to you soon.');
     url::redirect('page/about');
 }
Пример #9
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
if (MAINTENANCE && ALLOW_DEVELOPER_ACCESS) {
    flash::set_message(Kohana::lang('messages.maintenance_mode'));
}