示例#1
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype;
     switch (WT_Filter::get('action')) {
         case 'deletenews':
             $news_id = WT_Filter::getInteger('news_id');
             if ($news_id) {
                 deleteNews($news_id);
             }
             break;
     }
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $usernews = getUserNews(WT_USER_ID);
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = '';
     $title .= $this->getTitle();
     $content = '';
     if (count($usernews) == 0) {
         $content .= WT_I18N::translate('You have not created any journal items.');
     }
     foreach ($usernews as $key => $news) {
         $day = date('j', $news['date']);
         $mon = date('M', $news['date']);
         $year = date('Y', $news['date']);
         $content .= "<div class=\"journal_box\">";
         $content .= "<div class=\"news_title\">" . $news['title'] . '</div>';
         $content .= "<div class=\"news_date\">" . format_timestamp($news['date']) . '</div>';
         if ($news["text"] == strip_tags($news["text"])) {
             // No HTML?
             $news["text"] = nl2br($news["text"], false);
         }
         $content .= $news["text"] . "<br><br>";
         $content .= "<a href=\"#\" onclick=\"window.open('editnews.php?news_id='+" . $key . ", '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Edit') . "</a> | ";
         $content .= "<a href=\"index.php?action=deletenews&amp;news_id={$key}&amp;ctype={$ctype}\" onclick=\"return confirm('" . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . "</a><br>";
         $content .= "</div><br>";
     }
     if (WT_USER_ID) {
         $content .= "<br><a href=\"#\" onclick=\"window.open('editnews.php?user_id='+WT_USER_ID, '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Add a new journal entry') . "</a>";
     }
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
 }
}
if (isset($_POST['addnews'])) {
    $content = $_POST['content'];
    $heading = $_POST['heading'];
    $link = $_POST['link'];
    $added_by = $_SESSION['admin'];
    $eventid = $_POST['event_id_news'];
    if ($heading && $content) {
        addNews($content, $heading, $link, $eventid, $added_by);
        $newsmsg = "News has been successfully added to the database!";
    } else {
        $newsmsg = "Content and Heading both fields are required!";
    }
}
if (isset($_POST['deletenews'])) {
    deleteNews($_POST['news_heading'], $_SESSION['admin']);
    $newsdelmsg = "News has been deleted!";
}
//footer
flush();
ob_flush();
ob_end_clean();
?>
	<script type ="text/javascript" src="css/jquery.js"></script>
	<script type="text/javascript" src="css/jquery.jdpicker.js"></script>
	<link rel="stylesheet" href="css/jdpicker.css" type="text/css" media="all" />
	<script type="text/javascript">
        $(document).ready(function () {
            $('#strtdate1').jdPicker();
        });
    </script>
示例#3
0
文件: caller.php 项目: jocchann/edfc
<?php

require_once 'init.php';
//listens for what is sent through the link
//this page's only job is to receive items - kind of like a directory
if (isset($_GET['caller_id'])) {
    $dir = $_GET['caller_id'];
    if ($dir == "logout") {
        logged_out();
    } else {
        if ($dir == "deleteuser") {
            $id = $_GET['id'];
            deleteUser($id);
        } else {
            if ($dir == "deletenews") {
                $id = $_GET['id'];
                deleteNews($id);
            } else {
                if ($dir == "deleteevent") {
                    $id = $_GET['id'];
                    deleteEvent($id);
                } else {
                    //remove for when files go live
                    echo "Caller id was passed incorrectly.";
                }
            }
        }
    }
}
示例#4
0
<?php

$timeStart = microtime(true);
session_start();
if (empty($_SESSION)) {
    exit(header("Location: ../../index.php"));
}
require_once $_SESSION['File_Root'] . '/Kernel/Include.php';
require_once $_SESSION['File_Root'] . '/HTML/Header.php';
require_once 'Functions/SQL.php';
redirectToLogin($accountID, $linkRoot);
redirectToBattle($verifyBattle, $linkRoot);
hasAdmin($accountAccess);
$newID = htmlspecialchars(addslashes($_POST['newID']));
deleteNews($bdd, $newID);
?>

<?php 
echo $anew11;
?>

<br>
<form method="POST" action="index.php">
	<input class="btn btn-success" type="submit" value="Ok">
</form>
<br/>

<?php 
require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
?>
示例#5
0
        $date = time() - $_SESSION["timediff"];
        if (empty($title)) {
            $title = "No Title";
        }
        if (empty($text)) {
            $text = "No Text";
        }
        $message = array();
        if ($news_id) {
            $message["id"] = $news_id;
        }
        $message["username"] = $username;
        if ($username == $GEDCOM) {
            $_SESSION['clearcache'] = true;
        }
        $message["date"] = $date;
        $message["title"] = $title;
        $message["text"] = $text;
        if (addNews($message)) {
            print $pgv_lang["news_saved"];
        }
    } else {
        if ($action == "delete") {
            if (deleteNews($news_id)) {
                print $pgv_lang["news_deleted"];
            }
        }
    }
}
print "<center><br /><br /><a href=\"javascript:;\" onclick=\"if (window.opener.refreshpage) window.opener.refreshpage(); window.close();\">" . $pgv_lang["close_window"] . "</a><br /></center>";
print_simple_footer();
示例#6
0
文件: index.php 项目: stamlercas/csa
     include '../view/busSchedule.php';
     break;
 case 'deleteApple':
     deleteApple();
     break;
 case 'deleteDate':
     deleteDate();
     break;
 case 'deleteForm':
     deleteForm();
     break;
 case 'deleteMovie':
     deleteMovie();
     break;
 case 'deleteNews':
     deleteNews();
     break;
 case 'deletePolicy':
     deletePolicy();
     break;
 case 'editApple':
     editApple();
     break;
 case 'editContent':
     editContent();
     break;
 case 'editForm':
     editForm();
     break;
 case 'editNews':
     editNews();
示例#7
0
    if (isset($_POST['updateNews'])) {
        $answer = updateNews($newsId, $_POST['header'], $_POST['text'], $date);
        switch ($answer) {
            case 0:
                $echoAnswer = "Новость успешно обновлена!";
                break;
            case 1:
                $echoAnswer = "Произошла ошибка при обновлении новости!";
                break;
            case 2:
                $echoAnswer = "Не удалось подключиться к БД!";
                break;
        }
    } else {
        if (isset($_POST['deleteNews'])) {
            $answer = deleteNews($newsId);
            switch ($answer) {
                case 0:
                    $echoAnswer = "Новость успешно удалена!";
                    break;
                case 1:
                    $echoAnswer = "Произошла ошибка при удалении новости!";
                    break;
                case 2:
                    $echoAnswer = "Не удалось подключиться к БД!";
                    break;
            }
        }
    }
}
echo $echoAnswer;
示例#8
0
文件: admin.php 项目: sebspas/AFK-WEB
            break;
        default:
            break;
    }
}
if (isset($_GET['delete'])) {
    $User = $Model->recupUser($_GET['delete']);
    if ($_SESSION['rang'] <= $User->rang) {
        echo "<div class='error' >Suppression Impossible !</div>";
    } else {
        deleteUser($_GET['delete']);
        header('Location : index.php?page=admin&supprimer=User');
    }
}
if (isset($_GET['deleteNews'])) {
    deleteNews($_GET['deleteNews']);
    header('Location : index.php?page=admin&supprimer=News');
}
if (isset($_GET['deleteEvent'])) {
    deleteEvent($_GET['deleteEvent']);
    header('Location : index.php?page=admin&supprimer=Event');
}
/******************************************************/
/*				 Forum Gestion			     		  */
/******************************************************/
$listeCategorie = recupCategories();
$listeForum = recupForum();
function checkCategorie()
{
    if (isCategorieInDb($_POST['nom'])) {
        return "Categorie déjà utilisé, merci d'en choisir un autre.";
示例#9
0
        echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">';
        echo '<input type="hidden" name="date" value="' . $news['date'] . '">';
        echo '<table>';
        echo '<tr><th style="text-align:left;font-weight:900;" dir="auto;">' . WT_I18N::translate('Title:') . '</th><tr>';
        echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['title'] . '"></td></tr>';
        echo '<tr><th valign="top" style="text-align:left;font-weight:900;" dir="auto;">' . WT_I18N::translate('Entry text:') . '</th></tr>';
        echo '<tr><td>';
        echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . WT_Filter::escapeHtml($news['text']) . '</textarea>';
        echo '</td></tr>';
        echo '<tr><td><input type="submit" value="' . WT_I18N::translate('save') . '"></td></tr>';
        echo '</table>';
        echo '</form>';
        break;
    case 'save':
        $message = array();
        if ($news_id) {
            $message['id'] = $news_id;
        }
        $message['user_id'] = $user_id;
        $message['gedcom_id'] = $gedcom_id;
        $message['date'] = $date;
        $message['title'] = $title;
        $message['text'] = $text;
        addNews($message);
        $controller->addInlineJavascript('window.opener.location.reload();window.close();');
        break;
    case 'delete':
        deleteNews($news_id);
        $controller->addInlineJavascript('window.opener.location.reload();window.close();');
        break;
}
示例#10
0
<?php

/* Zum Wechseln der Kategorien wird eine Session benötigt. */
session_start();
/** Globaler Sessionstorage bei Bedarf initialisieren. */
if (!isset($_SESSION['Kategorie'])) {
    $_SESSION['Kategorie'] = "all";
}
if (isset($_POST) && !empty($_POST)) {
    if (isset($_POST['titel']) && isset($_POST['untertitel']) && isset($_POST['text']) && isset($_POST['foto']) && isset($_POST['autor_id']) && isset($_POST['kategorie_id'])) {
        saveData($_POST);
    }
    if (isset($_POST['action']) && $_POST['action'] == 'delete') {
        deleteNews($_POST['news_id']);
    }
    if ($_POST['action'] == 'search') {
        search($_POST['search']);
    }
    if (isset($_POST['action']) && $_POST['action'] == 'xml') {
        writeXML();
    }
}
function sqlConnect()
{
    $user = '******';
    $password = '';
    $connection = mysqli_connect('localhost', $user, $password, "data");
    if (mysqli_connect_errno()) {
        echo "Keine Datenbankverbindung möglich: " . mysqli_connect_errno();
    }
    return $connection;
示例#11
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype;
     switch (WT_Filter::get('action')) {
         case 'deletenews':
             $news_id = WT_Filter::get('news_id');
             if ($news_id) {
                 deleteNews($news_id);
             }
             break;
     }
     $block = get_block_setting($block_id, 'block', true);
     if (isset($_REQUEST['gedcom_news_archive'])) {
         $limit = 'nolimit';
         $flag = 0;
     } else {
         $flag = get_block_setting($block_id, 'flag', 0);
         if ($flag == 0) {
             $limit = 'nolimit';
         } else {
             $limit = get_block_setting($block_id, 'limit', 'nolimit');
         }
     }
     if ($cfg) {
         foreach (array('limit', 'flag') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $usernews = getGedcomNews(WT_GED_ID);
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
         $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
     } else {
         $title = '';
     }
     $title .= $this->getTitle();
     $content = '';
     if (count($usernews) == 0) {
         $content .= WT_I18N::translate('No news articles have been submitted.') . '<br>';
     }
     $c = 0;
     foreach ($usernews as $news) {
         if ($limit == 'count') {
             if ($c >= $flag) {
                 break;
             }
             $c++;
         }
         if ($limit == 'date') {
             if ((int) ((WT_TIMESTAMP - $news['date']) / 86400) > $flag) {
                 break;
             }
         }
         $content .= "<div class=\"news_box\" id=\"article{$news['id']}\">";
         $content .= "<div class=\"news_title\">" . WT_Filter::escapeHtml($news['title']) . '</div>';
         $content .= "<div class=\"news_date\">" . format_timestamp($news['date']) . '</div>';
         if ($news["text"] == strip_tags($news["text"])) {
             $news["text"] = nl2br($news["text"], false);
         }
         $content .= $news["text"];
         // Print Admin options for this News item
         if (WT_USER_GEDCOM_ADMIN) {
             $content .= '<hr>' . "<a href=\"#\" onclick=\"window.open('editnews.php?news_id='+" . $news['id'] . ", '_blank', news_window_specs); return false;\">" . WT_I18N::translate('Edit') . "</a> | " . "<a href=\"index.php?action=deletenews&amp;news_id=" . $news['id'] . "&amp;ctype={$ctype}\" onclick=\"return confirm('" . WT_I18N::translate('Are you sure you want to delete this news article?') . "');\">" . WT_I18N::translate('Delete') . "</a><br>";
         }
         $content .= "</div>";
     }
     $printedAddLink = false;
     if (WT_USER_GEDCOM_ADMIN) {
         $content .= "<a href=\"#\" onclick=\"window.open('editnews.php?gedcom_id='+WT_GED_ID, '_blank', news_window_specs); return false;\">" . WT_I18N::translate('Add a news article') . "</a>";
         $printedAddLink = true;
     }
     if ($limit == 'date' || $limit == 'count') {
         if ($printedAddLink) {
             $content .= "&nbsp;&nbsp;|&nbsp;&nbsp;";
         }
         $content .= "<a href=\"index.php?gedcom_news_archive=yes&amp;ctype={$ctype}\">" . WT_I18N::translate('View archive') . "</a>";
         $content .= help_link('gedcom_news_archive') . '<br>';
     }
     if ($template) {
         require WT_THEME_DIR . 'templates/block_main_temp.php';
     } else {
         return $content;
     }
 }
示例#12
0
文件: news.php 项目: pauljenny/NoCMS
/*            	Basé sur le kit graphique de Frozen Blade Enhanced          */
/*           				Codé par Polo                                   */
/****************************************************************************/
if (!isset($_SESSION['connect']) || getSecurityLevel($_SESSION['id']) < $array_site['niveau_admin']) {
    include './modules/error.php';
} else {
    include './modules/admin/fonctions/news.php';
    if (!isset($_GET['act'])) {
        $fetch = array();
        $query = getNews();
        while ($fetch[] = $query->fetch(PDO::FETCH_ASSOC)) {
        }
    } elseif ($_GET['act'] == 'modify' && isset($_GET['id']) && is_numeric($_GET['id'])) {
        $query = getNewsById($_GET['id']);
        $fetch = $query->fetch(PDO::FETCH_NUM);
        if (isset($_POST['bouton'])) {
            traiterInfosMod($_GET['id']);
        }
    } elseif ($_GET['act'] == 'delete' && isset($_GET['id']) && is_numeric($_GET['id'])) {
        $query = getNewsById($_GET['id']);
        $fetch = $query->fetch(PDO::FETCH_NUM);
        if (isset($_POST['bouton'])) {
            deleteNews($_GET['id']);
        }
    } elseif ($_GET['act'] == 'add' && !isset($_GET['id'])) {
        if (isset($_POST['bouton'])) {
            addNews();
        }
    }
    include './modules/admin/html/news.php';
}