/var/www/hkosl.com/aga/wp-content/plugins/smart-slider-3/library/smartslider/models/Conflicts.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php

abstract class N2SmartsliderConflictsModelAbstract extends N2Model {

    protected 
$conflicts = array();

    protected 
$debugConflicts = array();

    public 
$curlLog false;


    public function 
__construct() {
        
parent::__construct();

        
$this->testPHPINIMaxInputVars();
        
$this->testApiConnection();
        
$this->testDatabaseTables();
    }

    private function 
testPHPINIMaxInputVars() {
        if (
function_exists('ini_get')) {
            
$max_input_vars intval(ini_get('max_input_vars'));
            if (
$max_input_vars 1000) {
                
$this->conflicts[] = $this->displayConflict('PHP'sprintf(n2_('Increase <b>%1$s</b> in php.ini to 1000 or more. Current value: %2$s'), 'max_input_vars'$max_input_vars), 'https://smartslider3.helpscoutdocs.com/article/55-wordpress-installation');
            }
        }
    }

    private function 
testApiConnection() {
        
$log N2Base::getApplication('smartslider')->storage->get('log''api');
        if (!empty(
$log)) {
            if (
strpos($log'ACTION_MISSING') === false) {
                
$this->conflicts[] = $this->displayConflict(n2_('Unable to connect to the API'), n2_('See <b>Debug Information</b> for more details!'));

                
$this->curlLog json_decode($logtrue);
            }
        }
    }

    private function 
testDatabaseTables() {
        
$tables = array(
            
'#__nextend2_image_storage',
            
'#__nextend2_section_storage',
            
'#__nextend2_smartslider3_generators',
            
'#__nextend2_smartslider3_sliders',
            
'#__nextend2_smartslider3_sliders_xref',
            
'#__nextend2_smartslider3_slides'
        
);

        foreach (
$tables AS $table) {
            
$table $this->db->parsePrefix($table);
            
$result $this->db->queryRow('SHOW TABLES LIKE :table', array(
                
":table" => $table
            
));

            if (empty(
$result)) {
                
$this->conflicts[]      = n2_('MySQL table missing') . ': ' $table;
                
$this->debugConflicts[] = n2_('MySQL table missing') . ': ' $table;
            }
        }
    }

    public function 
getConflicts() {
        return 
$this->conflicts;
    }

    protected function 
displayConflict($title$description$url '') {
        
$this->conflicts[]      = '<b>' $title '</b> - ' $description . (!empty($url) ? ' <a href="' $url '" target="_blank">' n2_('Learn more') . '</a>' '');
        
$this->debugConflicts[] = $title;
    }

    public function 
getDebugConflicts() {

        return 
$this->debugConflicts;
    }
}