Skip to content

Commit

Permalink
Autoupdater Robot
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteNews committed Feb 29, 2016
1 parent 383a698 commit 3e6b0c4
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 57 deletions.
16 changes: 16 additions & 0 deletions core/ckeditor/styles.js
Expand Up @@ -109,3 +109,19 @@ CKEDITOR.stylesSet.add( 'default', [
{ name: 'Square Bulleted List', element: 'ul', styles: { 'list-style-type': 'square' } } { name: 'Square Bulleted List', element: 'ul', styles: { 'list-style-type': 'square' } }
]); ]);


// CKEDITOR fix: replace <br/> and &nbsp; with <p></p> tags
(function() {
/**
* Check for a paste event and replace <p>&nbsp;</p> with blank
*/

CKEDITOR.on('instanceReady', function(e) {
e.editor.on('paste', function(ev) {
ev.data.dataValue = ev.data.dataValue.replace(/<p[^>]*><br\s*\/?><\/p>/ig,'');
ev.data.dataValue = ev.data.dataValue.replace(/<p[^>]*>&nbsp;<\/p>/ig,'');
}, null, null, 9);
});

CKEDITOR.plugins.add('ckeditor_paragraph_paste_fix', {
});
})();
2 changes: 1 addition & 1 deletion core/core.php
Expand Up @@ -987,7 +987,7 @@ function cn_front_msg_show($area, $css = 'fe_css')
function cn_db_init() function cn_db_init()
{ {
// basic CN db // basic CN db
include SERVDIR.'/core/db/coreflat.php'; require_once SERVDIR.'/core/db/coreflat.php';
} }


// Since 2.0: Language codes initialize // Since 2.0: Language codes initialize
Expand Down
2 changes: 1 addition & 1 deletion core/includes/active_news.php
Expand Up @@ -56,7 +56,7 @@
// Reverse news (by user, or site option) // Reverse news (by user, or site option)
if ($reverse || getoption('reverse_active')) if ($reverse || getoption('reverse_active'))
{ {
$sortby = ''; $sortby = 'ASC';
$dir = 'R'; $dir = 'R';
} }


Expand Down
4 changes: 2 additions & 2 deletions core/includes/dispatcher.php
Expand Up @@ -40,14 +40,14 @@
/// Removing the "Powered By..." line is NOT allowed by the CuteNews License, only registered users are alowed to do so. /// Removing the "Powered By..." line is NOT allowed by the CuteNews License, only registered users are alowed to do so.
if (!file_exists(SERVDIR."/cdata/reg.php")) if (!file_exists(SERVDIR."/cdata/reg.php"))
{ {
echo base64_decode('PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDoxNXB4O3dpZHRoOjEwMCU7dGV4dC1hbGlnbjpjZW50ZXI7Zm9udDo5cHggVmVyZGFuYTsiPlBvd2VyZWQgYnkgPGEgaHJlZj0iaHR0cDovL2N1dGVwaHAuY29tLyIgdGl0bGU9IkN1dGVOZXdzIC0gUEhQIE5ld3MgTWFuYWdlbWVudCBTeXN0ZW0iPkN1dGVOZXdzPC9hPjwvZGl2Pg=='); echo base64_decode('PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDoxNXB4IWltcG9ydGFudDt3aWR0aDoxMDAlIWltcG9ydGFudDt0ZXh0LWFsaWduOmNlbnRlciFpbXBvcnRhbnQ7Zm9udDo5cHggVmVyZGFuYSFpbXBvcnRhbnQ7ZGlzcGxheTpibG9jayFpbXBvcnRhbnQ7dGV4dC1pbmRlbnQ6IDBweCFpbXBvcnRhbnQ7dmlzaWJpbGl0eTogdmlzaWJsZSFpbXBvcnRhbnQ7Y29sb3I6IzAwMDAwMCFpbXBvcnRhbnQ7Ij5Qb3dlcmVkIGJ5IDxhIGhyZWY9Imh0dHA6Ly9jdXRlcGhwLmNvbS8iIHRpdGxlPSJDdXRlTmV3cyAtIFBIUCBOZXdzIE1hbmFnZW1lbnQgU3lzdGVtIiBzdHlsZT0iZm9udDo5cHggVmVyZGFuYSFpbXBvcnRhbnQ7ZGlzcGxheTppbmxpbmUhaW1wb3J0YW50O3Zpc2liaWxpdHk6dmlzaWJsZSFpbXBvcnRhbnQ7Y29sb3I6IzAwMzM2NiFpbXBvcnRhbnQ7dGV4dC1pbmRlbnQ6IDBweCFpbXBvcnRhbnQ7Ij5DdXRlTmV3czwvYT48L2Rpdj4=');
} }
else else
{ {
include(SERVDIR."/cdata/reg.php"); include(SERVDIR."/cdata/reg.php");
if ( !preg_match('/\\A(\\w{6})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expand Down
6 changes: 3 additions & 3 deletions core/news.php
Expand Up @@ -618,20 +618,20 @@ function cn_modify_bb_print($e, $t, $bb)
// make comment link // make comment link
function cn_modify_bb_full_link($e, $t, $bb) function cn_modify_bb_full_link($e, $t, $bb)
{ {

$action = REQ('action', 'GPG'); $action = REQ('action', 'GPG');
list($opts, $anchor) = cn_helper_bb_decode($bb); list($opts, $anchor) = cn_helper_bb_decode($bb);

if ($e['f'] == '' and $action !== 'showheadlines') if ($e['f'] == '' and $action !== 'showheadlines')
{ {
return '<!-- no full story-->'; return '<!-- no full story-->';
} }

$id = intval($e['id']); $id = intval($e['id']);
$id = cn_put_alias($id); $id = cn_put_alias($id);


if (getoption('full_popup')) if (getoption('full_popup'))
{ {
return '<a href="#" onclick="window.open(\''.getoption('http_script_dir').'/print.php?id='.$id.$anchor.'&popup=news\', \'Comment news\', \''.getoption('full_popup_string').'\'); return false;">'.$t.'</a>'; return '<a href="#" onclick="window.open(\''.getoption('http_script_dir').'/popup.php?id='.$id.$anchor.'&popup=news\', \'Comment news\', \''.getoption('full_popup_string').'\'); return false;">'.$t.'</a>';
} }
else else
{ {
Expand Down
38 changes: 19 additions & 19 deletions example.php
Expand Up @@ -5,25 +5,25 @@
// Play with settings -------------------------------------------------- // Play with settings --------------------------------------------------
$pw = REQ('pw'); $pw = REQ('pw');


if (isset($pw['PHP_SELF'])&&$pw['PHP_SELF']) $PHP_SELF = $pw['PHP_SELF']; if (isset($pw['PHP_SELF']) && $pw['PHP_SELF']) $PHP_SELF = $pw['PHP_SELF'];
if (isset($pw['template'])&&$pw['template']) $template = $pw['template']; if (isset($pw['template']) && $pw['template']) $template = $pw['template'];


if (isset($pw['start_from'])&&$pw['start_from']) $start_from = $pw['start_from']; if (isset($pw['start_from']) && $pw['start_from']) $start_from = $pw['start_from'];
if (isset($pw['number'])&&$pw['number']) $number = $pw['number']; if (isset($pw['number']) && $pw['number']) $number = $pw['number'];
if (isset($pw['archive'])&&$pw['archive']) $archive = $pw['archive']; if (isset($pw['archive']) && $pw['archive']) $archive = $pw['archive'];
if (isset($pw['category'])&&$pw['category']) $category = $pw['category']; if (isset($pw['category']) && $pw['category']) $category = $pw['category'];
if (isset($pw['ucat'])&&$pw['ucat']) $ucat = $pw['ucat']; if (isset($pw['ucat']) && $pw['ucat']) $ucat = $pw['ucat'];
if (isset($pw['sortby'])&&$pw['sortby']) $sortby = $pw['sortby']; if (isset($pw['sortby']) && $pw['sortby']) $sortby = $pw['sortby'];
if (isset($pw['dir'])&&$pw['dir']) $dir = $pw['dir']; if (isset($pw['dir']) && $pw['dir']) $dir = $pw['dir'];
if (isset($pw['page_alias'])&&$pw['page_alias']) $page_alias = $pw['page_alias']; if (isset($pw['page_alias']) && $pw['page_alias']) $page_alias = $pw['page_alias'];
if (isset($pw['tag'])&&$pw['tag']) $tag = $pw['tag']; if (isset($pw['tag']) && $pw['tag']) $tag = $pw['tag'];
if (isset($pw['user_by'])&&$pw['user_by']) $user_by = $pw['user_by']; if (isset($pw['user_by']) && $pw['user_by']) $user_by = $pw['user_by'];


if (isset($pw['static'])&&$pw['static']) $static = $pw['static']; if (isset($pw['static']) && $pw['static']) $static = $pw['static'];
if (isset($pw['reverse'])&&$pw['reverse']) $reverse = $pw['reverse']; if (isset($pw['reverse']) && $pw['reverse']) $reverse = $pw['reverse'];
if (isset($pw['only_active'])&&$pw['only_active']) $only_active = $pw['only_active']; if (isset($pw['only_active']) && $pw['only_active']) $only_active = $pw['only_active'];
if (isset($pw['no_prev'])&&$pw['no_prev']) $no_prev = $pw['no_prev']; if (isset($pw['no_prev']) && $pw['no_prev']) $no_prev = $pw['no_prev'];
if (isset($pw['no_next'])&&$pw['no_next']) $no_next = $pw['no_next']; if (isset($pw['no_next']) && $pw['no_next']) $no_next = $pw['no_next'];
// --------------------------------------------------------------------- // ---------------------------------------------------------------------


if (isset($_GET['do'])&& $_GET['do'] == "rss") include("rss.php"); if (isset($_GET['do'])&& $_GET['do'] == "rss") include("rss.php");
Expand Down
37 changes: 37 additions & 0 deletions popup.php
@@ -0,0 +1,37 @@
<?php

require_once (dirname(__FILE__).'/core/init.php');

list($id, $template, $popup) = GET('id, template, popup');

$id = cn_id_alias($id);

if (!$template) $template = 'default';
$ent = db_news_load(db_get_nloc($id));

if (isset($ent[$id]))
{
echo "<html><head><style>
body { margin: 0; padding: 0; }
body, td
{
font-family: verdana, arial, sans-serif;
color: red;
font-size: 12px;
font-weight: normal;
line-height: 1.3em;
}
input { border-radius: 3px; }
input.text { background: #ffffff; border: 1px solid gray; }
input.submit { background: #f0f0f0; border: 1px groove #808080; }
input.submit:hover { background: #ffffff; cursor: pointer; }
.cn_comm_textarea { width: 450px; height: 150px; }
</style></head><body>";
if ($popup == 'comment') $subaction = 'only_comments';
include SERVDIR . '/show_news.php';
echo "</body></html>";
}
else
{
echo i18n("ID not found for active news");
}
28 changes: 1 addition & 27 deletions print.php
Expand Up @@ -11,33 +11,7 @@


if (isset($ent[$id])) if (isset($ent[$id]))
{ {
if ($popup) echo entry_make($ent[$id], 'print', $template);
{
echo "<html><head><style>
body { margin: 0; padding: 0; }
body, td
{
font-family: verdana, arial, sans-serif;
color: black;
font-size: 12px;
font-weight: normal;
line-height: 1.3em;
}
input { border-radius: 3px; }
input.text { background: #ffffff; border: 1px solid gray; }
input.submit { background: #f0f0f0; border: 1px groove #808080; }
input.submit:hover { background: #ffffff; cursor: pointer; }
.cn_comm_textarea { width: 450px; height: 150px; }
</style></head><body>";
if ($popup == 'comment') $subaction = 'only_comments';
include SERVDIR . '/show_news.php';
echo "</body></html>";
}
else
{
echo entry_make($ent[$id], 'print', $template);
}

} }
else else
{ {
Expand Down
4 changes: 3 additions & 1 deletion search.php
Expand Up @@ -120,6 +120,8 @@
$item = $ent[$id]; $item = $ent[$id];


$MB = function_exists('mb_strtolower'); $MB = function_exists('mb_strtolower');

$Ts = $MB ? mb_strtolower($item['t'], 'UTF-8') : strtolower($item['t']);
$Fs = $MB ? mb_strtolower($item['f'], 'UTF-8') : strtolower($item['f']); $Fs = $MB ? mb_strtolower($item['f'], 'UTF-8') : strtolower($item['f']);
$Ss = $MB ? mb_strtolower($item['s'], 'UTF-8') : strtolower($item['s']); $Ss = $MB ? mb_strtolower($item['s'], 'UTF-8') : strtolower($item['s']);


Expand All @@ -131,7 +133,7 @@
continue; continue;


// Query string not found // Query string not found
if (!preg_match('/'.join('.*?', $_query).'/uis', $Fs . $Ss)) if (!preg_match('/'.join('.*?', $_query).'/uis', $Fs . $Ss . $Ts))
continue; continue;


$st++; $st++;
Expand Down
15 changes: 13 additions & 2 deletions show_news.php
Expand Up @@ -40,7 +40,6 @@


// Decoding requested categories // Decoding requested categories
list ($requested_cats, $is_in_category) = cn_get_requested_cats($category, $ucat, $nocategory); list ($requested_cats, $is_in_category) = cn_get_requested_cats($category, $ucat, $nocategory);

// Allowed modules // Allowed modules
$allow_add_comment = false; $allow_add_comment = false;
$allow_full_story = false; $allow_full_story = false;
Expand All @@ -60,13 +59,24 @@
$_GET['id'] = $_POST['id'] = $id = substr($id, 1); $_GET['id'] = $_POST['id'] = $id = substr($id, 1);
} }


$show_detail = true;
if (isset($_GET['id']) && $_GET['id']!='' && $category!='') {
$id1 = cn_id_alias($id);
$ent = db_news_load(db_get_nloc($id1));

$cur_cat_new = $ent[$id1]['c'];
if (!isset($requested_cats[$cur_cat_new]) || $requested_cats[$cur_cat_new]!=1) {
$show_detail = false;
}
}

// Show news only is in category // Show news only is in category
if ($is_in_category && empty($CN_HALT)) if ($is_in_category && empty($CN_HALT))
{ {
// --- Determine what user want to do --- // --- Determine what user want to do ---
hook('show_news/determs_before'); hook('show_news/determs_before');


if (empty($static) and in_array($subaction, array("showcomments", "showfull", "addcomment", "only_comments"))) if (empty($static) and in_array($subaction, array("showcomments", "showfull", "addcomment", "only_comments")) && $show_detail)
{ {
if ($subaction == "addcomment") if ($subaction == "addcomment")
{ {
Expand All @@ -79,6 +89,7 @@
} }
elseif ($subaction == "showfull") elseif ($subaction == "showfull")
{ {

$allow_full_story = true; $allow_full_story = true;
} }


Expand Down
2 changes: 1 addition & 1 deletion skins/cute.js
Expand Up @@ -307,4 +307,4 @@ function tiny_msg(object)
alert(object.title); alert(object.title);


return false; return false;
} }

0 comments on commit 3e6b0c4

Please sign in to comment.