Skip to content

Commit

Permalink
Added check for iconv and mbstring during install. Logic checks for i…
Browse files Browse the repository at this point in the history
…conv function exists first, if it does then it will not check for mbstring as only 1 is needed.

If neither are available then it will prompt for user to enable mbstring. This is only based on the assumption mbstring is better/quicker and should also be easier to enable in php by a user.
  • Loading branch information
ecommercehq committed Apr 6, 2014
1 parent 53c376a commit 8f4a588
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 9 additions & 2 deletions upload/install/controller/step_2.php
Expand Up @@ -10,7 +10,7 @@ public function index() {
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
$this->data['error_warning'] = '';
}

$this->data['action'] = $this->url->link('step_2');
Expand All @@ -31,7 +31,7 @@ public function index() {
$this->children = array(
'header',
'footer'
);
);

$this->response->setOutput($this->render());
}
Expand Down Expand Up @@ -69,6 +69,13 @@ private function validate() {
$this->error['warning'] = 'Warning: ZLIB extension needs to be loaded for OpenCart to work!';
}

if (!function_exists('iconv')) {
// iconv or mbstrings are used in the utf8 helper. Only 1 is needed but suggested to enable mbstring if iconv is not set
if (!extension_loaded('mbstring')) {
$this->error['warning'] = 'Warning: mbstring extension needs to be loaded for OpenCart to work!';
}
}

if (!file_exists(DIR_OPENCART . 'config.php')) {
$this->error['warning'] = 'Warning: config.php does not exist. You need to rename config-dist.php to config.php!';
} elseif (!is_writable(DIR_OPENCART . 'config.php')) {
Expand Down
10 changes: 9 additions & 1 deletion upload/install/view/template/step_2.tpl
Expand Up @@ -93,6 +93,14 @@
<td>On</td>
<td align="center"><?php echo extension_loaded('zlib') ? '<img src="view/image/good.png" alt="Good" />' : '<img src="view/image/bad.png" alt="Bad" />'; ?></td>
</tr>
<?php if (!function_exists('iconv')) { ?>
<tr>
<td>mbstring:</td>
<td><?php echo extension_loaded('mbstring') ? 'On' : 'Off'; ?></td>
<td>On</td>
<td align="center"><?php echo extension_loaded('mbstring') ? '<img src="view/image/good.png" alt="Good" />' : '<img src="view/image/bad.png" alt="Bad" />'; ?></td>
</tr>
<?php } ?>
</table>
</fieldset>
<p>3. Please make sure you have set the correct permissions on the files list below.</p>
Expand Down Expand Up @@ -167,4 +175,4 @@
</div>
</form>
</div>
<?php echo $footer; ?>
<?php echo $footer; ?>

0 comments on commit 8f4a588

Please sign in to comment.