Skip to content

Commit

Permalink
Merge pull request #96 from Maescool/nextgen
Browse files Browse the repository at this point in the history
Add possibility to change the javascript url.
  • Loading branch information
dapphp authored May 30, 2020
2 parents 09d735e + 8339b48 commit 16d8bc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions StorageAdapter/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected function checkTablesExist()
if (!$result) {
$err = $this->pdo_conn->errorInfo();

if ($this->database_driver == self::SI_DRIVER_SQLITE3 &&
if ($this->database_driver == \Securimage::SI_DRIVER_SQLITE3 &&
$err[1] === 1 && strpos($err[2], 'no such table') !== false)
{
return false;
Expand Down Expand Up @@ -444,7 +444,7 @@ protected function purgeOldCodesFromDatabase()
$query = sprintf("DELETE FROM %s WHERE %s - created > %s",
$this->database_table,
$now,
$this->pdo_conn->quote("$limit", PDO::PARAM_INT)
$this->pdo_conn->quote("$limit", \PDO::PARAM_INT)
);

$result = $this->pdo_conn->query($query);
Expand Down
2 changes: 1 addition & 1 deletion WavFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ public function setSampleValue($sampleFloat, $blockNum, $channelNum)
} else {
// replace
for ($i = 0; $i < $sampleBytes; ++$i) {
$this->_samples{$offset + $i} = $sampleBinary{$i};
$this->_samples[$offset + $i] = $sampleBinary[$i];
}
}

Expand Down
7 changes: 7 additions & 0 deletions securimage.php
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,8 @@ public function check($code, $captchaId = null, $alwaysDelete = false)
* true/false Whether or not to show a button to refresh the image (default: true)
* 'audio_icon_url':
* URL to the image used for showing the HTML5 audio icon
* 'js_url':
* URL to the javascript file
* 'icon_size':
* Size (for both height & width) in pixels of the audio and refresh buttons
* 'show_text_input':
Expand Down Expand Up @@ -1129,6 +1131,7 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
$icon_size = (isset($options['icon_size'])) ? $options['icon_size'] : 32;
$audio_play_url = (isset($options['audio_play_url'])) ? $options['audio_play_url'] : null;
$audio_swf_url = (isset($options['audio_swf_url'])) ? $options['audio_swf_url'] : null;
$js_url = (isset($options['js_url'])) ? $options['js_url'] : null;
$show_input = (isset($options['show_text_input'])) ? (bool)$options['show_text_input'] : true;
$refresh_alt = (isset($options['refresh_alt_text'])) ? $options['refresh_alt_text'] : 'Refresh Image';
$refresh_title = (isset($options['refresh_title_text'])) ? $options['refresh_title_text'] : 'Refresh Image';
Expand Down Expand Up @@ -1193,6 +1196,10 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
$swf_path = $audio_swf_url;
}

if (!empty($js_url)) {
$js_path = $js_url;
}

$audio_obj = $image_id . '_audioObj';
$html = '';

Expand Down

0 comments on commit 16d8bc8

Please sign in to comment.