update v1.0.3.3

This commit is contained in:
sujitprasad
2015-12-22 14:09:23 +05:30
parent 2bc3db252e
commit 696e0390fe
8590 changed files with 3456 additions and 818 deletions

View File

@@ -1,3 +1,3 @@
/vendor
/node_modules /node_modules
.env .env

View File

@@ -1,49 +1,27 @@
## Laravel PHP Framework
<h3>About Faveo</h3> [![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework)
<p>Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support. [![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework)
<br/><br/> [![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework)
The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SMEs empowering them with state of art, ticket based support system. In todays competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions. [![Latest Unstable Version](https://poser.pugx.org/laravel/framework/v/unstable.svg)](https://packagist.org/packages/laravel/framework)
<br/><br/> [![License](https://poser.pugx.org/laravel/framework/license.svg)](https://packagist.org/packages/laravel/framework)
To date, Faveo has been integrated with 6 platforms and every month there is 1 to 2 update releases with new features & platform integration.
<br/><br/>
Faveo can also be customised according to requirement and we do undertake such request.
<br/><br/>
Faveo is designed & developed by <a href="http://www.ladybirdweb.com/" target="_blank">Ladybird Web Solution Pvt Ltd</a>, and launched in October 2015.</p>
<h3>Flavors of Faveo</h3>
<ul>
<li>Community Edition Free, Open source edition</li>
<li>Pro Edition Downloadable edition. Install it in location of our choice on premises or any hosting of your choice </li>
<li>Cloud Edition Coming soon. Get started in 5 minutes. We will take care of servers, backup etc. Always stay updated with the latest updates of Faveo</li>
</ul>
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
<h3><a id="user-content-faveo-user-manual" href="https://github.com/ladybirdweb/faveo-helpdesk#faveo-user-manual" aria-hidden="true"></a>Faveo User Manual</h3> Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
<p>Check out Faveo Knowledge Base <a href="http://www.ladybirdweb.com/support/knowledgebase" target="_blank">here</a></p>
<h3><a id="user-content-requirements" href="https://github.com/ladybirdweb/faveo-helpdesk#requirements" aria-hidden="true"></a>Requirements</h3>
<p>To run Faveo your host just needs a couple of things:</p>
<ul>
<li>PHP 5.5 or greater</li>
<li>MySQL 5.5 or greater</li>
<li>The mod_rewrite Apache module</li>
</ul>
<h3>Faveo Web Hosting</h3> ## Official Documentation
<p><a href="http://www.store.ladybirdwebhost.com/" target="_blank">Ladybird Web Host</a> Offers hosting with minimum requirement to host Faveo web application. Faveo has been tested on Ladybird Web Host servers &amp; works very well in their server environment. All web hosting packages offered by Ladybird Web Host come with 30 day money back gurantee.</p>
<h3><a id="user-content-credits" href="https://github.com/ladybirdweb/faveo-helpdesk#credits" aria-hidden="true"></a>Credits</h3>
<ul>
<li>Laravel Framework</li>
<li>Admin LTE Theme</li>
</ul>
<h3><a id="user-content-website" href="https://github.com/ladybirdweb/faveo-helpdesk#website" aria-hidden="true"></a>Website</h3> Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
<p><a href="http://www.faveohelpdesk.com/" target="_blank">www.faveohelpdesk.com</a></p>
<h3>YouTube Channel</h3> ## Contributing
<p><a href="https://www.youtube.com/channel/UC-eqh-h241b1janp6sU7Iiw" target="_blank">Click here</a></p>
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
<h3>Road Map for Community Edition:</h3> ## Security Vulnerabilities
<p><a href="http://www.faveohelpdesk.com/faveo-helpdesk-road-map" target="_blank">Click here</a></p>
<h3>Don't panic if you come across bugs</h3> If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
<p>Faveo is very very new in the market, the product is fully working and is production worthy but it definitely will have some bugs like any software. We fully support Faveo whether free or pro edition, incase you come across any bugs, email us through the <a href="http://www.faveohelpdesk.com/contact-us/">contact form</a>. We want to make your experience of using Faveo as memorable as possible, so help us make Faveo a World, top class helpdesk application. Do check out our roadmap to stayed tuned with future releases </p>
### License
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

View File

@@ -115,8 +115,10 @@ class MailController extends Controller {
// echo $_SERVER['DOCUMENT_ROOT']; // echo $_SERVER['DOCUMENT_ROOT'];
$dir_img_paths = __DIR__; $dir_img_paths = __DIR__;
$dir_img_path = explode('/code', $dir_img_paths); $dir_img_path = explode('/code', $dir_img_paths);
$filepath = explode('../../../../../public/',$attachment->filePath); $filepath = explode('../../../../../../public/',$attachment->filePath);
$path = $dir_img_path[0]."/code/public/".$filepath[1]; // dd($filepath);
// $path = $dir_img_path[0]."/public/".$filepath[1];
$path = public_path().'/'.$filepath[1];
// dd($path); // dd($path);
$filesize = filesize($path); $filesize = filesize($path);
$file_data = file_get_contents($path); $file_data = file_get_contents($path);

View File

@@ -24,10 +24,10 @@ class NotificationController extends Controller {
public function send_notification() { public function send_notification() {
// $this->test(); // $this->test();
$company = $this->company(); $company = $this->company();
$this->send_notification_to_admin($company); // $this->send_notification_to_admin($company);
$this->send_notification_to_team_lead($company); // $this->send_notification_to_team_lead($company);
$this->send_notification_to_manager($company); // $this->send_notification_to_manager($company);
$this->send_notification_to_agent($company); // $this->send_notification_to_agent($company);
} }
/** /**

View File

@@ -49,6 +49,50 @@ class OrganizationController extends Controller {
} }
} }
/**
* This function is used to display the list of Organizations
* @return datatable
*/
public function org_list() {
return \Datatable::collection(Organization::all())
->searchColumns('name')
->orderColumns('name', 'website')
->addColumn('name', function ($model) {
return $model->name;
})
->addColumn('website', function ($model) {
$website = $model->website;
return $website;
})
->addColumn('phone', function ($model) {
$phone = $model->phone;
return $phone;
})
->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
//return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id .'"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="'.route('organizations.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="'.route('organizations.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
<div class="modal fade" id="deletearticle'.$model->id .'">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4>
</div>
<div class="modal-body">
'.$model->user_name.'
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="'.route('org.delete',$model->id).'"><button class="btn btn-danger">delete</button></a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>';
})
->make();
}
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* @return type Response * @return type Response

View File

@@ -565,7 +565,7 @@ class TicketController extends Controller {
$user->role = "user"; $user->role = "user";
$user->active = "1"; $user->active = "1";
// mail user his/her password // mail user his/her password
\Event::fire(new \App\Events\ClientTicketFormPost($from_data,$emailadd,$source));
if ($user->save()) { if ($user->save()) {
$user_id = $user->id; $user_id = $user->id;
// Event fire // Event fire

View File

@@ -66,6 +66,72 @@ class UserController extends Controller {
} }
} }
/**
* This function is used to display the list of users
* @return datatable
*/
public function user_list() {
return \Datatable::collection(User::where('role','!=','admin')->where('role','!=','agent')->get())
->searchColumns('user_name')
->orderColumns('user_name', 'email')
->addColumn('user_name', function ($model) {
return $model->user_name;
})
->addColumn('email', function ($model) {
$email = $model->email;
return $email;
})
->addColumn('phone', function ($model) {
$phone = "";
if($model->phone_number) {
$phone = $model->ext . ' ' . $model->phone_number;
}
$mobile = "";
if($model->mobile) {
$mobile = $model->mobile;
}
$phone = $phone ."&nbsp;&nbsp;&nbsp;". $mobile;
return $phone;
})
->addColumn('status', function ($model) {
$status = $model->active;
if($status == 1) {
$stat = '<button class="btn btn-success btn-xs">Active</button>';
} else {
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
}
return $stat;
})
->addColumn('lastlogin', function ($model) {
$t = $model->updated_at;
return TicketController::usertimezone($t);
})
->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
//return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id .'"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
<div class="modal fade" id="deletearticle'.$model->id .'">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4>
</div>
<div class="modal-body">
'.$model->user_name.'
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="'.route('user.delete',$model->id).'"><button class="btn btn-danger">delete</button></a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>';
})
->make();
}
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* @return type Response * @return type Response

View File

@@ -0,0 +1,626 @@
<?php namespace App\Http\Controllers\Common;
// controllers
use App\Http\Controllers\Controller;
// requests
use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\SmtpRequest;
use App\Http\Requests;
// models
use App\Model\helpdesk\Theme\Footer2;
use App\Model\helpdesk\Theme\Footer3;
use App\Model\helpdesk\Theme\Footer4;
use App\Model\helpdesk\Theme\Footer;
use App\Model\helpdesk\Email\Smtp;
use App\Model\helpdesk\Utility\Version_Check;
// classes
use Config;
use Input;
use Crypt;
use Illuminate\Support\Collection;
use App\Model\helpdesk\Settings\Plugin;
/**
* ***************************
* Settings Controllers
* ***************************
* Controller to keep smtp details and fetch where ever needed
* @package default
*/
class SettingsController extends Controller {
/**
* Create a new controller instance.
* @return type void
*/
public function __construct() {
// $this->smtp();
$this->middleware('auth');
$this->middleware('roles');
SettingsController::driver();
SettingsController::host();
SettingsController::port();
SettingsController::from();
SettingsController::encryption();
SettingsController::username();
SettingsController::password();
}
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter(Footer $footer) {
$footer = $footer->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer', compact('footer'));
}
/**
* Post footer
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter(Footer $footer, Request $request) {
$footer = $footer->whereId('1')->first();
if ($footer->fill($request->input())->save()) {
return redirect('create-footer')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer')->with('fails', 'Footer was not Saved');
}
}
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter2(Footer2 $footer2) {
$footer2 = $footer2->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer2', compact('footer2'));
}
/**
* Post footer 2
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter2(Footer2 $footer2, Request $request) {
$footer2 = $footer2->whereId('1')->first();
if ($footer2->fill($request->input())->save()) {
return redirect('create-footer2')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer2')->with('fails', 'Footer was not Saved');
}
}
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter3(Footer3 $footer3) {
$footer3 = $footer3->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer3', compact('footer3'));
}
/**
* Post footer 3
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter3(Footer3 $footer3, Request $request) {
$footer3 = $footer3->whereId('1')->first();
if ($footer3->fill($request->input())->save()) {
return redirect('create-footer3')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer3')->with('fails', 'Footer was not Saved');
}
}
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter4(Footer4 $footer4) {
$footer4 = $footer4->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer4', compact('footer4'));
}
/**
* Post footer 4
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter4(Footer4 $footer4, Request $request) {
$footer4 = $footer4->whereId('1')->first();
if ($footer4->fill($request->input())->save()) {
return redirect('create-footer4')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer4')->with('fails', 'Footer was not Saved');
}
}
/**
* Driver
* @return type void
*/
static function driver() {
$set = new Smtp;
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->driver);
}
/**
* SMTP host
* @return type void
*/
static function host() {
$set = new Smtp;
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->host);
}
/**
* SMTP port
* @return type void
*/
static function port() {
$set = new Smtp;
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.port', intval($settings->port));
}
/**
* SMTP from
* @return type void
*/
static function from() {
$set = new Smtp;
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]);
}
/**
* SMTP encryption
* @return type void
*/
static function encryption() {
$set = new Smtp;
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.encryption', $settings->encryption);
}
/**
* SMTP username
* @return type void
*/
static function username() {
$set = new Smtp;
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.username', $settings->email);
}
/**
* SMTP password
* @return type void
*/
static function password() {
$settings = Smtp::first();
if ($settings->password) {
$pass = $settings->password;
$password = Crypt::decrypt($pass);
Config::set('mail.password', $password);
}
}
/**
* get SMTP
* @return type view
*/
public function getsmtp() {
$settings = Smtp::where('id', '=', '1')->first();
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
}
/**
* POST SMTP
* @return type view
*/
public function postsmtp(SmtpRequest $request) {
$data = Smtp::where('id', '=', 1)->first();
$data->driver = $request->input('driver');
$data->host = $request->input('host');
$data->port = $request->input('port');
$data->encryption = $request->input('encryption');
$data->name = $request->input('name');
$data->email = $request->input('email');
$data->password = Crypt::encrypt($request->input('password'));
if ($data->save()) {
return \Redirect::route('getsmtp')->with('success', 'success');
} else {
return \Redirect::route('getsmtp')->with('fails', 'fails');
}
}
/**
* SMTP
* @return type void
*/
static function smtp() {
$settings = Smtp::where('id', '=', '1')->first();
if ($settings->password) {
$password = Crypt::decrypt($settings->password);
Config::set('mail.driver', $settings->driver);
Config::set('mail.password', $password);
Config::set('mail.username', $settings->email);
Config::set('mail.encryption', $settings->encryption);
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->name]);
Config::set('mail.port', intval($settings->port));
Config::set('mail.host', $settings->host);
}
}
/**
* Settings
* @param type Smtp $set
* @return type view\
*/
public function settings(Smtp $set) {
$settings = $set->where('id', '1')->first();
return view('themes.default1.admin.settings', compact('settings'));
}
/**
* Post settings
* @param type Settings $set
* @param type Request $request
* @return type view
*/
public function PostSettings(Settings $set, Request $request) {
$settings = $set->where('id', '1')->first();
$pass = $request->input('password');
$password = Crypt::encrypt($pass);
$settings->password = $password;
$settings->save();
if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist/logo';
$fileName = rand(0000, 9999) . '.' . $name;
Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName;
$settings->save();
}
$settings->fill($request->except('logo', 'password'))->save();
return redirect()->back()->with('success', 'Settings updated Successfully');
}
/**
* version_check
* @return type
*/
public function version_check() {
$response_url = \URL::route('post-version-check');
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
echo "<input type='hidden' name='_token' value='csrf_token()'/>";
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
echo "<input type='hidden' name='id' value='19'/>";
echo "<input type='hidden' name='response_url' value='" . $response_url . "' />";
echo "</form>";
echo "<script language='javascript'>document.redirect.submit();</script>";
}
/**
* post_version_check
* @return type
*/
public function post_version_check(Request $request) {
$current_version = \Config::get('app.version');
$new_version = $request->value;
if ($current_version == $new_version) {
// echo "No, new Updates";
return redirect()->route('checkupdate')->with('info', ' No, new Updates');
} elseif ($current_version < $new_version) {
$version = Version_Check::where('id', '=', '1')->first();
$version->current_version = $current_version;
$version->new_version = $new_version;
$version->save();
// echo "Version " . $new_version . " is Available";
return redirect()->route('checkupdate')->with('info', ' Version ' . $new_version . ' is Available');
} else {
// echo "Error Checking Version";
return redirect()->route('checkupdate')->with('info', ' Error Checking Version');
}
}
public function getupdate() {
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
}
public function Plugins() {
return view('themes.default1.admin.helpdesk.settings.plugins');
}
public function GetPlugin() {
$plugins = $this->fetchConfig();
//dd($plugins);
return \Datatable::collection(new Collection($plugins))
->searchColumns('name')
->addColumn('name', function($model) {
if (array_has($model, 'path')) {
if ($model['status'] == 0) {
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Activate</a>";
$settings = " ";
} else {
$settings = "<a href=" . url($model['settings']) . ">Settings</a> | ";
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Deactivate</a>";
}
$delete = "<a href= id=delete".$model['path']." data-toggle=modal data-target=#del".$model['path']."><span style='color:red'>Delete</span></a>"
. "<div class='modal fade' id=del".$model['path'].">
<div class='modal-dialog'>
<div class=modal-content>
<div class=modal-header>
<h4 class=modal-title>Delete</h4>
</div>
<div class=modal-body>
<p>Are you Sure ?</p>
<div class=modal-footer>
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>" . \Lang::get('lang.close') . "</button>
<a href=" . url('plugin/delete/' . $model['path']) . "><button class='btn btn-danger'>Delete</button></a>
</div>
</div>
</div>
</div>
</div>";
$action = "<br><br>" . $delete . " | " . $settings . $activate;
} else {
$action = '';
}
return ucfirst($model['name']) . $action;
})
->addColumn('description', function($model) {
return ucfirst($model['description']);
})
->addColumn('author', function($model) {
return ucfirst($model['author']);
})
->addColumn('website', function($model) {
return "<a href=".$model['website']." target=_blank>".$model['website']."</a>";
})
->addColumn('version', function($model) {
return $model['version'];
})
->make();
}
/**
* Reading the Filedirectory
* @return type
*/
public function ReadPlugins() {
$dir = app_path() . '/Plugins';
$plugins = array_diff(scandir($dir), array('.', '..'));
return $plugins;
}
/**
* After plugin post
* @param Request $request
* @return type
*/
public function PostPlugins(Request $request) {
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
$plug = new Plugin();
$file = $request->file('plugin');
//dd($file);
$destination = app_path() . '/Plugins';
$zipfile = $file->getRealPath();
/**
* get the file name and remove .zip
*/
$filename2 = $file->getClientOriginalName();
$filename2 = str_replace('.zip', '', $filename2);
$filename1 = ucfirst($file->getClientOriginalName());
$filename = str_replace('.zip', '', $filename1);
mkdir($destination . '/' . $filename);
/**
* extract the zip file using zipper
*/
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . '/' . $filename);
$file = app_path() . '/Plugins/' . $filename; // Plugin file path
if (file_exists($file)) {
$seviceporvider = $file . '/ServiceProvider.php';
$config = $file . '/config.php';
if (file_exists($seviceporvider) && file_exists($config)) {
/**
* move to faveo config
*/
$faveoconfig = config_path() . '/plugins/' . $filename . '.php';
if ($faveoconfig) {
copy($config, $faveoconfig);
/**
* write provider list in app.php line 128
*/
$app = base_path() . '/config/app.php';
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',";
$line_i_am_looking_for = 128;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines));
$plug->create(['name' => $filename, 'path' => $filename,'status'=>1]);
return redirect()->back()->with('success', 'Installed SuccessFully');
} else {
/**
* delete if the plugin hasn't config.php and ServiceProvider.php
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no ' . $file);
}
} else {
/**
* delete if the plugin hasn't config.php and ServiceProvider.php
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> ' . $file);
}
} else {
/**
* delete if the plugin Name is not equal to the folder name
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> ' . $file);
}
}
/**
* Delete the directory
* @param type $dir
* @return boolean
*/
public function deleteDirectory($dir) {
if (!file_exists($dir)) {
return true;
}
if (!is_dir($dir)) {
return unlink($dir);
}
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') {
continue;
}
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
return false;
}
}
return rmdir($dir);
}
public function ReadConfigs() {
$dir = app_path() . '/Plugins/';
$files = array_diff(scandir($dir), array('.', '..', 'ServiceProvider.php'));
$plugins = array();
if ($files) {
foreach ($files as $key => $file) {
$plugin = $dir . $file;
$plugins[$key] = array_diff(scandir($plugin), array('.', '..', 'ServiceProvider.php'));
$plugins[$key]['file'] = $plugin;
}
foreach ($plugins as $plugin) {
$dir = $plugin['file'];
//opendir($dir);
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file == 'config.php') {
$config[] = $dir . '/' . $file;
}
}
closedir($dh);
}
}
return $config;
} else {
return 'null';
}
}
public function fetchConfig() {
$configs = $this->ReadConfigs();
//dd($configs);
$plug = new Plugin;
$plug = $plug->select('path', 'status')->orderBy('name')->get()->toArray();
//dd($plug[0]['path']);
if ($configs !== 'null') {
foreach ($configs as $key => $config) {
$fields[$key] = include $config;
if ($plug != null) {
$fields[$key]['path'] = $plug[$key]['path'];
$fields[$key]['status'] = $plug[$key]['status'];
}
//dd($fields);
}
return $fields;
} else {
return array();
}
}
public function DeletePlugin($slug) {
$dir = app_path() . '/Plugins/' . $slug;
$this->deleteDirectory($dir);
/**
* remove service provider from app.php
*/
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path() . '/config/app.php';
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, "//", $file_contents);
file_put_contents($path_to_file, $file_contents);
$plugin = new Plugin();
$plugin = $plugin->where('path', $slug)->first();
$plugin->delete();
return redirect()->back()->with('success', 'Deleted Successfully');
}
public function StatusPlugin($slug) {
$plug = new Plugin;
$plug = $plug->where('name', $slug)->first();
$status = $plug->status;
if ($status == 0) {
$plug->status = 1;
$app = base_path() . '/config/app.php';
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
$line_i_am_looking_for = 128;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines));
}
if ($status == 1) {
$plug->status = 0;
/**
* remove service provider from app.php
*/
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path() . '/config/app.php';
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, "//", $file_contents);
file_put_contents($path_to_file, $file_contents);
}
$plug->save();
return redirect()->back()->with('success', 'Status has changed');
}
}

View File

@@ -94,7 +94,7 @@ class InstallController extends Controller {
*/ */
public function prerequisitescheck() { public function prerequisitescheck() {
Session::put('step2', 'step2'); Session::put('step2', 'step2');
return Redirect::route('localization'); return Redirect::route('configuration');
} }
/** /**
@@ -144,10 +144,10 @@ class InstallController extends Controller {
return Redirect::route('account'); return Redirect::route('account');
} }
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step3') == 'step3') { if (Session::get('step2') == 'step2') {
return View::make('themes/default1/installer/helpdesk/view4'); return View::make('themes/default1/installer/helpdesk/view4');
} else { } else {
return Redirect::route('localization'); return Redirect::route('prerequisites');
} }
} else { } else {
return redirect('/auth/login'); return redirect('/auth/login');
@@ -168,6 +168,7 @@ class InstallController extends Controller {
Session::put('databasename', Input::get('databasename')); Session::put('databasename', Input::get('databasename'));
Session::put('username', Input::get('username')); Session::put('username', Input::get('username'));
Session::put('password', Input::get('password')); Session::put('password', Input::get('password'));
Session::put('port', Input::get('port'));
return Redirect::route('database'); return Redirect::route('database');
} }
@@ -183,6 +184,8 @@ class InstallController extends Controller {
$database = Input::get('databasename'); $database = Input::get('databasename');
$dbusername = Input::get('username'); $dbusername = Input::get('username');
$dbpassword = Input::get('password'); $dbpassword = Input::get('password');
$port = Input::get('port');
// set default value // set default value
$path0 = app_path('../config/database.php'); $path0 = app_path('../config/database.php');
$content0 = File::get($path0); $content0 = File::get($path0);
@@ -209,6 +212,12 @@ class InstallController extends Controller {
$content3 = File::get($path3); $content3 = File::get($path3);
$content3 = str_replace('%password%', $dbpassword, $content3); $content3 = str_replace('%password%', $dbpassword, $content3);
File::put($path3, $content3); File::put($path3, $content3);
$path4 = app_path('../config/database.php');
$content4 = File::get($path4);
$content4 = str_replace('%port%', $port, $content4);
File::put($path4, $content4);
} elseif ($default == 'pgsql') { } elseif ($default == 'pgsql') {
$path = app_path('../config/database.php'); $path = app_path('../config/database.php');
$content = File::get($path); $content = File::get($path);
@@ -229,6 +238,12 @@ class InstallController extends Controller {
$content3 = File::get($path3); $content3 = File::get($path3);
$content3 = str_replace('%password1%', $password, $content3); $content3 = str_replace('%password1%', $password, $content3);
File::put($path3, $content3); File::put($path3, $content3);
$path4 = app_path('../config/database.php');
$content4 = File::get($path4);
$content4 = str_replace('%port1%', $port, $content4);
File::put($path4, $content4);
} elseif ($default == 'sqlsrv') { } elseif ($default == 'sqlsrv') {
$path = app_path('../config/database.php'); $path = app_path('../config/database.php');
$content = File::get($path); $content = File::get($path);
@@ -249,8 +264,12 @@ class InstallController extends Controller {
$content3 = File::get($path3); $content3 = File::get($path3);
$content3 = str_replace('%password2%', $password, $content3); $content3 = str_replace('%password2%', $password, $content3);
File::put($path3, $content3); File::put($path3, $content3);
}
$path4 = app_path('../config/database.php');
$content4 = File::get($path4);
$content4 = str_replace('%port2%', $port, $content4);
File::put($path4, $content4);
}
return 1; return 1;
} }

Some files were not shown because too many files have changed in this diff Show More