Skip to content

Commit

Permalink
Merge conflict resolution. Added a use at the same line as remote. Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
splaer committed Feb 25, 2015
2 parents 6d4f4c6 + 2b83b52 commit b2af455
Show file tree
Hide file tree
Showing 56 changed files with 729 additions and 132 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.git
Dockerfile
.dockerignore
app/storage/logs/*
app/storage/views/*
vendor/*
vendor/*
33 changes: 9 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
FROM ubuntu
MAINTAINER Brady Wetherington <[email protected]>

# Merging all apt-stuff together
####RUN apt-get install -y apache2-bin libapache2-mod-php5 php5-mysql

RUN apt-get update && apt-get install -y \
apache2-bin \
libapache2-mod-php5 \
php5-mysql \
php5-mcrypt \
php5-gd \
patch \
curl \
git \
php5-mcrypt

#expect

# stopped using expect (!)
vim \
git

RUN php5enmod mcrypt

#RUN echo "include_path=/var/www/html/include" >> /etc/php5/apache2/php.ini
RUN php5enmod gd

RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php5/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php5/cli/php.ini
Expand All @@ -29,18 +23,12 @@ RUN useradd --uid 1000 --gid 50 docker
RUN echo export APACHE_RUN_USER=docker >> /etc/apache2/envvars
RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars

#COPY httpd.conf /etc/apache2/apache2.conf

COPY docker/000-default.conf /etc/apache2/sites-enabled/000-default.conf

COPY . /var/www/html

#apachectl start

RUN a2enmod rewrite

#RUN apt-get install -y patch

############ INITIAL APPLICATION SETUP #####################

COPY docker/app_start.patch /tmp/app_start.patch
Expand Down Expand Up @@ -71,19 +59,16 @@ RUN cp -n /var/www/html/app/config/production/app.example.php /var/www/html/app/
# Change default hostname to blank...I guess?
RUN sed -i s%http://staging.yourserver.com%% /var/www/html/app/config/production/app.php

# turn off the toolbar
RUN sed -i 's%\x27debug\x27 => true%\x27debug\x27 => false%' /var/www/html/app/config/production/app.php

RUN chown -R docker /var/www/html

############## DEPENDENCIES via COMPOSER ###################

# get curl (this feels yucky, doesn' it?)
#RUN apt-get install -y curl

#global install of composer
RUN cd /tmp;curl -sS https://getcomposer.org/installer | php;mv /tmp/composer.phar /usr/local/bin/composer

# Composer won't install without git (doctrine/inflector specifically?)
#RUN apt-get install -y git

# Get dependencies
RUN cd /var/www/html;composer install

Expand All @@ -100,4 +85,4 @@ RUN cd /var/www/html;composer install

CMD . /etc/apache2/envvars ;apache2 -DFOREGROUND

EXPOSE 80
EXPOSE 80
8 changes: 6 additions & 2 deletions app/commands/AppCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,16 @@ public function fire()
// Seed the tables with dummy data
if( $this->dummyData === true )
{
$this->call('db:seed');
$this->call('db:seed', array('--force'=>true));
}
else
{
// Seeding Settings table is mandatory
$this->call('db:seed', array('--class' => 'SettingsSeeder'));
$this->call('db:seed', array('--class' => 'SettingsSeeder', '--force'=>true));
// Seeding Statuslabels is strongly recommended
$this->call('db:seed', array('--class' => 'StatuslabelsSeeder', '--force'=>true));
// Seeding Categories is good to have
$this->call('db:seed', array('--class' => 'CategoriesSeeder', '--force'=>true));
}
}

Expand Down
94 changes: 94 additions & 0 deletions app/commands/SendExpirationAlerts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

class SendExpirationAlerts extends Command {

/**
* The console command name.
*
* @var string
*/
protected $name = 'alerts:expiring';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This command checks for expiring warrantees and service agreements, and sends out an alert email.';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$expiring_assets = Asset::getExpiringWarrantee(60);

$data['count'] = count($expiring_assets);
$data['email_content'] ='';



foreach ($expiring_assets as $asset) {
$now = date("Y-m-d");
$expires = $asset->warrantee_expires();
$difference = round(abs(strtotime($expires) - strtotime($now))/86400);

if ($difference > 30) {
$data['email_content'] .= '<tr style="background-color: #fcffa3;">';
} else {
$data['email_content'] .= '<tr style="background-color:#d9534f;">';
}
$data['email_content'] .= '<td><a href="'.Config::get('app.url').'/hardware/'.$asset->id.'/view">';
$data['email_content'] .= $asset->name.'</a></td><td>'.$asset->asset_tag.'</td>';
$data['email_content'] .= '<td>'.$asset->warrantee_expires().'</td>';
$data['email_content'] .= '<td>'.$difference.' days</td>';
$data['email_content'] .= '</tr>';
}

if ((Setting::getSettings()->alert_email!='') && (Setting::getSettings()->alerts_enabled==1)){

if (count($expiring_assets) > 0) {

Mail::send('emails.expiring-report', $data, function ($m) {
$m->to(Setting::getSettings()->alert_email, Setting::getSettings()->site_name);
$m->subject('Expiring Assets Report');
});

}

} else {

if (Setting::getSettings()->alert_email=='') {
echo "Could not send email. No alert email configured in settings. \n";
} elseif (Setting::getSettings()->alerts_enabled!=1) {
echo "Alerts are disabled in the settings. No mail will be sent. \n";
}

}




}





}
14 changes: 14 additions & 0 deletions app/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@
*/

'cipher' => MCRYPT_RIJNDAEL_256,

/*
|--------------------------------------------------------------------------
| Prevent Password changes
|--------------------------------------------------------------------------
|
| If for some reason you do not wish for admins to be able to edit the password
| for any user (including themselves), set this to true.
|
*/

'lock_passwords' => false,



/*
|--------------------------------------------------------------------------
Expand Down
61 changes: 34 additions & 27 deletions app/controllers/account/ChangeEmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Sentry;
use Validator;
use View;
use Config;
use Lang;

class ChangeEmailController extends AuthorizedController
{
Expand Down Expand Up @@ -36,34 +38,39 @@ public function postIndex()
'email' => 'required|email|unique:users,email,'.Sentry::getUser()->email.',email',
'email_confirm' => 'required|same:email',
);

if (Config::get('app.lock_passwords')) {
return Redirect::route('change-password')->with('error', Lang::get('admin/users/table.lock_passwords'));
} else {

// Create a new validator instance from our validation rules
$validator = Validator::make(Input::all(), $rules);

// If validation fails, we'll exit the operation now.
if ($validator->fails()) {
// Ooops.. something went wrong
return Redirect::back()->withInput()->withErrors($validator);
}

// Grab the user
$user = Sentry::getUser();

// Check the user current password
if ( ! $user->checkPassword(Input::get('current_password'))) {
// Set the error message
$this->messageBag->add('current_password', 'Your current password is incorrect');

// Redirect to the change email page
return Redirect::route('change-email')->withErrors($this->messageBag);
}

// Update the user email
$user->email = Input::get('email');
$user->save();

// Redirect to the settings page
return Redirect::route('change-email')->with('success', 'Email successfully updated');
// Create a new validator instance from our validation rules
$validator = Validator::make(Input::all(), $rules);

// If validation fails, we'll exit the operation now.
if ($validator->fails()) {
// Ooops.. something went wrong
return Redirect::back()->withInput()->withErrors($validator);
}

// Grab the user
$user = Sentry::getUser();

// Check the user current password
if ( ! $user->checkPassword(Input::get('current_password'))) {
// Set the error message
$this->messageBag->add('current_password', 'Your current password is incorrect');

// Redirect to the change email page
return Redirect::route('change-email')->withErrors($this->messageBag);
}

// Update the user email
$user->email = Input::get('email');
$user->save();

// Redirect to the settings page
return Redirect::route('change-email')->with('success', 'Email successfully updated');
}
}

}
6 changes: 6 additions & 0 deletions app/controllers/account/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Sentry;
use Validator;
use View;
use Config;
use Lang;

class ChangePasswordController extends AuthorizedController
{
Expand Down Expand Up @@ -37,6 +39,9 @@ protected function postIndex()
'password_confirm' => 'required|same:password',
);

if (Config::get('app.lock_passwords')) {
return Redirect::route('change-password')->with('error', Lang::get('admin/users/table.lock_passwords'));
} else {
// Create a new validator instance from our validation rules
$validator = Validator::make(Input::all(), $rules);

Expand All @@ -61,6 +66,7 @@ protected function postIndex()
// Update the user password
$user->password = Input::get('password');
$user->save();
}

// Redirect to the change-password page
return Redirect::route('change-password')->with('success', 'Password successfully updated');
Expand Down
49 changes: 49 additions & 0 deletions app/controllers/account/ViewAssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Location;
use View;
use Asset;
use Actionlog;
use Lang;

class ViewAssetsController extends AuthorizedController
{
Expand Down Expand Up @@ -55,6 +57,53 @@ public function getRequestAsset($assetId = null) {


}



// Get the acceptance screen
public function getAcceptAsset($assetId = null) {

// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
}

return View::make('frontend/account/accept-asset', compact('asset'));




}

// Save the acceptance
public function postAcceptAsset($assetId = null) {

// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
}

$user = Sentry::getUser();


$logaction = new Actionlog();
$logaction->asset_id = $assetId;
$logaction->checkedout_to = $asset->assigned_to;
$logaction->asset_type = 'hardware';
$logaction->note = e(Input::get('note'));
$logaction->user_id = $user->id;
$logaction->accepted_at = date("Y-m-d h:i:s");
$log = $logaction->logaction('accepted');

return Redirect::to('account/view-assets')->with('success', 'You have successfully accept this asset.');




}



}
Loading

0 comments on commit b2af455

Please sign in to comment.