public function check()
 {
     require_once libfile('function/admincp');
     require_once libfile('function/plugin');
     require_once libfile('function/cloudaddons');
     $pluginarray = C::t('common_plugin')->fetch_all_data();
     $addonids = array();
     foreach ($pluginarray as $row) {
         if (ispluginkey($row['identifier'])) {
             $addonids[] = $row['identifier'] . '.plugin';
         }
     }
     $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
     savecache('addoncheck_plugin', $checkresult);
     $newversion = 0;
     foreach ($checkresult as $value) {
         list(, $newver) = explode(':', $value);
         if ($newver) {
             $newversion++;
         }
     }
     if ($newversion) {
         $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_plugin_new_plugin', array('newversion' => $newversion)));
     } else {
         $return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_plugin_no_upgrade'));
     }
     return $return;
 }
Example #2
0
    include template('common/header_ajax');
    echo $patchlist;
    include template('common/footer_ajax');
    exit;
} elseif ($_GET['action'] == 'pluginnotice') {
    require_once libfile('function/admincp');
    require_once libfile('function/plugin');
    require_once libfile('function/cloudaddons');
    $pluginarray = C::t('common_plugin')->fetch_all_data();
    $addonids = array();
    foreach ($pluginarray as $row) {
        if (ispluginkey($row['identifier'])) {
            $addonids[] = $row['identifier'] . '.plugin';
        }
    }
    $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
    savecache('addoncheck_plugin', $checkresult);
    $newversion = 0;
    foreach ($checkresult as $value) {
        list(, $newver) = explode(':', $value);
        if ($newver) {
            $newversion++;
        }
    }
    include template('common/header_ajax');
    if ($newversion) {
        $lang = lang('forum/misc');
        echo '<div class="bm"><div class="bm_h cl"><a href="javascript:;" onclick="$(\'plugin_notice\').style.display=\'none\';setcookie(\'pluginnotice\', 1, 86400)" class="y" title="' . $lang['patch_close'] . '">' . $lang['patch_close'] . '</a>';
        echo '<h2 class="i">' . $lang['plugin_title'] . '</h2></div><div class="bm_c">';
        echo lang('forum/misc', 'plugin_memo', array('number' => $newversion));
        echo '<div align="right"><a href="admin.php?action=plugins" class="xi2">' . $lang['plugin_link'] . '</a></div>';