Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions TextformatterVideoEmbed.module
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ class TextformatterVideoEmbed extends Textformatter implements ConfigurableModul
*/
protected function getEmbedCode($oembedURL, $videoID) {

$db = wire('db');
$videoID = $db->escape_string($videoID);
$result = $db->query("SELECT embed_code FROM " . self::dbTableName . " WHERE video_id='$videoID'");
$database = wire('database');
$videoID = $database->escape_string($videoID);
$result = $database->query("SELECT embed_code FROM " . self::dbTableName . " WHERE video_id='$videoID'");

if($result->num_rows) {
list($embedCode) = $result->fetch_row();
if($result->rowCount()) {

list($embedCode) = $result->fetch();

} else {

Expand All @@ -87,15 +88,16 @@ class TextformatterVideoEmbed extends Textformatter implements ConfigurableModul

$sql = "INSERT INTO " . self::dbTableName . " SET " .
"video_id='$videoID', " .
"embed_code='" . $db->escape_string($embedCode) . "', " .
"embed_code='" . $database->escape_string($embedCode) . "', " .
"created=NOW() ";

$db->query($sql);
$database->query($sql);
}

$result->free();
}

$result->closeCursor();

// account for possibility that stored embed code contains http version while requested on https
if($this->http == 'https') $embedCode = str_replace('http://', 'https://', $embedCode);

Expand Down Expand Up @@ -252,7 +254,7 @@ class TextformatterVideoEmbed extends Textformatter implements ConfigurableModul
"created TIMESTAMP NOT NULL " .
")";

wire('db')->query($sql);
wire('database')->query($sql);

}

Expand All @@ -261,7 +263,7 @@ class TextformatterVideoEmbed extends Textformatter implements ConfigurableModul
*
*/
public function ___uninstall() {
try { wire('db')->query("DROP TABLE " . self::dbTableName); } catch(Exception $e) { }
try { wire('database')->query("DROP TABLE " . self::dbTableName); } catch(Exception $e) { }
}


Expand Down