1
difenduandada
2024-10-15 7fd2948ee35c8e147ed35ce6d8502f94a98ddd22
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
    if(isset($_GET['status'])){
        $type = 'success';
        $message = '';
        if($_GET['status'] == 'updated'){
            $message = 'CloudArcade successfully updated to version '.VERSION.'!';
        } elseif($_GET['status'] == 'error'){
            $type = 'warning';
            $message = 'Error: '.esc_string($_GET['info']);
        }
        show_alert($message, $type);
    }
?>
<div class="check-update"></div>
<div class="section">
<?php
 
if(!check_purchase_code() && !ADMIN_DEMO){
    echo('<div class="bs-callout bs-callout-warning"><p>Please provide your <b>Item Purchase code</b>. You can submit or update your Purchase code on site settings.</p><p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code" target="_blank">Where to get Envato purchase code?</a></p></div>');
} else {
 
if(!ADMIN_DEMO){
    if(function_exists('check_writeable')){
        if(!check_writeable()){
            $msg = 'CloudArcade don\'t have permissions to modify files, any settings can\'t be saved and can\'t do backup and update. Change all folders and files CHMOD to 777 to fix this.';
            show_alert($msg, 'warning');
        }
    }
    $pre = '';
    $beta = '';
    if(isset($_GET['beta'])){
        $beta = '&test';
        $pre = 'super';
    }
    $ch = curl_init('https://api.cloudarcade.net/verify/verify.php?action=next_update&ref='.DOMAIN.'&v='.VERSION.$beta);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $curl = curl_exec($ch);
    $data = json_decode($curl, true);
    curl_close($ch);
    if(isset($data['log'])){
        $v_latest = esc_int($data['version']);
        $v_current = esc_int(VERSION);
        if($v_current < $v_latest){
            echo('<div class="bs-callout bs-callout-info">CloudArcade version '.$data['version'].' is available.</div>');
            if(isset($data['info'])){
                echo($data['info']);
            }
            echo('<p>Changelog:</p>');
            echo('<ul>');
            foreach ($data['log'] as $key) {
                echo('<li>'.$key.'</li>');
            }
            echo('</ul>');
            if(isset($data['html'])){
                echo($data['html']);
            }
            //
            ?>
            <div class="bs-callout bs-callout-info">Read more info about the update here <a href="https://cloudarcade.net/changelog/" target="_blank">https://cloudarcade.net/changelog/</a></div>
            <hr>
            <div class="progress mb-4 d-none">
                <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
            </div>
            <form id="form-update" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <input type="hidden" name="action" value="updater">
                    <input type="hidden" name="redirect" value="<?php echo DOMAIN ?>admin/dashboard.php?viewpage=update">
                    <input type="hidden" name="code" minlength="5" value="<?php echo $pre.check_purchase_code() ?>" required/>
                    <button type="submit" class="btn btn-primary btn-md" id="btn-update"><?php _e('Update') ?></button>
                </div>
            </form>
 
            <div id="update-error" class="d-none">
                <div class="bs-callout bs-callout-danger" id="u-error"></div>
                <?php _e('Server response') ?>:
                <div class="bs-callout bs-callout-warning" id="u-response"></div>
            </div>
 
            <?php
        } else {
            echo('<div class="bs-callout bs-callout-info">'._t('Congratulation! You are up to date.').'</div>');
        }
    }
} else {
    echo('<div class="bs-callout bs-callout-info">'._t('Congratulation! You are up to date.').'</div>');
}
 
?>
 
<hr>
<?php if(!ADMIN_DEMO){ ?>
<h4>Got an issues after updating?</h4>
<p>You can go back to previous version using <b>Backup Restore</b> plugin. Each update attept, system will create a backup file (Games and thumbnail files are not backed up).</p>
<p>Have an unknown issues? you can contact me through <a href="https://codecanyon.net/user/redfoc" target="_blank">codecanyon profile</a> page.</p>
<h4>How updater works?</h4>
<p>Updater will override specific file and folder that have an update. Updater can also modify database table.</p>
<?php } } ?>
</div>