Skip to content

Commit

Permalink
Merge pull request #1 from zyx0814/1.3.1
Browse files Browse the repository at this point in the history
更新1.3.1文件
  • Loading branch information
zyx0814 committed May 3, 2017
2 parents 35a62a7 + 2b53154 commit 3c44df5
Show file tree
Hide file tree
Showing 33 changed files with 647 additions and 285 deletions.
36 changes: 18 additions & 18 deletions upload/admin/app/cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
unset($app['dateline']);
$apparray = array();
if ($app['identifier']) {
$entrydir = DZZ_ROOT . './dzz/' . $app['identifier'];
$entrydir = DZZ_ROOT . './dzz/' . str_replace(':','/',$app['identifier']);

if (file_exists($entrydir . '/install.php')) {
$app['extra']['installfile'] = 'install.php';
Expand All @@ -51,7 +51,7 @@
}
$apparray['app'] = $app;
$apparray['version'] = strip_tags($_G['setting']['version']);
exportdata('Dzz! app', $app['identifier'] ? $app['identifier'] : random(5), $apparray);
exportdata('Dzz! app', $app['identifier'] ? str_replace(':','_',$app['identifier']) : random(5), $apparray);
exit();

} elseif ($do == 'import') {//导入应用
Expand All @@ -60,13 +60,13 @@
} else {
$apparray = getimportdata('Dzz! app');
if ($apparray['app']['identifier']) {
if (!is_dir(DZZ_ROOT . './dzz/' . $apparray['app']['identifier'])) {
if (!is_dir(DZZ_ROOT . './dzz/' . str_replace(':','/',$apparray['app']['identifier']))) {
showmessage('list_cp_Application_directory_exist');
}
$extra = unserialize($apparray['app']['extra']);
$filename = $extra['installfile'];
if (!empty($filename) && preg_match('/^[\w\.]+$/', $filename)) {
$filename = DZZ_ROOT . './dzz/' . $$apparray['app']['identifier'] . '/' . $filename;
$filename = DZZ_ROOT . './dzz/' . str_replace(':','/',$apparray['app']['identifier']) . '/' . $filename;
if (file_exists($filename)) {
@include_once $filename;
} else {
Expand All @@ -93,8 +93,8 @@
showmessage('list_cp_Application_delete');
}
if ($app['identifier']) {
$entrydir = DZZ_ROOT . './dzz/' . $app['identifier'];
$file = $entrydir . '/dzz_app_' . $value['identifier'] . '.xml';
$entrydir = DZZ_ROOT . './dzz/' . str_replace(':','/',$app['identifier']);
$file = $entrydir . '/dzz_app_' . str_replace(':','_',$app['identifier']) . '.xml';
if (!file_exists($file)) {
$apparray['disablefile'] = $app['extra']['disablefile'];
$apparray['app']['version'] = $app['version'];
Expand All @@ -103,7 +103,7 @@
$apparray = getimportdata('Dzz! app');
}
if (!empty($apparray['disablefile']) && preg_match('/^[\w\.]+$/', $apparray['disablefile'])) {
$filename = entrydir . '/' . $apparray['disablefile'];
$filename = $entrydir . '/' . $apparray['disablefile'];
if (file_exists($filename)) {
@include $filename;
} else {
Expand All @@ -127,8 +127,8 @@
}
$finish = FALSE;
if ($app['identifier']) {
$entrydir = DZZ_ROOT . './dzz/' . $app['identifier'];
$file = $entrydir . '/dzz_app_' . $value['identifier'] . '.xml';
$entrydir = DZZ_ROOT . './dzz/' . str_replace(':','/',$app['identifier']);
$file = $entrydir . '/dzz_app_' . str_replace(':','_',$app['identifier']) . '.xml';
if (!file_exists($file)) {
$apparray['app']['extra']['enablefile'] = $app['extra']['enablefile'];
$apparray['app']['version'] = $app['version'];
Expand All @@ -137,7 +137,7 @@
$apparray = getimportdata('Dzz! app');
}
if (!empty($apparray['app']['extra']['enablefile']) && preg_match('/^[\w\.]+$/', $apparray['app']['extra']['enablefile'])) {
$filename = entrydir . '/' . $apparray['app']['extra']['enablefile'];
$filename = $entrydir . '/' . $apparray['app']['extra']['enablefile'];
if (file_exists($filename)) {
@include $filename;
} else {
Expand All @@ -157,17 +157,17 @@
} elseif ($do == 'install') {//安装应用
$finish = FALSE;
$dir = $_GET['dir'];
$xmlfile = 'dzz_app_' . $dir . '.xml';
$importfile = DZZ_ROOT . './dzz/' . $dir . '/' . $xmlfile;
$xmlfile = 'dzz_app_' . str_replace(':','_',$dir) . '.xml';
$importfile = DZZ_ROOT . './dzz/' . str_replace(':','/',$dir) . '/' . $xmlfile;
if (!file_exists($importfile)) {
showmessage('list_cp_Application_allocation' . '' . $xmlfile, $_GET['refer']);
showmessage('list_cp_Application_allocation' . ':' . $xmlfile, $_GET['refer']);
}
$importtxt = @implode('', file($importfile));
$apparray = getimportdata('Dzz! app');
$filename = $apparray['app']['extra']['installfile'];
$request_uri = ADMINSCRIPT . '?mod=app';
if (!empty($filename) && preg_match('/^[\w\.]+$/', $filename)) {
$filename = DZZ_ROOT . './dzz/' . $dir . '/' . $filename;
$filename = DZZ_ROOT . './dzz/' . str_replace(':','/',$dir) . '/' . $filename;
if (file_exists($filename)) {
@include_once $filename;
} else {
Expand All @@ -193,8 +193,8 @@
$request_uri = ADMINSCRIPT . '?mod=app';
$msg = lang('application_uninstall_successful');
if ($app['identifier']) {
$entrydir = DZZ_ROOT . './dzz/' . $app['identifier'];
$file = $entrydir . '/dzz_app_' . $app['identifier'] . '.xml';
$entrydir = DZZ_ROOT . './dzz/' . str_replace(':','/',$app['identifier']);
$file = $entrydir . '/dzz_app_' . str_replace(':','_',$app['identifier']) . '.xml';
if (!file_exists($file)) {
$apparray['app']['extra']['uninstallfile'] = $app['extra']['uninstallfile'];
$apparray['app']['version'] = $app['version'];
Expand Down Expand Up @@ -230,8 +230,8 @@
$finish = FALSE;
$msg = lang('application_upgrade_successful');

$entrydir = DZZ_ROOT . './dzz/' . $app['identifier'];
$file = $entrydir . '/dzz_app_' . $app['identifier'] . '.xml';
$entrydir = DZZ_ROOT . './dzz/' . str_replace(':','/',$app['identifier']);
$file = $entrydir . '/dzz_app_' . str_replace(':','_',$app['identifier']) . '.xml';
if (!file_exists($file)) {
showmessage('list_cp_Application_tautology');
}
Expand Down
32 changes: 30 additions & 2 deletions upload/admin/app/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,49 @@
$multi = multi($count, $perpage, $page, $theurl, 'pull-right');
}
} elseif ($do == 'notinstall') {
$identifiers = C::t('app_market') -> fetch_all_identifier();
//$identifiers = C::t('app_market') -> fetch_all_identifier();

$plugindir = DZZ_ROOT . './dzz';
$pluginsdir = dir($plugindir);
$newplugins = array();
print_r($plugindir);exit('ddd');
$list = array();
while ($entry = $pluginsdir -> read()) {
echo $entry;
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'));
}else{
$plugindir1 = $entrydir;
$pluginsdir1 = dir($plugindir1);
while ($entry1 = $pluginsdir1 -> read()) {
if (!in_array($entry1, array('.', '..')) && is_dir($plugindir1 . '/' . $entry1) && !in_array($entry.':'.$entry1, $identifiers)) {
$entrydir1 = $entrydir.'/'. $entry1;
//$filemtime = filemtime($entrydir1);
$entrytitle1 = $entry1;
$entryversion1 = $entrycopyright1 = $importtxt = '';
exit($entrydir1 . '/dzz_app_' . $entry.'_'.$entry1 . '.xml<br>');
if (file_exists($entrydir1 . '/dzz_app_' . $entry.'_'.$entry1 . '.xml')) {
$importtxt = @implode('', file($entrydir1 . '/dzz_app_' . $entry.'_'.$entry1 . '.xml'));
}
if ($importtxt) {
$pluginarray1 = getimportdata('Dzz! app', 0, 1);
if (!empty($pluginarray1['plugin']['name'])) {
$pluginarray1['plugin']['name'] = dhtmlspecialchars($pluginarray1['plugin']['name']);
$pluginarray1['plugin']['version'] = dhtmlspecialchars($pluginarray1['plugin']['version']);
$pluginarray1['plugin']['copyright'] = dhtmlspecialchars($pluginarray1['plugin']['copyright']);
}
$list[$entry.':'.$entry1] = $pluginarray1;
}
exit($entry);
}

}

}
if ($importtxt) {
$pluginarray = getimportdata('Dzz! app', 0, 1);
Expand Down
30 changes: 30 additions & 0 deletions upload/admin/app/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,36 @@
if (file_exists($entrydir . '/dzz_app_' . $entry . '.xml')) {
//echo $entrydir.'/dzz_app_'.$entry.'.xml'.'<br>';
$importtxt = implode('', file($entrydir . '/dzz_app_' . $entry . '.xml'));
}else{
$plugindir1 = $entrydir;
$pluginsdir1 = dir($plugindir1);
while ($entry1 = $pluginsdir1 -> read()) {
if (!in_array($entry1, array('.', '..')) && is_dir($plugindir1 . '/' . $entry1) && !in_array($entry.':'.$entry1, $identifiers)) {
$entrydir1 = $entrydir.'/'. $entry1;
//$filemtime = filemtime($entrydir1);
$entrytitle1 = $entry1;
$entryversion1 = $entrycopyright1 = $importtxt = '';
if (file_exists($entrydir1 . '/dzz_app_' . $entry.'_'.$entry1 . '.xml')) {

$importtxt = @implode('', file($entrydir1 . '/dzz_app_' . $entry.'_'.$entry1 . '.xml'));
}
if ($importtxt) {
$apparray = getimportdata('Dzz! app', 0, 1, $importtxt);
$value = $apparray['app'];
if (!empty($value['appname'])) {
$value['appname'] = dhtmlspecialchars($value['appname']);
$value['identifier'] = dhtmlspecialchars($entry.':'.$entry1);
$value['version'] = dhtmlspecialchars($value['version']);
$value['vendor'] = dhtmlspecialchars($value['vendor']);
$value['grouptitle'] = $grouptitle[$value['group']];
$list[$entry.':'.$entry1] = $value;
}

}
}

}

}
if ($importtxt) {
$apparray = getimportdata('Dzz! app', 0, 1, $importtxt);
Expand Down
Loading

0 comments on commit 3c44df5

Please sign in to comment.