} else { echo "Error selecting database, exited."; exit; } $blog_id = isset($_POST['blog_id']) ? $_POST['blog_id'] : $_GET['blog_id']; $app = isset($_POST['app']) ? $_POST['app'] : $_GET['app']; if (!isset($blog_id)) { echo "blog_id paramater missing"; } else { $selectSQL = "SELECT * FROM blogs WHERE blog_id=" . $blog_id . " AND removed = 'N'"; $get_blog = mysql_query_or_die($selectSQL, $useradmin); $blogObject = array(); if ($row_get_blog = mysql_fetch_assoc($get_blog)) { $blogObject = $row_get_blog; } $blogObject['blog_content'] = preg_replace('/\\012/', '<br/>', linkifyYouTubeURLs($blogObject['blog_content'])); $blogObject['blog_content'] = replace_hyperlink($blogObject['blog_content']); } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title><?php echo isset($blogObject['blog_title']) && $blogObject['blog_title'] != '' ? $blogObject['blog_title'] : drupal_substr(str_replace('"', '\\"', preg_replace('/^.+:/', '', $clean_cotent)), 0, 45); ?> </title> <meta name="description" content="<?php echo drupal_substr(str_replace('"', '\\"', $clean_cotent), 0, 200);
if ($isplayer) { $size = ''; if (array_key_exists('width', $_REQUEST)) { $width = $_REQUEST['width']; $size = 'width="' . $width . '" '; } else { $width = '100%'; } if (array_key_exists('height', $_REQUEST)) { $height = $_REQUEST['height']; $size = $size . ' height="' . $height . '"'; } else { $height = '100%'; } if ($type_source == 'youtube') { print linkifyYouTubeURLs($filedata['URL'], $size); //returns iframe } else { if ($type_source == 'gdrive') { print linkifyGoogleDriveURLs($filedata['URL'], $size); //returns iframe } else { if ($type_media == 'image') { $size = 'width="' . $width . '" height="' . $height . '"'; $annot_edit = $isannotation_editor ? '&annedit=yes' : ''; $text = '<iframe ' . $size . ' src="' . HEURIST_BASE_URL . 'records/files/mediaViewer.php?ulf_ID=' . $_REQUEST['ulf_ID'] . $annot_edit . '&db=' . $_REQUEST['db'] . '" frameborder="0"></iframe>'; print $text; } else { if ($type_media == 'document' && $filedata['mimeType']) { print '<embed width="100%" height="80%" name="plugin" src="' . $filedata['URL'] . '" type="' . $filedata['mimeType'] . '" />'; } else {
$found[] = $img_tag; preg_match_all('/(alt|title|src|width|height|id)=("[^"]*")/i', $img_tag, $imgs[htmlspecialchars($img_tag)]); } } $contentImgs = array(); foreach ($imgs as $img) { $contentImgs[] = array(); $j = count($contentImgs) - 1; for ($i = 0; $i < count($img[1]); $i++) { $contentImgs[$j][$img[1][$i]] = str_replace("\"", "", $img[2][$i]); } } $parsedImgs = array(); foreach ($contentImgs as $img) { if ($img['id'] === "youtubevideo") { $src = 'http://www.youtube.com/embed/' . linkifyYouTubeURLs($img['src']); $parsedImgs[] = '<iframe width="' . $img['width'] . '" height="' . $img['height'] . '" src="' . $src . '" frameborder="0" allowfullscreen="allowfullscren"></iframe>'; } } $_POST['editor'] = str_replace($found, $parsedImgs, $_POST['editor']); $_POST['editor'] = htmlspecialchars($_POST['editor']); preg_match('!\\d+!', $_POST['id'], $results); $_POST['id'] = $results[0]; //echo $_POST['title']."<br>"; //echo $_POST['editor']; //printr($_POST); $update = QueryFactory::Build("update")->Table("articles")->Where(["id", "=", $_POST['id']]); $update->Set(["title", $_POST['title']], ['content', $_POST['editor']], ['updated', "UNIX_TIMESTAMP()"]); DatabaseManager::Query($update); } // Linkify youtube URLs which are not already links.
function smarty_function_wrap($params, &$smarty) { if ($params['var']) { if (array_key_exists('dt', $params)) { $dt = $params['dt']; } if (array_key_exists('mode', $params)) { $mode = $params['mode']; } else { $mode = null; } $label = ""; if (array_key_exists('lbl', $params) && $params['lbl'] != "") { $label = $params['lbl']; } $width = ""; $mapsize = "width=200"; if (array_key_exists('width', $params) && $params['width'] != "") { $width = $params['width']; if (is_numeric($width) < 0) { $width = $width . "px"; $mapsize = "width=" . $width; } } $height = ""; if (array_key_exists('height', $params) && $params['height'] != "") { $height = $params['height']; if (is_numeric($height) < 0) { $height = $height . "px"; $mapsize = $mapsize . "&height=" . $height; } } if (!(strpos($mapsize, "&") > 0)) { $mapsize = $mapsize . "&height=200"; } $size = ""; if ($width == "" && $height == "") { $size = "width=" . ($dt == 'geo' ? "200px" : "'300px'"); } else { if ($width != "") { $size = "width='" . $width . "'"; } if ($height != "") { $size = $size . " height='" . $height . "'"; } } if ($dt == "url") { return "<a href='" . $params['var'] . "' target='_blank'>" . $params['var'] . "</a>"; } else { if ($dt == "file") { //insert image or link $values = $params['var']; $limit = intval(@$params['limit']); $sres = ""; if (!is_array($values) || !array_key_exists(0, $values)) { $values = array($values); } foreach ($values as $idx => $value) { if ($limit > 0 && $idx >= $limit) { break; } $type_media = $value['mediaType']; if ($mode == "thumbnail") { $sres = $sres . "<a href='" . ($value['playerURL'] ? $value['playerURL'] : $value['URL']) . "' target='_blank'>" . "<img src='" . $value['thumbURL'] . "' title='" . $value['description'] . "'/></a>"; } else { if ($mode == "player") { if ($type_media == 'image') { $sres = $sres . "<img src='" . $value['URL'] . "' " . $size . " title='" . $value['description'] . "'/>"; //.$value['origName']; } else { if ($value['remoteSource'] == 'youtube') { $sres = $sres . linkifyYouTubeURLs($value['URL'], $size); } else { if ($value['remoteSource'] == 'gdrive') { $sres = $sres . linkifyGoogleDriveURLs($value['URL'], $size); } else { if ($type_media == 'document' && $value['mimeType']) { $sres = $sres . '<embed $size name="plugin" src="' . $value['URL'] . '" type="' . $value['mimeType'] . '" />'; } else { if ($type_media == 'video') { // UNFORTUNATELY HTML5 rendering does not work properly // $sres = $sres.createVideoTag($value['URL'], $value['mimeType'], $size); $sres = $sres . createVideoTag2($value['URL'], $value['mimeType'], $size); } else { if ($type_media == 'audio') { $sres = $sres . createAudioTag($value['URL'], $value['mimeType']); } else { $sres = $sres . "Unsupported media type " . $type_media; } } } } } } } else { $lurl = strtolower($value['URL']); if ($value['remoteSource'] == 'youtube') { $sres = $sres . linkifyYouTubeURLs($value['URL'], $size); } else { if ($value['remoteSource'] == 'gdrive') { $sres = $sres . linkifyGoogleDriveURLs($value['URL'], $size); } else { if ($type_media == 'image' || strpos($lurl, ".jpg") > 0 || strpos($lurl, ".png") > 0 || strpos($lurl, ".gif") > 0) { $sres = $sres . "<img src='" . $value['URL'] . "' " . $size . " title='" . $value['description'] . "'/>"; //.$value['origName']; } else { $sres = $sres . "<a href='" . $value['URL'] . "' target='_blank' title='" . $value['description'] . "'>" . $value['origName'] . "</a>"; } } } } } } return $sres; } else { if ($dt == 'geo') { $value = $params['var']; $res = ""; if ($value && $value['wkt']) { $geom = geoPHP::load($value['wkt'], 'wkt'); if (!$geom->isEmpty()) { if (array_key_exists('mode', $params) && $params['mode'] == "link") { $point = $geom->centroid(); if ($label == "") { $label = "on map"; } $res = '<a href="http://maps.google.com/maps?z=18&q=' . $point->y() . "," . $point->x() . '" target="_blank">' . $label . "</a>"; } else { $recid = $value['recid']; $url = HEURIST_BASE_URL . "viewers/map/showMapUrl.php?" . $mapsize . "&q=ids:" . $recid . "&db=" . HEURIST_DBNAME; //"&t="+d; return "<img src=\"" . $url . "\" " . $size . "/>"; } } } return $res; } else { if ($label != "") { $label = $label . ": "; } return $label . $params['var'] . '<br/>'; } } } } else { return ''; } }