Пример #1
0
 $errors = array();
 // Check menu link title
 if (empty($_POST['title'])) {
     $errors[] = "Please enter the link title";
 }
 // Check menu link url
 if (empty($_POST['url'])) {
     $errors[] = "Please enter the page URL";
 }
 // Deal with description meta tag (cut 150 chars from the body if it's empty)
 if (empty($_POST['destination'])) {
     $errors[] = "Please enter the link destination";
 }
 // Deal with weight
 $weight = "1";
 $url = filterURL($_POST['url']);
 if (!empty($errors)) {
     // Errors found, loop through
     $error_message = "<ul>";
     foreach ($errors as $msg) {
         $error_message .= "<li>" . $msg . "</li>";
     }
     $error_message .= "</ul>";
     set_message($error_message, "danger", "none");
 } else {
     $sql = "UPDATE menu_items SET\n\t\t\t\t\t\t\t\ttitle=:title,\n\t\t\t\t\t\t\t\turl=:url,\n\t\t\t\t\t\t\t\tdestination=:destination,\n\t\t\t\t\t\t\t\ttarget=:target,\n\t\t\t\t\t\t\t\tactive=:active\n\t\t\t\t\t\t\tWHERE menuID = :menuID";
     $stmt = $pdo->prepare($sql);
     $stmt->bindParam(':title', $_POST['title'], PDO::PARAM_STR);
     $stmt->bindParam(':url', $url, PDO::PARAM_STR);
     $stmt->bindParam(':destination', $_POST['destination'], PDO::PARAM_STR);
     $stmt->bindParam(':target', $_POST['target'], PDO::PARAM_STR);
Пример #2
0
function getFileURIWithoutLang()
{
    //Form the URL
    $currentPageURL = getPageURL();
    //echo $currentPageURL."<br/>";
    //remove language parameters (for users pages)
    $currentPageURL = filterURL($currentPageURL, "pageLang");
    //echo $currentPageURL."<br/>";
    //remove language parameters (for admins pages)
    $currentPageURL = filterURL($currentPageURL, "lang");
    //echo $currentPageURL."<br/>";
    $currentPageURL = trim($currentPageURL, "&");
    //echo $currentPageURL."<br/>";
    //If last char is not ? return $currentPageURL
    //else : If the URI has ? then append & to it
    //		 else append ?
    if ($currentPageURL[strlen($currentPageURL) - 1] != '?') {
        if (strstr($currentPageURL, '?')) {
            $currentPageURL .= "&";
        } else {
            $currentPageURL .= "?";
        }
    }
    return $currentPageURL;
}
Пример #3
0
     $head_code = "";
 }
 if (!empty($_POST['tags'])) {
     $tags = $_POST['tags'];
 } else {
     $tags = "";
 }
 // Deal with description meta tag (cut 150 chars from the body if it's empty)
 if (empty($_POST['description'])) {
     $description = substr($_POST['body'], 0, 155) . "...";
 } else {
     $description = strip_tags($_POST['description']);
 }
 // If the URL is empty, create an automatic one from the title
 if (empty($_POST['url'])) {
     $url = filterURL($_POST['title']);
 } else {
     $url = $_POST['url'];
 }
 $now = time();
 $sql = "UPDATE cms_pages SET type=:type,title=:title,description=:description,body=:body,updated=:updated,url=:url,template=:template,head_title=:title_tag,head_code=:head_code,tags=:tags WHERE nodeID = :nodeID LIMIT 1";
 $stmt = $pdo->prepare($sql);
 $stmt->bindParam(':type', $type, PDO::PARAM_STR);
 $stmt->bindParam(':title', $_POST['title'], PDO::PARAM_STR);
 $stmt->bindParam(':description', $description, PDO::PARAM_STR);
 $stmt->bindParam(':body', $_POST['body'], PDO::PARAM_STR);
 $stmt->bindParam(':updated', $now, PDO::PARAM_STR);
 $stmt->bindParam(':url', $url, PDO::PARAM_STR);
 $stmt->bindParam(':nodeID', $row->nodeID, PDO::PARAM_STR);
 $stmt->bindParam(':template', $_POST['template'], PDO::PARAM_STR);
 $stmt->bindParam(':title_tag', $title_tag, PDO::PARAM_STR);