diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..0762b9e
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/via_socket.iml b/.idea/via_socket.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/via_socket.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..55660ce
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,934 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MSG91_sms_config
+ $classers
+ getsettings
+ viaSocket
+ MSG91sms
+ MSG91Sms
+ MSG
+ addLog
+ hooks
+ getHooks
+ checkHooks
+ saveToDb
+ get
+ images
+
+
+ via_socket
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1513883544150
+
+
+ 1513883544150
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hooks.php b/hooks.php
new file mode 100644
index 0000000..c741707
--- /dev/null
+++ b/hooks.php
@@ -0,0 +1,21 @@
+getHooks();
+
+
+
+foreach($hooks as $hook){
+ add_hook($hook['hook'], 1, $hook['function'], "");
+}
\ No newline at end of file
diff --git a/hooks/AdminLogin.php b/hooks/AdminLogin.php
new file mode 100644
index 0000000..ba47874
--- /dev/null
+++ b/hooks/AdminLogin.php
@@ -0,0 +1,25 @@
+ 'AdminLogin',
+ 'function' => 'AdminLogin_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+);
+if(!function_exists('AdminLogin_admin')){
+ function AdminLogin_admin($args){
+ $class = new Viasocket();
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/AfterModuleChangePackage.php b/hooks/AfterModuleChangePackage.php
new file mode 100644
index 0000000..15ba12c
--- /dev/null
+++ b/hooks/AfterModuleChangePackage.php
@@ -0,0 +1,27 @@
+ 'AfterModuleChangePackage',
+ 'function' => 'AfterModuleChangePackage',
+ 'description' => array(
+ 'english' => 'After module Change Package'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+);
+if(!function_exists('AfterModuleChangePackage')){
+ function AfterModuleChangePackage($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+return $hook;
diff --git a/hooks/AfterModuleChangePassword.php b/hooks/AfterModuleChangePassword.php
new file mode 100644
index 0000000..7f277ab
--- /dev/null
+++ b/hooks/AfterModuleChangePassword.php
@@ -0,0 +1,28 @@
+ 'AfterModuleChangePassword',
+ 'function' => 'AfterModuleChangePassword',
+ 'description' => array(
+ 'english' => 'After module change password'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterModuleChangePassword')){
+ function AfterModuleChangePassword($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+return $hook;
diff --git a/hooks/ClientLogin_admin.php b/hooks/ClientLogin_admin.php
new file mode 100644
index 0000000..f0bd2a2
--- /dev/null
+++ b/hooks/ClientLogin_admin.php
@@ -0,0 +1,27 @@
+ 'ClientLogin',
+ 'function' => 'ClientLogin_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+
+if(!function_exists('ClientLogin_admin')){
+ function ClientLogin_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/acceptorder.php b/hooks/acceptorder.php
new file mode 100644
index 0000000..d95d052
--- /dev/null
+++ b/hooks/acceptorder.php
@@ -0,0 +1,29 @@
+ 'AcceptOrder',
+ 'function' => 'AcceptOrder_SMS',
+ 'description' => array(
+ 'english' => 'After order accepted'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+);
+if(!function_exists('AcceptOrder_SMS')){
+ function AcceptOrder_SMS($args){
+ $class = new Viasocket();
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/aftermodulecreate_hosting.php b/hooks/aftermodulecreate_hosting.php
new file mode 100644
index 0000000..81056ee
--- /dev/null
+++ b/hooks/aftermodulecreate_hosting.php
@@ -0,0 +1,28 @@
+ 'AfterModuleCreate',
+ 'function' => 'AfterModuleCreate_Hosting',
+ 'description' => array(
+ 'english' => 'After hosting create'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterModuleCreate_Hosting')){
+ function AfterModuleCreate_Hosting($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+return $hook;
diff --git a/hooks/aftermodulesuspend.php b/hooks/aftermodulesuspend.php
new file mode 100644
index 0000000..d950e5e
--- /dev/null
+++ b/hooks/aftermodulesuspend.php
@@ -0,0 +1,29 @@
+ 'AfterModuleSuspend',
+ 'function' => 'AfterModuleSuspend',
+ 'description' => array(
+ 'english' => 'After module suspended'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterModuleSuspend')){
+ function AfterModuleSuspend($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/aftermoduleunsuspend.php b/hooks/aftermoduleunsuspend.php
new file mode 100644
index 0000000..6f49bc0
--- /dev/null
+++ b/hooks/aftermoduleunsuspend.php
@@ -0,0 +1,28 @@
+ 'AfterModuleUnsuspend',
+ 'function' => 'AfterModuleUnsuspend',
+ 'description' => array(
+ 'english' => 'After module unsuspend'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterModuleUnsuspend')){
+ function AfterModuleUnsuspend($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+return $hook;
\ No newline at end of file
diff --git a/hooks/afterregistrarregistration.php b/hooks/afterregistrarregistration.php
new file mode 100644
index 0000000..3fbb588
--- /dev/null
+++ b/hooks/afterregistrarregistration.php
@@ -0,0 +1,31 @@
+ 'AfterRegistrarRegistration',
+ 'function' => 'AfterRegistrarRegistration',
+ 'description' => array(
+ 'english' => 'After domain registration'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if (!function_exists('AfterRegistrarRegistration')) {
+ function AfterRegistrarRegistration($args)
+ {
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if (!$settings['api']) {
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'], $args);
+
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/afterregistrarregistration_admin.php b/hooks/afterregistrarregistration_admin.php
new file mode 100644
index 0000000..624c81b
--- /dev/null
+++ b/hooks/afterregistrarregistration_admin.php
@@ -0,0 +1,26 @@
+ 'AfterRegistrarRegistration',
+ 'function' => 'AfterRegistrarRegistration_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterRegistrarRegistration_admin')){
+ function AfterRegistrarRegistration_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/afterregistrarregistrationfailed.php b/hooks/afterregistrarregistrationfailed.php
new file mode 100644
index 0000000..67439d2
--- /dev/null
+++ b/hooks/afterregistrarregistrationfailed.php
@@ -0,0 +1,29 @@
+ 'AfterRegistrarRegistrationFailed',
+ 'function' => 'AfterRegistrarRegistrationFailed',
+ 'description' => array(
+ 'english' => 'After domain registration failed'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterRegistrarRegistrationFailed')){
+ function AfterRegistrarRegistrationFailed($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/afterregistrarregistrationfailed_admin.php b/hooks/afterregistrarregistrationfailed_admin.php
new file mode 100644
index 0000000..22a9398
--- /dev/null
+++ b/hooks/afterregistrarregistrationfailed_admin.php
@@ -0,0 +1,26 @@
+ 'AfterRegistrarRegistrationFailed',
+ 'function' => 'AfterRegistrarRegistrationFailed_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterRegistrarRegistrationFailed_admin')){
+ function AfterRegistrarRegistrationFailed_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/afterregistrarrenewal.php b/hooks/afterregistrarrenewal.php
new file mode 100644
index 0000000..def19d2
--- /dev/null
+++ b/hooks/afterregistrarrenewal.php
@@ -0,0 +1,30 @@
+ 'AfterRegistrarRenewal',
+ 'function' => 'AfterRegistrarRenewal',
+ 'description' => array(
+ 'english' => 'After domain renewal'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterRegistrarRenewal')){
+ function AfterRegistrarRenewal($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+
+}
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/afterregistrarrenewal_admin.php b/hooks/afterregistrarrenewal_admin.php
new file mode 100644
index 0000000..ef393eb
--- /dev/null
+++ b/hooks/afterregistrarrenewal_admin.php
@@ -0,0 +1,26 @@
+ 'AfterRegistrarRenewal',
+ 'function' => 'AfterRegistrarRenewal_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterRegistrarRenewal_admin')){
+ function AfterRegistrarRenewal_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/afterregistrarrenewalfailed_admin.php b/hooks/afterregistrarrenewalfailed_admin.php
new file mode 100644
index 0000000..aeea549
--- /dev/null
+++ b/hooks/afterregistrarrenewalfailed_admin.php
@@ -0,0 +1,26 @@
+ 'AfterRegistrarRenewalFailed',
+ 'function' => 'AfterRegistrarRenewalFailed_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+if(!function_exists('AfterRegistrarRenewalFailed_admin')){
+ function AfterRegistrarRenewalFailed_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/clientadd.php b/hooks/clientadd.php
new file mode 100644
index 0000000..f9cdda6
--- /dev/null
+++ b/hooks/clientadd.php
@@ -0,0 +1,29 @@
+ 'ClientAdd',
+ 'function' => 'ClientAdd',
+ 'description' => array(
+ 'english' => 'After client register'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('ClientAdd')){
+ function ClientAdd($args){
+ $class = new Viasocket();
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/clientchangepassword.php b/hooks/clientchangepassword.php
new file mode 100644
index 0000000..2bb7981
--- /dev/null
+++ b/hooks/clientchangepassword.php
@@ -0,0 +1,30 @@
+ 'ClientChangePassword',
+ 'function' => 'ClientChangePassword',
+ 'description' => array(
+ 'english' => 'After client change password'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('ClientChangePassword')){
+ function ClientChangePassword($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/domainrenewalnotice.php b/hooks/domainrenewalnotice.php
new file mode 100644
index 0000000..b7ca1f8
--- /dev/null
+++ b/hooks/domainrenewalnotice.php
@@ -0,0 +1,29 @@
+ 'DailyCronJob',
+ 'function' => 'DomainRenewalNotice',
+ 'description' => array(
+ 'english' => 'Donmain renewal notice before {x} days ago'
+ ),
+ 'type' => 'client',
+ 'extra' => '15',
+
+);
+if(!function_exists('DomainRenewalNotice')){
+ function DomainRenewalNotice($args){
+
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+return $hook;
\ No newline at end of file
diff --git a/hooks/invoicecreated.php b/hooks/invoicecreated.php
new file mode 100644
index 0000000..87ccc54
--- /dev/null
+++ b/hooks/invoicecreated.php
@@ -0,0 +1,31 @@
+ 'InvoiceCreated',
+ 'function' => 'InvoiceCreated',
+ 'description' => array(
+
+ 'english' => 'After invoice created'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('InvoiceCreated')){
+ function InvoiceCreated($args){
+
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/invoicepaid.php b/hooks/invoicepaid.php
new file mode 100644
index 0000000..017b6c4
--- /dev/null
+++ b/hooks/invoicepaid.php
@@ -0,0 +1,30 @@
+ 'InvoicePaid',
+ 'function' => 'InvoicePaid',
+ 'description' => array(
+ 'english' => 'Whenyou have paidthe billsends a message.'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+if(!function_exists('InvoicePaid')){
+ function InvoicePaid($args){
+
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/invoicepaymentreminder_first.php b/hooks/invoicepaymentreminder_first.php
new file mode 100644
index 0000000..30284b3
--- /dev/null
+++ b/hooks/invoicepaymentreminder_first.php
@@ -0,0 +1,31 @@
+ 'InvoicePaymentReminder',
+ 'function' => 'InvoicePaymentReminder_Firstoverdue',
+ 'description' => array(
+ 'english' => 'Invoice payment reminder for first overdue'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('InvoicePaymentReminder_Firstoverdue')){
+ function InvoicePaymentReminder_Firstoverdue($args){
+
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/invoicepaymentreminder_reminder.php b/hooks/invoicepaymentreminder_reminder.php
new file mode 100644
index 0000000..5bb64b4
--- /dev/null
+++ b/hooks/invoicepaymentreminder_reminder.php
@@ -0,0 +1,31 @@
+ 'InvoicePaymentReminder',
+ 'function' => 'InvoicePaymentReminder_Reminder',
+ 'description' => array(
+ 'english' => 'Invoice payment reminder'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('InvoicePaymentReminder_Reminder')){
+ function InvoicePaymentReminder_Reminder($args){
+
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
\ No newline at end of file
diff --git a/hooks/invoicepaymentreminder_second.php b/hooks/invoicepaymentreminder_second.php
new file mode 100644
index 0000000..0d48453
--- /dev/null
+++ b/hooks/invoicepaymentreminder_second.php
@@ -0,0 +1,30 @@
+ 'InvoicePaymentReminder',
+ 'function' => 'InvoicePaymentReminder_secondoverdue',
+ 'description' => array(
+ 'english' => 'Invoice payment second for first overdue'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('InvoicePaymentReminder_secondoverdue')){
+ function InvoicePaymentReminder_secondoverdue($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/invoicepaymentreminder_third.php b/hooks/invoicepaymentreminder_third.php
new file mode 100644
index 0000000..7c4acb6
--- /dev/null
+++ b/hooks/invoicepaymentreminder_third.php
@@ -0,0 +1,31 @@
+ 'InvoicePaymentReminder',
+ 'function' => 'InvoicePaymentReminder_thirdoverdue',
+ 'description' => array(
+ 'english' => 'Invoice payment third for first overdue'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('InvoicePaymentReminder_thirdoverdue')){
+ function InvoicePaymentReminder_thirdoverdue($args){
+
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/ticketadminreply.php b/hooks/ticketadminreply.php
new file mode 100644
index 0000000..e91d8bb
--- /dev/null
+++ b/hooks/ticketadminreply.php
@@ -0,0 +1,30 @@
+ 'TicketAdminReply',
+ 'function' => 'TicketAdminReply',
+ 'description' => array(
+ 'english' => 'After ticket replied by admin'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('TicketAdminReply')){
+ function TicketAdminReply($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/ticketclose.php b/hooks/ticketclose.php
new file mode 100644
index 0000000..bb66ba1
--- /dev/null
+++ b/hooks/ticketclose.php
@@ -0,0 +1,30 @@
+ 'TicketClose',
+ 'function' => 'TicketClose',
+ 'description' => array(
+ 'english' => 'When the ticket is closed it sends a message.'
+ ),
+ 'type' => 'client',
+ 'extra' => '',
+
+);
+
+if(!function_exists('TicketClose')){
+ function TicketClose($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/ticketopen_admin.php b/hooks/ticketopen_admin.php
new file mode 100644
index 0000000..4cabe7f
--- /dev/null
+++ b/hooks/ticketopen_admin.php
@@ -0,0 +1,27 @@
+ 'TicketOpen',
+ 'function' => 'TicketOpen_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+
+if(!function_exists('TicketOpen_admin')){
+ function TicketOpen_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/hooks/ticketuserreply_admin.php b/hooks/ticketuserreply_admin.php
new file mode 100644
index 0000000..913c9b4
--- /dev/null
+++ b/hooks/ticketuserreply_admin.php
@@ -0,0 +1,27 @@
+ 'TicketUserReply',
+ 'function' => 'TicketUserReply_admin',
+ 'type' => 'admin',
+ 'extra' => '',
+
+);
+
+if(!function_exists('TicketUserReply_admin')){
+ function TicketUserReply_admin($args){
+ $class = new Viasocket();
+ $settings = $class->getSettings();
+ if(!$settings['api']){
+ return null;
+ }
+ $event = $class->getEventStatus(__FUNCTION__);
+ if($event['active'] == 0){
+ return null;
+ }
+ $args['event'] = __FUNCTION__;
+
+ $class->callSocket($settings['api'],$args);
+ }
+}
+
+return $hook;
diff --git a/images/icon.png b/images/icon.png
new file mode 100644
index 0000000..684eb3d
Binary files /dev/null and b/images/icon.png differ
diff --git a/lang/english.php b/lang/english.php
new file mode 100644
index 0000000..15313a5
--- /dev/null
+++ b/lang/english.php
@@ -0,0 +1,47 @@
+Github page for download new version.
Please visit this page after file transfer finished.
";
+$_ADDONLANG['uptodate'] = "Your addon is up to date.";
+$_ADDONLANG['save'] = "Save";
+$_ADDONLANG['gsmnumberfield'] = "GSM/Mobile Number Field (Custom client field)";
+$_ADDONLANG['wantsmsfield'] = "Subscribe SMS Field (Custom client field)";
+$_ADDONLANG['user'] = "Username";
+$_ADDONLANG['pass'] = "Password";
+$_ADDONLANG['apiid'] = "API ID";
+$_ADDONLANG['email'] = "Email";
+$_ADDONLANG['countrycode'] = "Country Code Prefix";
+$_ADDONLANG['senderid'] = "SenderID(Title)";
+$_ADDONLANG['dateformat'] = "Date Format";
+$_ADDONLANG['sender'] = "Sender";
+$_ADDONLANG['settings'] = "Settings";
+$_ADDONLANG['signature'] = "Signature";
+$_ADDONLANG['clientsmstemplates'] = "Client Templates";
+$_ADDONLANG['adminsmstemplates'] = "Admin Templates";
+$_ADDONLANG['sendsms'] = "Send SMS";
+$_ADDONLANG['messages'] = "Sent Messages";
+$_ADDONLANG['update'] = "Update";
+$_ADDONLANG['smssent'] = "
SMS Sent";
+$_ADDONLANG['client'] = "Client";
+$_ADDONLANG['selectclient'] = "Select client";
+$_ADDONLANG['message'] = "Message";
+$_ADDONLANG['debug'] = "Print log";
+$_ADDONLANG['send'] = "Send";
+$_ADDONLANG['debugsonuc'] = "Result";
+$_ADDONLANG['gsmnumber'] = "GSM Number";
+$_ADDONLANG['datetime'] = "Date Time";
+$_ADDONLANG['status'] = "Status";
+$_ADDONLANG['delete'] = "Delete";
+$_ADDONLANG['parameter'] = "Parameter:";
+$_ADDONLANG['active'] = "Activate";
+$_ADDONLANG['ekstra'] = "Extra {x}";
+$_ADDONLANG['admingsm'] = "Admin GSM Numbers";
+$_ADDONLANG['admingsmornek'] = "Seperate numbers with comma Etc. 5321232525,5331002020";
+$_ADDONLANG['lisans'] = "Via Socket - Github Page";
+$_ADDONLANG['credit'] = "Remaining Credit";
+
+$_ADDONLANG['error'] = "Error";
+$_ADDONLANG['pending'] = "Pending";
+$_ADDONLANG['sent'] = "Sent";
+$_ADDONLANG['success'] = "Success";
+
diff --git a/logo.png b/logo.png
new file mode 100644
index 0000000..684eb3d
Binary files /dev/null and b/logo.png differ
diff --git a/utils.php b/utils.php
new file mode 100644
index 0000000..e1ce364
--- /dev/null
+++ b/utils.php
@@ -0,0 +1,195 @@
+message;
+ }
+ /**
+ * @return array
+ */
+ public function getSettings()
+ {
+ $result = select_query("mod_via_socket_settings", "*");
+ return mysql_fetch_array($result);
+ }
+
+ /**
+ * @return array
+ */
+ public function getEvents()
+ {
+ $result = select_query("mod_via_socket_events", "*");
+ return $result;
+ }
+
+ function getHooks()
+ {
+ if ($handle = opendir(dirname(__FILE__) . '/hooks')) {
+ while (false !== ($entry = readdir($handle))) {
+ if (substr($entry, strlen($entry) - 4, strlen($entry)) == ".php") {
+ $file[] = require_once('hooks/' . $entry);
+ }
+ }
+ closedir($handle);
+ }
+ return $file;
+ }
+
+ function saveToDb($event, $status, $errors = null, $logs = null)
+ {
+ $now = date("Y-m-d H:i:s");
+ $table = "mod_via_socket_logs";
+ $values = array(
+ "event" => $event,
+ "text" => $this->getMessage(),
+ "status" => $status,
+ "errors" => $errors,
+ "logs" => $logs,
+ "datetime" => $now
+ );
+ insert_query($table, $values);
+
+ $this->addLog("Saved to database");
+ }
+
+
+ public function addError($error)
+ {
+ $this->errors[] = $error;
+ }
+
+ public function addLog($log)
+ {
+ $this->logs[] = $log;
+ }
+
+ /**
+ * @return array
+ */
+ public function getErrors()
+ {
+ $res = '
';
+ foreach ($this->errors as $d) {
+ $res .= "- $d
";
+ }
+ $res .= '
';
+ return $res;
+ }
+
+ /**
+ * @return array
+ */
+ public function getLogs()
+ {
+ $res = 'Debug Result
';
+ foreach ($this->logs as $d) {
+ $res .= "- $d
";
+ }
+ $res .= '
';
+ return $res;
+ }
+
+ /*
+ * Runs at addon install/update
+ * This function controls that if there is any change at hooks files. Such as new hook, variable changes at hooks.
+ */
+ function checkHooks($hooks = null)
+ {
+ if ($hooks == null) {
+ $hooks = $this->getHooks();
+ }
+
+ $i = 0;
+ foreach ($hooks as $hook) {
+ $sql = "SELECT `id` FROM `mod_via_socket_events` WHERE `name` = '" . $hook['function'] . "' AND `type` = '" . $hook['type'] . "' LIMIT 1";
+ $result = mysql_query($sql);
+ $num_rows = mysql_num_rows($result);
+ if ($num_rows == 0) {
+ if ($hook['type']) {
+ $values = array(
+ "name" => $hook['function'],
+ "type" => $hook['type'],
+ "extra" => $hook['extra'],
+ "description" => json_encode(@$hook['description']),
+ "active" => 1
+ );
+ insert_query("mod_via_socket_events", $values);
+ $i++;
+ }
+ } else {
+ $values = array(
+ "variables" => $hook['variables']
+ );
+ update_query("mod_via_socket_events", $values, "name = '" . $hook['name'] . "'");
+ }
+ }
+ return $i;
+ }
+
+
+ public function callSocket($url, $argArray)
+ {
+ $this->addLog("arg: " . json_encode($argArray));
+ $this->addLog("url: " . $url);
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS,
+ json_encode($argArray));
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $server_output = curl_exec($ch);
+ curl_close($ch);
+ $this->addLog("response: " . $server_output);
+ $this->saveToDb($argArray['event'], 'info', '', $this->getLogs());
+ return $server_output;
+ }
+
+ function callUpdateQueryOnEvent($idsArr,$status){
+ $eventUpdateArray = array(
+ "active" => $status
+ );
+ $eventIds = implode(',',$idsArr);
+ update_query("mod_via_socket_events", $eventUpdateArray, "id IN (".$eventIds.")");
+ }
+ public function updateEvents($eventArray){
+ $result = $this->getEvents();
+ $statusZeroArray = [];
+ while ($row = mysql_fetch_array($result)){
+ if(!in_array($row['id'],$eventArray)){
+ $statusZeroArray[] = $row['id'];
+ }
+ }
+ $this->callUpdateQueryOnEvent($eventArray,1);
+ $this->callUpdateQueryOnEvent($statusZeroArray,0);
+
+ }
+ function getEventStatus($eventName = null){
+ $where = array("name" => $eventName);
+ $result = select_query("mod_via_socket_events", "*", $where);
+ $data = mysql_fetch_assoc($result);
+
+ return $data;
+ }
+
+
+}
diff --git a/via_socket.php b/via_socket.php
new file mode 100644
index 0000000..1cb58ba
--- /dev/null
+++ b/via_socket.php
@@ -0,0 +1,214 @@
+ "Socket",
+ "description" => "WHMCS ViaSocket Addon. You can see details from: https://github.com/via_socket/ViaSocket-WHMCS-Plugin",
+ "version" => "1.1",
+ "author" => "Sameer Rathod",
+ "language" => "english",
+ );
+ return $configarray;
+}
+
+function via_socket_activate() {
+
+ $query = "CREATE TABLE IF NOT EXISTS `mod_via_socket_logs` (`id` int(11) NOT NULL AUTO_INCREMENT,`event` varchar(40) NOT NULL,`text` text,`status` varchar(10) DEFAULT NULL,`errors` text,`logs` text,`datetime` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+ mysql_query($query);
+
+ $query = "CREATE TABLE `mod_via_socket_settings` ( `id` INT(11) NOT NULL AUTO_INCREMENT , `api` VARCHAR(512) NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;";
+ full_query($query);
+
+ $query = "INSERT INTO `mod_via_socket_settings` (`api`) VALUES ('');";
+ full_query($query);
+
+ $query = "CREATE TABLE IF NOT EXISTS `mod_via_socket_events` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(50) CHARACTER SET utf8 NOT NULL,`type` enum('client','admin') CHARACTER SET utf8 NOT NULL,`admingsm` varchar(255) CHARACTER SET utf8 NOT NULL,`active` tinyint(1) NOT NULL,`extra` varchar(3) CHARACTER SET utf8 NOT NULL,`description` text CHARACTER SET utf8,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;";
+ mysql_query($query);
+
+ //Creating hooks
+ require_once("utils.php");
+ $class = new Viasocket();
+ $class->checkHooks();
+
+ return array('status'=>'success','description'=>'ViaSocket succesfully activated :)');
+
+
+
+}
+
+function via_socket_deactivate() {
+
+ //$query = "DROP TABLE `mod_MSG91sms_templates`";
+ //mysql_query($query);
+ $query = "DROP TABLE `mod_via_socket_settings`";
+ full_query($query);
+ //$query = "DROP TABLE `mod_MSG91sms_messages`";
+ //mysql_query($query);
+
+ return array('status'=>'success','description'=>'Via Socket succesfully deactivated :(');
+}
+
+function via_socket_upgrade($vars) {
+ $version = $vars['version'];
+
+ switch($version){
+ case "1":
+ break;
+
+ }
+
+ $class = new Viasocket();
+ $class->checkHooks();
+}
+
+function via_socket_output($vars){
+ $modulelink = $vars['modulelink'];
+ $version = $vars['version'];
+ $LANG = $vars['_lang'];
+ putenv("TZ=Europe/Istanbul");
+
+ $class = new Viasocket();
+
+ $tab = $_GET['tab'];
+ $echo = '
+
+ ';
+ echo '
+
+ ';
+
+
+ if (!isset($tab) || $tab == "settings")
+ {
+ /* UPDATE SETTINGS */
+ if ($_POST['api'] && $_POST['action']=="save") {
+ $update = array(
+ "api" => $_POST['api']
+ );
+ update_query("mod_via_socket_settings", $update, "");
+
+ if ($_POST['evnt']) {
+ $class->updateEvents($_POST['evnt']);
+ }
+
+// $class->callSocket($_POST['api'],array("invoicecheck"=>"checked"));
+ }
+ /* UPDATE SETTINGS */
+
+ $settings = $class->getSettings();
+ $eventResults = $class->getEvents();
+
+
+
+ echo '
+
+
+
+
+
Webhook Configuration
+
+
+
+
+
+ ';
+ }
+ elseif($tab == "update"){
+ //to change the url here.
+ $currentversion = file_get_contents("https://raw.github.com/SendOTP/viaSocket-Plugin/master/version.txt");
+ echo '';
+ if($version != $currentversion){
+ echo $LANG['newversion'];
+ }else{
+ echo $LANG['uptodate'].'
';
+ }
+ echo '
';
+ }
+ echo $LANG['lisans'];
+}