Permalink
Browse files

Autoupdater Robot

  • Loading branch information...
1 parent 8d8092d commit 30a1768bf6ab8ebc4992b2c2ba6c9caa1beddacd @CuteNews committed Aug 21, 2014
View
Oops, something went wrong.
View
Oops, something went wrong.
@@ -13,7 +13,7 @@
$logged_as_member = TRUE;
$name = $user['name'];
$mail = $user['email'];
-
+
// Extern call from internal widget (login), if checkbox 'remember_me' is set
if ((isset($_POST['CN_COOKIE_POSTPROCESS'])) && isset($_POST['cn_remember_me']))
cn_save_session(TRUE);
@@ -22,7 +22,7 @@
{
$logged_as_member = FALSE;
$name = trim(REQ('name', 'POST'));
- $mail = trim(REQ('mail', 'POST'));
+ $mail = trim(REQ('mail', 'POST'));
}
// Can't add comment
@@ -273,7 +273,8 @@
cn_guest_auth($name, $mail);
// Redirect...
-echo '<script type="text/javascript">window.location="'.addslashes(REQ('referer')).'";</script>';
+$ref= preg_replace('/&edit_id=\d+/', '', REQ('referer'));
+echo '<script type="text/javascript">window.location="'.addslashes($ref).'";</script>';
echo '<div><a href="'.$refer.'">click there</a> if automatic redirect not work</div>';
return FALSE;
@@ -1,5 +1,9 @@
<?php if (!defined('EXEC_TIME')) die('Access restricted');
+//desable/enable standart comment thread
+$is_comments=getoption('comments_std_show');
+if(!$is_comments) return TRUE;
+
global $PHP_SELF, $_SESS;
// Scan external query
@@ -22,9 +26,6 @@
// Load system configurations
$comm_number = intval( getoption('comments_per_page') );
-// $comm_addcomm = cn_get_template('form', $template);
-// $comm_paginate = cn_get_template('prev_next', $template);
-
$comments = $entry['co'];
$total_comments = count($comments);
@@ -99,12 +100,14 @@
$cpn = '';
}
+echo '<br style="clear:both;"/>';
if ($total_comments && test('Mda'))
{
if (getoption('reverse_comments')) $comments = array_reverse($comments);
// Action with comments box
- echo '<form action="'.PHP_SELF.'" method="POST">';
+ echo '<form id="comments_frm" action="'.PHP_SELF.'" method="POST">';
+
echo '<input type="hidden" name="id" value="'.$id.'" />';
echo '<input type="hidden" name="subaction" value="addcomment" />';
echo '<input type="hidden" name="action" value="comment_process" />';
@@ -121,9 +124,15 @@
{
// Some operations, e.g. remove comments
if (test('Mda'))
- echo '<div class="cn_comment_submit"><input type="submit" value="Delete comments"/></div>';
-
+ {
+ echo '<div id="del_btn" class="cn_comment_submit" style="visibility:hidden;"><input type="submit" id="btn_delete" value="Delete comments"/></div>';
+ }
echo '</form>';
+ echo '<script type="text/javascript">function d(){var a=document.getElementById("del_btn"); var ck=document.getElementsByName("comm_delete[]"); var i=0; var en="visibility:hidden;"; var dl=document.getElementById("btn_delete"); var cheked=0; '
+ . 'for(i=0;i<ck.length;i++){ if(ck[i].checked){ cheked++; en="visibility:visible;"; }} a.setAttribute("style", en); '
+ . 'var btn_name="Delete comment"; if(cheked>1){btn_name=btn_name+"s";} dl.setAttribute("value",btn_name);}';
+ echo 'var ss=document.getElementsByName("comm_delete[]"); var i=0; for (i=0; i<ss.length; i++){ ss[i].onclick=d; }</script>';
+
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -158,7 +167,7 @@
if($ni) $entry['co'][$item['id']]['c']=$ni;
}
- }
+ }
$echo = entry_make($entry, 'form', $template, 'comm');
// Keep [bb]codes[/bb]
@@ -52,4 +52,4 @@
}
}
-$count_cute_news_includes++;
+if(isset($count_cute_news_includes)) $count_cute_news_includes++;
View
@@ -4,12 +4,21 @@
if (substr(PHP_VERSION, 0, 5) < '4.1.0')
die('PHP Version is '.PHP_VERSION.', need great than PHP &gt;= 4.1.0 to start cutenews');
+define('DEV_DEBUG',false); //for visual detect errors
+if(DEV_DEBUG)
+{
+ ini_set('display_errors', '1');
+ error_reporting(E_ALL|E_STRICT);
+}
+else
+{
+ error_reporting(E_ALL ^ E_NOTICE);
+}
// definitions
-error_reporting(E_ALL ^ E_NOTICE);
define('EXEC_TIME', microtime(true));
-define('VERSION', '2.0.1');
-define('VERSION_ID', 201);
+define('VERSION', '2.0.2');
+define('VERSION_ID', 202);
define('VERSION_NAME', 'CuteNews v.' . VERSION);
define('SERVDIR', dirname(dirname(__FILE__).'.html'));
define('MODULE_DIR', SERVDIR . '/core/modules');
@@ -25,9 +34,11 @@
// magic quotes = ON, filtering it
if (ini_get('magic_quotes_gpc')) cn_filter_magic_quotes();
-// catch errors
-set_error_handler("user_error_handler");
-
+if(!DEV_DEBUG)
+{
+ // catch errors
+ set_error_handler("user_error_handler");
+}
// create cutenews caches
$_CN_SESS_CACHE = array();
$_CN_cache_block_id = array();
@@ -8,10 +8,9 @@ function add_news_invoke()
$FlatDB = new FlatDB();
// loadall
- list($article_type, $preview) = GET('postpone_draft, preview', 'GETPOST');
+ list($article_type, $preview) = GET('postpone_draft, preview', 'GETPOST');
list($from_date_hour, $from_date_minutes, $from_date_seconds, $from_date_month, $from_date_day, $from_date_year) = GET('from_date_hour, from_date_minutes, from_date_seconds, from_date_month, from_date_day, from_date_year', 'GETPOST');
list($title, $page, $category, $short_story, $full_story, $if_use_html, $vConcat, $vTags, $faddm) = GET('title, page, category, short_story, full_story, if_use_html, concat, tags, faddm', 'GETPOST');
-
$categories = cn_get_categories();
list($morefields) = cn_get_more_fields($faddm);
@@ -42,13 +41,17 @@ function add_news_invoke()
// sanitize page name
$page = preg_replace('/[^a-z0-9_\.]/i', '-', $page);
-
+ if(empty($page)&& getoption('auto_news_alias'))
+ {
+ $page= strtolower(preg_replace('/[^a-z0-9_\.]/i', '-', cn_transliterate($title)));
+ }
+
// basic news
$member = member_get();
$entry = array();
$entry['id'] = $c_time;
- $entry['t'] = cn_htmlclear($title);
+ $entry['t'] = cn_htmlclear($title);
$entry['u'] = $member['name'];
$entry['c'] = news_make_category($category);
$entry['s'] = cn_htmlclear($short_story);
@@ -61,16 +64,12 @@ function add_news_invoke()
$entry['pg'] = $page;
// Check page alias for exists
- if ($page && bt_get_id($page, 'pg_ts'))
+ if ($page && bt_get_id($page, 'pg_ts') && !$preview)
{
cn_throw_message('Page alias already exists', 'e');
}
else
{
- // Add page alias
- bt_set_id($page, $c_time, 'pg_ts');
- bt_set_id($c_time, $page, 'ts_pg');
-
// Get latest id for news
$latest_id = intval( bt_get_id('latest_id', 'conf') );
$latest_id++;
@@ -102,6 +101,10 @@ function add_news_invoke()
// no errors in a[rticle] area
if (cn_get_message('e', 'c') == 0)
{
+ // Add page alias
+ bt_set_id($page, $c_time, 'pg_ts');
+ bt_set_id($c_time, $page, 'ts_pg');
+
$sc = $draft ? 'draft' : '';
$es = db_news_load( db_get_nloc($entry['id']) );
@@ -156,13 +159,15 @@ function add_news_invoke()
}
}
// show news preview
- else cn_assign('preview_html', entry_make($entry, 'active') );
+ else
+ {
+ cn_assign('preview_html', entry_make($entry, 'active') );
+ }
}
// -----------------------------------------------------------------------------------------------------------------
-
- cn_assign('categories, vCategory, vTitle, vShort, vFull, is_active_html, vUseHtml, vConcat, vTags, morefields',
- $categories, $category, $title, $short_story, $full_story,$is_active_html, $if_use_html, $vConcat, $vTags, $morefields);
+ cn_assign('categories, vCategory, vTitle, vShort, vFull, is_active_html, vUseHtml, vConcat, vTags, morefields,vPage',
+ $categories, $category, $title, $short_story, $full_story,$is_active_html, $if_use_html, $vConcat, $vTags, $morefields, $page);
// ---
echoheader("addedit@addedit/main.css", i18n("Add News")); echo exec_tpl('addedit/main'); echofooter();
Oops, something went wrong.

0 comments on commit 30a1768

Please sign in to comment.