public function onMobileModule() { global $_G; if (!$_G['setting']['plugins']['available']) { return ''; } require_once libfile('function/admincp'); loadcache('pluginlanguage_script', 1); $return = array(); foreach ($_G['setting']['plugins']['available'] as $pluginid) { $row = array(); $modulefile = DISCUZ_ROOT . './source/plugin/' . $pluginid . '/discuz_mobile_' . $pluginid . '.xml'; if (file_exists($modulefile)) { $_GET['importtxt'] = @implode('', file($modulefile)); $pluginarray = getimportdata('Discuz! Mobile', 0, 1); if ($pluginarray) { foreach ($pluginarray as $name => $value) { $row[] = array('name' => isset($_G['cache']['pluginlanguage_script'][$pluginid][$name]) ? $_G['cache']['pluginlanguage_script'][$pluginid][$name] : $name, 'logo' => $value['logo'], 'url' => preg_match('/^http:\\/\\//', $value['url']) ? $value['url'] : $_G['siteurl'] . $value['url']); } } } $return[$pluginid] = $row; } return $return; }
function import_styles($ignoreversion = 1, $dir = '') { global $db, $tablepre, $version, $importtxt, $stylearray; if (!isset($dir)) { $stylearrays = array(getimportdata('Discuz! Style')); } else { $dir = str_replace(array('/', '\\'), '', $dir); $templatedir = DISCUZ_ROOT . './templates/' . $dir; $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) && strip_tags($stylearray['version']) != strip_tags($version)) { cpmsg('styles_import_version_invalid', '', 'error'); } $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', '', 'error'); } } if (!($templateid = $db->result_first("SELECT templateid FROM {$tablepre}templates WHERE name='{$stylearray['tplname']}'"))) { $db->query("INSERT INTO {$tablepre}templates (name, directory, copyright)\r\n\t\t\t\t\tVALUES ('{$stylearray['tplname']}', '{$stylearray['directory']}', '{$stylearray['copyright']}')"); $templateid = $db->insert_id(); } } else { $templateid = 1; } if ($db->result_first("SELECT COUNT(*) FROM {$tablepre}styles WHERE name='{$stylearray['name']}'")) { $stylearray['name'] .= '_' . random(4); $renamed = 1; } $db->query("INSERT INTO {$tablepre}styles (name, templateid)\r\n\t\t\tVALUES ('{$stylearray['name']}', '{$templateid}')"); $styleidnew = $db->insert_id(); foreach ($stylearray['style'] as $variable => $substitute) { $substitute = @htmlspecialchars($substitute); $db->query("INSERT INTO {$tablepre}stylevars (styleid, variable, substitute)\r\n\t\t\t\tVALUES ('{$styleidnew}', '{$variable}', '{$substitute}')"); } } updatecache('styles'); updatecache('settings'); return $renamed; }
function build_cache_plugin() { global $importtxt; $data = array(); $query = DB::query("SELECT * FROM " . DB::table('common_plugin') . " WHERE available='1'"); $pluginsetting = array(); while ($plugin = DB::fetch($query)) { $dir = substr($plugin['directory'], 0, -1); $plugin['modules'] = unserialize($plugin['modules']); if ($plugin['modules']['extra']['langexists']) { require_once libfile('function/plugin'); require_once libfile('function/admincp'); $file = DISCUZ_ROOT . './source/plugin/' . $dir . '/discuz_plugin_' . $dir . ($plugin['modules']['extra']['installtype'] ? '_' . $plugin['modules']['extra']['installtype'] : '') . '.xml'; $importtxt = @implode('', file($file)); $pluginarray = getimportdata('Discuz! Plugin', 1, 1); if ($pluginarray) { updatepluginlanguage($pluginarray); } } $queryvars = DB::query("SELECT * FROM " . DB::table('common_pluginvar') . " WHERE pluginid='{$plugin['pluginid']}'"); while ($var = DB::fetch($queryvars)) { $data[$plugin['identifier']][$var['variable']] = $var['value']; if (in_array(substr($var['type'], 0, 6), array('group_', 'forum_'))) { $stype = substr($var['type'], 0, 5) . 's'; $type = substr($var['type'], 6); if ($type == 'select') { foreach (explode("\n", $var['extra']) as $key => $option) { $option = trim($option); if (strpos($option, '=') === FALSE) { $key = $option; } else { $item = explode('=', $option); $key = trim($item[0]); $option = trim($item[1]); } $var['select'][] = array($key, $option); } } $pluginsetting[$stype][$plugin['identifier']]['name'] = $plugin['name']; $pluginsetting[$stype][$plugin['identifier']]['setting'][$var['pluginvarid']] = array('title' => $var['title'], 'description' => $var['description'], 'type' => $type, 'select' => $var['select']); } } } writetocache('pluginsetting', getcachevars(array('pluginsetting' => $pluginsetting))); save_syscache('plugin', $data); }
showtablefooter(); showformfooter(); } } elseif ($operation == 'import') { if (!submitcheck('importsubmit')) { shownav('tools', 'nav_javascript'); showsubmenu('nav_javascript', array(array('config', 'jswizard&operation=config', 0), $infosidemenu, array('admin', 'jswizard', 0), array(array('menu' => 'jswizard_addmodule', 'submenu' => $addmenu), '', 0), array('jswizard_module', 'jswizard&type=module', 0), array('import', 'jswizard&operation=import', 1))); showformheader('jswizard&operation=import', 'enctype'); showtableheader('jswizard_import'); showimportdata(); showtablerow('', 'class="rowform"', mradio('importrewrite', array(0 => lang('jswizard_import_default'), 1 => lang('jswizard_import_norewrite'), 2 => lang('jswizard_import_rewrite')), 0, FALSE)); showsubmit('importsubmit'); showtablefooter(); showformfooter(); } else { $importarray = getimportdata(0); $keys = implode("','", array_keys($importarray)); if ($importrewrite != 2) { $query = $db->query("SELECT variable FROM {$tablepre}request WHERE variable IN ('{$keys}')"); $existkeyarray = array(); while ($existkey = $db->fetch_array($query)) { if ($importrewrite == 1) { unset($importarray[$existkey['variable']]); } else { $existkeyarray[] = $existkey['variable']; } } if ($importrewrite == 0 && $existkeyarray) { $existkeys = implode(", ", $existkeyarray); cpmsg('jswizard_import_exist', '', 'error'); }
showmessage('应用卸载成功', ADMINSCRIPT . '?mod=app&op=list&do=available', array(), array('alert' => 'right')); } } elseif ($do == 'upgrade') { $appid = intval($_GET['appid']); if (!($app = C::t('app_market')->fetch($appid))) { showmessage('应用不存在,或已删除'); } $finish = FALSE; $msg = '应用升级成功!'; $entrydir = DZZ_ROOT . './dzz/' . $app['identifier']; $file = $entrydir . '/dzz_app_' . $app['identifier'] . '.xml'; if (!file_exists($file)) { showmessage('应用配置文件不存在,请将应用配置文件放入应用目录后重试'); } $importtxt = @implode('', file($file)); $apparray = getimportdata('Dzz! app', 0, 0, $importtxt); $filename = $apparray['app']['extra']['upgradefile']; $toversion = $apparray['app']['version']; if (!empty($apparray['app']['extra']['upgradefile']) && preg_match('/^[\\w\\.]+$/', $apparray['app']['extra']['upgradefile'])) { $filename = $entrydir . '/' . $apparray['app']['extra']['upgradefile']; if (file_exists($filename)) { @(include $filename); } else { $finish = TRUE; } } else { $finish = TRUE; } if ($finish) { C::t('app_market')->update($appid, array('version' => $toversion)); showmessage('应用升级成功', ADMINSCRIPT . '?mod=app&op=list&do=updatelist', array(), array('alert' => 'right'));
$plugindir = DZZ_ROOT . './dzz'; $pluginsdir = dir($plugindir); $newplugins = array(); $list = array(); while ($entry = $pluginsdir->read()) { if (!in_array($entry, array('.', '..')) && is_dir($plugindir . '/' . $entry) && !in_array($entry, $identifiers)) { $entrydir = DZZ_ROOT . './dzz/' . $entry; $d = dir($entrydir); $filemtime = filemtime($entrydir); $entrytitle = $entry; $entryversion = $entrycopyright = $importtxt = ''; if (file_exists($entrydir . '/dzz_app_' . $entry . '.xml')) { $importtxt = @implode('', file($entrydir . '/dzz_app_' . $entry . '.xml')); } if ($importtxt) { $pluginarray = getimportdata('Dzz! app', 0, 1); if (!empty($pluginarray['plugin']['name'])) { $pluginarray['plugin']['name'] = dhtmlspecialchars($pluginarray['plugin']['name']); $pluginarray['plugin']['version'] = dhtmlspecialchars($pluginarray['plugin']['version']); $pluginarray['plugin']['copyright'] = dhtmlspecialchars($pluginarray['plugin']['copyright']); } $list[$entry] = $pluginarray; } } } } elseif ($do == 'upgrade') { $sql = ''; if ($group) { $sql = " and `group` = '{$group}'"; } if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('app_market') . " WHERE 1 {$sql}")) {
function cloudaddons_clear($type, $id) { global $_G; if (isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] > 0) { return; } $dirs = array('plugin' => array('plugin', './source/plugin/'), 'template' => array('style', './template/')); if ($dirs[$type] && cloudaddons_getmd5($id . '.' . $type)) { $entrydir = DISCUZ_ROOT . $dirs[$type][1] . $id; $d = dir($entrydir); $filedeleted = false; while ($f = $d->read()) { if (preg_match('/^discuz\\_' . $dirs[$type][0] . '\\_' . $id . '(\\_\\w+)?\\.xml$/', $f)) { @unlink($entrydir . '/' . $f); if ($type == 'plugin' && !$filedeleted) { @unlink($entrydir . '/' . $f); $importtxt = @implode('', file($entrydir . '/' . $f)); $pluginarray = getimportdata('Discuz! Plugin'); if ($pluginarray['installfile']) { @unlink($entrydir . '/' . $pluginarray['installfile']); } if ($pluginarray['upgradefile']) { @unlink($entrydir . '/' . $pluginarray['upgradefile']); } $filedeleted = true; } } } } }
require_once libfile('function/block'); blockclass_cache(); if ($_G['config']['output']['tplrefresh']) { cleartemplatecache(); } $plugins = array('qqconnect', 'cloudstat', 'soso_smilies', 'cloudsearch', 'qqgroup', 'security', 'xf_storage', 'mobile'); $opens = array('mobile'); require_once libfile('function/plugin'); require_once libfile('function/admincp'); foreach ($plugins as $pluginid) { $importfile = DISCUZ_ROOT . './source/plugin/' . $pluginid . '/discuz_plugin_' . $pluginid . '.xml'; if (!file_exists($importfile)) { continue; } $importtxt = @implode('', file($importfile)); $pluginarray = getimportdata('Discuz! Plugin', $importtxt); $plugin = C::t('common_plugin')->fetch_by_identifier($pluginid); if ($plugin) { $modules = unserialize($plugin['modules']); if ($modules['system'] > 0) { if ($pluginarray['plugin']['version'] != $plugin['version']) { pluginupgrade($pluginarray, ''); if ($pluginarray['upgradefile']) { $plugindir = DISCUZ_ROOT . './source/plugin/' . $pluginarray['plugin']['directory']; if (file_exists($plugindir . '/' . $pluginarray['upgradefile'])) { @(include_once $plugindir . '/' . $pluginarray['upgradefile']); } } } if ($modules['system'] != 2) { $modules['system'] = 2;
} } cpmsg('project_update_forum', $BASESCRIPT . '?action=project', 'succeed'); } } elseif ($operation == 'import') { if (!submitcheck('importsubmit')) { shownav('tools', 'project_scheme'); showsubmenu('project_scheme', array($allowforumsedit ? array('project_forum_scheme', 'project&type=forum', $type == 'forum') : array(), $allowusergroups ? array('project_group_scheme', 'project&type=group', $type == 'group') : array(), $allowcreditwizard ? array('project_extcredit_scheme', 'project&type=extcredit', $type == 'extcredit') : array(), array('project_import_stick', 'project&operation=import', $operation == 'import'))); showformheader('project&operation=import', 'enctype'); showtableheader('project_import_stick'); showimportdata(); showsubmit('importsubmit'); showtablefooter(); showformfooter(); } else { $projectarray = getimportdata(); if (strip_tags($projectarray['version']) != strip_tags($version)) { cpmsg('project_export_version_invalid', '', 'error'); } else { $db->query("INSERT INTO {$tablepre}projects (name, type, description, value) VALUES ('{$projectarray['name']}', '{$projectarray['type']}', '{$projectarray['description']}', '{$projectarray['value']}')"); cpmsg('project_import_succeed', $BASESCRIPT . '?action=project', 'succeed'); } } } elseif ($operation == 'add') { $delfields = array('forum' => array('fid', 'fup', 'type', 'name', 'status', 'displayorder', 'threads', 'posts', 'todayposts', 'lastpost', 'description', 'password', 'icon', 'redirect', 'moderators', 'rules', 'threadtypes'), 'group' => array('groupid', 'radminid', 'type', 'system', 'grouptitle', 'creditshigher', 'creditslower', 'stars', 'color', 'groupavatar')); if (!submitcheck('addsubmit')) { shownav('tools', 'project_scheme_add'); showsubmenu('project_scheme_add'); if (!empty($projectid)) { $query = $db->query("SELECT name, description, value FROM {$tablepre}projects WHERE id='{$projectid}'"); $project = $db->fetch_array($query);
function pluginvalidator($identifier) { global $importtxt; $validatorkey = ''; if (file_exists(DISCUZ_ROOT . './source/plugin/' . $identifier . '/validator.xml')) { $importtxt = file_get_contents(DISCUZ_ROOT . './source/plugin/' . $identifier . '/validator.xml'); $validatorarray = getimportdata('Discuz! Plugin Validator'); if (!empty($validatorarray) && is_array($validatorarray)) { $md5 = ''; foreach ($validatorarray as $file) { $md5 .= file_exists(DISCUZ_ROOT . $file) ? @md5_file($file) : ''; } $validatorkey = md5(md5($md5) . $identifier); } } return $validatorkey; }
dheader('Content-Type: ' . (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? 'application/octetstream' : 'application/octet-stream')); echo $plugin_export; dexit(); } elseif ($operation == 'import') { if (!submitcheck('importsubmit')) { shownav('extended', 'nav_plugins'); showsubmenu('nav_plugins', array(array('config', 'plugins&operation=config', 0), array('admin', 'plugins', 0), array('import', 'plugins&operation=import', 1))); showformheader('plugins&operation=import', 'enctype'); showtableheader('plugins_import', 'fixpadding'); showimportdata(); showtablerow('', '', '<input type="checkbox" name="ignoreversion" value="1" class="checkbox" /> ' . lang('plugins_import_ignore_version')); showsubmit('importsubmit'); showtablefooter(); showformfooter(); } else { $pluginarray = getimportdata(); if (empty($ignoreversion) && strip_tags($pluginarray['version']) != strip_tags($version)) { cpmsg('plugins_import_version_invalid', '', 'error'); } $query = $db->query("SELECT pluginid FROM {$tablepre}plugins WHERE identifier='{$pluginarray[plugin][identifier]}' LIMIT 1"); if ($db->num_rows($query)) { cpmsg('plugins_import_identifier_duplicated', '', 'error'); } $sql1 = $sql2 = $comma = ''; foreach ($pluginarray['plugin'] as $key => $val) { if ($key == 'directory') { //compatible for old versions $val .= !empty($val) && substr($val, -1) != '/' ? '/' : ''; } $sql1 .= $comma . $key; $sql2 .= $comma . '\'' . $val . '\'';
function import_styles($ignoreversion = 1, $dir = '', $restoreid = 0, $updatecache = 1) { global $_G, $importtxt, $stylearray; if (!isset($dir)) { $stylearrays = array(getimportdata('Discuz! Style')); } else { if (!$restoreid) { $dir = str_replace(array('/', '\\'), '', $dir); $templatedir = DISCUZ_ROOT . './template/' . $dir; } else { $templatedir = DISCUZ_ROOT . $dir; } $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) && strip_tags($stylearray['version']) != strip_tags($_G['setting']['version'])) { cpmsg('styles_import_version_invalid', '', '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', '', 'error', array('basedir' => $basedir, 'directory' => $stylearray['directory'])); } } if (!($templateid = DB::result_first("SELECT templateid FROM " . DB::table('common_template') . " WHERE name='{$stylearray['tplname']}'"))) { DB::query("INSERT INTO " . DB::table('common_template') . " (name, directory, copyright)\r\n\t\t\t\t\t\tVALUES ('{$stylearray['tplname']}', '{$stylearray['directory']}', '{$stylearray['copyright']}')"); $templateid = DB::insert_id(); } } else { $templateid = 1; } if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_style') . " WHERE name='{$stylearray['name']}'")) { $stylearray['name'] .= '_' . random(4); $renamed = 1; } DB::query("INSERT INTO " . DB::table('common_style') . " (name, templateid)\r\n\t\t\t\tVALUES ('{$stylearray['name']}', '{$templateid}')"); $styleidnew = DB::insert_id(); } else { $styleidnew = $restoreid; DB::query("DELETE FROM " . DB::table('common_stylevar') . " WHERE styleid='{$styleidnew}'"); } foreach ($stylearray['style'] as $variable => $substitute) { $substitute = @htmlspecialchars($substitute); DB::query("INSERT INTO " . DB::table('common_stylevar') . " (styleid, variable, substitute)\r\n\t\t\t\tVALUES ('{$styleidnew}', '{$variable}', '{$substitute}')"); } } if ($updatecache) { updatecache('styles'); updatecache('setting'); } return $renamed; }
} } } elseif ($operation == 'import') { if (!submitcheck('importsubmit') && !isset($dir)) { shownav('style', 'styles_admin'); showsubmenu('styles_admin', array(array('admin', 'styles', '0'), array('import', 'styles&operation=import', '1'))); showformheader('styles&operation=import', 'enctype'); showtableheader('styles_import'); showimportdata(); showtablerow('', '', '<input class="checkbox" type="checkbox" name="ignoreversion" id="ignoreversion" value="1" /><label for="ignoreversion"> ' . lang('styles_import_ignore_version') . '</label>'); showsubmit('importsubmit'); showtablefooter(); showformfooter(); } else { if (!isset($dir)) { $stylearrays = array(getimportdata()); } else { $dir = str_replace(array('/', '\\'), '', $dir); $templatedir = DISCUZ_ROOT . './templates/' . $dir; $searchdir = dir($templatedir); $stylearrays = array(); while ($searchentry = $searchdir->read()) { if (substr($searchentry, 0, 13) == 'discuz_style_' && fileext($searchentry) == 'txt') { $importfile = $templatedir . '/' . $searchentry; $styledata = preg_replace("/(#.*\\s+)*/", '', @implode('', file($importfile))); $style = daddslashes(unserialize(base64_decode($styledata)), 1); if (!is_array($style)) { cpmsg('import_data_invalid', '', 'error'); } $stylearrays[] = $style; }
} else { cpmsg('smilies_update_error', '', 'error'); } } elseif ($operation == 'import') { if (!submitcheck('importsubmit')) { shownav('style', 'smilies_edit'); showsubmenu('nav_smilies', array(array('smilies_type', 'smilies', 0), array('smilies_import', 'smilies&operation=import', 1))); showtips('smilies_tips_import'); showformheader('smilies&operation=import', 'enctype'); showtableheader('smilies_import'); showimportdata(); showsubmit('importsubmit'); showtablefooter(); showformfooter(); } else { $smileyarray = getimportdata(); $renamed = 0; if ($db->result_first("SELECT COUNT(*) FROM {$tablepre}imagetypes WHERE type='smiley' AND name='{$smileyarray['name']}'")) { $smileyarray['name'] .= '_' . random(4); $renamed = 1; } $db->query("INSERT INTO {$tablepre}imagetypes (name, type, directory)\r\n\t\t\tVALUES ('{$smileyarray['name']}', 'smiley', '{$smileyarray['directory']}')"); $typeid = $db->insert_id(); foreach ($smileyarray['smilies'] as $key => $smiley) { $db->query("INSERT INTO {$tablepre}smilies (type, typeid, displayorder, code, url)\r\n\t\t\t\tVALUES ('smiley', '{$typeid}', '{$smiley['displayorder']}', '', '{$smiley['url']}')"); } $db->query("UPDATE {$tablepre}smilies SET code=CONCAT('{:', typeid, '_', id, ':}') WHERE typeid='{$typeid}'"); updatecache(array('smileytypes', 'smilies', 'smileycodes', 'smilies_js')); cpmsg($renamed ? 'smilies_import_succeed_renamed' : 'smilies_import_succeed', $BASESCRIPT . '?action=smilies', 'succeed'); } }
include template('common/header'); echo $optionlist; include template('common/footer'); exit; } elseif ($operation == 'sortlist') { $optionid = $_GET['optionid']; $option = C::t('forum_typeoption')->fetch($optionid); include template('common/header'); $option['type'] = $lang['threadtype_edit_vars_type_' . $option['type']]; $option['available'] = 1; showtablerow('', array('class="td25"', 'class="td28 td23"'), array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$option['optionid']}\" " . ($option['model'] ? 'disabled' : '') . ">", "<input type=\"text\" class=\"txt\" size=\"2\" name=\"displayorder[{$option['optionid']}]\" value=\"{$option['displayorder']}\">", "<input class=\"checkbox\" type=\"checkbox\" name=\"available[{$option['optionid']}]\" value=\"1\" " . ($option['available'] ? 'checked' : '') . " " . ($option['model'] ? 'disabled' : '') . ">", dhtmlspecialchars($option['title']), $option[type], "<input class=\"checkbox\" type=\"checkbox\" name=\"required[{$option['optionid']}]\" value=\"1\" " . ($option['required'] ? 'checked' : '') . " " . ($option['model'] ? 'disabled' : '') . ">", "<input class=\"checkbox\" type=\"checkbox\" name=\"unchangeable[{$option['optionid']}]\" value=\"1\" " . ($option['unchangeable'] ? 'checked' : '') . ">", "<input class=\"checkbox\" type=\"checkbox\" name=\"search[{$option['optionid']}][form]\" value=\"1\" " . (getstatus($option['search'], 1) == 1 ? 'checked' : '') . ">", "<input class=\"checkbox\" type=\"checkbox\" name=\"search[{$option['optionid']}][font]\" value=\"1\" " . (getstatus($option['search'], 2) == 1 ? 'checked' : '') . ">", "<input class=\"checkbox\" type=\"checkbox\" name=\"subjectshow[{$option['optionid']}]\" value=\"1\" " . ($option['subjectshow'] ? 'checked' : '') . ">", "<a href=\"" . ADMINSCRIPT . "?action=threadtypes&operation=optiondetail&optionid={$option['optionid']}\" class=\"act\">" . $lang['edit'] . "</a>")); include template('common/footer'); exit; } elseif ($operation == 'import') { $sortid = 0; $newthreadtype = getimportdata('Discuz! Threadtypes'); if ($newthreadtype) { $idcmp = $searcharr = $replacearr = $indexoption = array(); $create_tableoption_sql = $separator = ''; $i = 0; foreach ($newthreadtype as $key => $value) { if (!$i) { if ($newname1 = trim(strip_tags($value['name']))) { $findname = 0; $tmpnewname1 = $newname1; $decline = '_'; while (!$findname) { if (C::t('forum_threadtype')->checkname($tmpnewname1)) { $tmpnewname1 = $newname1 . $decline; $decline .= '_'; } else {
$tmpdir = 'saekv://data/download/' . $_GET['rid']; $end = ''; $md5tmp = 'saekv://data/download/' . $_GET['rid'] . '.md5'; if ($packnum) { list($md5total, $md5s) = unserialize(implode('', @file($md5tmp))); dmkdir($tmpdir, 0777, false); } else { dir_clear($tmpdir); @unlink($md5tmp); dmkdir($tmpdir, 0777, false); $md5total = ''; $md5s = array(); } $data = cloudaddons_open('&mod=app&ac=download&rid=' . $_GET['rid'] . '&packnum=' . $packnum); $_GET['importtxt'] = $data; $array = getimportdata('Discuz! File Pack'); if (!$array['Status']) { list($_cur, $_max) = explode('/', $array['part']); $percent = intval($_cur / $_max * 100); if ($array['type'] != $_GET['type'] || $array['key'] != $_GET['key'] || !$array['files']) { dir_clear($tmpdir); @unlink($md5tmp); cloudaddons_faillog($_GET['rid'], 100); cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 100)); } foreach ($array['files'] as $file => $data) { $filename = $tmpdir . '/' . $file . '._addons_'; $dirname = dirname($filename); dmkdir($dirname, 0777, false); $fp = fopen($filename, !$data['Part'] ? 'w' : 'a'); if (!$fp) {
<?php define('IN_SITE', TRUE); define('IN_ADMINCP', TRUE); chdir('../../'); require_once './source/class/class_core.php'; $dzf = C::app(); $dzf->init_cron = false; $dzf->init_session = false; $dzf->init(); if ($_GET['key'] !== md5($_G['setting']['authkey'] . $_SERVER['REMOTE_ADDR'])) { exit; } $plugins = array('qqconnect', 'cloudstat', 'soso_smilies', 'cloudsearch', 'qqgroup', 'security', 'xf_storage'); require_once libfile('function/plugin'); require_once libfile('function/admincp'); require_once libfile('function/cache'); foreach ($plugins as $pluginid) { $importfile = DZF_ROOT . './source/plugin/' . $pluginid . '/core_plugin_' . $pluginid . '.xml'; $importtxt = @implode('', file($importfile)); $pluginarray = getimportdata('DZF! Plugin', $importtxt); if (plugininstall($pluginarray)) { if (!empty($pluginarray['installfile']) && file_exists(DZF_ROOT . './source/plugin/' . $pluginid . '/' . $pluginarray['installfile'])) { @(include_once DZF_ROOT . './source/plugin/' . $pluginid . '/' . $pluginarray['installfile']); } } }
} elseif (preg_match('/^TC\\_BIG5$/i', $extra)) { /*vot*/ $extratxt = 'Traditional Chinese'; } elseif (preg_match('/^TC\\_UTF8$/i', $extra)) { /*vot*/ $extratxt = 'Traditional Chinese UTF-8'; /*vot*/ } else { /*vot*/ $extratxt = 'English UTF8'; } if ($modules['extra']['installtype'] == $extratxt) { continue; } $importtxt = @implode('', file($entrydir . '/' . $f)); $pluginarray = getimportdata('Discuz! Plugin'); $newverother = !empty($pluginarray['plugin']['version']) ? $pluginarray['plugin']['version'] : 0; if ($newverother > $row['version']) { $nowarray[] = '<a href="' . ADMINSCRIPT . '?action=plugins&operation=upgrade&pluginid=' . $row['pluginid'] . '&confirmed=yes&installtype=' . rawurlencode($extra) . '">' . $plugins[$row['identifier']] . ' -> ' . $newverother . ($extra ? ' (' . $extratxt . ')' : '') . '</a>'; } } } } } } } foreach ($result as $id => $row) { if ($row['result'] == 0) { $errarray[] = '<a href="' . ADMINSCRIPT . '?action=cloudaddons&id=' . $id . '.plugin" target="_blank">' . $plugins[$id] . '</a>'; } elseif ($row['result'] == 2) { $newarray[] = '<a href="' . ADMINSCRIPT . '?action=cloudaddons&id=' . $id . '.plugin" target="_blank">' . $plugins[$id] . ($row['newver'] ? ' -> ' . $row['newver'] : '') . '</a>';
unset($thame['default']); if (!$thame) { showmessage('主题不存在'); } $apparray = array(); $apparray['thame'] = $thame; exportdata('Dzz! theme', $apparray['thame']['folder'], $apparray); exit; } elseif ($do == 'install') { //安装主题 $finish = FALSE; $dir = $_GET['dir']; $xmlfile = 'dzz_theme_' . $dir . '.xml'; $importfile = DZZ_ROOT . './dzz/styles/thame/' . $dir . '/' . $xmlfile; if (!file_exists($importfile)) { showmessage('主题目录内没有主题配置文件:' . $xmlfile, dreferer()); } $importtxt = @implode('', file($importfile)); $apparray = getimportdata('Dzz! theme'); $thame = $apparray['thame']; unset($thame['id']); unset($thame['default']); if ($id = DB::result_first("select id from %t where folder=%s", array('thame', $dir))) { C::t('thame')->update($id, $thame); } else { $id = C::t('thame')->insert($thame, 1); } //if($id && $thame['default']) DB::query("update %t SET `default`='0' where id!=%d",array('thame',$id)); showmessage('主题安装成功', dreferer(), array(), array('alert' => 'right')); } //include template('cp');
function import_block($xmlurl, $clientid, $xmlkey = '', $signtype = '', $ignoreversion = 1, $update = 0) { global $_G, $importtxt; $_G['gp_importtype'] = $_G['gp_importtxt'] = ''; $xmlurl = strip_tags($xmlurl); $clientid = strip_tags($clientid); $xmlkey = strip_tags($xmlkey); $parse = parse_url($xmlurl); if (!empty($parse['host'])) { $queryarr = explode('&', $parse['query']); $para = array(); foreach ($queryarr as $value) { $k = $v = ''; list($k, $v) = explode('=', $value); if (!empty($k) && !empty($v)) { $para[$k] = $v; } } $para['clientid'] = $clientid; $para['op'] = 'getconfig'; $para['charset'] = CHARSET; $signurl = create_sign_url($para, $xmlkey, $signtype); $pos = strpos($xmlurl, '?'); $pos = $pos === false ? strlen($xmlurl) : $pos; $signurl = substr($xmlurl, 0, $pos) . '?' . $signurl; $importtxt = @dfsockopen($signurl); } else { $importtxt = @implode('', file($xmlurl)); } $blockarrays = getimportdata('Discuz! Block', 0); if (empty($blockarrays['name']) || empty($blockarrays['fields']) || empty($blockarrays['getsetting'])) { cpmsg(cplang('import_data_typeinvalid') . cplang($importtxt), '', 'error'); } if (empty($ignoreversion) && strip_tags($blockarrays['version']) != strip_tags($_G['setting']['version'])) { cpmsg(cplang('blockxml_import_version_invalid'), '', 'error', array('cur_version' => $blockarrays['version'], 'set_version' => $_G['setting']['version'])); } $data = array('name' => htmlspecialchars($blockarrays['name']), 'version' => htmlspecialchars($blockarrays['version']), 'url' => $xmlurl, 'clientid' => $clientid, 'key' => $xmlkey, 'signtype' => !empty($signtype) ? 'MD5' : '', 'data' => serialize($blockarrays)); $data = daddslashes($data); if (!$update) { DB::insert('common_block_xml', $data); } else { DB::update('common_block_xml', $data, "`id`='{$update}'"); } }
$thamefolders = array(); foreach (DB::fetch_all("select folder from %t where 1 ", array('thame')) as $value) { $thamefolders[$value['folder']] = $value['folder']; } $thamedir = DZZ_ROOT . './dzz/styles/thame'; $thamesdir = dir($thamedir); $newthames = array(); $list = array(); while ($entry = $thamesdir->read()) { if (!in_array($entry, array('.', '..')) && is_dir($thamedir . '/' . $entry) && !in_array($entry, $thamefolders)) { $entrydir = $thamedir . '/' . $entry; $filemtime = filemtime($entrydir); $importtxt = ''; if (file_exists($entrydir . '/dzz_theme_' . $entry . '.xml')) { //echo $entrydir.'/dzz_app_'.$entry.'.xml'.'<br>'; $importtxt = implode('', file($entrydir . '/dzz_theme_' . $entry . '.xml')); } if ($importtxt) { $apparray = getimportdata('Dzz! theme', 0, 1, $importtxt); $value = $apparray['thame']; if (!empty($value['name'])) { $value['name'] = dhtmlspecialchars($value['name']); $value['folder'] = dhtmlspecialchars($entry); $value['version'] = dhtmlspecialchars($value['version']); $value['vendor'] = dhtmlspecialchars($value['vendor']); $list[$entry] = $value; } } } } include template('list');