Example #1
0
function video_display($content_to_display)
{
    $videoPattern = "/{{2}(video:[A-Za-z0-9\\-\\_ \\.\\(\\)'\"]+){{2}/";
    $videoIds = getFilterIds($content_to_display, $videoPattern);
    $videos = array();
    foreach ($videoIds as $videoId) {
        $videoname = end(explode(":", $videoId));
        $videos[] = Videos::FindByName($videoname);
    }
    foreach ($videos as $thevid) {
        if (is_object($thevid)) {
            $replacement = $thevid->embed_video();
            $content_to_display = updateContent($content_to_display, "/{{2}video:" . str_replace(")", "\\)", str_replace("(", "\\(", $thevid->slug)) . "{{2}/", $replacement);
        } else {
            $content_to_display = "<span class=\"database_error\">HCd&gt;CMS Warning: Video &ldquo;{$videoname}&rdquo; not found!</span> " . $content_to_display;
        }
    }
    return $content_to_display;
}
Example #2
0
 function numberOfPagesReferencing()
 {
     $pages = Pages::FindAll();
     // this should work, but it doesn't ensure that the >>s are balanced (ie, it will also match <<image>>)
     $anyImagePattern = "/([>{2}<{2}]){$oldName}([>{2}<{2}])/";
     foreach ($pages as $page) {
         $replacement = '$1' . $newName . '$2';
         $page->content = updateContent($page->content, $anyImagePattern, $replacement);
         $page->save();
     }
     return 0;
 }
Example #3
0
     if ($_FILES["ext5"]["tmp_name"] != "" && $_POST["ext5_chk"] != 1) {
         $myext5 = savefile("ext5", $table . "5_");
     } else {
         if ($_POST["ext5"] != "" && $_POST["ext5_chk"] != 1) {
             $myext5 = ",ext5='" . $_POST["ext5"] . "'";
         } else {
             if ($_POST["ext5_chk"] == 1) {
                 $myext5 = ",ext5=null";
             }
         }
     }
     //si pas de changement d'etat
     $szQuery = "update {$table} set \r\n    \t\t\t\t\ttitre1='" . addquote($_POST["titre1"]) . "',\r\n    \t\t\t\t\ttitre2='" . addquote($_POST["titre2"]) . "',\r\n    \t\t\t\t\ttitre3='" . addquote($_POST["titre3"]) . "',\r\n    \t\t\t\t\ttitre4='" . addquote($_POST["titre4"]) . "',\r\n    \t\t\t\t\ttitre5='" . addquote($_POST["titre5"]) . "',\r\n    \t\t\t\t\tabstract='" . addquote($_POST["abstract"]) . "',\r\n              abstract2='" . addquote($_POST["abstract2"]) . "',\r\n    \t\t\t\t\tabstract3='" . addquote($_POST["abstract3"]) . "',\r\n    \t\t\t\t\tabstract4='" . addquote($_POST["abstract4"]) . "',\r\n    \t\t\t\t\tabstract5='" . addquote($_POST["abstract5"]) . "',\r\n    \t\t\t\t\tcontenu='" . addquote($_POST["contenu"]) . "',\r\n    \t\t\t\t\tdate_actu='" . datetimebdd($_POST["date_actu"]) . "',\r\n    \t\t\t\t\tdate_fin='" . datetimebdd($_POST["date_fin"]) . "',\r\n    \t\t\t\t\tnote='" . $_POST["note"] . "',\r\n    \t\t\t\t\tversion_id='" . $_POST["version_id"] . "',\r\n    \t\t\t\t\ttwitter='" . $_POST["twitter"] . "',\r\n    \t\t\t\t\ttva_id='" . $_POST["tva_id"] . "',\r\n    \t\t\t\t\tfournisseur_id='" . $_POST["fournisseur_id"] . "',\r\n              note1='" . $_POST["note1"] . "',\r\n              note2='" . $_POST["note2"] . "',\r\n              note3='" . $_POST["note3"] . "',\r\n              note4='" . $_POST["note4"] . "',\r\n              archive='" . $_POST["archive"] . "',\r\n              envoye='" . $_POST["envoye"] . "',\r\n              titleseo='" . addquote($_POST["titleseo"]) . "',\r\n              abstractseo='" . addquote($_POST["abstractseo"]) . "',\r\n              robotseo='" . addquote($_POST["robotseo"]) . "'\r\n    \t\t\t\t\t{$myext}\r\n    \t\t\t\t\t{$myext2}\r\n    \t\t\t\t\t{$myext3}\r\n    \t\t\t\t\t{$myext4}\r\n              {$myext5}\r\n              where content_id=" . $content_id;
     majfichier($content_id);
     majval($content_id);
     updateContent($content_id, $_GET["arbre_id"], $_GET["langue_id"]);
     createdefault("ext", $table, $content_id);
     createdefault("ext2", $table . "2_", $content_id);
     createdefault("ext3", $table . "3_", $content_id);
     createdefault("ext4", $table . "4_", $content_id);
     createdefault("ext5", $table . "5_", $content_id);
 }
 if ($_POST["version_id"] == 1) {
     $sql = "update " . __racinebd__ . "contenu set translate=1 where contenu_id=" . $contenu_id;
     query($sql);
 }
 $sql = "delete from " . __racinebd__ . "tag_content where content_id=" . $content_id;
 query($sql);
 //sauvegarde des tags 1
 for ($i = 0; $i < count($_POST["tag_id"]); $i++) {
     $sql = "insert into " . __racinebd__ . "tag_content (tag_id,content_id) values (" . $_POST["tag_id"][$i] . "," . $_GET["id"] . ")";
Example #4
0
function processEditContent()
{
    $contentID = $_POST['ContentID'];
    $title = $_POST['Title'];
    $content = $_POST['Content'];
    $url = $_POST['Url'];
    $errors = '';
    if (empty($title) || strlen($headline) > 50) {
        $errors .= '<br />* Provide a headline that is less than 50 characters';
    }
    if (empty($content) || strlen($content) > 3000) {
        $errors .= '<br />* Provide content that is less than 3,000 characters';
    }
    $userID = $_SESSION['UserID'];
    $result = updateContent($contentID, $title, $content, $userID);
    if ($result) {
        header("Location:{$url}");
    } else {
        $errorMsg = print_r($result);
        include '../view/errorPage.php';
    }
}
<?php

require_once "edit_functions.php";
if (isset($_POST["update_plate"])) {
    updateContent($_POST["id"], $_POST["title"], $_POST["media"]);
}
//edit.php
// aadressireal on ?edit_id siis trükin välja selle väärtuse
if (isset($_GET["edit_id"])) {
    echo $_GET["edit_id"];
    // id oli aadressireal
    // tahaks ühte rida kõige uuemaid andmeid kus id on $_GET["edit_id"]
    $content = getEditData($_GET["edit_id"]);
    var_dump($car);
} else {
    // ei olnud aadressireal
    echo "VIGA";
    // die - edasi lehte ei laeta
    //die();
    //suuname kasutaja table.php lehele
    header("Location: table.php");
}
?>

<h2>Muuda postitust</h2>
<form action="<?php 
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post" >
	<input type="hidden" name="id" value="<?php 
echo $_GET["edit_id"];
Example #6
0
 function UpdateProductReferences($oldName, $newName)
 {
     $pages = Pages::FindAll();
     $anyProductPattern = "/{{2}(product:{$oldName}+){{2}/";
     foreach ($pages as $page) {
         $replacement = '{{product:' . $newName . '{{';
         $page->content = updateContent($page->content, $anyProductPattern, $replacement);
         $page->save();
     }
 }
Example #7
0
 function remove_from_content()
 {
     // Not Done or Tested yet
     // A function to cycle through content types and remove references when deleting a video
     $videoPattern = "/{{2}(video:[A-Za-z0-9\\-\\_ \\.\\(\\)'\"]+){{2}/";
     $videoIds = getFilterIds($content_to_display, $videoPattern);
     $videos = array();
     foreach ($videoIds as $videoId) {
         $videos[] = Videos::FindByName(end(explode(":", $videoId)));
     }
     foreach ($videos as $thevid) {
         if (is_object($thevid)) {
             $replacement = $thevid->get_embed();
             $content_to_display = updateContent($content_to_display, "/{{2}video:" . str_replace(")", "\\)", str_replace("(", "\\(", $thevid->name)) . "{{2}/", $replacement);
         } else {
             $content_to_display = "<span class=\"database_error\">HCd&gt;CMS Warning: Video not found!</span> " . $content_to_display;
         }
     }
     return $content_to_display;
 }
function mail_image_display($content_to_display)
{
    $pattern_recog = array("left" => array("{", "{"), "right" => array("}", "}"), "reg" => array("{", "}"));
    foreach ($pattern_recog as $float => $direction) {
        $imagePattern = "*" . $direction[0] . "{2}([A-Za-z0-9_ \\-]+)" . $direction[1] . "{2}*";
        $imageIds = getFilterIds($content_to_display, $imagePattern);
        $images = array();
        foreach ($imageIds as $imageId) {
            if ($imageId == "random") {
                $random_image = Images::FindRandom();
                $random_image->name = "random";
                $images[] = $random_image;
            } else {
                if ($imageId == "random_cover") {
                    $random_image = Images::FindRandomCover();
                    $random_image->name = "random_cover";
                    $images[] = $random_image;
                } else {
                    $images[] = Images::FindByName($imageId);
                }
            }
        }
        foreach ($images as $key => $image) {
            if (isset($image)) {
                if (substr($image->description, 0, 7) == "http://") {
                    $replacement = "<span class=\"photo{$float}\"><a href=\"{$image->description}\"><img src=\"http://" . SITE_URL . get_link("/images/view/" . $image->id) . "\" alt=\"" . $image->title . "\" /></a>";
                    $replacement .= "<br /><a href=\"{$image->description}\">" . $image->title . "</a></span>";
                } else {
                    $replacement = "<span class=\"photo{$float}\"><img src=\"http://" . SITE_URL . get_link("/images/view/" . $image->id) . "\" alt=\"" . $image->title . "\" />";
                    if ($image->description != "") {
                        $replacement .= "<br />" . $image->description;
                    }
                    $replacement .= "</span>";
                }
                $content_to_display = updateContent($content_to_display, "*" . $direction[0] . "{2}{$image->name}" . $direction[1] . "{2}*", $replacement);
            }
        }
    }
    return $content_to_display;
}