diff --git a/framework/core/subsystems/expString.php b/framework/core/subsystems/expString.php index f495cfdb8d..77276b8c02 100644 --- a/framework/core/subsystems/expString.php +++ b/framework/core/subsystems/expString.php @@ -699,7 +699,7 @@ private static function xss_clean($str, $is_image = FALSE) { while (list($key) = each($str)) { - if (preg_match('/^[a-zA-Z0-9_\-\.\/\\@\x7f-\xff]*$/', $key)) { // check for valid array name + if (preg_match('/^[a-zA-Z0-9_ \-\.\/\\@\x7f-\xff]*$/', $key)) { // check for valid array name $str[$key] = self::xss_clean($str[$key]); } else { return null; diff --git a/framework/modules/administration/controllers/administrationController.php b/framework/modules/administration/controllers/administrationController.php index 8af9ac5b17..b0c4d49e82 100644 --- a/framework/modules/administration/controllers/administrationController.php +++ b/framework/modules/administration/controllers/administrationController.php @@ -648,7 +648,7 @@ public function install_extension_confirm() { // Look for stale sessid directories: $sessid = session_id(); - if (file_exists(BASE."tmp/extensionuploads/$sessid") && is_dir(BASE."tmp/extensionuploads/$sessid")) expFile::removeDirectory("tmp/extensionuploads/$sessid"); + if (file_exists(BASE . "tmp/extensionuploads/$sessid") && is_dir(BASE . "tmp/extensionuploads/$sessid")) expFile::removeDirectory("tmp/extensionuploads/$sessid"); $return = expFile::makeDirectory("tmp/extensionuploads/$sessid"); if ($return != SYS_FILES_SUCCESS) { switch ($return) { @@ -665,7 +665,7 @@ public function install_extension_confirm() { } } - $dest = BASE."tmp/extensionuploads/$sessid/archive$ext"; + $dest = BASE . "tmp/extensionuploads/$sessid/archive$ext"; if (is_uploaded_file($_FILES['mod_archive']['tmp_name'])) { move_uploaded_file($_FILES['mod_archive']['tmp_name'],$dest); } else { @@ -673,7 +673,7 @@ public function install_extension_confirm() { } if ($compression != 'zip') {// If not zip, must be tar - include_once(BASE.'external/Tar.php'); + include_once(BASE . 'external/Tar.php'); $tar = new Archive_Tar($dest,$compression); @@ -681,20 +681,20 @@ public function install_extension_confirm() { $tar->setErrorHandling(PEAR_ERROR_PRINT); $return = $tar->extract(dirname($dest)); if (!$return) { - flash('error',gt('Error extracting TAR archive')); + flash('error', gt('Error extracting TAR archive')); } else { // header('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=tar'); // self::verify_extension('tar'); } } else { // must be zip - include_once(BASE.'external/Zip.php'); + include_once(BASE . 'external/Zip.php'); $zip = new Archive_Zip($dest); // PEAR::setErrorHandling(PEAR_ERROR_PRINT); $zip->setErrorHandling(PEAR_ERROR_PRINT); if ($zip->extract(array('add_path'=>dirname($dest))) == 0) { - flash('error',gt('Error extracting ZIP archive').': '.$zip->_error_code . ' : ' . $zip->_error_string . '
'); + flash('error',gt('Error extracting ZIP archive') . ': '.$zip->_error_code . ' : ' . $zip->_error_string . '
'); } else { // header('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=zip'); // self::verify_extension('zip'); @@ -702,81 +702,81 @@ public function install_extension_confirm() { } $sessid = session_id(); $files = array(); - foreach (expFile::listFlat(BASE.'tmp/extensionuploads/'.$sessid,true,null,array(),BASE.'tmp/extensionuploads/'.$sessid) as $key=>$f) { + foreach (expFile::listFlat(BASE . 'tmp/extensionuploads/' . $sessid,true,null,array(),BASE . 'tmp/extensionuploads/' . $sessid) as $key=>$f) { if ($key != '/archive.tar' && $key != '/archive.tar.gz' && $key != '/archive.tar.bz2' && $key != '/archive.zip') { - if (empty($this->params['patch']) || !$this->params['patch']) { - $key = substr($key,1); - if (substr($key,0,7)=='themes/') { - $parts = explode('/',$key); - $parts[1] = DISPLAY_THEME_REAL; - $file = implode('/',$parts); - } else { - $file = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace("framework/", "", $key); + if (!empty($this->params['patch']) || $this->params['patch']) { // this is a patch/fix for root folder + $file = substr($key,1); + } else { + $file = substr($key,1); // remove leading slash + if (substr($file,0,7) == 'themes/') { // this is a theme +// $parts = explode('/',$file); +// $parts[1] = DISPLAY_THEME_REAL; // place it in our theme instead of theirs? +// $file = implode('/',$parts); + } else { // this is a custom mod to place within current theme + $file = 'themes/' . DISPLAY_THEME_REAL . '/' . str_replace("framework/", "", $key); } $file = str_replace("modules-1", "modules", $file); - } else { - $file = substr($key,1); } $files[] = array( - 'absolute'=>$file, - 'relative'=>$f, - 'canCreate'=>expFile::canCreate(BASE.$file), - 'ext'=>substr($f,-3,3) + 'absolute' => $file, + 'relative' => $f, + 'canCreate' => expFile::canCreate(BASE . $file), +// 'ext'=>substr($f,-3,3) ); } } assign_to_template(array( - 'relative'=>'tmp/extensionuploads/'.$sessid, - 'files'=>$files, - 'patch'=>empty($this->params['patch'])?0:$this->params['patch'] +// 'relative'=>'tmp/extensionuploads/'.$sessid, + 'files' => $files, + 'patch' => empty($this->params['patch']) ? 0 : $this->params['patch'] )); } } } public function install_extension_finish() { - $patch =$this->params['patch']==1; $sessid = session_id(); $success = array(); - if (!file_exists(BASE."tmp/extensionuploads/$sessid") || !is_dir(BASE."tmp/extensionuploads/$sessid")) { + if (!file_exists(BASE . "tmp/extensionuploads/$sessid") || !is_dir(BASE . "tmp/extensionuploads/$sessid")) { $nofiles = 1; } else { - foreach (array_keys(expFile::listFlat(BASE."tmp/extensionuploads/$sessid",true,null,array(),BASE."tmp/extensionuploads/$sessid")) as $file) { + foreach (array_keys(expFile::listFlat(BASE . "tmp/extensionuploads/$sessid",true,null, array(),BASE . "tmp/extensionuploads/$sessid")) as $file) { if ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') { - if ($patch) { // this is a patch/fix extension + if (!empty($this->params['patch']) && $this->params['patch'] == 1) { // this is a patch/fix for root folder expFile::makeDirectory(dirname($file)); - $success[$file] = copy(BASE."tmp/extensionuploads/$sessid".$file,BASE.substr($file,1)); - if (basename($file) == 'views_c') chmod(BASE.substr($file,1),0777); + $success[$file] = copy(BASE . "tmp/extensionuploads/$sessid" . $file,BASE . substr($file,1)); + if (basename($file) == 'views_c') + chmod(BASE . substr($file,1),0777); } else { - $newfile = substr($file,1); - if (substr($newfile,0,7)=='themes/') { // this is a theme extension - $parts = explode('/',$newfile); - $parts[1] = DISPLAY_THEME_REAL; - $newfile = implode('/',$parts); - } else { // this is a mod extension + $newfile = substr($file,1); // remove leading slash + if (substr($newfile,0,7) == 'themes/') { // this is a theme +// $parts = explode('/',$newfile); +// $parts[1] = DISPLAY_THEME_REAL; // place it in our theme instead of theirs? +// $newfile = implode('/',$parts); + } else { // this is a custom mod to place within current theme $newfile = str_replace("framework/", "", $newfile); - $newfile = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace("modules-1", "modules", $newfile); + $newfile = 'themes/' . DISPLAY_THEME_REAL . '/' . str_replace("modules-1", "modules", $newfile); } expFile::makeDirectory(dirname($newfile)); - $success[$newfile] = copy(BASE."tmp/extensionuploads/$sessid".$file,BASE.$newfile); + $success[$newfile] = copy(BASE . "tmp/extensionuploads/$sessid" . $file,BASE.$newfile); } } } - $del_return = expFile::removeDirectory(BASE."tmp/extensionuploads/$sessid"); //FIXME shouldn't use echo + $del_return = expFile::removeDirectory(BASE . "tmp/extensionuploads/$sessid"); //FIXME shouldn't use echo // echo $del_return; $tables = expDatabase::install_dbtables(); ksort($tables); assign_to_template(array( - 'tables'=>$tables + 'tables' => $tables )); $nofiles = 0; } assign_to_template(array( - 'nofiles'=>$nofiles, - 'success'=>$success, - 'redirect'=>expHistory::getLastNotEditable() + 'nofiles' => $nofiles, + 'success' => $success, + 'redirect' => expHistory::getLastNotEditable() )); } diff --git a/framework/modules/administration/views/administration/install_extension.bootstrap3.tpl b/framework/modules/administration/views/administration/install_extension.bootstrap3.tpl index 5bec689eaf..02e01e27bf 100644 --- a/framework/modules/administration/views/administration/install_extension.bootstrap3.tpl +++ b/framework/modules/administration/views/administration/install_extension.bootstrap3.tpl @@ -33,7 +33,7 @@ {form action=install_extension_confirm} {foreach from=$themes item=theme name=themes}
-
{control type="checkbox" name="files['`$theme->title`']" label=" " value="`$theme->enclosure`"}
+
{control type="checkbox" name="files[`$theme->title`]" label=" " value="`$theme->enclosure`"}

{$theme->title}

{'Dated'|gettext}: {$theme->publish_date|format_date:$smarty.const.DISPLAY_DATETIME_FORMAT} @@ -44,7 +44,6 @@
{*{$theme->body|summarize:"html":"paralinks"}*} {$theme->body|summarize:"html":"parahtml"} - {br} {'More Information'|gettext}
@@ -60,7 +59,7 @@ {control type=hidden name=patch value=1} {foreach from=$fixes item=fix name=fixes}
-
{control type="checkbox" name="files['`$fix->title`']" label=" " value="`$fix->enclosure`"}
+
{control type="checkbox" name="files[`$fix->title`]" label=" " value="`$fix->enclosure`"}

{$fix->title}

{'Dated'|gettext}: {$fix->publish_date|format_date:$smarty.const.DISPLAY_DATETIME_FORMAT} @@ -71,7 +70,6 @@
{*{$fix->body|summarize:"html":"paralinks"}*} {$fix->body|summarize:"html":"parahtml"} - {br} {'More Information'|gettext}
@@ -86,7 +84,7 @@ {form action=install_extension_confirm} {foreach from=$mods item=mod name=mods}
-
{control type="checkbox" name="files['`$mod->title`']" label=" " value="`$mod->enclosure`"}
+
{control type="checkbox" name="files[`$mod->title`]" label=" " value="`$mod->enclosure`"}

{$mod->title}

{'Dated'|gettext}: {$mod->publish_date|format_date:$smarty.const.DISPLAY_DATETIME_FORMAT} @@ -97,7 +95,6 @@
{*{$mod->body|summarize:"html":"paralinks"}*} {$mod->body|summarize:"html":"parahtml"} - {br} {'More Information'|gettext}
diff --git a/framework/modules/administration/views/administration/install_extension.tpl b/framework/modules/administration/views/administration/install_extension.tpl index efab10e617..f37cec7a3b 100644 --- a/framework/modules/administration/views/administration/install_extension.tpl +++ b/framework/modules/administration/views/administration/install_extension.tpl @@ -33,7 +33,7 @@ {form action=install_extension_confirm} {foreach from=$themes item=theme name=themes}
-
{control type="checkbox" name="files['`$theme->title`']" label=" " value="`$theme->enclosure`"}
+
{control type="checkbox" name="files[`$theme->title`]" label=" " value="`$theme->enclosure`"}

{$theme->title}

{'Dated'|gettext}: {$theme->publish_date|format_date:$smarty.const.DISPLAY_DATETIME_FORMAT} @@ -60,7 +60,7 @@ {control type=hidden name=patch value=1} {foreach from=$fixes item=fix name=fixes}
-
{control type="checkbox" name="files['`$fix->title`']" label=" " value="`$fix->enclosure`"}
+
{control type="checkbox" name="files[`$fix->title`]" label=" " value="`$fix->enclosure`"}

{$fix->title}

{'Dated'|gettext}: {$fix->publish_date|format_date:$smarty.const.DISPLAY_DATETIME_FORMAT} @@ -86,7 +86,7 @@ {form action=install_extension_confirm} {foreach from=$mods item=mod name=mods}
-
{control type="checkbox" name="files['`$mod->title`']" label=" " value="`$mod->enclosure`"}
+
{control type="checkbox" name="files[`$mod->title`]" label=" " value="`$mod->enclosure`"}

{$mod->title}

{'Dated'|gettext}: {$mod->publish_date|format_date:$smarty.const.DISPLAY_DATETIME_FORMAT} diff --git a/framework/modules/administration/views/administration/manage_themes.tpl b/framework/modules/administration/views/administration/manage_themes.tpl index 2ef7a1d374..acc0401adc 100755 --- a/framework/modules/administration/views/administration/manage_themes.tpl +++ b/framework/modules/administration/views/administration/manage_themes.tpl @@ -58,7 +58,6 @@ {if $theme->style_variations|@count>0} - {*
{"Style Variations"|gettext}
*} {foreach from=$theme->style_variations item=sv key=svkey name=styles} {group label=$sv|ucfirst|cat:' '|cat:'Style'|gettext} {if $smarty.const.DISPLAY_THEME == $class && $smarty.const.DISPLAY_THEME == $smarty.const.DISPLAY_THEME_REAL && $smarty.const.THEME_STYLE == $smarty.const.THEME_STYLE_REAL && @@ -66,13 +65,11 @@ {elseif $smarty.const.DISPLAY_THEME == $class && ($smarty.const.THEME_STYLE == $sv || ($smarty.const.THEME_STYLE == "" && $sv == "Default"))} ({"Previewing"|gettext}) {else} - {*{icon img="view.png" action=theme_preview theme=$class sv=$sv title="Preview this Theme"|gettext}*} {icon class="view" action=theme_preview theme=$class sv=$sv title="Preview this Theme Style"|gettext text="Preview"|gettext} {/if} {if $smarty.const.DISPLAY_THEME_REAL == $class && ($smarty.const.THEME_STYLE_REAL == $sv || ($smarty.const.THEME_STYLE_REAL == "" && $sv == "Default"))} ({"Current"|gettext}) {else} - {*{$sv}*} {icon class="switchtheme add" action=theme_switch theme=$class sv=$sv title='Select this Theme Style'|gettext text='Use'|gettext} {/if} {if ($theme->user_configured)} @@ -87,13 +84,11 @@ {else} {group label='Default Style'|gettext} {if $smarty.const.DISPLAY_THEME != $class} - {*{icon img="view.png" action=theme_preview theme=$class title="Preview this Theme"|gettext}*} {icon class="view" action=theme_preview theme=$class title="Preview this Theme"|gettext text="Preview"|gettext} {elseif $smarty.const.DISPLAY_THEME_REAL != $smarty.const.DISPLAY_THEME} ({"Previewing"|gettext}) {/if} {if $smarty.const.DISPLAY_THEME_REAL != $class} - {*{"Use"|gettext}*} {icon class="switchtheme add" action=theme_switch theme=$class title='Select this Theme'|gettext text="Use"|gettext} {else} ({"Current"|gettext}) @@ -103,9 +98,9 @@ {/if} {/group} {/if} - {if (!$theme->stock_theme)} + {*{if (!$theme->stock_theme)}*} {icon class=export action=export_theme theme=$class title="Export this Theme"|gettext} - {/if} + {*{/if}*} {/foreach}