Permalink
Browse files

Autoupdater Robot

1 parent 383a698 commit 3e6b0c4a7f5c82f52fb3a37f5fed61b76cbc1bef @CuteNews committed Feb 29, 2016
Showing with 97 additions and 57 deletions.
  1. +16 −0 core/ckeditor/styles.js
  2. +1 −1 core/core.php
  3. +1 −1 core/includes/active_news.php
  4. +2 −2 core/includes/dispatcher.php
  5. +3 −3 core/news.php
  6. +19 −19 example.php
  7. +37 −0 popup.php
  8. +1 −27 print.php
  9. +3 −1 search.php
  10. +13 −2 show_news.php
  11. +1 −1 skins/cute.js
@@ -109,3 +109,19 @@ CKEDITOR.stylesSet.add( 'default', [
{ 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', {
+ });
+})();
View
@@ -987,7 +987,7 @@ function cn_front_msg_show($area, $css = 'fe_css')
function cn_db_init()
{
// basic CN db
- include SERVDIR.'/core/db/coreflat.php';
+ require_once SERVDIR.'/core/db/coreflat.php';
}
// Since 2.0: Language codes initialize
@@ -56,7 +56,7 @@
// Reverse news (by user, or site option)
if ($reverse || getoption('reverse_active'))
{
- $sortby = '';
+ $sortby = 'ASC';
$dir = 'R';
}
@@ -40,14 +40,14 @@
/// 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"))
{
- echo base64_decode('PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDoxNXB4O3dpZHRoOjEwMCU7dGV4dC1hbGl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YWdlbWVudCBQb3dlcmVkIGJ5IDxhIGhyZWY9Imh0dHA6Ly9jdXRlcGhwLmNvbS8iIHRpdGxlPSJDdXRlTmV3cyAtIFBIUCBOZXdzIE1hbmFnZW1lbnQgU3lzdGVtIj5DdXRlTmV3czwvYT48L2Rpdj4=');
+ echo base64_decode('PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDoxNXB4IWltcG9ydGFudDt3aWR0aDoxMDAlIWltcG9ydGFudDt0ZXh0LWFsaWduOmNlbnRlciFpbXBvcnRhbnQ7Zm9udDo5cHggVmVyZGFuYSFpbXBvcnRhbnQ7ZGlzcGxheTpibG9jayFpbXBvcnRhbnQ7dGV4dC1pbmRlbnQ6IDBweCFpbXBvcnRhbnQ7dmlzaWJpbGl0eTogdmlzaWJsZSFpbXBvcnRhbnQ7Y29sb3I6IzAwMDAwMCFpbXBvcnRhbnQ7Ij5Db250ZW50IE1hbmFnZW1lbnQgUG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vY3V0ZXBocC5jb20vIiB0aXRsZT0iQ3V0ZU5ld3MgLSBQSFAgTmV3cyBNYW5hZ2VtZW50IFN5c3RlbSIgc3R5bGU9ImZvbnQ6OXB4IFZlcmRhbmEhaW1wb3J0YW50O2Rpc3BsYXk6aW5saW5lIWltcG9ydGFudDt2aXNpYmlsaXR5OnZpc2libGUhaW1wb3J0YW50O2NvbG9yOiMwMDMzNjYhaW1wb3J0YW50O3RleHQtaW5kZW50OjBweCFpbXBvcnRhbnQ7Ij5DdXRlTmV3czwvYT48L2Rpdj4=');
}
}
}
View
@@ -618,20 +618,20 @@ function cn_modify_bb_print($e, $t, $bb)
// make comment link
function cn_modify_bb_full_link($e, $t, $bb)
{
+
$action = REQ('action', 'GPG');
list($opts, $anchor) = cn_helper_bb_decode($bb);
-
if ($e['f'] == '' and $action !== 'showheadlines')
{
return '<!-- no full story-->';
}
-
+
$id = intval($e['id']);
$id = cn_put_alias($id);
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
{
View
@@ -5,25 +5,25 @@
// Play with settings --------------------------------------------------
$pw = REQ('pw');
- 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['start_from'])&&$pw['start_from']) $start_from = $pw['start_from'];
- if (isset($pw['number'])&&$pw['number']) $number = $pw['number'];
- if (isset($pw['archive'])&&$pw['archive']) $archive = $pw['archive'];
- if (isset($pw['category'])&&$pw['category']) $category = $pw['category'];
- if (isset($pw['ucat'])&&$pw['ucat']) $ucat = $pw['ucat'];
- if (isset($pw['sortby'])&&$pw['sortby']) $sortby = $pw['sortby'];
- 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['tag'])&&$pw['tag']) $tag = $pw['tag'];
- 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['reverse'])&&$pw['reverse']) $reverse = $pw['reverse'];
- 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_next'])&&$pw['no_next']) $no_next = $pw['no_next'];
+ 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['start_from']) && $pw['start_from']) $start_from = $pw['start_from'];
+ if (isset($pw['number']) && $pw['number']) $number = $pw['number'];
+ if (isset($pw['archive']) && $pw['archive']) $archive = $pw['archive'];
+ if (isset($pw['category']) && $pw['category']) $category = $pw['category'];
+ if (isset($pw['ucat']) && $pw['ucat']) $ucat = $pw['ucat'];
+ if (isset($pw['sortby']) && $pw['sortby']) $sortby = $pw['sortby'];
+ 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['tag']) && $pw['tag']) $tag = $pw['tag'];
+ 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['reverse']) && $pw['reverse']) $reverse = $pw['reverse'];
+ 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_next']) && $pw['no_next']) $no_next = $pw['no_next'];
// ---------------------------------------------------------------------
if (isset($_GET['do'])&& $_GET['do'] == "rss") include("rss.php");
View
@@ -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");
+}
View
@@ -11,33 +11,7 @@
if (isset($ent[$id]))
{
- if ($popup)
- {
- 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);
- }
-
+ echo entry_make($ent[$id], 'print', $template);
}
else
{
View
@@ -120,6 +120,8 @@
$item = $ent[$id];
$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']);
$Ss = $MB ? mb_strtolower($item['s'], 'UTF-8') : strtolower($item['s']);
@@ -131,7 +133,7 @@
continue;
// Query string not found
- if (!preg_match('/'.join('.*?', $_query).'/uis', $Fs . $Ss))
+ if (!preg_match('/'.join('.*?', $_query).'/uis', $Fs . $Ss . $Ts))
continue;
$st++;
View
@@ -40,7 +40,6 @@
// Decoding requested categories
list ($requested_cats, $is_in_category) = cn_get_requested_cats($category, $ucat, $nocategory);
-
// Allowed modules
$allow_add_comment = false;
$allow_full_story = false;
@@ -60,13 +59,24 @@
$_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
if ($is_in_category && empty($CN_HALT))
{
// --- Determine what user want to do ---
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")
{
@@ -79,6 +89,7 @@
}
elseif ($subaction == "showfull")
{
+
$allow_full_story = true;
}
View
@@ -307,4 +307,4 @@ function tiny_msg(object)
alert(object.title);
return false;
-}
+}

0 comments on commit 3e6b0c4

Please sign in to comment.