$date = getval("date", date("Y-m-d H:i:s"));
$title = getvalescaped("title", 0);
$body = getvalescaped("body", 0);
# get ref value from database, unless it is set to new
if (getval("ref", "") == "new") {
    $createnews = true;
} else {
    $news = get_news($ref, "", "");
    $createnews = false;
}
if (getval("save", "") != "") {
    # Save news
    if ($createnews) {
        add_news($date, $title, $body);
    } else {
        update_news($ref, $date, $title, $body);
    }
    redirect("plugins/news/pages/news_edit.php?findtext=" . $findtext . "&offset=" . $offset);
}
# Fetch news data
$news = get_news($ref, "", "");
include dirname(__FILE__) . "/../../../include/header.php";
?>

<p><a href="news_edit.php?offset=<?php 
echo $offset;
?>
&findtext=<?php 
echo $findtext;
?>
">&lt;&nbsp;<?php 
Esempio n. 2
0
             $px = @GetImageSize($_FILES['fb']['tmp_name']);
             if ($px[0] == 470 && $px[1] == 247) {
                 $rand = rand(100, 99999);
                 $name = time() . '_' . $rand;
                 $fb_sql = date('Y-m') . '/' . $name . '.jpg';
                 $imgdir = '../img/uploads/news/fb/' . $fb_sql;
                 move_uploaded_file($_FILES['fb']['tmp_name'], $imgdir);
             } else {
                 $error[0] = "Facebook ფოტოს ზომა: 470x247";
             }
         }
     }
 }
 if (empty($error[0])) {
     if ($_POST['update'] == 1) {
         if (update_news(['user' => $user_id, 'cat' => $cat, 'title' => $title, 'title_short' => $title_short, 'youtube' => $youtube, 'chpu' => $chpu, 'meta_desc' => $meta_desc, 'meta_key' => $meta_key, 'color' => $color, 'info' => $info, 'test' => $victorina, 'date' => $date, 'time' => $tm, 'style' => $style, 'text_short' => $text_short, 'text' => $text, 'phg' => $phg, 'sponsored' => $sponsored, 'copy' => $copy, 'slide' => $slide, 'slide_type' => $slide_type, 'thumbs' => $totalpath, 'img' => $read_sql, 'fb' => $fb_sql], $id)) {
             $response['photop'] = !empty($totalpath) ? $totalpath : '';
             $response['desimg'] = !empty($read_sql) ? $read_sql : '';
             $response['facebook'] = !empty($fb_sql) ? $fb_sql : '';
             $response['slide'] = json_encode(unserialize(base64_decode($slide)));
             $response['body'] = stripslashes($text);
             echo json_encode($response);
         }
     }
     if ($_POST['add'] == 1) {
         if (!empty($title) && !empty($cat)) {
             $test_chpu = $DB->getOne("SELECT count(#__news.id) FROM `#__news` WHERE `chpu`='{$chpu}'");
             if ($test_chpu > 0) {
                 $chpu = rand(100, 9999) . '_' . $chpu;
             }
             $result = add_news(['user' => $user_id, 'cat' => $cat, 'title' => $title, 'chpu' => $chpu, 'title_short' => $title_short, 'youtube' => $youtube, 'info' => $info, 'date' => $date, 'time' => $tm, 'slide' => $slide, 'slide_type' => $slide_type, 'text_short' => $text_short, 'text' => $text, 'phg' => $phg, 'sponsored' => $sponsored, 'copy' => $copy, 'moderate' => 2]);
Esempio n. 3
0
$app->get('/noticia/nova', $authenticate($app), function () use($app) {
    $app->render('noticia_nova.php', array('pageTitle' => _('Adicionar') . ' ' . get_setting('noticia_singular')));
});
// Guardar noticia
$app->post('/noticia/nova', $authenticate($app), function () use($app) {
    $news = $app->request()->post('news');
    save_news($news);
    $app->redirect('/backoffice/noticias');
});
$app->get('/noticia/editar/:id', $authenticate($app), function ($id) use($app) {
    $news = get_news_id($id);
    $app->render('noticia_editar.php', array('news' => $news, 'pageTitle' => _('Editar') . ' ' . get_setting('noticia_singular')));
});
$app->post('/noticia/editar', $authenticate($app), function () use($app) {
    $news = $app->request()->post('news');
    update_news($news);
    $app->redirect('/backoffice/noticias');
});
$app->get('/eventos', $authenticate($app), function () use($app) {
    $events = get_events();
    $app->render('eventos.php', array('events' => $events, 'pageTitle' => get_setting('evento_singular')));
});
//Obtem uma lista de todos os eventos
$app->get('/evento/novo', $authenticate($app), function () use($app) {
    $app->render('evento_novo.php', array('pageTitle' => _('Adicionar') . ' ' . get_setting('evento_singular')));
});
$app->post('/evento/novo', $authenticate($app), function () use($app) {
    $values = $app->request()->post('event');
    save_event($values);
    $app->redirect('/backoffice/eventos');
});
Esempio n. 4
0
}
// ban entries
function import_bans()
{
    global $site;
    global $connection;
    $query = 'SELECT `id`, `raw_announcement` from `bans`';
    if (!($result = @$site->execute_query($db_to_be_imported, 'bans', $query, $connection))) {
        // query was bad, error message was already given in $site->execute_query(...)
        $site->dieAndEndPage('');
    }
    while ($row = mysql_fetch_array($result)) {
        // skip empty entries
        if (!(strcmp($row['raw_announcement'], '') === 0)) {
            $query = 'UPDATE `bans` SET `announcement`=' . sqlSafeStringQuotes($site->bbcode($row['raw_announcement'])) . ' WHERE `id`=' . sqlSafeStringQuotes($row['id']) . ' LIMIT 1';
            // execute query, ignore result
            @$site->execute_query('news', $query, $connection);
        }
    }
}
// now convert the entries using the available functions
update_players();
update_teams();
update_news();
update_bans();
// done
?>
<p>Updating all database entries involving BBCode finished!</p>
</div>
</body>
</html>
Esempio n. 5
0
<?php

set_time_limit(0);
require_once '../includes/init.php';
//get_news('http://www.51766.com/xinwen/11019/1101981792.html', 616);
$news = $db->get_all("SELECT * FROM {$prefix}article WHERE article_id > 20607");
foreach ($news as $index => $new) {
    update_news($new['from_url'], $new['article_id']);
    if (0 !== $index && 0 === $index % 10) {
        flush();
    }
}
function update_news($url, $article_id)
{
    global $db, $prefix;
    $news = array();
    $html = @file_get_contents($url);
    $news['pub_date'] = get_content($html, '&nbsp; ', '.0');
    $news['content'] = get_tag_contents($html, 'div', '<div id="fontZoom">');
    $db->update($prefix . 'article', $news, array('article_id' => $article_id));
    //print_r($news);
    echo $url . ' 入库完毕<br />';
    //die();
}
//echo get_tag_contents($html, 'div', '<div class="block12">');
function get_tag_contents($html, $tag, $start_str, $tag_pos = 0, $length = 0)
{
    if (!empty($start_str)) {
        $html = end(explode($start_str, $html));
    }
    $tag_pos = stripos($html, '<' . $tag, $tag_pos);