403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/mequitecbeta.crmtiger.com/modules/CTMultipleSMTP/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/mequitecbeta.crmtiger.com/modules/CTMultipleSMTP/CTMultipleSMTP.php
<?php
require_once('data/CRMEntity.php');
require_once('data/Tracker.php');
require_once 'vtlib/Vtiger/Module.php';
require_once('modules/com_vtiger_workflow/include.inc');

class CTMultipleSMTP extends CRMEntity {
    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
     */
    function vtlib_handler($modulename, $event_type) {
        global $adb;
        if($event_type == 'module.postinstall') {
            self::addWidgetTo();
            self::checkEnable();
            self::installWorkflow();

        } else if($event_type == 'module.disabled') {
            // TODO Handle actions when this module is disabled.
            self::removeWidgetTo();
            self::disableSMTP();
            self::removeWorkflows();
        } else if($event_type == 'module.enabled') {
            // TODO Handle actions when this module is enabled.
            self::addWidgetTo();
            self::installWorkflow();
            self::checkEnable();
            

        } else if($event_type == 'module.preuninstall') {
            // TODO Handle actions when this module is about to be deleted.
            self::removeWidgetTo();
            self::removeWorkflows();
        } else if($event_type == 'module.preupdate') {
            // TODO Handle actions before this module is updated.
        } else if($event_type == 'module.postupdate') {
            self::checkEnable();
        }
    }

    static function disableSMTP(){
        global $adb;
        $rs = $adb->pquery('UPDATE `ct_multiple_smtp_settings` SET `enable`= ?',array(0));
    }

    static function checkEnable() {
        global $adb;
        $rs=$adb->pquery("SELECT `enable` FROM `ct_multiple_smtp_settings`;",array());
        if($adb->num_rows($rs)==0) {
            $adb->pquery("INSERT INTO `ct_multiple_smtp_settings` (`enable`) VALUES ('0');",array());
        }
    }
    /**
     * Add widget to other module.
     * @param unknown_type $moduleNames
     * @return unknown_type
     */
    static function addWidgetTo() {
        global $adb;
        $widgetType = 'HEADERSCRIPT';
        $widgetName = 'CTMultipleSMTPJs';
        $link = 'layouts/v7/modules/Settings/CTMultipleSMTP/resources/CTMultipleSMTP.js';
        $module = Vtiger_Module::getInstance('CTMultipleSMTP');
        if($module) {
            $module->addLink($widgetType, $widgetName, $link);
        }
        $max_id=$adb->getUniqueID('vtiger_settings_field');
        $adb->pquery("INSERT INTO `vtiger_settings_field` (`fieldid`, `blockid`, `name`, `description`, `linkto`, `sequence`) VALUES (?, ?, ?, ?, ?, ?)",array($max_id, '4', 'Multiple SMTP', 'Multiple SMTP', 'index.php?module=CTMultipleSMTP&parent=Settings&view=CTMultipleSMTPList', $max_id));
    }

    static function removeWidgetTo() {
        global $adb;
        $widgetType = 'HEADERSCRIPT';
        $widgetName = 'CTMultipleSMTPJs';
        $link = 'layouts/v7/modules/Settings/CTMultipleSMTP/resources/CTMultipleSMTP.js';
        $module = Vtiger_Module::getInstance('CTMultipleSMTP');
        if($module) {
            $module->deleteLink($widgetType, $widgetName, $link);
        }
        $adb->pquery("DELETE FROM vtiger_settings_field WHERE `name` = ?",array('Multiple SMTP'));
    }
    
    static function installWorkflow() {
        global $adb;
        $name='CTMultipleSMTPEmailTask';
        $dest1 = "modules/com_vtiger_workflow/tasks/".$name.".inc";
        $source1 = "modules/CTMultipleSMTP/workflow/".$name.".inc";

        if (file_exists($dest1)) {
            $file_exist1 = true;
        } else {
            if(copy($source1, $dest1)) {
                $file_exist1 = true;
            }
        }

        mkdir('modules/Settings/CTMultipleSMTP/workflow');
        chmod('modules/Settings/CTMultipleSMTP/workflow', 0777);

        $dest2 = "modules/Settings/CTMultipleSMTP/workflow/".$name.".inc";
        $source2 = "modules/CTMultipleSMTP/workflow/".$name.".inc";

        if (file_exists($dest2)) {
            $file_exist2 = true;
        } else {
            if(copy($source2, $dest2)) {
                $file_exist2 = true;
            }
        }

        $dest3 = "modules/Settings/CTMultipleSMTP/workflow/".$name.".php";
        $source3 = "modules/CTMultipleSMTP/workflow/".$name.".php";

        if (file_exists($dest3)) {
            $file_exist3 = true;
        } else {
            if(copy($source3, $dest3)) {
                $file_exist3 = true;
            }
        }
    }

    static function removeWorkflows() {
        global $adb;
        $sql1 = "DELETE FROM com_vtiger_workflow_tasktypes WHERE tasktypename = ?";
        $adb->pquery($sql1, array('CTMultipleSMTPEmailTask'));
    }
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit