Skip to content

Commit

Permalink
Initial commit of work snapshot.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdondich committed Mar 28, 2018
0 parents commit c16a711
Show file tree
Hide file tree
Showing 230 changed files with 263,299 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
661 changes: 661 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions ProcessMaker/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
namespace ProcessMaker;

use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Foundation\Application as IlluminateApplication;
use Illuminate\Support\Facades\Auth;

/**
* Class Application
* @package ProcessMaker
*
* This represents our top level processmaker application.
*/
class Application extends IlluminateApplication
{
// Our ProcessMaker Version
const VERSION = '4.0.0';

protected $namespace = 'ProcessMaker';

/**
* Sets the timezone for the application and for php with the specified timezone
* @param $tz string The timezone to set to
*/
public function setTimezone($tz)
{
config(['app.timezone' => $tz]);
date_default_timezone_set(config('app.timezone'));
}

/**
* Retrieves the currently set timezone
* @return string The timezone for the system
*/
public function getTimezone()
{
return config('app.timezone');
}

/**
* Return the System defined constants and Application variables
* Constants: SYS_*
* Sessions : USER_* , URS_*
*
* @note: This is ported from Gulliver System. This will most likely need to be refactored/removed
* @return array Contents of system contents.
*/
public function getSystemConstants()
{
$sysCon = [];
$sysCon['SYS_LANG'] = $this->getLocale();

// Get the current theme
$sysCon['SYS_SKIN'] = Theme::get();

// The following items should be refactored to no longer use $_SESSION
// Since these items should be request scope specific and not session specific
$sysCon["APPLICATION"] = (isset($_SESSION["APPLICATION"]))? $_SESSION["APPLICATION"] : "";
$sysCon["PROCESS"] = (isset($_SESSION["PROCESS"]))? $_SESSION["PROCESS"] : "";
$sysCon["TASK"] = (isset($_SESSION["TASK"]))? $_SESSION["TASK"] : "";
$sysCon["INDEX"] = (isset($_SESSION["INDEX"]))? $_SESSION["INDEX"] : "";
$sysCon['USER_LOGGED'] = Auth::user() ? Auth::user()->USR_UID : '';
$sysCon['USER_USERNAME'] = Auth::user() ? Auth::user()->USR_USERNAME : '';

return $sysCon;
}
}
42 changes: 42 additions & 0 deletions ProcessMaker/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
namespace ProcessMaker\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
// @todo Add our ProcessMaker specific commands to this list
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
/**
* Currently no scheduled tasks exists, however once scheduled cron tasks are required, they should
* be placed here.
*/
}

/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
16 changes: 16 additions & 0 deletions ProcessMaker/Exception/DatabaseConnectionFailedException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

/**
* Thrown if the connection fails
*
* @package ProcessMaker\Exceptions
*/

class DatabaseConnectionFailedException extends Exception
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

/**
* Exception thrown when a connection to a not supported driver (mysql, oracle, etc.) is tried.
*
* @package ProcessMaker\Exceptions
*/
class DatabaseConnectionTypeNotSupportedException extends Exception
{

}
14 changes: 14 additions & 0 deletions ProcessMaker/Exception/FileManagerExtensionException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

/**
* Description of InvalidFileManagerExtension
*
*/
class FileManagerExtensionException extends Exception
{

}
14 changes: 14 additions & 0 deletions ProcessMaker/Exception/FileManagerFileExistsException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

/**
* Description of FileManagerFileExistsException
*
*/
class FileManagerFileExistsException extends Exception
{
//put your code here
}
20 changes: 20 additions & 0 deletions ProcessMaker/Exception/FileManagerPathException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace ProcessMaker\Exception;

use Exception;
use Throwable;

/**
* Invalid File Manager path exception.
*
*/
class FileManagerPathException extends Exception
{

public function __construct($code = 0, Throwable $previous = null)
{
$message = G::LoadTranslation("ID_INVALID_PRF_PATH");
parent::__construct($message, $code, $previous);
}
}
14 changes: 14 additions & 0 deletions ProcessMaker/Exception/FileManagerRemoveEmailTemplateException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

/**
* Description of FileManagerRemoveEmailTemplateException
*
*/
class FileManagerRemoveEmailTemplateException extends Exception
{

}
14 changes: 14 additions & 0 deletions ProcessMaker/Exception/FileManagerUnableToEditException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

/**
* Description of FileManagerUnableToEditException
*
*/
class FileManagerUnableToEditException extends Exception
{

}
72 changes: 72 additions & 0 deletions ProcessMaker/Exception/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
namespace ProcessMaker\Exception;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Facades\App;

/**
* Our general exception handler
* @package ProcessMaker\Exception
*/
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];


/**
* Report our exception. If in testing with verbosity, it will also dump exception information to the console
* @param Exception $exception
* @throws Exception
*/
public function report(Exception $exception)
{
if (App::environment() == 'testing' && env('TESTING_VERBOSE')) {
// If we're verbose, we should print ALL Exceptions to the screen
print($exception->getMessage() . "\n");
print($exception->getFile() . ": Line: " . $exception->getLine() . "\n");
print($exception);
}
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}

/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
}
33 changes: 33 additions & 0 deletions ProcessMaker/Exception/ValidationException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace ProcessMaker\Exception;

use Illuminate\Validation\ValidationException as ValidationExceptionBase;
use Illuminate\Validation\Validator;

/**
* Description of ValidationException
*
*/
class ValidationException extends ValidationExceptionBase
{
const ERROR_CODE = 422;

public function __construct(Validator $validator)
{
$errors = $validator->errors()->getMessages();
foreach ($errors as $key => $messages) {
$message = $messages[0];
break;
}
$error = [
'error' => [
'code' => 422,
'message' => $message,
],
'errors' => $errors
];
$response = response()->json($error, static::ERROR_CODE);
parent::__construct($validator, $response);
}
}
22 changes: 22 additions & 0 deletions ProcessMaker/Facades/DatabaseManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace ProcessMaker\Facades;

use Illuminate\Support\Facades\Facade;

/**
* Facade for our Database Manager
* @package ProcessMaker\Facades
* @see \ProcessMaker\Managers\DatabaseManager
*/
class DatabaseManager extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'database.manager';
}
}
Loading

0 comments on commit c16a711

Please sign in to comment.