if (!empty($pluginarray['language'])) { $installlang[$pluginarray['plugin']['identifier']] = $pluginarray['language']['installlang']; } $filename = DISCUZ_ROOT . './source/plugin/' . $plugin['directory'] . $pluginarray['checkfile']; if (file_exists($filename)) { loadcache('pluginlanguage_install'); $installlang = $_G['cache']['pluginlanguage_install'][$plugin['identifier']]; @(include $filename); } } pluginupgrade($pluginarray, $installtype); if (!empty($plugin['directory']) && !empty($pluginarray['upgradefile']) && preg_match('/^[\\w\\.]+$/', $pluginarray['upgradefile'])) { dheader('location: ' . ADMINSCRIPT . '?action=plugins&operation=pluginupgrade&dir=' . $dir . '&installtype=' . $modules['extra']['installtype'] . '&fromversion=' . $plugin['version']); } $toversion = $pluginarray['plugin']['version']; cloudaddons_clear('plugin', $dir); cpmsg('plugins_upgrade_succeed', "action=plugins", 'succeed', array('toversion' => $toversion)); } } elseif ($operation == 'config') { if (empty($pluginid) && !empty($do)) { $pluginid = $do; } if ($_GET['identifier']) { $plugin = C::t('common_plugin')->fetch_by_identifier($_GET['identifier']); } else { $plugin = C::t('common_plugin')->fetch($pluginid); } //var_dump($_GET['identifier']);exit; if (!$plugin) { cpmsg('plugin_not_found', '', 'error'); } else {
function import_styles($ignoreversion = 1, $dir = '', $restoreid = 0, $updatecache = 1, $validate = 1) { global $_G, $importtxt, $stylearray; if (!isset($dir)) { $stylearrays = array(getimportdata('Discuz! Style')); } else { require_once libfile('function/cloudaddons'); if (!$restoreid) { $dir = str_replace(array('/', '\\'), '', $dir); $templatedir = DISCUZ_ROOT . './template/' . $dir; if ($validate) { cloudaddons_validator($dir . '.template'); } } else { $templatedir = DISCUZ_ROOT . $dir; $dir = basename($dir); if ($validate) { cloudaddons_validator($dir . '.template'); } } $searchdir = dir($templatedir); $stylearrays = array(); while ($searchentry = $searchdir->read()) { if (substr($searchentry, 0, 13) == 'discuz_style_' && fileext($searchentry) == 'xml') { $importfile = $templatedir . '/' . $searchentry; $importtxt = implode('', file($importfile)); $stylearrays[] = getimportdata('Discuz! Style'); } } } foreach ($stylearrays as $stylearray) { if (empty($ignoreversion) && !versioncompatible($stylearray['version'])) { cpmsg('styles_import_version_invalid', 'action=styles', 'error', array('cur_version' => $stylearray['version'], 'set_version' => $_G['setting']['version'])); } if (!$restoreid) { $renamed = 0; if ($stylearray['templateid'] != 1) { $templatedir = DISCUZ_ROOT . './' . $stylearray['directory']; if (!is_dir($templatedir)) { if (!@mkdir($templatedir, 0777)) { $basedir = dirname($stylearray['directory']); cpmsg('styles_import_directory_invalid', 'action=styles', 'error', array('basedir' => $basedir, 'directory' => $stylearray['directory'])); } } if (!($templateid = C::t('common_template')->get_templateid($stylearray['tplname']))) { $templateid = C::t('common_template')->insert(array('name' => $stylearray['tplname'], 'directory' => $stylearray['directory'], 'copyright' => $stylearray['copyright']), true); } } else { $templateid = 1; } if (C::t('common_style')->check_stylename($stylearray['name'])) { $renamed = 1; } else { $styleidnew = C::t('common_style')->insert(array('name' => $stylearray['name'], 'templateid' => $templateid), true); } } else { $styleidnew = $restoreid; C::t('common_stylevar')->delete_by_styleid($styleidnew); } foreach ($stylearray['style'] as $variable => $substitute) { $substitute = @dhtmlspecialchars($substitute); C::t('common_stylevar')->insert(array('styleid' => $styleidnew, 'variable' => $variable, 'substitute' => $substitute)); } } if ($dir) { cloudaddons_installlog($dir . '.template'); cloudaddons_clear('template', $dir); } if ($updatecache) { updatecache('styles'); updatecache('setting'); } return $renamed; }