Skip to content

Commit

Permalink
Merge branch 'hotfixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
conejoninja committed Dec 29, 2016
2 parents 7e88b75 + 2d2d035 commit fb709a6
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 22 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Osclass 3.7.1 2016-12-27
------------------------

- Fixed URL params error
- Blocked upgrade on demo sites
- Fixed some minor details

Osclass 3.7.0 2016-12-12
------------------------

Expand Down
18 changes: 12 additions & 6 deletions oc-admin/ajax/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,18 @@ function doModel()
******************************/
case 'upgrade': // AT THIS POINT WE KNOW IF THERE'S AN UPDATE OR NOT
osc_csrf_check();
$result = osc_do_upgrade();
if(!defined('__FROM_CRON__') || !__FROM_CRON__) {
if($result['error']==0) {
osc_add_flash_ok_message($result['message'], 'admin');
} else if($result['error']==6) {
osc_add_flash_warning_message($result['message'], 'admin');
if( defined('DEMO') ) {
$msg = __("This action cannot be done because it is a demo site");
$result = array("error" => 6, "message" => $msg);
osc_add_flash_warning_message( $msg, 'admin');
} else {
$result = osc_do_upgrade();
if (!defined('__FROM_CRON__') || !__FROM_CRON__) {
if ($result['error'] == 0) {
osc_add_flash_ok_message($result['message'], 'admin');
} else if ($result['error'] == 6) {
osc_add_flash_warning_message($result['message'], 'admin');
}
}
}
echo json_encode($result);
Expand Down
4 changes: 4 additions & 0 deletions oc-admin/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function doModel()
$this->redirectTo( osc_admin_base_url(true) . '?page=tools&action=locations' );
break;
case('upgrade'):
if( defined('DEMO') ) {
osc_add_flash_warning_message( _m("This action cannot be done because it is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true));
}
$this->doView('tools/upgrade.php');
break;
case 'version': $this->doView('tools/version.php');
Expand Down
7 changes: 6 additions & 1 deletion oc-admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ function doModel() {
//specific things for this class
switch ($this->action)
{
case 'upgrade-funcs': require(LIB_PATH.'osclass/upgrade-funcs.php');
case 'upgrade-funcs':
if( defined('DEMO') ) {
osc_add_flash_warning_message( _m("This action cannot be done because it is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true));
}
require(LIB_PATH.'osclass/upgrade-funcs.php');
break;
default: $this->doView('upgrade/index.php');
}
Expand Down
11 changes: 4 additions & 7 deletions oc-includes/osclass/classes/Rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function init()
$this->http_referer = $ref_match[1];
$_SERVER['REQUEST_URI'] = preg_replace('|[\?&]{1}http_referer=(.*)$|', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
}
$request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
$request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", Params::getServerParam('REQUEST_URI', false, false));
$this->raw_request_uri = $request_uri;
$route_used = false;
foreach($this->routes as $id => $route) {
Expand Down Expand Up @@ -187,12 +187,9 @@ public function extractParams($uri = '')
$uri_array = explode('?', $uri);
$length_i = count($uri_array);
for($var_i = 1;$var_i<$length_i;$var_i++) {
$aValues = preg_split('/&[a-z0-9]+=/i', '&'.$uri_array[$var_i], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
if(preg_match_all('|&([^=]+)=|', '&'.$uri_array[$var_i], $matches)) {
$length = count($matches[1]);
for($var_k = 0;$var_k<$length;$var_k++) {
Params::setParam($matches[1][$var_k], $aValues[$var_k]);
}
parse_str($uri_array[$var_i], $parsedVars);
foreach($parsedVars as $k => $v) {
Params::setParam($k, urldecode($v));
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions oc-includes/osclass/classes/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ public function getScripts()
public function printScripts()
{
foreach($this->getScripts() as $script) {
if($script!='') {}
echo '<script type="text/javascript" src="' . osc_apply_filter('theme_url', $script) . '"></script>' . PHP_EOL;
if($script!='') {
echo '<script type="text/javascript" src="' . osc_apply_filter('theme_url', $script) . '"></script>' . PHP_EOL;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion oc-includes/osclass/installer/basic_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INSERT INTO /*TABLE_PREFIX*/t_currency (pk_c_code, s_name, s_description, b_enab
('EUR', 'European Union euro', 'Euro €', true);

INSERT INTO /*TABLE_PREFIX*/t_preference VALUES
('osclass', 'version', 370, 'INTEGER')
('osclass', 'version', 371, 'INTEGER')
,('osclass', 'theme', 'bender', 'STRING')
,('osclass', 'admin_language', 'en_US', 'STRING')
,('osclass', 'language', 'en_US', 'STRING')
Expand Down
3 changes: 0 additions & 3 deletions oc-includes/osclass/model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ public function totalItems($categoryId = null, $options = null)
case 'ENABLED':
$this->dao->where('i.b_enabled', 1);
break;
case 'ENABLED':
$this->dao->where('i.b_enabled', 1);
break;
case 'DISABLED':
$this->dao->where('i.b_enabled', 0);
break;
Expand Down
2 changes: 1 addition & 1 deletion oc-includes/osclass/upgrade-funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@
$comm->query(sprintf("ALTER TABLE %st_preference MODIFY s_name VARCHAR(128) NOT NULL", DB_TABLE_PREFIX));
}

osc_changeVersionTo(370);
osc_changeVersionTo(371);

if(!defined('IS_AJAX') || !IS_AJAX) {
if(empty($aMessages)) {
Expand Down
2 changes: 1 addition & 1 deletion oc-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/


define('OSCLASS_VERSION', '3.7.0');
define('OSCLASS_VERSION', '3.7.1');

if( !defined('ABS_PATH') ) {
define( 'ABS_PATH', str_replace('\\', '/', dirname(__FILE__) . '/' ));
Expand Down

0 comments on commit fb709a6

Please sign in to comment.