cbb78e22 by Manish Mihsra

Initial

0 parents
Showing 1000 changed files with 4868 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 ../custom/.env
...\ No newline at end of file ...\ No newline at end of file
1 * text=auto
2 *.css linguist-vendored
3 *.less linguist-vendored
1 application/.env
2 application/storage/framework/sessions/
3 application/storage/framework/views/
4 application/storage/framework/cache/
5 custom/.env
1 #!/bin/bash
2
3 export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
4
5
6 echo asterisk -rx "sip show channels";
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 // use Config;
7
8 // use App\Models\User;
9 // use App\Models\Accesslog;
10
11 // use App\Models\CRMCall;
12 // use Schema;
13 // use PDO;
14 // use App\Models\Notification;
15 // use App\Jobs\KHRMSLib;
16
17 // use Input;
18 // use App\Models\Sipid;
19 // use App\Models\Kqueue;
20 // use App\Models\Dialline;
21 // use App\Models\Session;
22
23 // use Illuminate\Database\Schema\Blueprint;
24
25 class ClearDiallines extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'ClearDiallines';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'Clear diallines if it is not in use';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 DB::update(DB::raw("update diallines set status='Free' where channel='' and status='Blocked'"));
49 }
50 }
51
52
53
54
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class DailyLogout extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'DailyLogout';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'DailyLogout';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 $sipids=Sipid::where("status","=","1")->get();
49 foreach($sipids as $tsip)
50 {
51 $newqueue=new Kqueue();
52 $newqueue->sipNotify($tsip,"adminCommand","user","logout","");
53 }
54
55 Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
56 Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
57
58 $serverarray=explode(",",Config::get("app.asterisk_slaves"));
59 foreach($serverarray as $server)
60 {
61 $sparts=explode(":",$server);
62
63 Sipid::where("id",">=",$sparts[1])->where("id","<=",$sparts[2])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
64 Dialline::where("id",">=",$sparts[3])->where("id","<=",$sparts[4])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
65
66 $newqueue=new Kqueue();
67 $newqueue->astCommand($sparts[0],"channel request hangup all");
68 }
69
70 User::where('presence','>','0')->update(['presence'=>0]);
71 Session::truncate();
72
73 return "";
74 }
75 }
76
77
78
79
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class DeleteCrmcalls extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'DeleteCrmcalls';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'Delete data from CRMCalls before 7 days';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 $logdate=strtotime('-7 day');
49
50 CRMCall::where('created_at','<',date("Y-m-d",$logdate))->delete();
51 }
52 }
53
54
55
56
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class HangupCall extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'HangupCall';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'Hangup Long Wait Call';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 $Diallines = Dialline::where("status","=","Auto")->where("conf","=","")->where("channel","!=","")->get();
49
50 foreach ($Diallines as $key => $Dialline) {
51
52 $to_time = strtotime(date("Y-m-d H:i:s"));
53 $from_time = strtotime($Dialline->updated_at);
54
55 $diff_time = round(abs($to_time - $from_time)/60,2);
56
57 if($diff_time>2)
58 {
59 $newqueue=new Kqueue();
60 $newqueue->hangupChannel($Dialline);
61 }
62 }
63 }
64 }
65
66
67
68
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class InsertCrmArchive extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'InsertCrmArchive';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'Insert updated data into crmcalls_archive from crmcalls';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 echo 'Start';
49
50 $minidObj = DB::selectOne(DB::raw("SELECT MIN(id) AS min_id FROM crmcalls_archive WHERE created_at >= DATE_SUB((SELECT MAX(created_at) from crmcalls_archive), INTERVAL 1 HOUR)"));
51
52 $min_id = $minidObj->min_id;
53
54 DB::delete(DB::raw("DELETE FROM crmcalls_archive WHERE id >= '$min_id'"));
55
56 DB::insert(DB::raw("insert into crmcalls_archive select * from crmcalls where id>(select max(id) from crmcalls_archive)"));
57
58 echo 'End';
59 }
60 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4
5 use App\Jobs\KPAMIListen;
6
7 class KstychARP extends Command {
8
9 /**
10 * The console command name.
11 *
12 * @var string
13 */
14 protected $signature = 'KstychARP';
15
16 /**
17 * The console command description.
18 *
19 * @var string
20 */
21 protected $description = 'ARP Broadcast';
22
23 /**
24 * Execute the console command.
25 *
26 * @return mixed
27 */
28 public function handle()
29 {
30
31 }
32
33 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class KstychDaily extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'KstychDaily';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-10*24*60*60))->update(array('postdata'=>'','queries'=>''));
42 Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-30*24*60*60))->delete();
43
44
45
46 if(env('app_ip')=="10.3.177.14")
47 {
48
49 if(!Schema::hasTable('calllog_report'))
50 {
51 Schema::create('calllog_report', function(Blueprint $table)
52 {
53 $table->string('server', 100);
54 $table->dateTime('start');
55 $table->integer('length');
56 $table->string('user',100);
57 $table->string('name',100);
58 $table->string('dispo', 200);
59 $table->string('subdispo', 200);
60 $table->dateTime('callback');
61 $table->string('number', 100);
62 $table->string('clientcode', 100);
63 $table->string('currentstatus', 100);
64 $table->string('legalstatus', 100);
65 $table->string('client', 200);
66 $table->string('department', 200);
67 $table->string('state', 50);
68 $table->string('hsource', 100);
69 $table->string('type', 50);
70 $table->string('statuscode', 20);
71 $table->string('status', 100);
72 $table->string('statusstr', 100);
73 $table->integer('dialline');
74 $table->string('did', 50);
75 $table->bigInteger('waitsec');
76 $table->bigInteger('callsec');
77 $table->bigInteger('talksec');
78 $table->bigInteger('disposec');
79 $table->string('remarks', 500);
80 $table->string('userdata',1000);
81 });
82 }
83
84
85 $offline=array();
86 $arr=Config::get("app.hdfcnodes");
87 $logdate=strtotime('-1 day');
88
89
90 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
91
92
93
94 $ii=1;$ci=0;
95 foreach($arr as $server=>$serverline)
96 {
97 $ci++;
98 $conn = array(
99 'driver' => 'mysql',
100 'host' => $server,
101 'database' => env('DB_DATABASE', 'kstych_flexydial'),
102 'username' => env('DB_USERNAME', 'root'),
103 'password' => env('DB_PASSWORD', ''),
104 'charset' => 'utf8',
105 'collation' => 'utf8_unicode_ci',
106 'prefix' => '',
107 'options' => array(
108 PDO::ATTR_TIMEOUT => 5,
109 ),
110 );
111 Config::set("database.connections.conn$ci", $conn);
112
113 try
114 {
115 DB::connection("conn$ci")->getDatabaseName();
116
117
118 $alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->get();
119 $userarr=array();
120 foreach($alist as $aline)
121 {
122 $setstrarr=array();
123
124
125 $clientcode="";$currentstatus="";$legalstatus="";
126 if($aline->crm_id>0)
127 {
128 $user=DB::connection("conn$ci")->select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
129 if(isset($user[0]))
130 {
131 $clientcode=$user[0]->clientcode;
132 $currentstatus=$user[0]->currentstatus;
133 $legalstatus=$user[0]->legalstatus;
134 }
135 }
136 $tpostdata=json_decode($aline->data,true);
137 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
138 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
139 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
140
141 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::on("conn$ci")->find($aline->user_id);
142 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
143 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
144
145 $setstrarr[]="server='$server'";
146 $setstrarr[]="start='$fulldate'";
147 $setstrarr[]="length='$length'";
148 $setstrarr[]="user='$username'";
149 $setstrarr[]="name='$dispname'";
150 $setstrarr[]="dispo='$aline->userstatus'";
151 $setstrarr[]="subdispo='$aline->usersubstatus'";
152 $setstrarr[]="callback='$aline->usercallback'";
153
154 $setstrarr[]="number='$aline->number'";
155 $setstrarr[]="clientcode='$clientcode'";
156 $setstrarr[]="currentstatus='$currentstatus'";
157 $setstrarr[]="legalstatus='$legalstatus'";
158 $setstrarr[]="client='$aline->client'";
159 $setstrarr[]="department='$aline->department'";
160 $setstrarr[]="state='$aline->state'";
161 $setstrarr[]="hsource='$aline->hsource'";
162
163 $setstrarr[]="type='$aline->type'";
164 $setstrarr[]="status='$aline->status'";
165 $setstrarr[]="statuscode='$aline->statuscode'";
166 $setstrarr[]="statusstr='$aline->substatus'";
167 $setstrarr[]="dialline='$aline->dialline_id'";
168 $setstrarr[]="did='$aline->did'";
169 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
170 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
171 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
172 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
173 $setstrarr[]="remarks='$aline->userremarks'";
174 $setstrarr[]="userdata='$aline->userdata'";
175
176 $setstr=implode(",",$setstrarr);
177 DB::insert(DB::raw("insert into calllog_report set $setstr"));
178 }
179
180 }
181 catch(Exception $e)
182 {
183 $offline[]=$server;
184 }
185 }
186
187 }
188
189
190
191 }
192
193 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4
5 use App\Jobs\KPAGIListen;
6
7 class KstychPAGI extends Command {
8
9 /**
10 * The console command name.
11 *
12 * @var string
13 */
14 protected $signature = 'KstychPAGI';
15
16 /**
17 * The console command description.
18 *
19 * @var string
20 */
21 protected $description = 'Daemon to Listen to Asterisk';
22
23 /**
24 * Execute the console command.
25 *
26 * @return mixed
27 */
28 public function handle()
29 {
30 $agi = \PAGI\Client\Impl\ClientImpl::getInstance();
31 $kpagi = new KPAGIListen(array('pagiClient' => $agi));
32 $kpagi->init();
33 $kpagi->run();
34 }
35
36 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4
5 use App\Jobs\KPAMIListen;
6
7 class KstychPAMI extends Command {
8
9 /**
10 * The console command name.
11 *
12 * @var string
13 */
14 protected $signature = 'KstychPAMI {serverip=127.0.0.1}';
15
16 /**
17 * The console command description.
18 *
19 * @var string
20 */
21 protected $description = 'Daemon to Listen to Asterisk';
22
23 /**
24 * Execute the console command.
25 *
26 * @return mixed
27 */
28 public function handle()
29 {
30 $listener = new KPAMIListen($this->argument('serverip'));$listener->run();
31 }
32
33 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44 echo "\n".date('Y-m-d')."\n";
45
46 $wakka = new KHRMSLib();
47
48 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
49 $kformlib->gthis=$wakka;
50
51 $themehome=$wakka->GetThemePath('/');
52 $updatetime=time();
53
54 $clientlst=$wakka->GetBBBUserData("clientslist");
55
56 $isadmin=$wakka->IsAdmin();
57 $username=$wakka->GetUserName();
58 $triggers=Input::get("triggers");
59 $tmpstr=explode(",",$kformlib->HRFiledsStr);
60
61 $success="";$message="";$successcnt=0;$duplicatecount=0;
62
63
64 $conn = array(
65 'driver' => 'mysql',
66 'host' => '10.3.177.14',
67 'database' => env('DB_DATABASE', 'kstych_flexydial'),
68 'username' => env('DB_USERNAME', 'root'),
69 'password' => env('DB_PASSWORD', 'yb9738z'),
70 'charset' => 'utf8',
71 'collation' => 'utf8_unicode_ci',
72 'prefix' => '',
73 'options' => array(
74 PDO::ATTR_TIMEOUT => 5,
75 ),
76 );
77 Config::set("database.connections.conn", $conn);
78
79 DB::connection("conn")->getDatabaseName();
80
81 // $excelarray = DB::table('bz_record_upload_uat')->select('*')->get();
82
83 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat limit 1"));
84 $excelarray = (array)$excelarray;
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestrow = count($excelarray);
88 echo $highestColumn;
89 $flag = 0;
90 $editflag=0;
91
92 for($i=0;$i<=$highestrow;$i++)
93 {
94 if($excelarray[$i]["id"]!="")
95 {
96 if($excelarray[$i]["id"]=="CREATE")
97 {
98 $excelarray[$i]["id"]=$wakka->Query("insert into","","records_demo",array('created'=>date('Y-m-d H:i:s')));
99 }
100 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
101
102 if($wakka->getCount("records_demo","id='".$excelarray[$i]["id"]."'")==1)
103 {
104 $empdata=$wakka->getPersonServer($excelarray[$i]["id"]);
105 $ppldata=$empdata["peopledata"];
106 $createdlog=$empdata['modifylog'];
107 $fdirty=$empdata['dirty'];
108
109 $createdlog[$updatetime]=$username."::";
110 $createdlog["updated"]=$updatetime;
111
112 $newdata=$ppldata;
113 foreach($excelarray[$i] as $key => $value)
114 {
115 if($value!="")
116 {
117 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
118 {
119 $value=str_replace("'"," ",$value);
120 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
121
122 $fdirty[$key]=1;
123
124 $newdata[$key]=$value;
125 }
126 }
127 }
128 $empdata["peopledata"]=$newdata;
129 $empdata['modifylog']=$createdlog;
130 $empdata['dirty']=$fdirty;
131
132 $wakka->setPersonServer($excelarray[$i]["id"],$empdata);
133 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
134
135 }
136 }
137
138 }
139 mysqli_close($conn);
140
141 }
142 }
143
144
145
146
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 echo "\n".date('Y-m-d')."\n";
46
47 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 0,20000"));
83
84 foreach($excelarray as $key => $array){
85 $excelarray[$key] = (array)$array;
86 }
87
88 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
89 $highestColumn = $highestColumn[0]->cnt;
90
91 $highestrow = count($excelarray);
92
93 $flag = 0;
94 $editflag=0;
95
96 for($i=0;$i<=$highestrow;$i++)
97 {
98 if($excelarray[$i]["id"]!="")
99 {
100 if($excelarray[$i]["id"]=="CREATE")
101 {
102 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
103 }
104 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
105
106 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
107 {
108 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
109 $ppldata=$empdata["peopledata"];
110 $createdlog=$empdata['modifylog'];
111 $fdirty=$empdata['dirty'];
112
113 $createdlog[$updatetime]=$username."::";
114 $createdlog["updated"]=$updatetime;
115
116 $newdata=$ppldata;
117 foreach($excelarray[$i] as $key => $value)
118 {
119 if($value!="")
120 {
121 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
122 {
123 $value=str_replace("'"," ",$value);
124 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
125
126 $fdirty[$key]=1;
127
128 $newdata[$key]=$value;
129 }
130 }
131 }
132 $empdata["peopledata"]=$newdata;
133 $empdata['modifylog']=$createdlog;
134 $empdata['dirty']=$fdirty;
135
136 $wakka->setPerson($excelarray[$i]["id"],$empdata);
137 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
138
139 }
140 }
141
142 }
143 DB::connection("conn")->disconnect();
144
145
146 }
147 }
148
149
150
151
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_1 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_1';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 $wakka = new KHRMSLib();
46
47 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
48 $kformlib->gthis=$wakka;
49
50 $themehome=$wakka->GetThemePath('/');
51 $updatetime=time();
52
53 $clientlst=$wakka->GetBBBUserData("clientslist");
54
55 $isadmin=$wakka->IsAdmin();
56 $username=$wakka->GetUserName();
57 $triggers=Input::get("triggers");
58 $tmpstr=explode(",",$kformlib->HRFiledsStr);
59
60 $success="";$message="";$successcnt=0;$duplicatecount=0;
61
62
63 $conn = array(
64 'driver' => 'mysql',
65 'host' => '10.3.177.14',
66 'database' => env('DB_DATABASE', 'kstych_flexydial'),
67 'username' => env('DB_USERNAME', 'root'),
68 'password' => env('DB_PASSWORD', 'yb9738z'),
69 'charset' => 'utf8',
70 'collation' => 'utf8_unicode_ci',
71 'prefix' => '',
72 'options' => array(
73 PDO::ATTR_TIMEOUT => 5,
74 ),
75 );
76 Config::set("database.connections.conn", $conn);
77
78 DB::connection("conn")->getDatabaseName();
79
80 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 20001,20000"));
81
82 foreach($excelarray as $key => $array){
83 $excelarray[$key] = (array)$array;
84 }
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestColumn = $highestColumn[0]->cnt;
88
89 $highestrow = count($excelarray);
90
91 $flag = 0;
92 $editflag=0;
93
94 for($i=0;$i<=$highestrow;$i++)
95 {
96 if($excelarray[$i]["id"]!="")
97 {
98 if($excelarray[$i]["id"]=="CREATE")
99 {
100 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
101 }
102 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
103
104 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
105 {
106 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
107 $ppldata=$empdata["peopledata"];
108 $createdlog=$empdata['modifylog'];
109 $fdirty=$empdata['dirty'];
110
111 $createdlog[$updatetime]=$username."::";
112 $createdlog["updated"]=$updatetime;
113
114 $newdata=$ppldata;
115 foreach($excelarray[$i] as $key => $value)
116 {
117 if($value!="")
118 {
119 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
120 {
121 $value=str_replace("'"," ",$value);
122 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
123
124 $fdirty[$key]=1;
125
126 $newdata[$key]=$value;
127 }
128 }
129 }
130 $empdata["peopledata"]=$newdata;
131 $empdata['modifylog']=$createdlog;
132 $empdata['dirty']=$fdirty;
133
134 $wakka->setPerson($excelarray[$i]["id"],$empdata);
135 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
136
137 }
138 }
139
140 }
141 DB::connection("conn")->disconnect();
142
143 }
144 }
145
146
147
148
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_2 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_2';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 $wakka = new KHRMSLib();
46
47 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
48 $kformlib->gthis=$wakka;
49
50 $themehome=$wakka->GetThemePath('/');
51 $updatetime=time();
52
53 $clientlst=$wakka->GetBBBUserData("clientslist");
54
55 $isadmin=$wakka->IsAdmin();
56 $username=$wakka->GetUserName();
57 $triggers=Input::get("triggers");
58 $tmpstr=explode(",",$kformlib->HRFiledsStr);
59
60 $success="";$message="";$successcnt=0;$duplicatecount=0;
61
62
63 $conn = array(
64 'driver' => 'mysql',
65 'host' => '10.3.177.14',
66 'database' => env('DB_DATABASE', 'kstych_flexydial'),
67 'username' => env('DB_USERNAME', 'root'),
68 'password' => env('DB_PASSWORD', 'yb9738z'),
69 'charset' => 'utf8',
70 'collation' => 'utf8_unicode_ci',
71 'prefix' => '',
72 'options' => array(
73 PDO::ATTR_TIMEOUT => 5,
74 ),
75 );
76 Config::set("database.connections.conn", $conn);
77
78 DB::connection("conn")->getDatabaseName();
79
80 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 40001,20000"));
81
82 foreach($excelarray as $key => $array){
83 $excelarray[$key] = (array)$array;
84 }
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestColumn = $highestColumn[0]->cnt;
88
89 $highestrow = count($excelarray);
90
91 $flag = 0;
92 $editflag=0;
93
94 for($i=0;$i<=$highestrow;$i++)
95 {
96 if($excelarray[$i]["id"]!="")
97 {
98 if($excelarray[$i]["id"]=="CREATE")
99 {
100 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
101 }
102 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
103
104 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
105 {
106 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
107 $ppldata=$empdata["peopledata"];
108 $createdlog=$empdata['modifylog'];
109 $fdirty=$empdata['dirty'];
110
111 $createdlog[$updatetime]=$username."::";
112 $createdlog["updated"]=$updatetime;
113
114 $newdata=$ppldata;
115 foreach($excelarray[$i] as $key => $value)
116 {
117 if($value!="")
118 {
119 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
120 {
121 $value=str_replace("'"," ",$value);
122 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
123
124 $fdirty[$key]=1;
125
126 $newdata[$key]=$value;
127 }
128 }
129 }
130 $empdata["peopledata"]=$newdata;
131 $empdata['modifylog']=$createdlog;
132 $empdata['dirty']=$fdirty;
133
134 $wakka->setPerson($excelarray[$i]["id"],$empdata);
135 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
136
137 }
138 }
139
140 }
141 DB::connection("conn")->disconnect();
142
143 }
144 }
145
146
147
148
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_3 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_3';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 $wakka = new KHRMSLib();
46
47 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
48 $kformlib->gthis=$wakka;
49
50 $themehome=$wakka->GetThemePath('/');
51 $updatetime=time();
52
53 $clientlst=$wakka->GetBBBUserData("clientslist");
54
55 $isadmin=$wakka->IsAdmin();
56 $username=$wakka->GetUserName();
57 $triggers=Input::get("triggers");
58 $tmpstr=explode(",",$kformlib->HRFiledsStr);
59
60 $success="";$message="";$successcnt=0;$duplicatecount=0;
61
62
63 $conn = array(
64 'driver' => 'mysql',
65 'host' => '10.3.177.14',
66 'database' => env('DB_DATABASE', 'kstych_flexydial'),
67 'username' => env('DB_USERNAME', 'root'),
68 'password' => env('DB_PASSWORD', 'yb9738z'),
69 'charset' => 'utf8',
70 'collation' => 'utf8_unicode_ci',
71 'prefix' => '',
72 'options' => array(
73 PDO::ATTR_TIMEOUT => 5,
74 ),
75 );
76 Config::set("database.connections.conn", $conn);
77
78 DB::connection("conn")->getDatabaseName();
79
80 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 60001,20000"));
81
82 foreach($excelarray as $key => $array){
83 $excelarray[$key] = (array)$array;
84 }
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestColumn = $highestColumn[0]->cnt;
88
89 $highestrow = count($excelarray);
90
91 $flag = 0;
92 $editflag=0;
93
94 for($i=0;$i<=$highestrow;$i++)
95 {
96 if($excelarray[$i]["id"]!="")
97 {
98 if($excelarray[$i]["id"]=="CREATE")
99 {
100 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
101 }
102 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
103
104 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
105 {
106 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
107 $ppldata=$empdata["peopledata"];
108 $createdlog=$empdata['modifylog'];
109 $fdirty=$empdata['dirty'];
110
111 $createdlog[$updatetime]=$username."::";
112 $createdlog["updated"]=$updatetime;
113
114 $newdata=$ppldata;
115 foreach($excelarray[$i] as $key => $value)
116 {
117 if($value!="")
118 {
119 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
120 {
121 $value=str_replace("'"," ",$value);
122 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
123
124 $fdirty[$key]=1;
125
126 $newdata[$key]=$value;
127 }
128 }
129 }
130 $empdata["peopledata"]=$newdata;
131 $empdata['modifylog']=$createdlog;
132 $empdata['dirty']=$fdirty;
133
134 $wakka->setPerson($excelarray[$i]["id"],$empdata);
135 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
136
137 }
138 }
139
140 }
141 DB::connection("conn")->disconnect();
142
143 }
144 }
145
146
147
148
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_4 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_4';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 $wakka = new KHRMSLib();
46
47 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
48 $kformlib->gthis=$wakka;
49
50 $themehome=$wakka->GetThemePath('/');
51 $updatetime=time();
52
53 $clientlst=$wakka->GetBBBUserData("clientslist");
54
55 $isadmin=$wakka->IsAdmin();
56 $username=$wakka->GetUserName();
57 $triggers=Input::get("triggers");
58 $tmpstr=explode(",",$kformlib->HRFiledsStr);
59
60 $success="";$message="";$successcnt=0;$duplicatecount=0;
61
62
63 $conn = array(
64 'driver' => 'mysql',
65 'host' => '10.3.177.14',
66 'database' => env('DB_DATABASE', 'kstych_flexydial'),
67 'username' => env('DB_USERNAME', 'root'),
68 'password' => env('DB_PASSWORD', 'yb9738z'),
69 'charset' => 'utf8',
70 'collation' => 'utf8_unicode_ci',
71 'prefix' => '',
72 'options' => array(
73 PDO::ATTR_TIMEOUT => 5,
74 ),
75 );
76 Config::set("database.connections.conn", $conn);
77
78 DB::connection("conn")->getDatabaseName();
79
80 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 80001,20000"));
81
82 foreach($excelarray as $key => $array){
83 $excelarray[$key] = (array)$array;
84 }
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestColumn = $highestColumn[0]->cnt;
88
89 $highestrow = count($excelarray);
90
91 $flag = 0;
92 $editflag=0;
93
94 for($i=0;$i<=$highestrow;$i++)
95 {
96 if($excelarray[$i]["id"]!="")
97 {
98 if($excelarray[$i]["id"]=="CREATE")
99 {
100 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
101 }
102 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
103
104 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
105 {
106 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
107 $ppldata=$empdata["peopledata"];
108 $createdlog=$empdata['modifylog'];
109 $fdirty=$empdata['dirty'];
110
111 $createdlog[$updatetime]=$username."::";
112 $createdlog["updated"]=$updatetime;
113
114 $newdata=$ppldata;
115 foreach($excelarray[$i] as $key => $value)
116 {
117 if($value!="")
118 {
119 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
120 {
121 $value=str_replace("'"," ",$value);
122 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
123
124 $fdirty[$key]=1;
125
126 $newdata[$key]=$value;
127 }
128 }
129 }
130 $empdata["peopledata"]=$newdata;
131 $empdata['modifylog']=$createdlog;
132 $empdata['dirty']=$fdirty;
133
134 $wakka->setPerson($excelarray[$i]["id"],$empdata);
135 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
136
137 }
138 }
139
140 }
141 DB::connection("conn")->disconnect();
142
143 }
144 }
145
146
147
148
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 $wakka = new KHRMSLib();
46
47 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
48 $kformlib->gthis=$wakka;
49
50 $themehome=$wakka->GetThemePath('/');
51 $updatetime=time();
52
53 $clientlst=$wakka->GetBBBUserData("clientslist");
54
55 $isadmin=$wakka->IsAdmin();
56 $username=$wakka->GetUserName();
57 $triggers=Input::get("triggers");
58 $tmpstr=explode(",",$kformlib->HRFiledsStr);
59
60 $success="";$message="";$successcnt=0;$duplicatecount=0;
61
62
63 $conn = array(
64 'driver' => 'mysql',
65 'host' => '10.3.177.14',
66 'database' => env('DB_DATABASE', 'kstych_flexydial'),
67 'username' => env('DB_USERNAME', 'root'),
68 'password' => env('DB_PASSWORD', 'yb9738z'),
69 'charset' => 'utf8',
70 'collation' => 'utf8_unicode_ci',
71 'prefix' => '',
72 'options' => array(
73 PDO::ATTR_TIMEOUT => 5,
74 ),
75 );
76 Config::set("database.connections.conn", $conn);
77
78 DB::connection("conn")->getDatabaseName();
79
80 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and client='G4015' order by auto_id asc limit 0,20000"));
81
82 foreach($excelarray as $key => $array){
83 $excelarray[$key] = (array)$array;
84 }
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestColumn = $highestColumn[0]->cnt;
88
89 $highestrow = count($excelarray);
90
91 $flag = 0;
92 $editflag=0;
93
94 for($i=0;$i<=$highestrow;$i++)
95 {
96 if($excelarray[$i]["id"]!="")
97 {
98 if($excelarray[$i]["id"]=="CREATE")
99 {
100 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
101 }
102 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
103
104 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
105 {
106 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
107 $ppldata=$empdata["peopledata"];
108 $createdlog=$empdata['modifylog'];
109 $fdirty=$empdata['dirty'];
110
111 $createdlog[$updatetime]=$username."::";
112 $createdlog["updated"]=$updatetime;
113
114 $newdata=$ppldata;
115 foreach($excelarray[$i] as $key => $value)
116 {
117 if($value!="")
118 {
119 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
120 {
121 $value=str_replace("'"," ",$value);
122 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
123
124 $fdirty[$key]=1;
125
126 $newdata[$key]=$value;
127 }
128 }
129 }
130 $empdata["peopledata"]=$newdata;
131 $empdata['modifylog']=$createdlog;
132 $empdata['dirty']=$fdirty;
133
134 $wakka->setPerson($excelarray[$i]["id"],$empdata);
135 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
136
137 }
138 }
139
140 }
141 mysqli_close($conn);
142
143
144 }
145 }
146
147
148
149
1 <?php namespace App\Console;
2
3 use Illuminate\Console\Scheduling\Schedule;
4 use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
5
6 class Kernel extends ConsoleKernel
7 {
8
9 /**
10 * The Artisan commands provided by your application.
11 *
12 * @var array
13 */
14 protected $commands = [
15 'App\Console\Commands\KstychDaily',
16 'App\Console\Commands\KstychPAMI',
17 'App\Console\Commands\KstychPAGI',
18 'App\Console\Commands\DailyLogout',
19 'App\Console\Commands\InsertCrmArchive',
20 'App\Console\Commands\DeleteCrmcalls',
21 'App\Console\Commands\ClearDiallines',
22 'App\Console\Commands\HangupCall',
23 ];
24
25 /**
26 * Define the application's command schedule.
27 *
28 * @param \Illuminate\Console\Scheduling\Schedule $schedule
29 * @return void
30 */
31 protected function schedule(Schedule $schedule)
32 {
33 $schedule->command('KstychDaily')->daily()->withoutOverlapping();
34
35 $schedule->command('InsertCrmArchive')->everyTenMinutes()->withoutOverlapping();
36 $schedule->command('DeleteCrmcalls')->dailyAt('02:30')->withoutOverlapping();
37
38 // added cron for do diallines free by YASHWANT on 29062017
39 $schedule->command('ClearDiallines')->everyMinute()->withoutOverlapping(); // ->appendOutputTo(storage_path()."/output.txt");
40
41 $schedule->command('HangupCall')->everyTenMinutes()->withoutOverlapping();
42 }
43 }
1 <?php
2
3 namespace App\Events;
4
5 abstract class Event
6 {
7 //
8 }
1 <?php namespace App\Exceptions;
2
3 use Exception;
4 use Illuminate\Auth\Access\AuthorizationException;
5 use Illuminate\Database\Eloquent\ModelNotFoundException;
6 use Symfony\Component\HttpKernel\Exception\HttpException;
7 use Illuminate\Foundation\Validation\ValidationException;
8 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
10
11 use Config;
12 use Auth;
13 use Request;
14 use Mail;
15 use Cache;
16
17 class Handler extends ExceptionHandler {
18
19 /**
20 * A list of the exception types that should not be reported.
21 *
22 * @var array
23 */
24 protected $dontReport = [
25 AuthorizationException::class,
26 HttpException::class,
27 ModelNotFoundException::class,
28 ValidationException::class,
29 ];
30
31 /**
32 * Report or log an exception.
33 *
34 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
35 *
36 * @param \Exception $e
37 * @return void
38 */
39 public function report(Exception $e)
40 {
41 if(!empty($e))
42 {
43 $errorStr='';
44 if ($this->isHttpException($e) && $e->getStatusCode() == 404)$errorStr='MISSING';
45 else if(strstr(json_encode($e->getTrace(),true),"VerifyCsrfToken"))$errorStr='IGNORE';
46 else $errorStr='ERROR';
47
48 $accesslog=Config::get('runtime.accesslog_obj');
49 if($accesslog)
50 {
51 $postdata=(array)json_decode($accesslog->postdata);
52 $postdata["ErrorType"]=$errorStr;
53 $postdata["ErrorMsg"]=$e->getMessage();
54 $accesslog->postdata=json_encode($postdata, true);
55 $accesslog->stopLog();
56 }
57
58 if($errorStr=='ERROR')
59 {
60 $email=Config::get("app.email");
61 $user="guest";if(Auth::check())$user=Auth::user()->id." ".Auth::user()->dispname()." ".Auth::user()->username;
62 $ip=Request::getClientIp();
63
64 $key=$user.$ip.'ajaxerror'.Request::path();
65 if(Cache::get($key,'')!=$e->getMessage().json_encode($e->getTrace(),true)&&Cache::get($key.'cnt',0)<10)
66 {
67 Cache::put($key,$e->getMessage().json_encode($e->getTrace(),true), 24*60);//minutes in 1 day
68 Cache::put($key.'cnt',Cache::get($key.'cnt',0)+1, 24*60);
69
70 Mail::send('emails.ajaxerror', array('xhr'=>"app-fatal",'status'=>$e->getMessage(),'error'=>json_encode($e->getTrace(),true),'user'=>$user,'ip'=>$ip), function($message) use ($email)
71 {
72 $message->to($email, $email)->subject(Config::get("app.name")." : Error");
73 });
74
75 }
76 }
77 else if($errorStr=='MISSING'){}
78 else if($errorStr=='IGNORE'){}
79 }
80
81 return parent::report($e);
82 }
83
84 /**
85 * Render an exception into an HTTP response.
86 *
87 * @param \Illuminate\Http\Request $request
88 * @param \Exception $e
89 * @return \Illuminate\Http\Response
90 */
91 public function render($request, Exception $e)
92 {
93 if(!empty($e))
94 {
95 $errorStr='';
96 if ($this->isHttpException($e) && $e->getStatusCode() == 404)$errorStr='MISSING';
97 else $errorStr='ERROR';
98
99 if($errorStr=='ERROR')
100 {
101 if(!Config::get('app.debug')) return response()->view("errors.exception");
102 }
103 else if($errorStr=='MISSING')
104 {
105 return response()->view('errors.missing', array());
106 }
107 }
108
109 return parent::render($request, $e);
110 }
111
112 }
1 <?php namespace App\Http\Controllers;
2
3 use Input;
4 use App\Models\User;
5 use App\Models\CRMCall;
6 use App\Models\Sipid;
7 use App\Models\Kqueue;
8 use App\Models\Dialline;
9 use App\Models\Session;
10 use Config;
11
12 class AdminController extends Controller {
13
14
15 public function __construct()
16 {
17 $this->middleware('auth');
18 $this->middleware('module_access');
19 }
20
21 public function index()
22 {
23 $data=array();
24
25 return view('layout.module.admin.index',$data);
26 }
27 public function create()
28 {
29 //
30 }
31 public function store()
32 {
33 $action=Input::get('action');
34 if($action=="mmtbulkupload")return view('layout.module.admin.index',array());
35 if($action=="userlogoutall")
36 {
37 $sipids=Sipid::where("status","=","1")->get();
38 foreach($sipids as $tsip)
39 {
40 $newqueue=new Kqueue();
41 $newqueue->sipNotify($tsip,"adminCommand","user","logout","");
42 }
43
44 Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
45 Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
46
47 $serverarray=explode(",",Config::get("app.asterisk_slaves"));
48 foreach($serverarray as $server)
49 {
50 $sparts=explode(":",$server);
51
52 Sipid::where("id",">=",$sparts[1])->where("id","<=",$sparts[2])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
53 Dialline::where("id",">=",$sparts[3])->where("id","<=",$sparts[4])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
54
55 $newqueue=new Kqueue();
56 $newqueue->astCommand($sparts[0],"channel request hangup all");
57 }
58
59 User::where('presence','>','0')->update(['presence'=>0]);
60 Session::truncate();
61
62 return "";
63 }
64 }
65 public function show($id)
66 {
67 $data=array();
68 if($id=='masterdata')return view('layout.module.admin.masterdata',$data);
69 if($id=='accesslog')return view('layout.module.admin.accesslog',$data);
70 if($id=='emaillog')return view('layout.module.admin.emaillog',$data);
71 if($id=='bulkmail')return view('layout.module.admin.bulkmail',$data);
72 if($id=='dllogfile')return response()->download(storage_path('logs/laravel-'.date('Y-m-d').'.log'));
73 if($id=='main')return view('layout.module.admin.main',$data);
74 if($id=='agentreport')return view('layout.module.admin.agentreport',$data);
75 if($id=='liveusers')return view('layout.module.admin.liveusers',$data);
76 }
77 public function edit($id)
78 {
79 //
80 }
81 public function update($id)
82 {
83 //
84 }
85 public function destroy($id)
86 {
87 //
88 }
89
90
91 public function dashboard()
92 {
93 $data=array();
94
95 return view('layout.module.admin.dashboard',$data);
96 }
97 }
1 <?php
2
3 namespace App\Providers;
4
5 use Illuminate\Support\ServiceProvider;
6 use Illuminate\Support\Facades\Schema;
7
8 class AppServiceProvider extends ServiceProvider
9 {
10 /**
11 * Bootstrap any application services.
12 *
13 * @return void
14 */
15 public function boot()
16 {
17 Schema::defaultStringLength(191);
18 }
19
20 /**
21 * Register any application services.
22 *
23 * @return void
24 */
25 public function register()
26 {
27 //
28 }
29 }
1 <?php
2
3 namespace App\Http\Controllers\Auth;
4
5 use App\User;
6 use Validator;
7 use App\Http\Controllers\Controller;
8 use Illuminate\Foundation\Auth\ThrottlesLogins;
9 use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
10 use Session;
11
12 class AuthController extends Controller
13 {
14 /*
15 |--------------------------------------------------------------------------
16 | Registration & Login Controller
17 |--------------------------------------------------------------------------
18 |
19 | This controller handles the registration of new users, as well as the
20 | authentication of existing users. By default, this controller uses
21 | a simple trait to add these behaviors. Why don't you explore it?
22 |
23 */
24
25 use AuthenticatesAndRegistersUsers, ThrottlesLogins;
26
27 /**
28 * Where to redirect users after login / registration.
29 *
30 * @var string
31 */
32 protected $redirectTo = '/home';
33
34 /**
35 * Create a new authentication controller instance.
36 *
37 * @return void
38 */
39 public function __construct()
40 {
41 $this->middleware('guest', ['except' => 'logout']);
42 }
43
44 /**
45 * Get a validator for an incoming registration request.
46 *
47 * @param array $data
48 * @return \Illuminate\Contracts\Validation\Validator
49 */
50 protected function validator(array $data)
51 {
52 return Validator::make($data, [
53 'name' => 'required|max:255',
54 'email' => 'required|email|max:255|unique:users',
55 'password' => 'required|confirmed|min:6',
56 ]);
57 }
58
59 /**
60 * Create a new user instance after a valid registration.
61 *
62 * @param array $data
63 * @return User
64 */
65 protected function create(array $data)
66 {
67 return User::create([
68 'name' => $data['name'],
69 'email' => $data['email'],
70 'password' => bcrypt($data['password']),
71 ]);
72 }
73 }
1 <?php
2
3 namespace App\Http\Controllers\Auth;
4
5 use App\Http\Controllers\Controller;
6 use Illuminate\Foundation\Auth\ResetsPasswords;
7
8 class PasswordController extends Controller
9 {
10 /*
11 |--------------------------------------------------------------------------
12 | Password Reset Controller
13 |--------------------------------------------------------------------------
14 |
15 | This controller is responsible for handling password reset requests
16 | and uses a simple trait to include this behavior. You're free to
17 | explore this trait and override any methods you wish to tweak.
18 |
19 */
20
21 use ResetsPasswords;
22
23 /**
24 * Create a new password controller instance.
25 *
26 * @return void
27 */
28 public function __construct()
29 {
30 $this->middleware('guest');
31 }
32 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Response;
6 use App\Models\Group;
7 use App\Models\Master;
8 use App\Models\Record;
9 use App\Models\CRMCall;
10 use App\Models\CRMCallArchive;
11 use App\Models\CRM;
12 use App\Models\CRMCampaign;
13 use App\Models\CRMList;
14 use App\Jobs\KHRMSLib;
15 use App\Models\Sipid;
16 use App\Models\Dialline;
17 use App\Models\UserLog;
18 use App\Models\User;
19 use App\Models\Kqueue;
20 use App\Models\QCFeedback;
21 use DB;
22 use Log;
23 use Session;
24 $client='';
25
26 class AutodialController extends Controller {
27
28
29 public function index()
30 {
31
32 }
33 public function create()
34 {
35
36 }
37 public function store()
38 {
39
40
41 }
42 public function show($id)
43 {
44 if($id=="autodialmode")
45 {
46 $campaign=Input::get("client");
47 $user_id = Auth::user()->id;
48
49 $callsToDialled = $this->getCallsToBeDialled($campaign);
50 if($callsToDialled>0)
51 {
52 $this->createCall($campaign, $callsToDialled, $user_id);
53 }
54 }
55 }
56
57 public function getCallsToBeDialled($campaign)
58 {
59 $wakka = new KHRMSLib();
60 $mastersdata=$wakka->getCompanyMaster($campaign);
61
62 $ratio = $mastersdata["autodialercampaign"];
63 $availableUsers = $this->getFreeUserCnt($campaign);
64 $dialedCalls = $this->getDialedCallCount($campaign);
65
66 return $availableUsers*$ratio-$dialedCalls;
67 }
68
69 //To Get Number Of Free User which will be multiplied with Defined Ratio For Generating Number Of Calls
70 public function getFreeUserCnt($campaign)
71 {
72 $count=0;
73 $loggedInSips = Sipid::where('server','=',env('app_ip'))->where("user", "!=", 0)->where("status","=","1")->where("prepare_call","=","1")->where("clients","like","%$campaign%")->groupBy('user')->get();
74
75 if(count($loggedInSips))
76 foreach ($loggedInSips as $key => $loggedInSip)
77 {
78 $loggedInUsers[] = $loggedInSip->user;
79 }
80
81 $freeDials = Dialline::whereIn("user_id",$loggedInUsers)->where("status","=","Blocked")->count();
82
83 return count($loggedInSips)-$freeDials;
84 }
85
86 public function getDialedCallCount($campaign)
87 {
88 $cnt = Dialline::whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->where("regexstr","=",$campaign)->count();
89
90 return $cnt;
91 }
92
93 public function getAvailCallInPool($campaign)
94 {
95 //$cnt = CRMCall::where("client", "=", $campaign)->where("state","=","DialEnd")->where("type", "=", "Auto")->where("substatus","!=","")->count();
96
97 $cnt = Dialline::where("status","=","Auto")->where("conf","=","")->where("regexstr","=",$campaign)->count();
98
99 return $cnt;
100 }
101
102 public function getAvgTimeArray($user)
103 {
104 $avgdisposecObj = CRMCall::select(DB::Raw('(avg(disposec))/1000 as avgdisposec'))->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first();
105
106 $avgcallsecObj = CRMCall::select(DB::Raw('(avg(callsec))/1000 as avgcallsec'))->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first();
107
108 $returnArray['avgdisposec'] = round($avgdisposecObj->avgdisposec);
109 $returnArray['avgcallsec'] = round($avgdisposecObj->avgcallsec);
110
111 return $returnArray;
112 }
113
114 public function createCall($campaign, $acalls, $user_id)
115 {
116 $wakka = new KHRMSLib();
117 $mastersdata=$wakka->getCompanyMaster($campaign);
118
119 if($acalls>0)
120 {
121 for($i=0;$i<$acalls;$i++)
122 {
123 $callerid="";
124 if(!empty($mastersdata["DialerDID"]))
125 $callerid=$mastersdata["DialerDID"];
126
127 $calleridarr=explode(":",$callerid);$dspan="1";
128 if(isset($calleridarr[1]))
129 {
130 $callerid=$calleridarr[0];$dspan=$calleridarr[1];
131 }
132
133 $dialline=Dialline::where('server','=', env('app_ip'))->where("status","=","Free")->where("enabled","=","1");
134 if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan)->where('id','<=','30');
135 $dialline=$dialline->orderBy('updated_at','ASC')->first();
136
137 if(empty($dialline))
138 {
139 $dialline=Dialline::where('server','=', env('app_ip'))->where("status","=","Free")->where("enabled","=","1");
140 if($dspan!="")$dialline=$dialline->where('dspan','=', "2")->where('id','>','30');
141 $dialline=$dialline->orderBy('id','ASC')->first();
142 }
143
144 if($dialline)
145 {
146 $users=$wakka->getPersons("client='$campaign' and status='New' and mobile!='' limit 1");
147 if(sizeof($users)>=1)
148 {
149 $record=$wakka->getPerson($users[0]['id']);
150 if($record)
151 {
152 $record["peopledata"]["status"]="AutoCall";
153 $wakka->setPerson($users[0]['id'],$record);
154 }
155
156 $dialline->user_id=$user_id;
157 $dialline->status="AutoCall";
158 $dialline->regexstr=$users[0]['client'];
159 $dialline->number=$users[0]["mobile"];
160 $dialline->save();
161
162 $nowts=microtime(true)*1000;
163
164 //start the call log
165 $crmcall=new CRMCall();
166 $crmcall->number=$users[0]["mobile"];
167 $crmcall->user_id=0;
168 $crmcall->sipid_id=0;
169 $crmcall->crm_id=$users[0]['id'];
170 $crmcall->lan=$users[0]['lan'];
171 $crmcall->client=$users[0]['client'];
172 $crmcall->department=$users[0]['department'];
173 $crmcall->state='New';
174 $crmcall->type="AutoCall";
175 $crmcall->dialline_id=$dialline->id;
176
177 $crmcall->setTs('ts_Wait',$nowts);
178 $crmcall->setTs('ts_Call',$nowts);
179
180 $crmcall->did=$callerid;
181
182 $tdata=array();
183 $crmcall->data=json_encode($tdata);
184 $crmcall->save();
185
186 //start actual calls
187 $newqueue=new Kqueue();
188 $newqueue->autoCallOut($users[0]["mobile"],$callerid,$crmcall,$dialline);
189
190 }
191 }
192 else break;
193 }
194 }
195
196 //return 1;
197 }
198
199 }
1 <?php
2
3 namespace App\Http\Controllers;
4
5 use Illuminate\Foundation\Bus\DispatchesJobs;
6 use Illuminate\Routing\Controller as BaseController;
7 use Illuminate\Foundation\Validation\ValidatesRequests;
8 use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
9
10 class Controller extends BaseController
11 {
12 use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13 }
1 <?php namespace App\Http\Controllers;
2
3 use App\Http\Controllers\Controller;
4
5 use DB;
6 use Auth;
7 use Config;
8 use Input;
9 use Response;
10 use App\Models\User;
11 use App\Models\Communitie;
12 use App\Jobs\KFileLib;
13 use App\Jobs\KAuthLib;
14 use App\Jobs\KHRMSLib;
15
16 class DashboardController extends Controller {
17
18 public function __construct()
19 {
20 $this->middleware('auth');
21 $this->middleware('module_access');
22 }
23
24 public function index()
25 {
26 $data=array();
27
28 $user=Auth::user();
29 $data["data"]=$user->data();
30 $data["meta"]=$user->meta();
31 if(Input::has("tz"))
32 {
33 $user->timezone=Input::get("tz");
34 $data["meta"]['ncnt']=0;$user->meta=json_encode($data["meta"]);
35 $user->save();
36 }
37 return view('layout.module.dashboard.index',$data);
38 }
39
40 public function create()
41 {
42 }
43
44 public function store()
45 {
46 }
47
48 public function show($id)
49 {
50 if($id=="s")
51 {
52 $kfile=new KFileLib();$kfile->folderSpaceUse(Auth::user()->id.'/');
53 return Response::make("",200);
54 }
55 if($id=="r")
56 {
57 $umeta=Auth::user()->meta();
58 $kauthlib=new KAuthLib();
59
60 if(!isset($umeta['kautherror']))$umeta['kautherror']=0;
61 if(isset($umeta['kauthlibuser'])&&isset($umeta['kauthlibcred']))
62 {
63 if(Config::get("app.extAuth")=="owa")
64 {
65 $authparams=explode(",",Config::get("app.extAuthParams"));if(!isset($authparams[0]))$authparams[0]="";if(!isset($authparams[1]))$authparams[1]="";
66 if(!$kauthlib->owaAuthCheck($authparams[0],$authparams[1],$umeta['kauthlibuser'],$umeta['kauthlibcred'],""))
67 {
68 $umeta['kautherror']++;
69 if($umeta['kautherror']>5)Auth::user()->status='Disabled';
70 Auth::user()->meta=json_encode($umeta);
71 Auth::user()->save();
72 if($umeta['kautherror']>5)return Response::make("document.location='logout';",200);
73 }
74 else
75 {
76 $umeta['kautherror']=0;
77 Auth::user()->meta=json_encode($umeta);
78 Auth::user()->save();
79 return Response::make("",200);
80 }
81 }
82 if(Config::get("app.extAuth")=="smtp")
83 {
84 $authparams=explode(",",Config::get("app.extAuthParams"));if(!isset($authparams[0]))$authparams[0]="";if(!isset($authparams[1]))$authparams[1]="";if(!isset($authparams[2]))$authparams[2]="";
85 if(!$kauthlib->smtpLoginCheck($authparams[0],$authparams[1],$authparams[2],$umeta['kauthlibuser'],$umeta['kauthlibcred']))
86 {
87 $umeta['kautherror']++;
88 if($umeta['kautherror']>5)Auth::user()->status='Disabled';
89 Auth::user()->meta=json_encode($umeta);
90 Auth::user()->save();
91 if($umeta['kautherror']>5)return Response::make("document.location='logout';",200);
92 }
93 else
94 {
95 $umeta['kautherror']=0;
96 Auth::user()->meta=json_encode($umeta);
97 Auth::user()->save();
98 return Response::make("",200);
99 }
100 }
101 }
102 }
103 if($id=="dpart")
104 {
105 $page=Input::get("page");
106 $data=array();
107
108 $user=Auth::user();
109 $data["data"]=$user->data();
110 $data["meta"]=$user->meta();
111 if(Input::has("tz"))
112 {
113 $user->timezone=Input::get("tz");
114 $data["meta"]['ncnt']=0;$user->meta=json_encode($data["meta"]);
115 $user->save();
116 }
117
118 return view('layout.module.dashboard.'.$page,$data);
119 }
120 if($id=="search")
121 {
122 $data=array();
123 $data['stype']=Input::get('stype');
124 $data['strarr']=explode(" ",Input::get('str'));
125 $data['listdata']=array();
126 //hashtag imgurl title subtitle bubbles()
127 $groupacl=Auth::user()->getAccessList("group",true,false,false);
128
129 if($data['stype']=="User")
130 {
131 $users0=User::whereIn("group",$groupacl)->where('status','=','Active');$orderby='';
132 $users2=User::whereIn("group",$groupacl);
133 $users3=User::whereIn("group",$groupacl);
134 foreach($data['strarr'] as $searchkey)
135 {
136 $searchkey=trim($searchkey);
137 if($searchkey!='')
138 {
139 if($searchkey=='Learner'||$searchkey=='Trainer'||$searchkey=='Organization')$users0=$users0->where('usertype','=',$searchkey);
140 else if($searchkey=='MaxEdupoints')$orderby='Edupoints';
141 else $users0=$users0->where('data','like',"%$searchkey%");
142
143 $users2=$users2->where('fullname','like',"%$searchkey%");
144 $users3=$users3->where('email','like',"%$searchkey%");
145 }
146 }
147 //if($orderby=='Edupoints')$users0=$users0->orderBy()
148 $users=array();
149 $users0=$users0->orderBy(DB::raw('RAND()'))->take(30)->get();
150 $users2=$users2->orderBy(DB::raw('RAND()'))->take(20)->get();
151 $users3=$users3->orderBy(DB::raw('RAND()'))->take(20)->get();
152 foreach($users0 as $user)$users[]=$user;
153 foreach($users2 as $user)$users[]=$user;
154 foreach($users3 as $user)$users[]=$user;
155 $users=array_unique($users);
156 if(!empty($users))
157 {
158 foreach($users as $user)
159 {
160 $tuserdata=array();
161 $tuserdata['id']=$user->id;
162 $tuserdata['type']='user';
163 $tuserdata['hashtag']="p-".$user->id;
164 $tuserdata['imgurl']=$user->fetchphotothumb();
165 $tuserdata['title']=$user->dispname();
166 $tuserdata['subtitle']=$user->dataval2('personal','gender')." ".$user->dataval2('personal','location')." - ".$user->dataval2('personal','country');
167 $tuserdata['bubbles']=array($user->dataval2('personal','level'),$user->dataval2('personal','function'));
168
169
170 $data['listdata'][]=$tuserdata;
171 }
172 }
173
174
175 }
176 if($data['stype']=="Community")
177 {
178 $commuity1=Communitie::whereIn("group",$groupacl)->where('status','=','Active');
179 $commuity2=Communitie::whereIn("group",$groupacl)->where('status','=','Active');
180 $commuity3=Communitie::whereIn("group",$groupacl)->where('status','=','Active');
181
182 $commuity1=$commuity1->where(function ($query) use($data) {
183 foreach($data['strarr'] as $searchkey)
184 {
185 $searchkey=trim($searchkey);
186 if($searchkey!='')
187 {
188 $query->where('description','like',"%$searchkey%");
189 }
190 }
191 });
192 $commuity2=$commuity2->where(function ($query) use($data) {
193 foreach($data['strarr'] as $searchkey)
194 {
195 $searchkey=trim($searchkey);
196 if($searchkey!='')
197 {
198 $query->orWhere('category','like',"%$searchkey%");
199 }
200 }
201 });
202 $commuity3=$commuity3->where(function ($query) use($data) {
203 foreach($data['strarr'] as $searchkey)
204 {
205 $searchkey=trim($searchkey);
206 if($searchkey!='')
207 {
208 $query->orWhere('name','like',"%$searchkey%");
209 }
210 }
211 });
212
213 $commuity1=$commuity1->orderBy(DB::raw('RAND()'))->take(20)->get();
214 $commuity2=$commuity2->orderBy(DB::raw('RAND()'))->take(20)->get();
215 $commuity3=$commuity3->orderBy(DB::raw('RAND()'))->take(20)->get();
216 $community=array();
217 if(!empty($commuity1))foreach($commuity1 as $comm)$community[$comm->id]=$comm;
218 if(!empty($commuity2))foreach($commuity2 as $comm)$community[$comm->id]=$comm;
219 if(!empty($commuity3))foreach($commuity3 as $comm)$community[$comm->id]=$comm;
220
221 if(!empty($community))
222 {
223 foreach($community as $tcomm)
224 {
225 $tuserdata=array();
226 $tuserdata['id']=$tcomm->id;
227 $tuserdata['type']='community';
228 $tuserdata['hashtag']="g-".$tcomm->id;
229 $tuserdata['imgurl']="assets/images/community.jpg";
230 $tuserdata['title']=$tcomm->name;
231 $tuserdata['subtitle']=" Community ";
232 $tuserdata['bubbles']=array_unique(array_filter(explode(",",$tcomm->category)));
233
234
235 $data['listdata'][]=$tuserdata;
236 }
237 }
238 }
239 return view('layout.module.dashboard.search',$data);
240 }
241
242 if($id=="dashlet")
243 {
244 $module=strtolower(Input::get("module"));
245 // Adding current campaign against current user: Code by AmolG
246 if (Auth::check())
247 {
248 $client=Input::get("client");
249 if(empty($client))
250 {
251 $wakka = new KHRMSLib();
252 $clientList = $wakka->clientsOwnerRWAccess();
253 $client = (count($clientList) > 0) ? reset($clientList) : $client;
254 }
255 $id = Auth::id();
256 $myFile = storage_path("data.json");
257 if (!file_exists($myFile)) { fopen($myFile, 'w'); }
258 try {
259 $jsondata = file_get_contents($myFile); //Get data from existing json file
260 $arr_data = ($jsondata != '') ? json_decode($jsondata, true) : array(); // converts json data into array
261 $arr_data[$id] = $client; // Push user data to array
262 $jsondata = json_encode($arr_data, JSON_PRETTY_PRINT); //Convert updated array to JSON
263 file_put_contents($myFile, $jsondata);
264 }
265 catch (Exception $e) {}
266 }
267
268 if($module!=""&&view()->exists("layout.module.dashboard.$module"))
269 {
270 return view("layout.module.dashboard.$module");
271 }
272 }
273 }
274 public function edit($id)
275 {
276 //
277 }
278 public function update($id)
279 {
280 //
281 }
282 public function destroy($id)
283 {
284 //
285 }
286
287
288 public function dashboard()
289 {
290 $data["id"]="Dashboard";
291
292 return view('layout.module.dashboard.dashboard',$data);
293 }
294 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Response;
6 use App\Models\Group;
7 use App\Models\Master;
8 use App\Models\Record;
9 use App\Models\CRMCall;
10 use App\Models\CRMCallArchive;
11 use App\Models\CRM;
12 use App\Models\CRMCampaign;
13 use App\Models\CRMList;
14 use App\Jobs\KHRMSLib;
15 use App\Models\Sipid;
16 use App\Models\Dialline;
17 use App\Models\UserLog;
18 use App\Models\User;
19 use App\Models\Kqueue;
20 use DB;
21 use Log;
22 use Session;
23 $client='';
24
25 class DataController extends Controller {
26
27 public function __construct()
28 {
29 $this->middleware('auth');
30 $this->middleware('module_access');
31 }
32
33 public function index()
34 {
35 }
36
37 public function create()
38 {
39 }
40
41 public function store()
42 {
43 $action = Input::get("action");
44
45 if($action=="upload")
46 {
47 $data['wakka'] = new KHRMSLib();
48 return view("layout.module.data.upload",$data);
49 }
50 }
51
52 public function show($id)
53 {
54 if($id=="display")
55 {
56 return view("layout.module.data.display");
57 }
58
59 if($id=="upload")
60 {
61 return view("layout.module.data.upload");
62 }
63
64 if($id=="load")
65 {
66 $page = Input::get('page');
67
68 $listingCount = 20;
69 $offset = ($page-1)*$listingCount;
70 if($offset < 0)$offset=0;
71 $limit = $listingCount;
72
73 $customers = DB::table('records')->offset($offset)->limit($limit)->get();
74
75 $output = "<table class='table table-bordered table-striped'>
76 <tr>
77 <th style='background-color: #999 !important;color: #fff;text-align:center;'>ID</th>
78 <th style='background-color: #999 !important;color: #fff;text-align:center;'>LAN</th>
79 <th style='background-color: #999 !important;color: #fff;text-align:center;'>Name</th>
80 <th style='background-color: #999 !important;color: #fff;text-align:center;'>Number</th>
81 <th style='background-color: #999 !important;color: #fff;text-align:center;'>Campaign</th>
82 <th style='background-color: #999 !important;color: #fff;text-align:center;'>Organization</th>
83 <th style='background-color: #999 !important;color: #fff;text-align:center;'>Designation</th>
84 </tr>";
85
86 foreach($customers as $customer){
87 $output .= "<tr>
88 <td>$customer->id</td>
89 <td>$customer->lan</td>
90 <td>$customer->customerName</td>
91 <td>$customer->mobile</td>
92 <td>$customer->client</td>
93 <td>$customer->organizationName</td>
94 <td>$customer->designation</td>
95 </tr>";
96 }
97
98 $output .= "</table>";
99
100 return $output;
101 }
102
103 if($id=="churn")
104 {
105 // $recordsData = DB::table('records')->select('id','lan','client','status','dialer_status','dialer_substatus')->get();
106 $data['campaign'] = DB::table('records')->select('client',DB::raw('COUNT(client) as count'))->groupBy('client')->get();
107
108 $data['callStatus'] = DB::table('records')->select('status',DB::raw('COUNT(status) as count'))->groupBy('status')->get();
109
110 $data['dispoStatus'] = DB::table('records')->select('dialer_status',DB::raw('COUNT(dialer_status) as count'))->groupBy('dialer_status')->get();
111
112 $data['resultcodeStatus'] = DB::table('records')->select('dialer_substatus',DB::raw('COUNT(dialer_substatus) as count'))->groupBy('dialer_substatus')->get();
113
114 return view("layout.module.data.churn",$data);
115 }
116
117 if($id=="churnQueue")
118 {
119 $churnAction = Input::get("action");
120 $churnCampaign = Input::get("campaign");
121 $churnStatus = Input::get("status");
122 $churnSubStatus = Input::get("substatus");
123 $oldStatusString = 's:0:"";';
124
125 switch ($churnStatus) {
126 case 'Incall': $oldStatusString = 's:6:"Incall";'; break;
127 case 'Called': $oldStatusString = 's:6:"Called";'; break;
128 case 'New': $oldStatusString = 's:3:"New";'; break;
129 case 'NoNumber': $oldStatusString = 's:8:"NoNumber";'; break;
130 case 'Noqueue': $oldStatusString = 's:7:"Noqueue";'; break;
131 }
132
133 $newStatusString = 's:3:"New";';
134
135 if($churnAction == "callStatus" && $churnCampaign != "" && $churnStatus != ""){
136 if($churnCampaign == "AllCampaignData"){
137 DB::table('records')->where('status','=',$churnStatus)
138 ->update(['status'=>'New','peopledata' => DB::raw("REPLACE(peopledata,'$oldStatusString','$newStatusString')")]);
139
140 }else{
141 DB::table('records')->where('status','=',$churnStatus)->where('client','=',$churnCampaign)
142 ->update(['status'=>'New','peopledata' => DB::raw("REPLACE(peopledata,'$oldStatusString','$newStatusString')")]);
143 }
144
145 }elseif($churnAction == "dialerStatus" && $churnCampaign != "" && $churnStatus != ""){
146 if($churnCampaign == "AllCampaignData"){
147 DB::table('records')->where('dialer_status','=',$churnStatus)->update(['status'=>'New','peopledata' => DB::raw("REPLACE(peopledata,'". 's:6:"Called";' . "','$newStatusString')"),'peopledata' => DB::raw("REPLACE(peopledata,'". 's:7:"NoQueue";' . "','$newStatusString')")]);
148 }else{
149 DB::table('records')->where('client','=',$churnCampaign)->where('dialer_status','=',$churnStatus)->update(['status'=>'New','peopledata' => DB::raw("REPLACE(peopledata,'". 's:6:"Called";' . "','$newStatusString')"),'peopledata' => DB::raw("REPLACE(peopledata,'". 's:7:"NoQueue";' . "','$newStatusString')")]);
150 }
151
152 }elseif($churnAction == "clearQueue" && $churnCampaign != "" && $churnStatus != ""){
153 if($churnCampaign == "AllCampaignData"){
154 DB::table('records')->where('status','=','New')->update(['status'=>'Noqueue']);
155 return "All campaign records has removed from queue";
156 }else{
157 DB::table('records')->where('client','=',$churnCampaign)->where('status','=','New')->update(['status'=>'Noqueue']);
158 return "In ".$churnCampaign." campaign records has removed from queue";
159 }
160 }elseif($churnAction == "dialersubStatus" && $churnCampaign != "" && $churnStatus != ""){
161 if($churnCampaign == "AllCampaignData"){
162 DB::table('records')->where('dialer_substatus','=',$churnStatus)->update(['status'=>'New','peopledata' => DB::raw("REPLACE(peopledata,'". 's:6:"Called";' . "','$newStatusString')"),'peopledata' => DB::raw("REPLACE(peopledata,'". 's:7:"NoQueue";' . "','$newStatusString')")]);
163 }else{
164 DB::table('records')->where('client','=',$churnCampaign)->where('dialer_substatus','=',$churnStatus)->update(['status'=>'New','peopledata' => DB::raw("REPLACE(peopledata,'". 's:6:"Called";' . "','$newStatusString')"),'peopledata' => DB::raw("REPLACE(peopledata,'". 's:7:"NoQueue";' . "','$newStatusString')")]);
165 }
166 }else{
167 return "Select the filters";
168 }
169 return "In ".$churnCampaign." campaign ".$churnStatus." records churn successfully";
170 }
171
172 if($id=="churnCampaignChange")
173 {
174 $churnAction = Input::get("action");
175 $churnCampaign = Input::get("campaign");
176
177
178 if($churnAction == "campaignDispo"){
179 if($churnCampaign=="AllCampaignData"){
180 $data = DB::table('records')->select('dialer_status',DB::raw('COUNT(dialer_status) as count'))->groupBy('dialer_status')->get();
181 }else{
182 $data = DB::table('records')->select('dialer_status',DB::raw('COUNT(dialer_status) as count'))->where('client','=',$churnCampaign)->groupBy('dialer_status')->get();
183 }
184 $output = "";
185 foreach ($data as $dispo) {
186 $name = $dispo->dialer_status?$dispo->dialer_status:"--Blank--";
187 $output .= "<label><input type='radio' name='dispoStatus' value='$dispo->dialer_status'/> $name ($dispo->count)</label><br/>";
188 }
189 return $output;
190 }
191 //data churn by result code wise.
192 if($churnAction == "resultcampaigncode"){
193 if($churnCampaign=="AllCampaignData"){
194 $data = DB::table('records')->select('dialer_substatus',DB::raw('COUNT(dialer_substatus) as count'))->groupBy('dialer_substatus')->get();
195 }else{
196 $data = DB::table('records')->select('dialer_substatus',DB::raw('COUNT(dialer_substatus) as count'))->where('client','=',$churnCampaign)->groupBy('dialer_substatus')->get();
197 }
198 $output = "";
199 foreach ($data as $dispo) {
200 $name = $dispo->dialer_substatus?$dispo->dialer_substatus:"--Blank--";
201 $output .= "<label><input type='radio' name='disposubStatus' value='$dispo->dialer_substatus'/> $name ($dispo->count)</label><br/>";
202 }
203 return $output;
204 }
205
206 if($churnAction == "campaignCall"){
207 if($churnCampaign=="AllCampaignData"){
208 $data = DB::table('records')->select('status',DB::raw('COUNT(status) as count'))->groupBy('status')->get();
209 }else{
210 $data = DB::table('records')->select('status',DB::raw('COUNT(status) as count'))->where('client','=',$churnCampaign)->groupBy('status')->get();
211 }
212 $output = "";
213 foreach ($data as $dispo) {
214 $name = $dispo->status?$dispo->status:"--Blank--";
215 $output .= "<label><input type='radio' name='callStatus' value='$dispo->status'/> $name ($dispo->count)</label><br/>";
216 }
217 return $output;
218 }
219 }
220
221 return "";
222 }
223
224 public function edit($id)
225 {
226
227 }
228 public function update($id)
229 {
230
231 }
232 public function destroy($id)
233 {
234 //
235 }
236 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Response;
6 use App\Models\Group;
7 use App\Models\Master;
8 use App\Models\Record;
9 use App\Models\CRMCall;
10 use App\Models\CRMCallArchive;
11 use App\Models\CRM;
12 use App\Models\CRMCampaign;
13 use App\Models\CRMList;
14 use App\Jobs\KHRMSLib;
15 use App\Models\Sipid;
16 use App\Models\Dialline;
17 use App\Models\UserLog;
18 use App\Models\User;
19
20 use DB;
21 use Log;
22 use Session;
23 $client='';
24
25 class DialermodesaveController extends Controller {
26
27
28 public function index()
29 {
30
31 }
32 public function create()
33 {
34
35 }
36 public function store()
37 {
38
39
40 }
41 public function show($id)
42 {
43
44 if($id=="savedialerstate")
45 {
46 $dialerstate=Input::get('dialerstate');
47 $client=Input::get("client");
48
49 //echo "Prashant".$dialerstate;
50 DB::table('users')->where('id', Auth::user()->id)->update(['sel_campaign'=>Input::get("client"),'current_dialmode'=>Input::get('dialerstate')]);
51 }
52 }
53 private function redirectIncoming()
54 {
55
56 }
57
58 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Config;
6 use Session;
7
8 use App\Models\Group;
9 use App\Models\User;
10
11 class GroupController extends Controller {
12
13
14 public function __construct()
15 {
16 $this->middleware('auth');
17 $this->middleware('module_access');
18 }
19
20 public function index()
21 {
22 return view('layout.module.group.index',array('grouplist'=>Group::where('owner','=',Auth::user()->id)->orderBy("created_at","DESC")->paginate(30)));
23 }
24 public function create()
25 {
26 return view('layout.module.group.create');
27 }
28 public function store()
29 {
30 $data=array();
31 $grpname=substr(htmlentities(trim(Input::get("group"))),0,200);
32
33 $exists=Group::where("group","=",$grpname)->first();
34 if(!$exists)
35 {
36 $group=new Group();
37
38 $group->group=$grpname;
39 $group->dispname=$group->group;
40 $group->owner=Auth::user()->id;
41 $group->status=Input::get("groupstatus");
42 $role=Auth::user()->role();
43 foreach(Config::get('app.app_modules') as $tmod=>$tmodarr)
44 if (strstr(",".$role->modulerwa.",",",$tmod,"))
45 $data[$tmod."_settings"]=Input::get($tmod."_settings");
46 $group->data=json_encode($data);
47 $group->save();
48
49 return view('layout.module.group.edit',array('tgroup'=>$group,'displaymsg'=>array("type"=>"success","text"=>"Group Created")));
50 }
51 else
52 {
53 return view('layout.module.group.create',array('tgroup'=>array(),'displaymsg'=>array("type"=>"Error!","text"=>"Group Already Exists")));
54 }
55 }
56 public function show($id)
57 {
58 return view('layout.module.group.edit',array('tgroup'=>Group::find($id)));
59 }
60 public function edit($id)
61 {
62 return view('layout.module.group.edit',array('tgroup'=>Group::find($id)));
63 }
64 public function update($id)
65 {
66 $data=array();
67
68 $group=Group::find($id);
69
70 //$group->group=Input::get("group");
71 $group->status=Input::get("groupstatus");
72 $group->parent=Input::get("groupparent");
73 $group->dispname=Input::get("groupdispname");
74 if(trim($group->dispname)=="")$group->dispname=$group->group;
75
76 $role=Auth::user()->role();
77 foreach(Config::get('app.app_modules') as $tmod=>$tmodarr)
78 if (strstr(",".$role->modulerwa.",",",$tmod,"))
79 $data[$tmod."_settings"]=Input::get($tmod."_settings");
80
81 $group->data=json_encode($data);
82 $group->save();
83
84 return view('layout.module.group.edit',array('tgroup'=>$group,'displaymsg'=>array("type"=>"success","text"=>"Group Updated")));
85 }
86 public function destroy($id)
87 {
88 $group=Group::find($id);
89 $group->status="Disabled";
90 $group->save();
91
92 return "Group Disabled";
93 }
94
95
96 public function dashboard()
97 {
98 //echo "OK";
99 }
100 }
1 <?php namespace App\Http\Controllers;
2
3 use Input;
4 use App\Jobs\KHRMSLib;
5 use App\Models\Cutoff;
6 use Auth;
7 use Response;
8
9 class HRController extends Controller {
10
11 public function __construct()
12 {
13 $this->middleware('auth');
14 $this->middleware('module_access');
15 }
16
17 public function index()
18 {
19 $data=array();
20 $data['wakka'] = new KHRMSLib();
21 return view('layout.module.hr.index',$data);
22 }
23 public function create()
24 {
25 //
26 }
27 public function store()
28 {
29 if(Input::get('action') == "CutOff"){
30 //change start code
31 $cutoff = new Cutoff();
32 $cutoff->starttime=Input::get("cutoffstarttime");
33 $cutoff->endtime=Input::get("cutoffendtime");
34 $cutoff->user_id=Auth::user()->id;
35 $cutoff->save();
36 return Response::make("<script>simpleNotification('success','topRight','Cutoff added successfully!');</script>");
37 //change end code
38 }else{
39 $data=array();
40 $data['wakka'] = new KHRMSLib();
41 return view('layout.module.hr.'.strtolower(Input::get('action')),$data);
42 }
43 }
44 public function show($id)
45 {
46 $data=array();
47 $data['wakka'] = new KHRMSLib();
48
49 $type='text/html';
50 if($id=='IDCard')$type="image/png";
51 if($id=='SalarySlip')$type="application/pdf";
52 if($id=='IncentiveSlip')$type="application/pdf";
53
54 return response()->view('layout.module.hr.'.strtolower($id),$data)->header('Content-Type', $type);
55 }
56 public function edit($id)
57 {
58 //
59 }
60 public function update($id)
61 {
62 //
63 }
64 public function destroy($id)
65 {
66 //
67 }
68
69
70 public function dashboard()
71 {
72 //echo "OK";
73 }
74 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Config;
5 use Response;
6 use Input;
7 use Cache;
8 use App\Models\Message;
9 use App\Models\Sipid;
10 use App\Jobs\KPushNotify;
11 use App\Models\User;
12 use App\Models\Kqueue;
13
14 class MessageController extends Controller {
15
16 public function __construct()
17 {
18 $this->middleware('auth');
19 $this->middleware('module_access');
20 }
21
22 public function index()
23 {
24 //$messages=Message::where("to","=",Auth::user()->username)->whereIn("status",array("New","Read"))->orderBy('updated_at','desc')->paginate(50);
25 //return view('layout.module.message.index',array("messages"=>$messages));
26
27 $user=Auth::user();
28
29 $data=array();
30 $data["data"]=json_decode($user->data,true);
31 $data["id"]=$user->id;
32 $data["user"]=$user;
33 $data["displayname"]=Auth::user()->dispname();
34 $data["myphoto"] = $user->fetchphoto();
35
36 $data["messages"]=Message::where('to','=',$user->id)->orderBy("updated_at","DESC")->take(100)->get();
37 $data["newcount"]=Message::where('to','=',$user->id)->where('status','=','New')->count();
38 $data["users"]=array();
39 foreach($data["messages"] as $message)
40 {
41 $tuser=User::find($message->from);
42 if($tuser)
43 {
44 if(!isset($data["users"][$message->from]))
45 {
46 $data["message_time"][$message->id]=Auth::user()->post_date($message->updated_at);
47 $data["users"][$message->from]=array();
48 $data["users"][$message->from]['photothumb']=Auth::user()->fetchphotothumb($message->from);
49 $data["users"][$message->from]['dispname']=$tuser->dispname();
50 }
51 else
52 {
53 //self chat?
54 $data["message_time"][$message->id]=Auth::user()->post_date($message->updated_at);
55 //$data["users"][$message->from]=array();
56 //$data["users"][$message->from]['photothumb']=Auth::user()->fetchphotothumb($message->from);
57 //$data["users"][$message->from]['dispname']=$tuser->dispname();
58 }
59 }
60 }
61
62 return view(Config::get('app.mytheme').'.module.message.index',$data);
63 }
64 public function create()
65 {
66 //
67 }
68 public function store()
69 {
70 $type=Input::get("type");
71 if($type=="chat")
72 {
73 $id=explode("_",Input::get("id"));
74 //chanch if $id[1] is a user and in our friendlist TODO
75 $msg=htmlentities(Input::get("msg"));
76 $nowTS=time();
77
78 if(Message::where("from","=",Auth::user()->id)->where("created_at",'>',date('Y-m-d H:i:s',(time()-(60*60))))->count()>30)return Response::make("simpleNotification('error','topRight','Fairplay Voilation #940');");
79 if(Message::where("from","=",Auth::user()->id)->where("created_at",'>',date('Y-m-d H:i:s',(time()-(24*60*60))))->count()>100)return Response::make("simpleNotification('error','topRight','Fairplay Voilation #941');");
80
81 $ckey='chat'.Auth::user()->id.$id[1];
82 if(Cache::get($ckey,0)>100)return Response::make("simpleNotification('error','topRight','Fairplay Voilation #942');");
83 Cache::put($ckey,Cache::get($ckey,0)+1, 24*60);
84
85 $messageTo=Message::where("to","=",$id[1])->where("from","=",Auth::user()->id)->where("subject","=","Chat")->first();
86 $messageFrom=Message::where("to","=",Auth::user()->id)->where("from","=",$id[1])->where("subject","=","Chat")->first();
87 if(!$messageTo)
88 {
89 $messageTo=new Message();
90 $messageTo->to=$id[1];
91 $messageTo->from=Auth::user()->id;
92 $messageTo->subject="Chat";
93 }
94 if(!$messageFrom)
95 {
96 $messageFrom=new Message();
97 $messageFrom->to=Auth::user()->id;
98 $messageFrom->from=$id[1];
99 $messageFrom->subject="Chat";
100 }
101 $messageTo->status="Read";
102 $messageFrom->status="Read";
103
104
105 $dataTo=json_decode($messageTo->data,true);
106 $dataFrom=json_decode($messageFrom->data,true);
107
108 $dataTo[$nowTS]=array(Auth::user()->id,$msg);
109 $dataFrom[$nowTS]=array(Auth::user()->id,$msg);
110
111 $messageTo->data=json_encode($dataTo);
112 $messageFrom->data=json_encode($dataFrom);
113
114
115 $messageTo->save();
116 $messageFrom->save();
117
118 //add a queue notify to user if online
119 $noty=new KPushNotify();
120 $res=$noty->send(array($id[1]),"chat",Auth::user()->dispname(),$msg,Auth::user()->id);
121
122
123 if(!isset($res[$id[1]])||$res[$id[1]]<=0)
124 {
125 $messageTo->status="New";
126 $messageTo->save();
127 return Response::make("simpleNotification('alert','topRight','User is offline');");
128 }
129
130 }
131 if($type=="call")
132 {
133 $id=explode("_",Input::get("id"));
134
135 $sipid=Sipid::find(Input::get('sipid'));
136 $tosipid=Sipid::where("user","=",$id[1])->where("status","=","1")->first();
137 $tosip=0;
138 if($sipid&&$tosipid)
139 {
140 $tosip=$tosipid->id;
141
142 $newqueue=new Kqueue();
143 $newqueue->sipOriginate($sipid,"1001".$tosip,"kstychDialer");
144 }
145
146 return Response::make($tosip);
147 }
148 }
149 public function show($id)
150 {
151 if($id=="topbar")
152 {
153 $messages=Message::where("to","=",Auth::user()->id)->where("status","=","New")->orderBy('created_at','desc')->take(10)->get();
154 $count=Message::where("to","=",Auth::user()->id)->where("status","=","New")->count();
155
156 $data=array();
157 foreach($messages as $message)
158 {
159 $data[]=array("fromuser"=>$message->from,
160 "text"=>$message->subject,
161 "tstr"=>date("d-M H:i",strtotime($message->created_at)));
162 }
163 return view('layout.topbar.message',array("messages"=>$data,"messagescount"=>$count));
164 }
165
166
167
168 $data=array();
169 $tmessage=Message::find($id);
170 if($tmessage->subject=="Chat")
171 {
172 if($tmessage->to==Auth::user()->id)
173 {
174 $data['fromuser']=$tmessage->from;
175 $data["id"]=$id;
176 $data['mid']=$id;
177 $data['tuser']=User::find($tmessage->from);
178
179 $data['messages']=json_decode($tmessage->data,true);
180 $data["users"]=array();
181 foreach($data["messages"] as $ts=>$message)
182 {
183 $data["message_time"]["$ts"]=Auth::user()->post_date(date("Y-m-d H:i",$ts));
184
185 //$dataTo[$nowTS]=array(Auth::user()->id,$msg);
186 $tuser=User::find($message[0]);
187 if($tuser)
188 {
189 if(!isset($data["users"][$message[0]]))
190 {
191 $data["users"][$message[0]]=array();
192 $data["users"][$message[0]]['photothumb']=Auth::user()->fetchphotothumb($message[0]);
193 $data["users"][$message[0]]['dispname']=$tuser->dispname();
194 }
195 }
196 }
197 if($tmessage->status=="New"){$tmessage->status="Read";$tmessage->save();}
198 }
199 return view(Config::get('app.mytheme').'.module.message.messagecontent',$data);
200 }
201
202
203
204 return view('layout.module.message.msg',array("message"=>Message::find($id)));
205 }
206 public function edit($id)
207 {
208 //
209 }
210 public function update($id)
211 {
212 //
213 }
214 public function destroy($id)
215 {
216 //
217 }
218
219 public function dashboard()
220 {
221 //echo "OK";
222 }
223 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Config;
6 use Session;
7 use App\Http\Controllers;
8 use App\Http\Requests;
9 use Illuminate\Http\Request;
10 use DB;
11 use App\Models\Group;
12 use App\Models\User;
13 use App\Jobs\KHRMSLib;
14 use Log;
15 use DateTime;
16
17 class NotesController extends Controller
18 {
19 public function __construct()
20 {
21 // $this->middleware('auth');
22 // $this->middleware('module_access');
23 }
24
25 public function loadQuestions($userId='')
26 {
27 $fieldDetails=array();
28 $userId = Auth::user()->id;
29
30 $notesDetails = DB::table('agent_notes')
31 ->where('user_id',$userId)
32 ->get();
33
34 if($notesDetails != null){
35 $notesDetails = $notesDetails[0];
36
37 for($i=1;$i<=50;$i++){
38 $field = 'field_'.$i;
39
40 $fieldDetails[$i] = explode(":",$notesDetails->$field);
41 }
42
43 usort($fieldDetails, function($a1, $a2) {
44 $v1 = strtotime($a1[1]);
45 $v2 = strtotime($a2[1]);
46 return $v2 - $v1; // $v2 - $v1 to reverse direction
47 });
48
49 foreach($fieldDetails as $key=> $field){
50 $fieldDetails[$key+1] = $field;
51 }
52 }
53
54 return view('layout.module.notes.index',compact('userId','fieldDetails','notesDetails'));
55 }
56
57 public function store()
58 {
59 $userId=Input::get("user_id");
60 $action=Input::get("action");
61 $fieldVal=Input::get("fieldVal");
62 $dashboarduser=Auth::user();
63
64 $notesDetails = DB::table('agent_notes')
65 ->where('user_id',$userId)
66 ->get();
67
68 /*$fieldDetails=array();
69
70 for($i=1;$i<=50;$i++){
71 $field = 'field_'.$i;
72
73 $fieldDetails[$i] = explode(":",$notesDetails[0]->$field);}
74
75 usort($fieldDetails, function($a1, $a2) {
76 $v1 = strtotime($a1[1]);
77 $v2 = strtotime($a2[1]);
78 return $v2 - $v1; // $v2 - $v1 to reverse direction
79 });
80
81 foreach($fieldDetails as $key=> $field){
82 $fieldDetails[$key+1] = $field;
83 }*/
84
85 if($action=="save")
86 {
87 $fieldArray = array();
88 $fieldVal = explode(",",$fieldVal);
89
90 for($i=0;$i<50;$i++){
91 $fieldArray[]="field_".($i+1)."='".$fieldVal[$i]."'";
92 }
93
94 $setArray = implode(",",$fieldArray);
95
96 if($notesDetails == null)
97 {
98 DB::statement("insert into agent_notes set created_at='".date("Y-m-d H:i:s")."', updated_at='".date("Y-m-d H:i:s")."', user_id='".$userId."', $setArray" );
99 }
100 else{
101 $notesDetails = $notesDetails[0];
102
103 DB::statement("update agent_notes set updated_at='".date("Y-m-d H:i:s")."', $setArray where user_id='".$userId."'");
104 }
105
106 $notesDetails = DB::table('agent_notes')
107 ->where('user_id',$userId)
108 ->get();
109
110 $fieldDetails=array();
111
112 for($i=1;$i<=50;$i++){
113 $field = 'field_'.$i;
114
115 $fieldDetails[$i] = explode(":",$notesDetails[0]->$field);}
116
117 usort($fieldDetails, function($a1, $a2) {
118 $v1 = strtotime($a1[1]);
119 $v2 = strtotime($a2[1]);
120 return $v2 - $v1; // $v2 - $v1 to reverse direction
121 });
122
123 foreach($fieldDetails as $key=> $field){
124 $fieldDetails[$key+1] = $field;
125 }
126
127 unset($fieldDetails[0]);
128
129 return view('layout.module.notes.index',compact('userId','notesDetails','fieldDetails'));
130 }
131
132 }
133
134 }
135
136
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use App\Models\Notification;
5
6 class NotificationController extends Controller {
7
8
9 public function __construct()
10 {
11 $this->middleware('auth');
12 $this->middleware('module_access');
13 }
14
15 public function index()
16 {
17 $notifications=Notification::where("to","=",Auth::user()->username)->where("status","=","New")->orderBy('created_at')->get();
18 return view('layout.module.notification.index',array("notifications"=>$notifications));
19 }
20 public function create()
21 {
22 //
23 }
24 public function store()
25 {
26 //
27 }
28 public function show($id)
29 {
30 if($id=="topbar")
31 {
32 $this->checkLiveRooms();
33
34 $notifications=Notification::where("to","=",Auth::user()->username)->where("status","=","New")->orderBy('created_at','desc')->take(10)->get();
35 $count=Notification::where("to","=",Auth::user()->username)->where("status","=","New")->count();
36
37 $data=array();
38 foreach($notifications as $notification)
39 {
40 $data[]=array("sign"=>"+",
41 "type"=>$notification->type,
42 "text"=>$notification->data,
43 "tstr"=>date("d-M H:i",strtotime($notification->created_at)));
44 }
45 return view('layout.topbar.notification',array("notifications"=>$data,"notificationscount"=>$count));
46 }
47 }
48 public function edit($id)
49 {
50 //
51 }
52 public function update($id)
53 {
54 //
55 }
56 public function destroy($id)
57 {
58 if($id=="clearall")
59 {
60 Notification::where("to","=",Auth::user()->username)->where("status","=","New")->update(array('status' => 'Archive'));
61 return view('layout.module.notification.index',array("notifications"=>array(),'displaymsg'=>array("type"=>"success","text"=>"All Notifications Cleared")));
62 }
63 }
64
65
66 public function dashboard()
67 {
68 //echo "OK";
69 }
70
71 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Config;
6 use Session;
7 use App\Http\Controllers;
8 use App\Http\Requests;
9 use Illuminate\Http\Request;
10 use DB;
11 use Log;
12 use App\Models\Group;
13 use App\Models\User;
14 use App\Models\CRMCall;
15
16 class QuestionareController extends Controller
17 {
18 public function __construct()
19 {
20 $this->middleware('auth');
21 //$this->middleware('module_access');
22 }
23
24 public function loadQuestions($qid='', $optid='', $level=1)
25 {
26 if($qid == '') {
27 $auth_ques_count = 5;
28 $where = 'id = 1';
29 $auth_questions = DB::select('SELECT * FROM authentication_questions_test ORDER BY RAND() LIMIT '.$auth_ques_count );
30 $query = 'SELECT * FROM question WHERE '.$where;
31 $questions = DB::select($query);
32
33 return view('layout.module.questionare.questions',compact('qid','questions', 'auth_questions', 'auth_ques_count'));
34 }
35 else {
36 $where = 'question_no IN (SELECT question_id FROM question_tree WHERE parent_id = '.$qid.' AND parent_opt = "opt_'.$optid.'")';
37 $query = 'SELECT * FROM question WHERE '.$where;
38 $questions = DB::select($query);
39 return view('layout.module.questionare.childquestions',compact('qid','questions','auth_questions','level'));
40 }
41 }
42
43 public function saveQuestionAire()
44 {
45 $varid=Input::get('varid');
46 $questionDateTime=Input::get('questionDateTime');
47
48 $questionArray = $_POST['questionArray'];
49 $questionArray = json_decode($questionArray);
50 //$questionArray = explode(",",$questionArray);
51 $questionArray=(array)$questionArray;
52
53 $authQuestionArray = $_POST['authQuestionArray'];
54 $authQuestionArray = json_decode($authQuestionArray);
55 $authQuestionArray=(array)$authQuestionArray;
56
57 $recordDetails = DB::table('records')->where('id','=',$varid)->select('*')->first();
58
59 $user_id = Auth::user()->username;
60 $cust_id = $recordDetails->clientcode;
61 $name = $recordDetails->firstname;
62 $mobile = $recordDetails->mobile;
63
64 $crmcallDetails=CRMCall::where('crm_id','=',$varid)->orderBy("created_at","DESC")->first();
65
66 $call_id = $crmcallDetails->id;
67
68 foreach($questionArray as $key=> $quesArray){
69 $explodeQues = explode("-", $key);
70
71 $ques = $explodeQues[1];
72
73 DB::statement("insert into questionaire_details set created_at='".date("Y-m-d H:i:s")."', updated_at='".date("Y-m-d H:i:s")."', user_id='".$user_id."',cust_id='".$cust_id."',call_id='".$call_id."',name='".$name."',number='".$mobile."',question_time='".$questionDateTime."',auth_question_1='".$authQuestionArray['auth_0']->auth_ques."',auth_opt_1='".trim($authQuestionArray['auth_0']->auth_opt)."',auth_question_2='".$authQuestionArray['auth_1']->auth_ques."',auth_opt_2='".trim($authQuestionArray['auth_1']->auth_opt)."',auth_question_3='".$authQuestionArray['auth_2']->auth_ques."',auth_opt_3='".trim($authQuestionArray['auth_2']->auth_opt)."',auth_question_4='".$authQuestionArray['auth_3']->auth_ques."',auth_opt_4='".trim($authQuestionArray['auth_3']->auth_opt)."',auth_question_5='".$authQuestionArray['auth_4']->auth_ques."',auth_opt_5='".trim($authQuestionArray['auth_4']->auth_opt)."',question='".$ques."',primary_question='".$quesArray->prim_ques."',primary_response='".trim($quesArray->prim_response)."',primary_text='".$quesArray->prim_txt."',followup_question='".$quesArray->fol_ques."',followup_response='".trim($quesArray->fol_response)."',followup_text='".$quesArray->fol_txt."',secondary_question='".$quesArray->sec_ques."',secondary_response='".trim($quesArray->sec_response)."',secondary_text='".$quesArray->sec_txt."'");
74 }
75 return "<div class='alert alert-success'><strong>All Questions Saved Successfully!</strong></div>";
76 }
77 }
78
79
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Response;
6 use App\Models\Notification;
7 use App\Jobs\KHRMSLib;
8 use DB;
9
10
11 class RecordController extends Controller {
12
13
14 public function __construct()
15 {
16 $this->middleware('auth');
17 $this->middleware('module_access');
18 }
19
20 public function index()
21 {
22 return view('layout.module.record.index',array());
23 }
24 public function create()
25 {
26 //
27 }
28 public function store()
29 {
30 $data=array();
31 $data['wakka'] = new KHRMSLib();
32 $action=Input::get("action");
33 $client=Input::get("client");
34 $data['wakka']->HRFillNames($client);
35 if($action=="show")
36 {
37 return view('layout.module.record.show',$data);
38 }
39 if($action=="save")
40 {
41 return view('layout.module.record.save',$data);
42 }
43 if($action=="quicksearch")
44 {
45 return view('layout.module.record.quicksearch',$data);
46 }
47 if($action=="textsearch")
48 {
49 return view('layout.module.record.textsearch',$data);
50 }
51 if($action=="addkey")
52 {
53 $wakka = new KHRMSLib();
54
55 $varid=Input::get("varid");
56 $keys=explode(",",Input::get("keys"));
57 $record=$wakka->getPerson($varid);
58 if(!empty($keys))foreach($keys as $key)
59 {
60 $val=Input::get($key);
61 $record["peopledata"][$key]=$val;
62 }
63
64 $wakka->setPerson($varid,$record);
65
66 return Response::make("");
67 }
68 if($action=="delaltphone")
69 {
70 $wakka = new KHRMSLib();
71
72 $varid=Input::get("varid");
73 $i=Input::get("i");
74
75 $record=$wakka->getPerson($varid);
76 for($k=$i+1;$k<=10;$k++,$i++)
77 {
78 $record["peopledata"]["altphone$i"]=$record["peopledata"]["altphone$k"];
79 $record["peopledata"]["altphone_lbl_$i"]=$record["peopledata"]["altphone_lbl_$k"];
80 }
81 $record["peopledata"]["altphone10"]="";
82 $record["peopledata"]["altphone_lbl_10"]="";
83
84 $wakka->setPerson($varid,$record);
85 }
86 if($action=="bulkupload")
87 {
88 return view('layout.module.record.bulkupload',$data);
89 }
90 if($action=="Appointment")
91 {
92 $wakka = new KHRMSLib();
93
94 $CustomerName=Input::get("CustomerName");
95 $AppntLocation=Input::get("AppntLocation");
96 $AppntTime=Input::get("AppntTime");
97 $Address=Input::get("Address");
98 $AppntDate=Input::get("AppntDate");
99 $ContactPerson=Input::get("ContactPerson");
100 $Phone=Input::get("Phone");
101
102 $AppntDate=date("d-M-Y",strtotime($AppntDate));
103 $h = $AppntTime;
104 $hm = $h * 60;
105 $ms = $hm * 60;
106 $AppntTime=gmdate("g A",$ms);
107
108 $smsapi="http://115.114.132.71/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?userId=idcamps&pass=pacamps1&contenttype=1&from=HEROFC&selfid=true&alert=1&dlrreq=true";
109
110 $MsgContent="Dear $CustomerName, Your appointment is fixed at $AppntLocation. Appointment Date - $AppntDate, Time - $AppntTime. Address: $Address Contact Person - $ContactPerson. In case of any assistence Please give a missed call. $Tollfree";
111 $EnMsgContent=urlencode($MsgContent);
112 $smsurl=$smsapi."&to=".$Phone."&text=".$EnMsgContent;
113
114 $MessageID=$wakka->get_response($smsurl);
115
116 if($MessageID)
117 print $MessageID;
118 else
119 print "Failed";
120 //echo $CustomerName . ' = ' . $AppntLocation . ' = ' . $AppntTime . ' = ' . $Address . ' = ' . $AppntDate . ' = ' . $ContactPerson;
121 }
122 }
123 public function show($id)
124 {
125 $data=array();
126 $data['wakka'] = new KHRMSLib();
127 if($id=="bulkupload")
128 {
129 return view('layout.module.record.bulkupload',$data);
130 }
131 if($id=="textsearch")
132 {
133 return view('layout.module.record.textsearch',$data);
134 }
135 }
136 public function edit($id)
137 {
138 //
139 }
140 public function update($id)
141 {
142 //
143 }
144 public function destroy($id)
145 {
146
147 }
148
149
150 public function dashboard()
151 {
152 //echo "OK";
153 }
154
155 public function churnData()
156 {
157 $data=array();
158 $wakka = new KHRMSLib();
159
160 $listVal = DB::table('currentqueue_list')->get();
161
162 $rclientlst=$wakka->clientsReadAccess();
163
164 $data['listVal'] = $listVal;
165 $data['cntlistVal'] = count($listVal);
166 $data['rclientlst'] = $rclientlst;
167
168 return view('layout.module.record.churn',$data);
169 }
170
171 public function saveChurnData()
172 {
173 $user_agent=Input::get('agent');
174 $data = $_POST['data'];
175
176 $exitAgent = DB::table('cq_logic')->where('user_agent','=',$user_agent)->first();
177
178 if($exitAgent)
179 {
180 DB::update("update cq_logic set updated_at='".date("Y-m-d H:i:s")."', data='".$data."' where user_agent='".$user_agent."'");
181 }
182 else
183 {
184 DB::statement("insert into cq_logic set created_at='".date("Y-m-d H:i:s")."', updated_at='".date("Y-m-d H:i:s")."', user_agent='".$user_agent."', data='".$data."'");
185 }
186
187 return ;
188 }
189
190 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Config;
6 use Session;
7
8 use App\Models\Role;
9 use App\Models\User;
10
11 class RoleController extends Controller {
12
13
14 public function __construct()
15 {
16 $this->middleware('auth');
17 $this->middleware('module_access');
18 }
19
20 public function index()
21 {
22 return view('layout.module.role.index',array('rolelist'=>Role::paginate(50)));
23 }
24 public function create()
25 {
26 return view('layout.module.role.create');
27 }
28 public function store()
29 {
30 $data=array();
31 $rolename=substr(htmlentities(trim(Input::get("rolename"))),0,200);
32
33 $exists=Role::where("rolename","=",$rolename)->first();
34 if(!$exists&&$rolename!='')
35 {
36 $role=new Role();
37
38 $role->rolename=$rolename;
39 $role->status=Input::get("rolestatus");
40 $role->rolegroup=Input::get("rolegroup");
41
42 $role->modulerwa=Input::get("modulerwa");
43 $role->modulerw=Input::get("modulerw");
44 $role->moduler=Input::get("moduler");
45 $role->grouprwa=Input::get("grouprwa");
46 $role->grouprw=Input::get("grouprw");
47 $role->groupr=Input::get("groupr");
48
49 $role->default=Input::get("roledefault");
50
51 $role->data=json_encode($data);
52 $role->save();
53
54 if(Input::get("roledefault")==1)
55 {
56 Role::where('id','!=',$role->id)->update(array('default'=>0));
57 }
58
59 return view('layout.module.role.edit',array('trole'=>$role,'displaymsg'=>array("type"=>"success","text"=>"Role Created")));
60 }
61 else
62 {
63 return view('layout.module.role.create',array('trole'=>array(),'displaymsg'=>array("type"=>"Error!","text"=>"Role Already Exists")));
64 }
65
66 }
67 public function show($id)
68 {
69 return view('layout.module.role.edit',array('trole'=>Role::find($id)));
70 }
71 public function edit($id)
72 {
73 return view('layout.module.role.edit',array('trole'=>Role::find($id)));
74 }
75 public function update($id)
76 {
77 $data=array();
78
79 $role=Role::find($id);
80
81 //$role->rolename=$rolename;
82 $role->status=Input::get("rolestatus");
83 $role->rolegroup=Input::get("rolegroup");
84
85 $role->modulerwa=Input::get("modulerwa");
86 $role->modulerw=Input::get("modulerw");
87 $role->moduler=Input::get("moduler");
88 $role->grouprwa=Input::get("grouprwa");
89 $role->grouprw=Input::get("grouprw");
90 $role->groupr=Input::get("groupr");
91
92 $role->default=Input::get("roledefault");
93
94 $role->data=json_encode($data);
95 $role->save();
96
97 if(Input::get("roledefault")==1)
98 {
99 Role::where('id','!=',$role->id)->update(array('default'=>0));
100 }
101
102 return view('layout.module.role.edit',array('trole'=>$role,'displaymsg'=>array("type"=>"success","text"=>"Role Updated")));
103 }
104 public function destroy($id)
105 {
106 $role=Role::find($id);
107 $role->status="Disabled";
108 $role->save();
109
110 return "Role Disabled";
111 }
112
113
114 public function dashboard()
115 {
116 //echo "OK";
117 }
118 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 // use Response;
6 // use App\Models\Group;
7 // use App\Models\Master;
8 // use App\Models\Record;
9 // use App\Models\CRMCall;
10 // use App\Models\CRMCallArchive;
11 // use App\Models\CRM;
12 // use App\Models\CRMCampaign;
13 // use App\Models\CRMList;
14 // use App\Jobs\KHRMSLib;
15 // use App\Models\Sipid;
16 // use App\Models\Dialline;
17 // use App\Models\UserLog;
18 // use App\Models\User;
19 // use App\Models\Kqueue;
20 use DB;
21 // use Log;
22 // use Session;
23 // $client='';
24
25 class SettingController extends Controller {
26
27 public function __construct()
28 {
29 $this->middleware('auth');
30 // $this->middleware('module_access');
31 }
32
33 public function index()
34 {
35 $data['userCurrentTheme'] = Auth::user()->theme;
36 return view("layout.module.setting.index",$data);
37 }
38
39 public function create()
40 {
41 }
42
43 public function store()
44 {
45 $action = Input::get("action");
46
47 if($action=="upload")
48 {
49 $data['wakka'] = new KHRMSLib();
50 return view("layout.module.data.upload",$data);
51 }
52 }
53
54 public function show($id)
55 {
56 if($id=="theme")
57 {
58 $userInput = Input::get("name");
59 if($userInput != ""){
60 $themes = explode(",",env('themes'));
61 if(in_array($userInput, $themes)){
62 DB::table('users')->where('id',Auth::user()->id)->update(['theme'=>$userInput]);
63 $data['response'] = ["type"=>"success","message"=>"Selected theme applied, it will load automatically in second"];
64 $data['userCurrentTheme'] = $userInput;
65 }else{
66 $data['response'] = ["type"=>"warning","message"=>"Selected theme not available"];
67 $data['userCurrentTheme'] = Auth::user()->theme;
68 }
69 }else{
70 $data['response'] = ["type"=>"warning","message"=>"Please select theme"];
71 $data['userCurrentTheme'] = Auth::user()->theme;
72 }
73 return view("layout.module.setting.theme",$data);
74 }
75
76 if($id=="seatcount")
77 {
78 return view("layout.module.setting.seatCount");
79 }
80 return "";
81 }
82
83 public function edit($id)
84 {
85 }
86
87 public function update($id)
88 {
89 }
90
91 public function destroy($id)
92 {
93 }
94 }
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use App\Models\Task;
5
6 class TaskController extends Controller {
7
8 public function __construct()
9 {
10 $this->middleware('auth');
11 $this->middleware('module_access');
12 }
13
14 public function index()
15 {
16 $tasks=Task::where("username","=",Auth::user()->username)->whereIn("status",array("New","WIP"))->orderBy('endtime')->paginate(100);
17 $tR=$tY=$tG=array();
18 foreach($tasks as $task)
19 {
20 $task['progress']=intval(100*(time()-strtotime($task->created_at))/(strtotime($task->endtime)-strtotime($task->created_at)));
21 if($task['progress']>100)$tR[]=$task;
22 else if($task['progress']>80)$tY[]=$task;
23 else $tG[]=$task;
24 }
25
26 return view('layout.module.task.index',array("tR"=>$tR,"tY"=>$tY,"tG"=>$tG,"tasks"=>$tasks));
27 }
28 public function create()
29 {
30 //
31 }
32 public function store()
33 {
34 //
35 }
36 public function show($id)
37 {
38 if($id=="topbar")
39 {
40 $tasks=Task::where("username","=",Auth::user()->username)->whereIn("status",array("New","WIP"))->orderBy('endtime')->take(10)->get();
41 $count=Task::where("username","=",Auth::user()->username)->whereIn("status",array("New","WIP"))->count();
42
43 $data=array();
44 foreach($tasks as $task)
45 {
46 $data[]=array("title"=>substr($task->name,0,20)."..",
47 "progress"=>intval(100*(time()-strtotime($task->created_at))/(strtotime($task->endtime)-strtotime($task->created_at))));
48 }
49 return view('layout.topbar.task',array("tasks"=>$data,"taskscount"=>$count));
50 }
51 return view('layout.module.task.steps',array("task"=>Task::find($id)));
52 }
53 public function edit($id)
54 {
55 //
56 }
57 public function update($id)
58 {
59 //'displaymsg'=>array("type"=>"success","text"=>"Task Updated")
60 }
61 public function destroy($id)
62 {
63 //
64 }
65
66
67 public function dashboard()
68 {
69 //echo "OK";
70 }
71 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php namespace App\Http\Controllers;
2
3 use Auth;
4 use Input;
5 use Cache;
6 use Crypt;
7 use Response;
8 use Redirect;
9 use Session;
10 use Config;
11 use App\Models\User;
12 use App\Jobs\KHRMSLib;
13
14 class WebController extends Controller {
15
16
17 public function __construct()
18 {
19
20 }
21
22 public function index()
23 {
24 return view("layout.module.web.index");
25 }
26 public function create()
27 {
28 //
29 }
30 public function store()
31 {
32 $action=Input::get('action');
33 if(strstr("GetEmpPass,Feedback,EmpRMDetails,PPtoEmpId,WorkflowSubmit,FormToMail,",$action))
34 {
35 $data=array();
36 $data['wakka'] = new KHRMSLib();
37 return view("layout.module.hr.".strtolower($action),$data);
38 }
39 if($action=="NewRecruit")
40 {
41 $data=array();
42 $data['wakka'] = new KHRMSLib();
43 return view("layout.module.record.show",$data);
44 }
45 if($action=="CandidateAdd")
46 {
47 $data=array();
48 $data['wakka'] = new KHRMSLib();
49 return view("layout.module.recruitment.".strtolower($action),$data);
50 }
51 }
52 public function show($id)
53 {
54 $data=array();
55 if($id=="conflink")
56 {
57 return view("layout.module.web.conflink",$data);
58 }
59 if($id=="android")
60 {
61 if($_SERVER['SERVER_NAME']!=Config::get("app.domain"))return Redirect::to(Config::get("app.protocol").Config::get("app.domain")."/web/android?".$_SERVER['QUERY_STRING']);
62
63 Session::put('mdevice','android');
64 Session::put('device',Input::get('device',''));
65
66 if(Auth::check())
67 {
68 $user=Auth::user();
69 $dataarr=$user->meta();
70
71 $dataarr['mobiledevice']=Input::get('device','');
72 $dataarr['mobiletype']=Input::get('type','');
73 $dataarr['mobilegcm']=Input::get('gcm','');
74 $dataarr['mobilequeue']=Input::get('queuemsg','');
75
76 $user->meta=json_encode($dataarr);
77 $user->save();
78
79 return Redirect::to('home');
80 }
81 else return Redirect::to('login');
82 }
83 if($id=="ios")
84 {
85 if($_SERVER['SERVER_NAME']!=Config::get("app.domain"))return Redirect::to(Config::get("app.protocol").Config::get("app.domain")."/web/ios?".$_SERVER['QUERY_STRING']);
86
87 Session::put('mdevice','ios');
88 Session::put('iosdevice',Input::get('device',''));
89
90 if(Auth::check())
91 {
92 $user=Auth::user();
93 $dataarr=$user->meta();
94
95 $dataarr['mobiledevice']=Input::get('device','');
96 $dataarr['mobiletype']=Input::get('type','');
97 $dataarr['mobilegcm']=Input::get('gcm','');
98 $dataarr['mobilequeue']=Input::get('queuemsg','');
99
100 $user->meta=json_encode($dataarr);
101 $user->save();
102
103 return Redirect::to('home');
104 }
105 else return Redirect::to('login');
106 }
107
108 if($id=="WebCV")
109 {
110 $data=array();
111 $data['wakka'] = new KHRMSLib();
112 return view("layout.module.recruitment.webcv",$data);
113 }
114 if($id=="EmpSelfService")
115 {
116 $data=array();
117 $data['wakka'] = new KHRMSLib();
118 return view("layout.module.hr.empselfservice",$data);
119 }
120 if($id=="EscalateTasks")
121 {
122 $data=array();
123 $data['wakka'] = new KHRMSLib();
124 return view("layout.module.hr.escalatetasks",$data);
125 }
126 if($id=="RecruitsList")
127 {
128 $data=array();
129 $data['wakka'] = new KHRMSLib();
130 return view("layout.module.hr.recruitslist",$data);
131 }
132 if($id=="FeedbackForm")
133 {
134 $data=array();
135 $data['wakka'] = new KHRMSLib();
136 return view("layout.module.hr.formfeedback",$data);
137 }
138 if($id=="SalarySlip")
139 {
140 $data=array();
141 $data['wakka'] = new KHRMSLib();
142 return response()->view("layout.module.hr.salaryslip",$data)->header('Content-Type', 'application/pdf');
143 }
144 if($id=="IncentiveSlip")
145 {
146 $data=array();
147 $data['wakka'] = new KHRMSLib();
148 return response()->view("layout.module.hr.incentiveslip",$data)->header('Content-Type', 'application/pdf');
149 }
150 if($id=="QR")
151 {
152 $str=explode("|",Crypt::decrypt(Input::get('str')));
153 if($str[0]=='EL')
154 {
155 echo "<h3>$str[1] : $str[2] : ".date('Y-m-d H:i:s',$str[3])."</h3>";
156 }
157 if($str[0]=='ID')
158 {
159 echo "<h3>$str[1] : $str[2] : ".date('Y-m-d H:i:s',$str[3])."</h3>";
160 }
161 }
162 if($id=="monthdashboard")
163 {
164 return view("layout.module.web.monthdashboard",$data);
165 }
166 if($id=="monthdashboardall")
167 {
168 return view("layout.module.web.monthdashboardall",$data);
169 }
170 if($id=="logincheck")
171 {
172 return view("layout.module.web.logincheck",$data);
173 }
174 }
175 public function edit($id)
176 {
177 //
178 }
179 public function update($id)
180 {
181 //
182 }
183 public function destroy($id)
184 {
185
186 }
187
188
189 public function dashboard()
190 {
191 //echo "OK";
192 }
193
194 }
1 <!DOCTYPE html>
2 <html lang="{{ app()->getLocale() }}">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7
8 <!-- CSRF Token -->
9 <meta name="csrf-token" content="{{ csrf_token() }}">
10
11 <title>{{ config('app.name', 'Laravel') }}</title>
12
13 <!-- Scripts -->
14 <script src="{{ asset('js/app.js') }}" defer></script>
15
16 <!-- Fonts -->
17 <link rel="dns-prefetch" href="https://fonts.gstatic.com">
18 <link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600" rel="stylesheet" type="text/css">
19
20 <!-- Styles -->
21 <link href="{{ asset('css/app.css') }}" rel="stylesheet">
22 </head>
23 <body>
24 <div id="app">
25 <nav class="navbar navbar-expand-md navbar-light navbar-laravel">
26 <div class="container">
27 <a class="navbar-brand" href="{{ url('/') }}">
28 {{ config('app.name', 'Bhumihar') }}
29 </a>
30 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
31 <span class="navbar-toggler-icon"></span>
32 </button>
33
34 <div class="collapse navbar-collapse" id="navbarSupportedContent">
35 <!-- Left Side Of Navbar -->
36 <ul class="navbar-nav mr-auto">
37
38 </ul>
39
40 <!-- Right Side Of Navbar -->
41 <ul class="navbar-nav ml-auto">
42 <!-- Authentication Links -->
43 @guest
44 <li><a class="nav-link" href="{{ route('login') }}">Home</a></li>
45 <li class="nav-item dropdown">
46 <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>About <span class="caret"></span></a>
47 <ul class="navbar-nav mr-auto">
48 <li>
49 <a href="{{url('history')}}">
50 History
51 </a>
52 </li>
53 </ul>
54 </li>
55 <li><a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a></li>
56 <li><a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a></li>
57 @else
58 <li class="nav-item dropdown">
59 <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
60 {{ Auth::user()->name }} <span class="caret"></span>
61 </a>
62
63 <div class="dropdown-menu" aria-labelledby="navbarDropdown">
64 <a class="dropdown-item" href="{{ route('logout') }}"
65 onclick="event.preventDefault();
66 document.getElementById('logout-form').submit();">
67 {{ __('Logout') }}
68 </a>
69
70 <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
71 @csrf
72 </form>
73 </div>
74 </li>
75 @endguest
76 </ul>
77 </div>
78 </div>
79 </nav>
80
81 <main class="py-4">
82 @yield('content')
83 </main>
84 </div>
85 </body>
86 </html>
1 <?php
2
3 return [
4
5 /*
6 |--------------------------------------------------------------------------
7 | Default Database Connection Name
8 |--------------------------------------------------------------------------
9 |
10 | Here you may specify which of the database connections below you wish
11 | to use as your default connection for all database work. Of course
12 | you may use many connections at once using the Database library.
13 |
14 */
15
16 'default' => env('DB_CONNECTION', 'mysql'),
17
18 /*
19 |--------------------------------------------------------------------------
20 | Database Connections
21 |--------------------------------------------------------------------------
22 |
23 | Here are each of the database connections setup for your application.
24 | Of course, examples of configuring each database platform that is
25 | supported by Laravel is shown below to make development simple.
26 |
27 |
28 | All database work in Laravel is done through the PHP PDO facilities
29 | so make sure you have the driver for your particular database of
30 | choice installed on your machine before you begin development.
31 |
32 */
33
34 'connections' => [
35
36 'sqlite' => [
37 'driver' => 'sqlite',
38 'database' => env('DB_DATABASE', database_path('database.sqlite')),
39 'prefix' => '',
40 ],
41
42 'mysql' => [
43 'driver' => 'mysql',
44 'host' => env('DB_HOST', '127.0.0.1'),
45 'port' => env('DB_PORT', '3306'),
46 // 'database' => env('DB_DATABASE', 'forge'),
47 // 'username' => env('DB_USERNAME', 'forge'),
48 // 'password' => env('DB_PASSWORD', ''),
49 'database' => 'migrate',
50 'username' => 'root2',
51 'password' => '123456',
52 'unix_socket' => env('DB_SOCKET', ''),
53 'charset' => 'utf8mb4',
54 'collation' => 'utf8mb4_unicode_ci',
55 'prefix' => '',
56 'strict' => true,
57 'engine' => null,
58 ],
59
60 'pgsql' => [
61 'driver' => 'pgsql',
62 'host' => env('DB_HOST', '127.0.0.1'),
63 'port' => env('DB_PORT', '5432'),
64 'database' => env('DB_DATABASE', 'forge'),
65 'username' => env('DB_USERNAME', 'forge'),
66 'password' => env('DB_PASSWORD', ''),
67 'charset' => 'utf8',
68 'prefix' => '',
69 'schema' => 'public',
70 'sslmode' => 'prefer',
71 ],
72
73 'sqlsrv' => [
74 'driver' => 'sqlsrv',
75 'host' => env('DB_HOST', 'localhost'),
76 'port' => env('DB_PORT', '1433'),
77 'database' => env('DB_DATABASE', 'forge'),
78 'username' => env('DB_USERNAME', 'forge'),
79 'password' => env('DB_PASSWORD', ''),
80 'charset' => 'utf8',
81 'prefix' => '',
82 ],
83
84 ],
85
86 /*
87 |--------------------------------------------------------------------------
88 | Migration Repository Table
89 |--------------------------------------------------------------------------
90 |
91 | This table keeps track of all the migrations that have already run for
92 | your application. Using this information, we can determine which of
93 | the migrations on disk haven't actually been run in the database.
94 |
95 */
96
97 'migrations' => 'migrations',
98
99 /*
100 |--------------------------------------------------------------------------
101 | Redis Databases
102 |--------------------------------------------------------------------------
103 |
104 | Redis is an open source, fast, and advanced key-value store that also
105 | provides a richer set of commands than a typical key-value systems
106 | such as APC or Memcached. Laravel makes it easy to dig right in.
107 |
108 */
109
110 'redis' => [
111
112 'client' => 'predis',
113
114 'default' => [
115 'host' => env('REDIS_HOST', '127.0.0.1'),
116 'password' => env('REDIS_PASSWORD', null),
117 'port' => env('REDIS_PORT', 6379),
118 'database' => 0,
119 ],
120
121 ],
122
123 ];
1 <?php namespace App\Http\Controllers;
2
3 use App\Http\Controllers\Controller;
4
5 use Auth;
6 use Input;
7 /*use Session;
8 use Redirect;
9 use Crypt;
10 use Mail;
11 use Hash;
12 use URL;
13 use Request;
14 use Cache;
15 use File;
16 use Route;*/
17
18 use App\Models\Group;
19 use App\Models\Sipid;
20 use App\Models\Message;
21 use App\Models\Role;
22 use App\Models\Kqueue;
23 use App\Models\ConfServer;
24 use App\Models\LiveConf;
25 use App\Jobs\KFriendLib;
26 use App\Jobs\KPushNotify;
27 use App\Jobs\KFileLib;
28 use App\Jobs\KAuthLib;
29 use App\Jobs\KHRMSLib;
30
31 use Illuminate\Console\Command;
32 use Mail;
33 use DB;
34 use Config;
35
36 use App\Models\User;
37 use App\Models\Accesslog;
38
39 use App\Models\CRMCall;
40 use Schema;
41 use PDO;
42
43 use Illuminate\Database\Schema\Blueprint;
44
45 use \Aws\Ec2\Ec2Client;
46
47 class egController extends Controller {
48
49
50 public function eg()
51 {
52
53 $server_ip = "10.3.179.49";
54 $location = "Mumbai";
55
56 $wakka = new KHRMSLib();
57
58 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
59 $kformlib->gthis=$wakka;
60
61 $themehome=$wakka->GetThemePath('/');
62 $updatetime=time();
63
64 $clientlst=$wakka->GetBBBUserData("clientslist");
65
66 $isadmin=$wakka->IsAdmin();
67 $username=$wakka->GetUserName();
68 $triggers=Input::get("triggers");
69 $tmpstr=explode(",",$kformlib->HRFiledsStr);
70
71 $success="";$message="";$successcnt=0;$duplicatecount=0;
72
73 $conn = array(
74 'driver' => 'mysql',
75 'host' => '10.3.177.14',
76 'database' => env('DB_DATABASE', 'kstych_flexydial'),
77 'username' => env('DB_USERNAME', 'root'),
78 'password' => env('DB_PASSWORD', 'yb9738z'),
79 'charset' => 'utf8',
80 'collation' => 'utf8_unicode_ci',
81 'prefix' => '',
82 'options' => array(
83 PDO::ATTR_TIMEOUT => 5,
84 ),
85 );
86 Config::set("database.connections.conn", $conn);
87
88 DB::connection("conn")->getDatabaseName();
89
90 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.49' and ins_date>'2016-11-29' order by auto_id asc limit 0,1"));
91
92
93 foreach($excelarray as $key => $array){
94 $excelarray[$key] = (array)$array;
95 }
96
97 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
98 $highestColumn = $highestColumn[0]->cnt;
99
100 $highestrow = count($excelarray);
101
102 $flag = 0;
103 $editflag=0;
104
105 for($i=0;$i<=$highestrow;$i++)
106 {
107 if($excelarray[$i]["id"]!="")
108 {
109 if($excelarray[$i]["id"]=="CREATE")
110 {
111 //$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
112 }
113 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
114
115 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
116 {
117 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
118 $ppldata=$empdata["peopledata"];
119 $createdlog=$empdata['modifylog'];
120 $fdirty=$empdata['dirty'];
121
122 $createdlog[$updatetime]=$username."::";
123 $createdlog["updated"]=$updatetime;
124
125 $newdata=$ppldata;
126 foreach($excelarray[$i] as $key => $value)
127 {
128 if($value!="")
129 {
130 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
131 {
132 $value=str_replace("'"," ",$value);
133 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
134
135 $fdirty[$key]=1;
136
137 $newdata[$key]=$value;
138 }
139 }
140 }
141 $empdata["peopledata"]=$newdata;
142 $empdata['modifylog']=$createdlog;
143 $empdata['dirty']=$fdirty;
144
145 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
146 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
147 $successArr[] = $excelarray[$i];
148 }
149 }
150 else
151 {
152 $reason = "";
153
154 if($excelarray[$i]["id"]=="")
155 $reason .= "Column ID is blank,";
156
157 $excelarray[$i]['server_ip'] = $server_ip;
158 $excelarray[$i]['location'] = $location;
159
160 if($excelarray[$i]["clientcode"]!="")
161 $excelarray[$i]['cust_id'] = $excelarray[$i]["clientcode"];
162
163 $excelarray[$i]['Reason'] = $reason;
164
165 $failureArr[] = $excelarray[$i];
166 }
167
168 }
169
170 if(!empty($successArr)){
171 foreach($successArr as $succes)
172 {
173 $setSuccess=array();
174
175 $setSuccess[] = "server_ip='$server_ip'";
176 $setSuccess[] = "location='$location'";
177 $setSuccess[] = "record_id='".$succes['id']."'";
178 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
179 $setSuccess[] = "modified='".$succes['modified']."'";
180
181 $setSuccess = implode(",",$setSuccess);
182
183 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
184 }
185 }
186
187 if(!empty($failureArr)){
188 foreach($failureArr as $failur)
189 {
190 $setFailure=array();
191
192 $setFailure[] = "server_ip='$server_ip'";
193 $setFailure[] = "location='$location'";
194 $setFailure[] = "cust_id='".$failur['clientcode']."'";
195 $setFailure[] = "reason='".$failur['Reason']."'";
196
197 $setFailure = implode(",",$setFailure);
198
199 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
200 }
201 }
202
203 DB::connection("conn")->disconnect();
204
205
206
207 }
208
209 }
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 <?php
2 set_time_limit (0);
3 ini_set("memory_limit","1024M");
4
5 $file = file_get_contents("v1.2_slow-query.log");
6 $lines = explode("\n", $file);
7 $exclude = array();
8 foreach ($lines as $line) {
9 // if (strpos($line, '`accesslogs`') !== FALSE || strpos($line, '`sessions`') !== FALSE || strpos($line, '# User@Host:') || strpos($line, '# Thread_id:') !== FALSE || strpos($line, '`crmcalls`') !== FALSE || strpos($line, '`userlogs`') !== FALSE || strpos($line, '# User@Host:') !== FALSE|| strpos($line, '# Time:') !== FALSE || strpos($line, '`fullremark`') !== FALSE || strpos($line, '`diallines`') !== FALSE || strpos($line, 'sipids') !== FALSE || strpos($line, '# Query_time:') !== FALSE || strpos($line, 'SET timestamp=') !== FALSE) {
10 // continue;
11 // }
12 // if ( strpos($line, '`accesslogs`') === FALSE && (strpos($line, 'records') !== FALSE || strpos($line, '`records`') !== FALSE)) {
13 // $exclude[] = $line;
14 // }
15
16 if ( strpos($line, '`accesslogs`') === FALSE && strpos($line, 'diallines') !== FALSE) {
17 $exclude[] = $line;
18 }
19 // $exclude[] = $line;
20
21 }
22 $log = implode("\n", $exclude);
23 file_put_contents("v1.2_diallines.log", $log);
24
25 die;
26 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>abc</title>
5 </head>
6 <body>
7 <svg width="400" height="110">
8 <rect width="300" height="100" style="fill:rgb(255,255,255);stroke-width:3;stroke:rgb(0,0,0)" />
9 </svg>
10 </body>
11 </html>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 namespace App\Http;
4
5 use Illuminate\Foundation\Http\Kernel as HttpKernel;
6
7 class Kernel extends HttpKernel
8 {
9 /**
10 * The application's global HTTP middleware stack.
11 *
12 * These middleware are run during every request to your application.
13 *
14 * @var array
15 */
16 protected $middleware = [
17 \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
18 ];
19
20 /**
21 * The application's route middleware groups.
22 *
23 * @var array
24 */
25 protected $middlewareGroups = [
26 'web' => [
27 \App\Http\Middleware\EncryptCookies::class,
28 \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
29 \Illuminate\Session\Middleware\StartSession::class,
30 \Illuminate\View\Middleware\ShareErrorsFromSession::class,
31 \App\Http\Middleware\VerifyCsrfToken::class,
32 \App\Http\Middleware\BeforeFilter::class,
33 \App\Http\Middleware\AfterFilter::class,
34 ],
35
36 'api' => [
37 'throttle:600,1',
38 \App\Http\Middleware\EncryptCookies::class,
39 \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
40 \Illuminate\Session\Middleware\StartSession::class,
41 \Illuminate\View\Middleware\ShareErrorsFromSession::class,
42 //\App\Http\Middleware\VerifyCsrfToken::class,
43 \App\Http\Middleware\BeforeFilter::class,
44 \App\Http\Middleware\AfterFilter::class,
45 ],
46 ];
47
48 /**
49 * The application's route middleware.
50 *
51 * These middleware may be assigned to groups or used individually.
52 *
53 * @var array
54 */
55 protected $routeMiddleware = [
56 'auth' => \App\Http\Middleware\Authenticate::class,
57 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
58 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
59 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
60 'module_access' => \App\Http\Middleware\ModuleAccess::class,
61 ];
62 }
1 <?php namespace App\Http\Middleware;
2
3 use Closure;
4 use Route;
5 use Auth;
6 use Config;
7
8 class AfterFilter {
9
10 public function __construct()
11 {
12
13 }
14
15 /**
16 * Handle an incoming request.
17 *
18 * @param \Illuminate\Http\Request $request
19 * @param \Closure $next
20 * @return mixed
21 */
22 public function handle($request, Closure $next)
23 {
24
25 $response= $next($request);
26
27 //Config::get('runtime.accesslog_obj')->stopLog();
28
29 return $response;
30 }
31
32 }
1 <?php
2
3 namespace App\Http\Middleware;
4
5 use Closure;
6 use Illuminate\Support\Facades\Auth;
7
8 class Authenticate
9 {
10 /**
11 * Handle an incoming request.
12 *
13 * @param \Illuminate\Http\Request $request
14 * @param \Closure $next
15 * @param string|null $guard
16 * @return mixed
17 */
18 public function handle($request, Closure $next, $guard = null)
19 {
20 if (Auth::guard($guard)->guest()) {
21 if ($request->ajax()) {
22 return response('Unauthorized.', 401);
23 } else {
24 return redirect()->guest('login');
25 }
26 }
27
28 return $next($request);
29 }
30 }
1 <?php namespace App\Http\Middleware;
2
3 use Closure;
4 use Route;
5 use Auth;
6 use Config;
7 use App\Models\User;
8 use App\Models\Accesslog;
9 use App\Models\Group;
10
11 class BeforeFilter {
12
13 private $xssGlobal="";
14 private $xssGlobalIgnoreKeys="";
15
16 public function __construct()
17 {
18 $this->xssGlobal=Config::get("app.xssGlobal");
19 $this->xssGlobalIgnoreKeys=Config::get("app.xssGlobalIgnoreKeys");
20 }
21
22 /**
23 * Handle an incoming request.
24 *
25 * @param \Illuminate\Http\Request $request
26 * @param \Closure $next
27 * @return mixed
28 */
29 public function handle($request, Closure $next)
30 {
31 if (!$request->secure() && Config::get("app.protocol") === 'https://')
32 {
33 return redirect()->secure(Config::get("app.protocol").Config::get("app.domain").$request->getRequestUri());
34 }
35
36 //$accesslog = new Accesslog();
37 //Config::set('runtime.accesslog_obj',$accesslog->startLog());
38
39 $grparr=array();
40 $activegrps=Group::where('status','=','Active')->get(array('group'));
41 foreach($activegrps as $tgrp)
42 {
43 $grparr[]=$tgrp->group;
44 }
45 Config::set('app.app_groups',$grparr);
46
47 if(Auth::check())Config::set('app.mytheme',Auth::user()->dataval("mytheme","layout"));
48 else Config::set('app.mytheme',"layout");
49
50
51 if($this->xssGlobal!='')$request->merge($this->array_xss_clean($request->all()));
52
53
54 return $next($request);
55 }
56
57 function array_xss_clean($array)
58 {
59 $result = array();
60 foreach ($array as $key => $value)
61 {
62 if(!strstr($this->xssGlobalIgnoreKeys,$key))
63 {
64 $key = $this->val_xss_clean($key);
65 if (is_array($value))$result[$key] = $this->array_xss_clean($value);
66 else $result[$key] = $this->val_xss_clean($value);
67 }
68 }
69 return $result;
70 }
71 function val_xss_clean($val)
72 {
73 if(strstr($this->xssGlobal,"tag"))$val = strip_tags($val);
74 if(strstr($this->xssGlobal,"hent"))$val = htmlentities($val, ENT_QUOTES, "UTF-8");
75
76 return $val;
77 }
78
79 }
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!