| Name | Size | Mode | Actions |
|---|---|---|---|
| images/ | - | 0755 | rm |
| php53/ | - | 0755 | rm |
| php56/ | - | 0755 | rm |
| php71/ | - | 0755 | rm |
| .htaccess | 338 | 0644 | editdlrm |
| clone.php | 3439 | 0644 | editdlrm |
| edit.php | 4907 | 0644 | editdlrm |
| edit.xml | 433 | 0644 | editdlrm |
| fileindex.php | 89 | 0644 | editdlrm |
| import.php | 2722 | 0644 | editdlrm |
| info.xml | 1275 | 0644 | editdlrm |
| install.js | 921 | 0644 | editdlrm |
| install.php | 4246 | 0644 | editdlrm |
| install.xml | 880 | 0644 | editdlrm |
| md5 | 2767 | 0644 | editdlrm |
| notes.txt | 52 | 0644 | editdlrm |
| snews.php | 149354 | 0644 | editdlrm |
| snews.sql | 5472 | 0644 | editdlrm |
| snews.zip | 58145 | 0644 | editdlrm |
| upgrade.php | 2803 | 0644 | editdlrm |
| upgrade.xml | 231 | 0644 | editdlrm |
/var/softaculous/snews/snews.php (149354B)
,readmore,comments,date,edit,
', 'comments' => ',,comment,
' ); function tags($tag) { global $tags; return $tags[$tag]; } // Constants // Website define('_SITE',site()); // Prefix define('_PRE',db('prefix')); // Set login constant define('_ADMIN',(isset($_SESSION[_SITE.'Logged_In']) && $_SESSION[_SITE.'Logged_In'] == token() ? true : false)); // SITE SETTINGS - grab site settings from database function s($var) { global $site_settings; if (!$site_settings){ $query = 'SELECT name,value FROM '._PRE.'settings'; $result = mysql_query($query); while ($r = mysql_fetch_assoc($result)) { $site_settings[$r['name']] = $r['value']; } } $value = $site_settings[$var]; return $value; } // SESSION TOKEN function token() { $a = md5(substr(session_id(), 2, 7)); $b = $_SERVER['HTTP_USER_AGENT']; $token = md5($a.$b._SITE); return $token; } // STARTUP connect_to_db(); // LANGUAGE VARIABLES s('language') != 'EN' && file_exists('lang/'.s('language').'.php') == true ? include('lang/'.s('language').'.php') : include('lang/EN.php'); // SYSTEM VARIABLES (not to be translated) //SEF links of the hardcoded items - RESERVED WORDS - will clash if using for article/category seftitles. $l['cat_listSEF'] = 'archive,contact,sitemap,login'; if (_ADMIN) {$l['cat_listSEF'] .= ',administration,admin_category,admin_article,article_new,extra_new,page_new,snews_categories,snews_articles,extra_contents,snews_pages,snews_settings,snews_files,logout,groupings,admin_groupings';} //divider character $l['divider'] = '·'; // used in article pagination links $l['paginator'] = 'p_'; $l['comment_pages'] = 'c_'; // list of files & folders ignored by upload/file list routine $l['ignored_items'] = '.,..,cgi-bin,.htaccess,Thumbs.db,snews.php,index.php,lib.php,style.css,admin.js,'.s('language').'.php'; if(isset($_POST['Loginform']) && !_ADMIN) { $user = checkUserPass($_POST['uname']); $pass = checkUserPass($_POST['pass']); unset($_POST['uname'],$_POST['pass']); // Patch #18 - 1.7.1 - revised string by KikkoMax if (checkMathCaptcha() && md5($user) === s('username') && md5($pass) === s('password')) { //if (md5($user) === s('username') && md5($pass) === s('password') && checkMathCaptcha()) { $_SESSION[_SITE.'Logged_In'] = token(); notification(2,'','administration'); } else { die( notification(2,l('err_Login'),'login')); } } if($_POST['submit_text'] && !_ADMIN){ die (notification(2,l('error_not_logged_in'),'home')); } if (!empty($_GET['category'])) { // Patch #7 - 1.7.1 $url = explode('/', clean($_GET['category'])); $categorySEF = $url[0]; if (isset($url[1])) $subcatSEF = $url[1]; if (substr($url[1], 0, 1) == l('comment_pages') && is_numeric(substr($url[1], 1, 1))) $commentsPage = $url[1]; if (isset($url[2])) $articleSEF= $url[2]; if (isset($url[3])) $commentsPage = $url[3]; if (check_category($categorySEF)) { $_catID = 0; return; } // Admin content if (_ADMIN) { $pub_a = ''; $pub_c = ''; $pub_x = ''; } else { $pub_a = ' AND a.published = 1'; $pub_c = ' AND c.published =\'YES\''; $pub_x = ' AND x.published =\'YES\''; } // Query for / Category / subcategory / article / if ($articleSEF && substr( $articleSEF, 0, 2) != l('paginator') && substr( $articleSEF, 0, 2) != l('comment_pages')) { $MainQuery = 'SELECT a.id AS id, title, position, description_meta, keywords_meta, c.id AS catID, c.name AS name, c.description, x.name AS xname FROM '._PRE.'articles'.' AS a, '._PRE.'categories'.' AS c LEFT JOIN '._PRE.'categories'.' AS x ON c.subcat=x.id WHERE a.category=c.id '.$pub_a.$pub_c.$pub_x.' AND x.seftitle="'.$categorySEF.'" AND c.seftitle="'.$subcatSEF.'" AND a.seftitle="'.$articleSEF.'" '; } // Two queries for / Category / subcategory / OR / Category / article / elseif ($subcatSEF && substr( $subcatSEF, 0, 2) != l('paginator') && substr( $subcatSEF, 0,2) != l('comment_pages')) { $Try_Article = mysql_query('SELECT a.id AS id, title, position, description_meta, keywords_meta, c.id as catID, name, description, subcat FROM '._PRE.'articles'.' AS a LEFT JOIN '._PRE.'categories'.' AS c ON category = c.id WHERE c.seftitle = "'.$categorySEF.'" AND a.seftitle ="'.$subcatSEF.'" '.$pub_a.$pub_c.' AND subcat = 0 '); $R = mysql_fetch_assoc($Try_Article); // query for / category / article / if(empty($R)) { $MainQuery = 'SELECT c.id AS catID, c.name AS name, c.description, c.subcat, x.name AS xname FROM '._PRE.'categories'.' AS x LEFT JOIN '._PRE.'categories'.' AS c ON c.subcat = x.id WHERE x.seftitle = "'.$categorySEF.'" AND c.seftitle = "'.$subcatSEF.'" '.$pub_c.$pub_x ; } } else { switch(true): case (substr( $categorySEF, 0, 2) == l('paginator')) : break; case (false !== strpos($categorySEF, 'rss-')) : die(rss_contents($categorySEF)); // Patch #17A - 1.7.1 removed: , $articleSEF (redundant) // Two queries for / Category / OR /Page/ default: $Try_Page = mysql_query('SELECT id, title, category, description_meta, keywords_meta, position FROM '._PRE.'articles'.' AS a WHERE seftitle = "'.$categorySEF.'" '.$pub_a.' AND position = 3'); // query for category $R = mysql_fetch_assoc($Try_Page); if (!$R) { $MainQuery ='SELECT id AS catID, name, description FROM '._PRE.'categories'.' AS c WHERE seftitle = "'.$categorySEF.'" AND subcat = 0 '.$pub_c; } endswitch; } if (!empty($MainQuery)){ $Mainresult = mysql_query($MainQuery); if (mysql_num_rows($Mainresult) === 1 ){ $R = mysql_fetch_assoc($Mainresult); } else if(!in_array($_GET['action'],explode(',',l('cat_listSEF')))){ // Patch #7 - 1.7.1 $categorySEF = '404'; header('HTTP/1.1 404 Not Found'); unset($subcatSEF,$articleSEF); } update_articles(); } // globals } else { // ID for 'home' if (s('display_page') !== 0) $_ID = s('display_page'); } if(!empty($R['category'])) $_CAT = $R['category']; if(!empty($R['id'])) $_ID = $R['id']; if(!empty($R['title'])) $_TITLE = $R['title']; if(!empty($R['position'])) $_POS = $R['position']; if(!empty($R['catID'])) $_catID = $R['catID']; if(!empty($R['name'])) $_NAME = $R['name']; if(!empty($R['xname'])) $_XNAME = $R['xname']; if(!empty($R['keywords_meta'])) $_KEYW = $R['keywords_meta']; if(!empty($R['description_meta'])) $_DESCR = $R['description_meta']; else $_DESCR = $R['description']; // set comments page for / category / article / if (isset($url[3]) && !$_XNAME) $commentsPage = $url[2]; //TITLE function title() { global $categorySEF, $_DESCR, $_KEYW, $_TITLE, $_NAME, $_XNAME; echo ''.l('edit').''.' '.l('divider').' '.$visiblity.'
' : ''; if ($styleit == 1) { echo ''.l('error_404').'
'; // Patch #404 - 1.7.1 - message string revised. sitemap(); break; // Patch #404 - 1.7.1 - show sitemap with message. default: articles(); break; } } } // ARTICLES function articles() { global $categorySEF, $subcatSEF, $articleSEF, $_ID, $_POS, $_catID, $_XNAME; $frontpage = s('display_page'); $title_not_found = ''.l('create_new').' '.l('administration').'
'; } else { $visible =' AND a.visible=\'YES\' '; } if ($_ID || (!$_catID && $frontpage != 0)) { if (!$_ID) $_ID = $frontpage; // article or page, id as indentifier $query_articles = 'SELECT a.id AS aid,title,a.seftitle AS asef,text,a.date, a.displaytitle,a.displayinfo,a.commentable,a.visible FROM '._PRE.'articles'.' AS a WHERE id ='.$_ID.$visible; } else { if (s('display_pagination') == 'on') $on = true; else $on = false; if ($on == true) { if ($articleSEF) { $SEF = $articleSEF; } elseif ($subcatSEF) { $SEF = $subcatSEF; } else { $SEF = $categorySEF; } // pagination $currentPage = strpos($SEF, l('paginator')) === 0 ? str_replace(l('paginator'), '', $SEF) : ''; if ($_catID) { $count = 'SELECT COUNT(a.id) AS num FROM '._PRE.'articles'.' AS a WHERE position = 1 AND a.published =1 AND category = '.$_catID.$visible.' GROUP BY category'; } else { $count = 'SELECT COUNT(a.id) AS num FROM '._PRE.'articles'.' AS a LEFT OUTER JOIN '._PRE.'categories'.' as c ON category = c.id LEFT OUTER JOIN '._PRE.'categories'.' as x ON c.subcat = x.id AND (x.published =\'YES\') WHERE show_on_home = \'YES\' '.$visible.' AND position = 1 AND a.published =1 AND c.published =\'YES\' GROUP BY show_on_home'; } $count = mysql_query($count); if ($count) { $r = mysql_fetch_array($count); $num = $r['num']; } } if ($num === 0 ) { echo $title_not_found; } else { $articleCount = s('article_limit'); $article_limit = (empty($articleCount) || $articleCount < 1) ? 100 : $articleCount; $totalPages = ceil($num/$article_limit); if (!isset($currentPage) || !is_numeric($currentPage) || $currentPage < 1) { $currentPage = 1; } // get the rows for category if ($_catID) { $query_articles = 'SELECT a.id AS aid,title,a.seftitle AS asef,text,a.date, a.displaytitle,a.displayinfo,a.commentable,a.visible FROM '._PRE.'articles'.' AS a WHERE position = 1 AND a.published =1 AND category = '.$_catID.$visible.' ORDER BY artorder ASC,date DESC LIMIT '.($currentPage - 1) * $article_limit.','.$article_limit; } else { $query_articles = 'SELECT a.id AS aid,title,a.seftitle AS asef,text,a.date, displaytitle,displayinfo,commentable,a.visible, c.name AS name,c.seftitle AS csef, x.name AS xname,x.seftitle AS xsef FROM '._PRE.'articles'.' AS a LEFT OUTER JOIN '._PRE.'categories'.' as c ON category = c.id LEFT OUTER JOIN '._PRE.'categories'.' as x ON c.subcat = x.id AND x.published =\'YES\' WHERE show_on_home = \'YES\' AND position = 1 AND a.published =1 AND c.published =\'YES\''.$visible.' ORDER BY date DESC LIMIT '.($currentPage - 1) * $article_limit.','.$article_limit; } } } $result = mysql_query($query_articles); $numrows = mysql_num_rows($result); if (!$result || !$numrows) { if (_ADMIN) { echo $title_not_found; } echo ''.$edit_link.'
'; } } else if (empty($currentPage)) { if ($infoline == true) { $tag = explode(',', tags('infoline')); foreach ($tag as $tag ) { switch ($tag) { case 'date': echo $a_date_format; break; case 'readmore': case 'comments': ; break; case 'edit': if (_ADMIN) { echo ' '.$edit_link; } break; default: echo $tag; } } } else if (_ADMIN) { echo ''.$edit_link.'
'; } } } if (!empty($currentPage) && ($num> $article_limit) && $on) { paginator( $currentPage, $totalPages, l('paginator')); } if (!empty($_POS) && empty($currentPage) && $infoline == true) { if ($commentable == 'YES') { comment('unfreezed'); } else if ($commentable == 'FREEZ') { comment('freezed'); } } } } // COMMENTS function comment($freeze_status) { echo ''.$commentReason.'
'; } $postArt = clean(cleanXSS($_POST['article'])); $postArtID = retrieve('category','articles','id',$post_article_id); if ($postArtID == 0) { $postCat = '' ; } else { $postCat = cat_rel($postArtID, 'seftitle').'/'; } if ($fail){ $back_link = _SITE.$postCat.$postArt; echo ''.l('back').''; } else { echo ''; } } else { $commentCount = s('comment_limit'); $comment_limit = (empty($commentCount) || $commentCount < 1) ? 100 : $commentCount; if (isset($commentsPage)) { $pageNum = $commentsPage; } $offset = ($pageNum - 1) * $comment_limit; $totalrows = 'SELECT count(id) AS num FROM '._PRE.'comments'.' WHERE articleid = '.$_ID.' AND approved = \'True\';'; $rowsresult = mysql_query($totalrows); $numrows = mysql_fetch_array($rowsresult); $numrows = $numrows['num']; // Patch #8 - 1.7.1 - redundant section removed if ($numrows > 0) { $query = 'SELECT id,articleid,name,url,comment,time,approved FROM '._PRE.'comments'.' WHERE articleid = '.$_ID.' AND approved = \'True\' ORDER BY id '.$comments_order.' LIMIT '."$offset, $comment_limit"; $result = mysql_query($query) or die(l('dberror')); $ordinal = 1; $date_format = s('date_format'); $edit_link = ' '.$date; break; case ($tag == 'name'): $name = $r['name']; echo !empty($r['url']) ? ' '.$name.' ' : $name; break; case ($tag == 'comment'): echo $r['comment']; break; case ($tag == 'edit' && _ADMIN): echo $edit_link.'editcomment&commentid='.$r['id'].'" title="'.l('edit').' '.l('comment').'">'.l('edit').' '; echo $edit_link.'process&task=deletecomment&commentid='.$r['id'].'" title="'.l('delete').' '.l('comment').'" onclick="return pop()">'.l('delete').''; break; case ($tag == 'edit'): ; break; default: echo $tag; } } $ordinal++; } $maxPage = ceil($numrows / $comment_limit); $back_to_page = ceil(($numrows + 1) / $comment_limit); if ($maxPage > 1) { paginator($pageNum, $maxPage,l('comment_pages')); } } if ($freeze_status != 'freezed' && s('freeze_comments') != 'YES') { if ($numrows == 0) {echo ''.l('no_comment').'
';} // Patch #8 - 1.7.1 - new line added // recall and set vars for reuse when botched post if($_SESSION[_SITE.'comment']['fail'] == true) { $name = $_SESSION[_SITE.'comment']['name']; $comment = $_SESSION[_SITE.'comment']['comment']; $url = $_SESSION[_SITE.'comment']['url']; unset($_SESSION[_SITE.'comment']); } else { $url = $name = $comment = ''; } // end var retrieval $art_value = empty($articleSEF) ? $subcatSEF : $articleSEF; echo ''.l('frozen_comments').'
'; } } } // ARCHIVE function archive($start = 0, $size = 200) { echo ''.l('no_articles').'
'; } else { while ($r = mysql_fetch_array($result)) { $Or_id[] = 'a.id ='.$r['id']; } $Or_id = implode(' OR ',$Or_id); $query = 'SELECT title,a.seftitle AS asef,a.date AS date, c.name AS name,c.seftitle AS csef, x.name AS xname,x.seftitle AS xsef FROM '._PRE.'articles'.' AS a LEFT OUTER JOIN '._PRE.'categories'.' as c ON category = c.id LEFT OUTER JOIN '._PRE.'categories'.' as x ON c.subcat = x.id WHERE ('.$Or_id.') AND a.published = 1 AND c.published =\'YES\' AND (x.published =\'YES\' || x.published IS NULL) ORDER BY date DESC LIMIT '."$start, $size"; $result = mysql_query($query); $month_names = explode(', ', l('month_names')); $dot = l('divider'); echo '';
while ($r = mysql_fetch_array($result)) {
$year = substr($r['date'], 0, 4);
$month = substr($r['date'], 5, 2) -1;
$month_name = (substr($month, 0, 1) == 0) ? $month_names[substr($month, 1, 1)] : $month_names[$month];
if ($last <> $year.$month) {
echo ''.$month_name.', '.$year.'
';
}
$last = $year.$month;
$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef'];
echo $dot.'
'.$r['title'].' ('.$r['name'].')
';
}
echo'
'.l('required').'
'.l('charerror').'
'; } else { $keywords = explode(' ', $search_query); $keyCount = count($keywords); $query = 'SELECT a.id FROM '._PRE.'articles'.' AS a LEFT OUTER JOIN '._PRE.'categories'.' as c ON category = c.id AND c.published =\'YES\' LEFT OUTER JOIN '._PRE.'categories'.' as x ON c.subcat = x.id AND x.published =\'YES\' WHERE position != 2 AND a.published = 1 AND'; if(!_ADMIN){ $query = $query.' a.visible = \'YES\' AND '; } if ($keyCount > 1) { for ($i = 0; $i < $keyCount - 1; $i++) { $query = $query.' (title LIKE "%'.$keywords[$i].'%" || text LIKE "%'.$keywords[$i].'%" || keywords_meta LIKE "%'.$keywords[$i].'%") &&'; } $j = $keyCount - 1; $query = $query.'(title LIKE "%'.$keywords[$j].'%" || text LIKE "%'.$keywords[$j].'%" || keywords_meta LIKE "%'.$keywords[$j].'%")'; } else { $query = $query.'(title LIKE "%'.$keywords[0].'%" || text LIKE "%'.$keywords[0].'%" || keywords_meta LIKE "%'.$keywords[0].'%")'; } $query = $query.' ORDER BY id DESC LIMIT '.$limit; $result = mysql_query($query); $numrows = mysql_num_rows($result); if (!$numrows) { echo ''.l('noresults').' '.stripslashes($search_query).'.
'; } else { echo ''.$numrows.' '.l('resultsfound').' '. stripslashes($search_query).'.
'; while ($r = mysql_fetch_array($result)) { $Or_id[] = 'a.id ='.$r['id']; } $Or_id = implode(' OR ',$Or_id); $query = 'SELECT title,a.seftitle AS asef,a.date AS date, c.name AS name,c.seftitle AS csef, x.name AS xname,x.seftitle AS xsef FROM '._PRE.'articles'.' AS a LEFT OUTER JOIN '._PRE.'categories'.' as c ON category = c.id LEFT OUTER JOIN '._PRE.'categories'.' as x ON c.subcat = x.id WHERE '.$Or_id; $result = mysql_query($query); while ($r = mysql_fetch_array($result)) { $date = date(s('date_format'), strtotime($r['date'])); if ($r['name']) $name = ' ('.$r['name'].')'; if (isset($r['xsef'])) $link = $r['xsef'].'/'.$r['csef'].'/'; else $link = isset($r['csef']) ? $r['csef'].'/' : ''; echo ''.$r['title'].$name.' - '.$date.'
'; } } } echo ''; } // RSS FEED - ARTICLES/PAGES/COMMENTS function rss_contents($rss_item){ // Patch #17A - 1.7.1 - removed: , $artSEF='' (redundant) header('Content-type: text/xml; charset='.s('charset').''); $limit = s('rss_limit'); switch($rss_item) { case 'rss-articles': $heading = l('articles'); $query = _PRE.'articles'.' WHERE position = 1 AND visible = \'YES\' AND published = 1 ORDER BY date'; break; case 'rss-pages': $heading = l('pages'); $query = _PRE.'articles'.' WHERE position = 3 AND visible = \'YES\' AND published = 1 ORDER BY date'; break; case 'rss-comments': $heading = l('comments'); $query = _PRE.'comments'." WHERE approved = 'True' ORDER BY id"; break; } echo ''.l('login_limit').'
'; echo html_input('text', 'uname', 'uname', '', l('username'), 'text', '', '', '', '', '', '', '', '', ''); echo html_input('password', 'pass', 'pass', '', l('password'), 'text', '', '', '', '', '', '', '', '', ''); echo mathCaptcha(); echo ''; echo html_input('hidden', 'Loginform', 'Loginform', 'True', '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', 'submit', 'submit', l('login'), '', 'button', '', '', '', '', '', '', '', '', ''); echo '
'.$lbl.':
'.$input.$val.' />
'.$input.$check.' /> '.$lbl.'
'; break; case 'hidden': case 'submit': case 'reset': case 'button': $output = $input.$val.' />'; break; case 'textarea': $output = ''.$lbl.':
sNews '.l('administration').'
'; echo ''.l('categories').': '.l('add_new').''; $link = ' '.l('divider').' '.l('view').''; } echo '
'.l('articles').': '; $art_new = $catnum['catnum'] > 0 ? ''.l('add_new').'' : l('create_cat'); echo $art_new; if (stats('articles','1') > 0) { echo $link.'snews_articles/">'.l('view').''; } echo '
'.l('pages').': '.l('add_new').''; if (stats('articles','3') > 0) { echo $link.'snews_pages/">'.l('view').''; } echo '
'; if (s('enable_extras') == 'YES') { echo ''.l('extra_contents').'
'; echo ''.l('groupings').': '.l('add_new').''; if (stats('extras','') > 0) { echo $link.'groupings/">'.l('view').''; } echo '
'; } echo ''.l('extra_contents').': '.l('add_new').''; if (stats('articles','2') > 0) { echo $link.'extra_contents/">'.l('view').''; } echo '
'; echo ''.l('comments').'
'; echo ''; echo ''.l('settings_title').'
'; echo html_input('form','','','','','','','','','','','','post', '?action=process&task=save_settings',''); # Expandable Settings echo ''; echo ''; # Expandable Contact echo ''; echo ''; # Expandable Time & Locale echo ''; echo ''; # Expandable Contents echo ''; echo ''; # Expandable Comments echo ''; echo ''; echo ''; # Save Settings button echo html_input('submit','save','save',l('save'),'','button','','','','','','','','',''); echo '
'; echo ''; echo ''.l('change_up').''; echo '
'; echo ''.$frm_add_edit.'
'; # Patch #19 - 1.7.1 - replaces fieldset string echo html_input('text', 'name', 't', $frm_name, l('name'), '', 'onchange="genSEF(this,document.forms[\'post\'].seftitle)"', 'onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"', '', '', '', '', '', '', ''); echo html_input('text', 'seftitle', 's', $frm_sef_title, l('sef_title_cat'), '', '', '', '', '', '', '', '', '', ''); echo html_input('text', 'description', 'desc', $frm_description, l('description'), '', '', '', '', '', '', '', '', '', ''); if (empty($sub_cat)) { echo ''.l('subcategory').':
'; category_list($categoryid); echo '
'; // echo '
'; # Patch #19 - 1.7.1 if ($sub_cat) { echo html_input('hidden', 'subcat', 'subcat', $sub_cat, '', '', '', '', '', '', '', '', '', '', ''); } echo html_input('hidden', 'catorder', 'catorder', $catorder, '', '', '', '', '', '', '', '', '', '', ''); echo html_input('hidden', 'task', 'task', 'admin_category', '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', $frm_task, $frm_task, $frm_submit, '', 'button', '', '', '', '', '', '', '', '', ''); if (!empty($categoryid)) { echo ' '; echo html_input('hidden', 'id', 'id', $categoryid, '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', 'delete_category', 'delete_category', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', ''); } echo '
'; } // CATEGORIES - ADMIN LIST function admin_categories() { # Patch #19 - 1.7.1 - replaces fieldset string $add = ' - '.l('add_new').''; $link = '?action=admin_category'; $tab = 1; echo ''.l('categories').$add.'
'; echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', '?action=process&task=reorder', ''); echo ''; $query = 'SELECT id, name, description, published, catorder FROM '._PRE.'categories'.' WHERE subcat = 0 ORDER BY catorder,id ASC'; $result = mysql_query($query); if (!$result || !mysql_num_rows($result)) { echo ''.l('category_not_exist').'
'; } else { while ($r = mysql_fetch_array($result)) { $cat_input = ' '; echo ''.$cat_input.''.$r['name'].' '.l('divider').' '.l('edit').' '; echo $r['published'] != 'YES' ? ' '.l('divider').' ['.l('status').' '.l('unpublished').']' : ''; echo ' '.l('divider').' '.l('add_subcategory').'
'; $subquery = 'SELECT id,name,description,published,catorder FROM '._PRE.'categories'.' WHERE subcat = '.$r['id'].' ORDER BY catorder,id ASC'; $subresult = mysql_query($subquery); $tab2 = 1; while ($sub = mysql_fetch_array($subresult)) { $subcat_input = ' '; echo ''.$subcat_input.''.$sub['name'].''.l('divider').' '.l('edit').' '; echo ($sub['published'] != 'YES' ? ' '.l('divider').' ['.l('status').' '.l('unpublished').']' : ''); echo '
'; $tab2++; } $tab++; } } echo ''.html_input('submit', 'reorder', 'reorder', l('order_content'), '', 'button', '', '', '', '', '', '', '', '', ''); echo '
'; echo ''.l('day').': '.l('month').': '.l('year').': '.l('hour').': '.l('minute').':
'; return; } // ARTICLES FORM function form_articles($contents) { if (is_numeric($_GET['id']) && !is_null($_GET['id'])) { $id = $_GET['id']; $query = mysql_query('SELECT * FROM '._PRE.'articles'.' WHERE id='.$id); $r = mysql_fetch_array($query); $article_category = $r['category']; $edit_option = $r['position']==0 ? 1 : $r['position']; $edit_page = $r['page_extra']; $extraid = $r['extraid']; switch ($edit_option) { case 1: $frm_fieldset = l('edit').' '.l('article'); $toggle_div='show'; $frm_position1 = 'selected="selected"'; break; case 2: $frm_fieldset = l('edit').' '.l('extra_contents'); $toggle_div='show'; $frm_position2 = 'selected="selected"'; break; case 3: $frm_fieldset = l('edit').' '.l('page'); $toggle_div='show'; $frm_position3 = 'selected="selected"'; break; } $frm_action = _SITE.'?action=process&task=admin_article&id='.$id; $frm_title = $_SESSION[_SITE.'temp']['title'] ? $_SESSION[_SITE.'temp']['title'] : $r['title']; $frm_sef_title = $_SESSION[_SITE.'temp']['seftitle'] ? cleanSEF($_SESSION[_SITE.'temp']['seftitle']) : $r['seftitle']; $frm_text = str_replace('&', '&', $_SESSION[_SITE.'temp']['text'] ? $_SESSION[_SITE.'temp']['text'] : $r['text']); $frm_meta_desc = $_SESSION[_SITE.'temp']['description_meta'] ? cleanSEF($_SESSION[_SITE.'temp']['description_meta']) : $r['description_meta']; $frm_meta_key = $_SESSION[_SITE.'temp']['keywords_meta'] ? cleanSEF($_SESSION[_SITE.'temp']['keywords_meta']) : $r['keywords_meta']; $frm_display_title = $r['displaytitle'] == 'YES' ? 'ok' : ''; $frm_display_info = $r['displayinfo'] == 'YES' ? 'ok' : ''; $frm_publish = $r['published'] == 1 ? 'ok' : ''; $show_in_subcats = $r['show_in_subcats'] == 'YES' ? 'ok' : ''; $frm_showonhome = $r['show_on_home'] == 'YES' ? 'ok' : ''; $frm_commentable = ($r['commentable'] == 'YES' || $r['commentable'] == 'FREEZ') ? 'ok' : ''; $frm_task = 'edit_article'; $frm_submit = l('edit_button'); // Patch #11 - 1.7.1 } else { switch ($contents) { case 'article_new': $frm_fieldset = l('article_new'); $toggle_div=''; $pos = 1; $frm_position1 = 'selected="selected"'; break; case 'extra_new': $frm_fieldset = l('extra_new'); $toggle_div=''; $pos = 2; $frm_position2 = 'selected="selected"'; break; case 'page_new': $frm_fieldset = l('page_new'); $toggle_div=''; $pos = 3; $frm_position3 = 'selected="selected"'; break; } if (empty($frm_fieldset)) { $frm_fieldset = l('article_new'); } $frm_action = _SITE.'?action=process&task=admin_article'; $frm_title = $_SESSION[_SITE.'temp']['title']; $frm_sef_title = cleanSEF($_SESSION[_SITE.'temp']['seftitle']); $frm_text = $_SESSION[_SITE.'temp']['text']; $frm_meta_desc = cleanSEF($_SESSION[_SITE.'temp']['description_meta']); $frm_meta_key = cleanSEF($_SESSION[_SITE.'temp']['keywords_meta']); $frm_display_title = 'ok'; $frm_display_info = ($contents == 'extra_new') ? '' : 'ok'; $frm_publish = 'ok'; $show_in_subcats = 'ok'; $frm_showonhome = s('display_new_on_home') == 'on' ? 'ok' : ''; $frm_commentable = ($contents == 'extra_new' || $contents == 'page_new' || s('enable_comments') != 'YES') ? '' : 'ok'; $frm_task = 'add_article'; $frm_submit = l('submit'); } $catnum = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as catnum FROM "._PRE.'categories'."")); if ($contents == 'article_new' && $catnum['catnum'] < 1) { echo l('create_cat'); } else { echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', $frm_action, ''); echo ''; echo html_input('hidden', 'task', 'task', 'admin_article', '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', $frm_task, $frm_task, $frm_submit, '', 'button', '', '', '', '', '', '', '', '', ''); if (!empty($id)) { echo html_input('hidden', 'article_category', 'article_category', $article_category, '', '', '', '', '', '', '', '', '', '', ''); echo html_input('hidden', 'id', 'id', $id, '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', 'delete_article', 'delete_article', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', ''); } echo '
'; }} // ARTICLES - ADMIN LIST - Patch #19 - 1.7.1 - in 5 locations function admin_articles($contents) { global $categorySEF, $subcatSEF; $link = ' '.l('add_new').' - '.l('see').' ('.$link.'">'.l('all').') - '.l('filter').' ('.$link.l('year').'">'.l('year').' / '.$link.l('month').'"> '.l('month').')'; } else { $add = ''; } $tab = 1; if ($subcatSEF == l('year') || $subcatSEF == l('month')) { $query = 'SELECT DISTINCT(YEAR(date)) AS dyear FROM '._PRE.'articles'.' WHERE '.$qw.' ORDER BY date DESC'; $result = mysql_query($query); $month_names = explode(', ', l('month_names')); echo ''.l('articles').'
'; // Patch #19 - 1.7.1 - replaces fieldset string echo ' - '.l('filter').' '.$subcatSEF.' - '.l('see').' ('.$link.'">'.l('all').') - '.l('filter').' ('.$link.l('year').'">'.l('year').' / '.$link.l('month').'">'.l('month').')'; if ($result){ while ($r = mysql_fetch_array($result)) { $ryear = $r['dyear']; echo ($subcatSEF == l('month') ? ''.$r['dyear'].'' : $link.l('year').'='.$r['dyear'].'">'.$r['dyear'].' '); if ($subcatSEF == l('month')) { $qx = "SELECT DISTINCT(MONTH(date)) AS dmonth FROM "._PRE.'articles'." WHERE $qw AND YEAR(date)=$ryear ORDER BY date ASC"; $rqx = mysql_query($qx); while ($rx = mysql_fetch_array($rqx)){ $m = $rx['dmonth'] - 1; echo ' '.l('divider').' '.$link.l('year').'='.$r['dyear'].';'.l('month').'='.$rx['dmonth'].'">'.$month_names[$m].' '; } } echo ''.l('no_content_for_filter').'
' : ''.l('article_not_exist').'
'; echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', '?action=process&task=reorder', ''); echo ''.$title.$add.'
'; // Patch #19 - 1.7.1 - replaces fieldset string echo ''; if ($contents == 'extra_view') { $cat_array_irregular = array('-1','-3'); foreach ($cat_array_irregular as $cat_value) { $legend_label = $cat_value == -3 ? l('pages') : l('all'); $page_only_xsql = $cat_value == -3 ? 'page_extra ASC,' : ''; $sql = "SELECT id, title, seftitle, date, published, artorder, visible, default_page, page_extra FROM "._PRE.'articles'." WHERE category = $cat_value AND position = $p $filterquery ORDER BY $page_only_xsql artorder ASC, date DESC "; $query = mysql_query($sql) or die(mysql_error()); $num_rows = mysql_num_rows($query); $tab=1; echo ''.$legend_label.'
'; // Patch #19 - 1.7.1 - replaces fieldset string if ($num_rows == 0) { echo $no_content; } else { $lbl_filter = -5; while ($r = mysql_fetch_array($query)) { if ($cat_value == -3) { if ($lbl_filter != $r['page_extra']) { $assigned_page = retrieve('title','articles','id',$r['page_extra']); echo !$assigned_page ? l('all_pages') : $assigned_page; } } $order_input = ' '; // Patch #13 - 1.7.1 - next string replace 1 below it. echo ''.$order_input.' '.$r['title'].' '; //echo '
'.$order_input.' '.$r['title'].' '.l('divider').''.l('view').' '; if ($r['default_page'] != 'YES'){ echo l('divider').' '.l('edit').' '; } $visiblity = $r['visible'] == 'YES' ? ''.l('hide').'' : l('hidden').' ( '.l('show').' )' ; echo ' '.l('divider').' '.$visiblity; if ($r['published'] == 2) { echo l('divider').' ['.l('status').' '.l('future_posting').']'; } if ($r['published'] == 0) { echo l('divider').' ['.l('status').' '.l('unpublished').']'; } echo '
'; $tab++; $lbl_filter = $r['page_extra']; } } echo ''.l('no_categories').'
'; } else { $sql = "SELECT id, title, seftitle, date, published, artorder, visible, default_page FROM "._PRE.'articles'." WHERE category = '0' AND position = $p $subquery ORDER BY artorder ASC, date DESC "; $query = mysql_query($sql) or die(mysql_error()); $num_rows = mysql_num_rows($query); if ($num_rows > 0) { echo ''.l('no_category_set').'
'; // Patch #19 - 1.7.1 - replaces fieldset string while ($O = mysql_fetch_array($query)) { $order_input = ' '; echo ''.$order_input.''.$O['title'].' '; if ($r['default_page'] != 'YES'){ echo l('divider').' '.l('edit').' '; } $visiblity = $O['visible'] == 'YES' ? ''.l('hide').'' : l('hidden').' ( '.l('show').' )' ; echo ' '.l('divider').' '.$visiblity; if ($O['published'] == 2) { echo l('divider').' ['.l('status').' '.l('future_posting').']'; } if ($O['published'] == 0) { echo l('divider').' ['.l('status').' '.l('unpublished').']'; } echo '
'; $tab22++; } echo ''.$row['name'].'
'; // Patch #19 - 1.7.1 - replaces fieldset string $sql = "SELECT id, title, seftitle, date, published, artorder, visible, default_page FROM "._PRE.'articles'." WHERE category = '".$row['id']."' AND position = $p $subquery $filterquery ORDER BY artorder ASC, date DESC "; $query = mysql_query($sql) or die(mysql_error()); $num_rows = mysql_num_rows($query); if ($num_rows == 0) { echo $no_content; } while ($r = mysql_fetch_array($query)) { $order_input = ' '; echo ''.$order_input.' '.$r['title'].' '.l('divider').' '.l('view').' '; if ($r['default_page'] != 'YES'){ echo l('divider').' '.l('edit').' '; } $visiblity = $r['visible'] == 'YES' ? ''.l('hide').'' : l('hidden').' ( '.l('show').' )' ; echo ' '.l('divider').' '.$visiblity; if ($r['published'] == 2) { echo l('divider').' ['.l('status').' '.l('future_posting').']'; } if ($r['published'] == 0) { echo l('divider').' ['.l('status').' '.l('unpublished').']'; } echo '
'; $tab++; } $query2 = mysql_query("SELECT id, name, seftitle FROM "._PRE.'categories'." WHERE subcat = '$row[id]' ORDER BY catorder ASC"); $tab2 = 1; while ($row2 = mysql_fetch_array($query2)){ echo ''.$row2['name'].''.l('article_not_exist').'
'; } while ($r = mysql_fetch_array($query)) { $order_input = ' '; echo ''.$order_input.' '.$r['title'].' '.l('divider').' '.l('view').' '; if ($r['default_page'] != 'YES') { echo l('divider').' '.l('edit').' '; } $visiblity = $r['visible'] == 'YES' ? ''.l('hide').'' : l('hidden').' ( '.l('show').' )' ; echo ' '.l('divider').' '.$visiblity; if ($r['published'] == 2) { echo l('divider').' ['.l('status').' '.l('future_posting').']'; } if ($r['published'] == 0) { echo l('divider').' ['.l('status').' '.l('unpublished').']'; } echo '
'; $tab++; } } echo ''.html_input('submit', 'reorder', 'reorder', l('order_content'), '', 'button', '', '', '', '', '', '', '', '', ''); echo '
'.l('formatting').':
';
$formatting = array(
'strong' => '',
'em' => 'key',
'underline' => 'key',
'del' => 'key',
'p' => '',
'br' => ''
);
foreach ($formatting as $key => $var) {
$css = $var == 'key' ? $key :'buttons';
echo '';
}
echo '
'.l('insert').':
';
$insert = array('img', 'link', 'include', 'func','intro');
foreach ($insert as $key) {
echo '';
}
echo '
'.l('edit_comment').' ( '.$articleTITLE.' )
'; echo html_input('textarea', 'editedcomment', 'ec', stripslashes($r['comment']), l('comment'), '', '', '', '', '', '2', '100', '', '', ''); echo html_input('text', 'name', 'n', $r['name'], l('name'), '', '', '', '', '', '', '', '', '', ''); echo html_input('text', 'url', 'url', $r['url'], l('url'), '', '', '', '', '', '', '', '', '', ''); echo html_input('checkbox', 'approved', 'a', '', l('approved'), '', '', '', '', $r['approved'] == 'True' ? 'ok' : '', '', '', '', '', ''); echo ''; // echo '
'; # Patch #19 - 1.7.1 echo html_input('hidden', 'id', 'id', $r['articleid'], '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', 'submit_text', 'submit_text', l('edit'), '', 'button', '', '', '', '', '', '', '', '', ''); echo html_input('hidden', 'commentid', 'commentid', $r['id'], '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', 'delete_text', 'delete_text', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', ''); echo '
'; } // FORM EXTRA GROUPINGS function form_groupings() { if (s('enable_extras') == 'YES') { if (isset($_GET['id']) && is_numeric($_GET['id']) && !is_null($_GET['id'])) { $extraid = $_GET['id']; $query = mysql_query('SELECT id,name,seftitle,description FROM '._PRE.'extras'.' WHERE id='.$extraid); $r = mysql_fetch_array($query); $frm_action = _SITE.'?action=process&task=admin_groupings&id='.$extraid; $frm_add_edit = l('edit'); $frm_name = $r['name']; $frm_sef_title = $r['seftitle']; $frm_description = $r['description']; $frm_task = 'edit_groupings'; $frm_submit = l('edit_button'); // Patch #11 - 1.7.1 } else { $frm_action = _SITE.'?action=process&task=admin_groupings'; $frm_add_edit = l('add_groupings'); $frm_name = $_POST['name']; $frm_sef_title = $_POST['name'] == '' ? cleanSEF($_POST['name']) : cleanSEF($_POST['seftitle']); $frm_description = ''; $frm_task = 'add_groupings'; $frm_submit = l('add_groupings'); } echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', $frm_action, ''); echo ''.$frm_add_edit.'
'; echo html_input('text', 'name', 't', $frm_name, l('name'), '', 'onchange="genSEF(this,document.forms[\'post\'].seftitle)"', 'onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"', '', '', '', '', '', '', ''); echo html_input('text', 'seftitle', 's', $frm_sef_title, l('extra_title'), '', '', '', '', '', '', '', '', '', ''); echo html_input('text', 'description', 'desc', $frm_description, l('description'), '', '', '', '', '', '', '', '', '', ''); echo ''; // echo '
'; # Patch #19 - 1.7.1 echo html_input('hidden', 'task', 'task', 'admin_groupings', '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', $frm_task, $frm_task, $frm_submit, '', 'button', '', '', '', '', '', '', '', '', ''); if (!empty($extraid)) { echo ' '; echo html_input('hidden', 'id', 'id', $extraid, '', '', '', '', '', '', '', '', '', '', ''); if ($extraid != 1) { echo html_input('submit', 'delete_groupings', 'delete_groupings', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', ''); } } echo '
'; } } // ADMIN GROUPINGS function admin_groupings() { if (s('enable_extras') == 'YES') { if (stats('extras','') > 0) { $add = ' - '.l('add_new').''; } else { $add = ''; } echo ''.l('groupings').$add.'
'; // Patch #19 - 1.7.1 - replaces fieldset string $result = mysql_query('SELECT id,name,description FROM '._PRE.'extras'.' ORDER BY id ASC'); if (!$result || !mysql_num_rows($result)) { echo ''.l('group_not_exist').'
'; } else { while ($r = mysql_fetch_array($result)) { echo ''.$r['name'].' '.l('divider').''.l('edit').'
'; } } echo ''.l('administration').' OR '.l('empty_cat').'
'; $no_success = true; } else { delete_cat($id); } break; } $success = isset($no_success) ? '' : notification(0,'','snews_categories'); echo $success; } break; case 'reorder': if (isset($_POST['reorder'])) { switch ($_POST['order']){ case 'snews_articles': case 'extra_contents': case 'snews_pages': $table = 'articles'; $order_type = 'artorder'; $remove = 'page_'; break; case 'snews_categories': $table = 'categories'; $order_type = 'catorder'; $remove = 'cat_'; break; } foreach ($_POST as $key => $value){ $type_id = str_replace($remove,'',$key); $key = clean(cleanXSS(trim($value))); if ($key != 'reorder' && $key != 'order' && $key != $table && $key != l('order_content') && $key != $_POST['order']){ $query = "UPDATE "._PRE.$table." SET $order_type = $value WHERE id = $type_id LIMIT 1;"; mysql_query($query) or die(mysql_error().''.$filename.' ['.$kb_size.' KB] ['.$filetype.']
'; } } else { die(notification(2,l('file_error'),'snews_files')); } } else { if (isset($_GET['task']) == 'delete') { $file_to_delete = $_GET['folder'].'/'.$_GET['file']; @unlink($file_to_delete); echo notification(0,'','snews_files'); } else { echo ''.l('upload').'
'; # Patch #19 - 1.7.1 - title string replaces fieldset echo ''.l('view_files').' '.(!isset($_POST['upload_dir']) ? ' root' : ' '.str_replace('.', 'root', $_POST['upload_dir'])); echo '
'; # Patch #19 - 1.7.1 - title string replaces fieldset echo ''.$note.'
'; switch(true){ case (!$link): $goto = ''; break; case ($link == 'home'): $goto = ''; break; case ($link != 'home'): $goto = ''; break; } if ($error == 2) { $_SESSION[_SITE.'fatal'] = $note == '' ? '' : '')); return $output; } // HTML ENTITIES function entity($item) { $item = htmlspecialchars($item, ENT_QUOTES, s('charset')); return $item; } //FILE INCLUSION function file_include($text, $shorten) { $fulltext = substr($text, 0, $shorten); if(substr_count ($fulltext, '&')>0){$fulltext = str_replace('&', '&', str_replace('&', '&', $fulltext));} if ($shorten < 9999000 && preg_match('',$fulltext)) { if (substr_count ($fulltext, '
') > substr_count ($fulltext, '
')) { $fulltext .=''; } } $ins = strpos($fulltext, '[/func]'); if ($ins > 0) { $text = str_replace('[func]', '|&|', $fulltext); $text = str_replace('[/func]', '|&|', $text); $text = explode('|&|', $text); $num = count($text) - 1; $i = 1; while ($i <= $num) { $func = explode(':|:', $text[$i]); ob_start(); $returned = call_user_func_array($func[0], explode(',',$func[1])); $text[$i] = ob_get_clean(); if (empty($text[$i])) { $text[$i] = $returned; } $i = $i + 2; } $fulltext = implode($text); } $inc = strpos($fulltext, '[/include]'); if ($inc > 0) { $text = str_replace('[include]', '|&|', $fulltext); $text = str_replace('[/include]', '|&|', $text); $text = explode('|&|', $text); $num = count($text); $extension = explode(',', s('file_extensions')); for ($i = 0; $i<$num; $i++) { if ($i == $num) { break; } if (!in_array(substr(strrchr($text[$i], '.'), 1), $extension)) { echo substr($text[$i], 0); } else { if (preg_match('/^[a-z0-9_\-.\/]+$/i', $text[$i])) { $filename=$text[$i]; file_exists($filename) ? include($filename) : print l('error_file_exists'); } else { echo l('error_file_name'); } } } } else { echo $fulltext; } } // CLEAN - cleaning query function clean($query) { if (get_magic_quotes_gpc()) { $query = stripslashes($query); } $query = mysql_real_escape_string($query); return $query; } // BREAK TO NEW LINE function br2nl($text){ $text = str_replace('\r\n','',str_replace("
","\n",preg_replace('/
/i', "\\n", $text))); return $text; } // SEND EMAIL function send_email($send_array) { foreach ($send_array as $var => $value) { $$var = $value; } $body = isset($status) ? $status."\n" : ''; if (isset($message)) { $text = l('message').': '."\n".br2nl($message)."\n"; } if (isset($comment)) { $text = l('comment').': '."\n".br2nl($comment)."\n"; } $header = "MIME-Version: 1.0\n"; $header .= "Content-type: text/plain; charset=".s('charset')."\n"; $header .= "From: $name <$email>\r\nReply-To: $name <$email>\r\nReturn-Path: <$email>\r\n"; $body .= isset($name) ? l('name').': '.$name."\n" : ''; $body .= isset($email) ? l('email').': '.$email."\n" : ''; // The below requires new lang var if ip to be sent with email - $l['ip'] = 'IP'; // $body .= isset($ip) ? l('ip').': '.$ip."\n" : ''; $body .= isset($url) && $url!='' ? l('url').': '.$url."\n\n" : ''; $body .= $text."\n"; mail($to,$subject,$body,$header); } // USER/PASS CHECK function checkUserPass($input) { $output = clean(cleanXSS($input)); $output = strip_tags($output); if (ctype_alnum($output) === true && strlen($output) > 3 && strlen($output) < 14) { return $output; } else { return null; } } // MATH CAPTCHA - // Patch #18 - 1.7.1 - revised function by KikkoMax function mathCaptcha() { $x = rand(1, 9); $y = rand(1, 9); if (!isset($_SESSION[_SITE.'mathCaptcha-digit'])) { $_SESSION[_SITE.'mathCaptcha-digit'] = $x + $y; $_SESSION[_SITE.'mathCaptcha-digit-x'] = $x; $_SESSION[_SITE.'mathCaptcha-digit-y'] = $y; } $math = ''; return $math; } /* function mathCaptcha() { $x = rand(1, 9); $y = rand(1, 9); $_SESSION[_SITE.'mathCaptcha-digit'] = $x + $y; $math = '
'; $math .= $_SESSION[_SITE.'mathCaptcha-digit-x'].' + '.$_SESSION[_SITE.'mathCaptcha-digit-y'].' = '; $math .= ''; return $math; } */ // CHECK MATH CAPTCHA RESULT function checkMathCaptcha() { $result = false; $testNumber = isset($_SESSION[_SITE.'mathCaptcha-digit']) ? $_SESSION[_SITE.'mathCaptcha-digit'] : 'none'; unset($_SESSION[_SITE.'mathCaptcha-digit']); if (is_numeric($testNumber) && is_numeric($_POST['calc']) && ($testNumber == $_POST['calc'])) { $result = true; } return $result; } //CATEGORY CHECK function check_category($category) { $main_menu = explode(',', l('cat_listSEF')); if (in_array($category, $main_menu)) { return true; } else { return false; } } // MAKE A CLEAN SEF URL function cleanSEF($string) { $string = str_replace(' ', '-', $string); $string = preg_replace('/[^0-9a-zA-Z-_]/', '', $string); $string = str_replace('-', ' ', $string); $string = preg_replace('/^\s+|\s+$/', '', $string); $string = preg_replace('/\s+/', ' ', $string); $string = str_replace(' ', '-', $string); return strtolower($string); } // CLEAN CHECK SEF function cleancheckSEF($string) { $ret = !preg_match('/^[a-z0-9-_]+$/i', $string) ? 'notok' : 'ok'; return $ret; } // XSS CLEAN $XSS_cache = array(); $ra1 = array('applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml'); $ra2 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base', 'onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); $tagBlacklist = array_merge($ra1, $ra2); //CLEANXSS function cleanXSS($val) { if ($val != "") { global $XSS_cache; if (!empty($XSS_cache) && array_key_exists($val, $XSS_cache)) return $XSS_cache[$val]; $source = html_entity_decode($val, ENT_QUOTES, 'ISO-8859-1'); $source = preg_replace('/&#(\d+);/me','chr(\\1)', $source); $source = preg_replace('/&#x([a-f0-9]+);/mei','chr(0x\\1)', $source); while($source != filterTags($source)) { $source = filterTags($source); } $source = nl2br($source); $XSS_cache[$val] = $source; return $source; } return $val; } //FILTER TAGS function filterTags($source) { global $tagBlacklist; $preTag = NULL; $postTag = $source; $tagOpen_start = strpos($source, '<'); while($tagOpen_start !== FALSE) { $preTag .= substr($postTag, 0, $tagOpen_start); $postTag = substr($postTag, $tagOpen_start); $fromTagOpen = substr($postTag, 1); $tagOpen_end = strpos($fromTagOpen, '>'); if ($tagOpen_end === false) break; $tagOpen_nested = strpos($fromTagOpen, '<'); if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) { $preTag .= substr($postTag, 0, ($tagOpen_nested+1)); $postTag = substr($postTag, ($tagOpen_nested+1)); $tagOpen_start = strpos($postTag, '<'); continue; } $tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start + 1); $currentTag = substr($fromTagOpen, 0, $tagOpen_end); $tagLength = strlen($currentTag); if (!$tagOpen_end) { $preTag .= $postTag; $tagOpen_start = strpos($postTag, '<'); } $tagLeft = $currentTag; $attrSet = array(); $currentSpace = strpos($tagLeft, ' '); if (substr($currentTag, 0, 1) == '/') { $isCloseTag = TRUE; list($tagName) = explode(' ', $currentTag); $tagName = substr($tagName, 1); } else { $isCloseTag = FALSE; list($tagName) = explode(' ', $currentTag); } if ((!preg_match('/^[a-z][a-z0-9]*$/i',$tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $tagBlacklist)))) { $postTag = substr($postTag, ($tagLength + 2)); $tagOpen_start = strpos($postTag, '<'); continue; } while ($currentSpace !== FALSE) { $fromSpace = substr($tagLeft, ($currentSpace+1)); $nextSpace = strpos($fromSpace, ' '); $openQuotes = strpos($fromSpace, '"'); $closeQuotes = strpos(substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1; if (strpos($fromSpace, '=') !== FALSE) { if (($openQuotes !== FALSE) && (strpos(substr($fromSpace, ($openQuotes+1)), '"') !== FALSE)) $attr = substr($fromSpace, 0, ($closeQuotes+1)); else $attr = substr($fromSpace, 0, $nextSpace); } else $attr = substr($fromSpace, 0, $nextSpace); if (!$attr) $attr = $fromSpace; $attrSet[] = $attr; $tagLeft = substr($fromSpace, strlen($attr)); $currentSpace = strpos($tagLeft, ' '); } $postTag = substr($postTag, ($tagLength + 2)); $tagOpen_start = strpos($postTag, '<'); } $preTag .= $postTag; return $preTag; } // CLEAN - WORD FILTER function cleanWords($text) { if ((strtolower(s('word_filter_enable')) == 'on') && (file_exists(s('word_filter_file')))) { $bad_words_from_what = preg_replace('/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/', '', file(s('word_filter_file'))); $bad_words_from_what = preg_replace('/^(.*)$/', '/\\1/i', $bad_words_from_what); $bad_words_to_what = s('word_filter_change'); $text = preg_replace($bad_words_from_what, $bad_words_to_what, $text); return $text; } else { return $text; } } // CHECK IF UNIQUE function check_if_unique($what, $text, $not_id = 'x', $subcat) { $text = clean($text); switch ($what) { case 'article_seftitle': $sql = _PRE.'articles'.' WHERE seftitle = "'.$text.(!empty($not_id) ? '" AND category = '.$not_id : '"'); break; case 'article_title': $sql = _PRE.'articles'.' WHERE title = "'.$text.(!empty($not_id) ? '" AND category = '.$not_id : '"'); break; case 'subcat_seftitle': $sql = _PRE.'categories'.' WHERE seftitle = "'.$text.'" AND subcat = '.$subcat; break; case 'subcat_name': $sql = _PRE.'categories'.' WHERE name = "'.$text.'" AND subcat = '.$subcat; break; case 'cat_seftitle_edit': $sql = _PRE.'categories'.' WHERE seftitle = "'.$text.'" AND id != '.$not_id; break; case 'cat_name_edit': $sql = _PRE.'categories'.' WHERE name = "'.$text.'" AND id != '.$not_id; break; case 'subcat_seftitle_edit': $sql = _PRE.'categories'.' WHERE seftitle = "'.$text.'" AND subcat = '.$subcat.' AND id != '.$not_id; break; case 'subcat_name_edit': $sql = _PRE.'categories'.' WHERE name = "'.$text.'" AND subcat = '.$subcat.' AND id != '.$not_id; break; case 'group_seftitle': $sql = _PRE.'extras'.' WHERE seftitle = "'.$text.(!empty($not_id) ? '" AND id != '.$not_id : '"'); break; case 'group_name': $sql = _PRE.'extras'.' WHERE name = "'.$text.(!empty($not_id) ? '" AND id != '.$not_id : '"'); break; } $rows = mysql_num_rows(mysql_query('SELECT id FROM '.$sql)); if ($rows == 0) { return false; } else { return true; } } // ARTICLES - FUTURE POSTING function update_articles() { $last_date = s('last_date'); $updatetime = !empty($last_date) ? strtotime($last_date) : time(); $dif_time = time() - $updatetime; if ($dif_time > 1200 || empty($last_date)) { mysql_query('UPDATE '._PRE.'articles'.' SET published=1 WHERE published=2 AND date <= NOW()'); mysql_query('UPDATE '._PRE.'settings'.' SET value=NOW() WHERE name=\'last_date\''); } } ?>
'; $math .= $x.' + '.$y.' = '; $math .= '
'.l('addcomment').'
'."\r\n"; echo ''.l('required').'
'."\r\n"; echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', _SITE, '')."\r\n"; echo html_input('text', 'name', 'name', $name, '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('text', 'url', 'url', $url, l('url'), 'text', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('textarea', 'text', 'text', $comment, '* '.l('comment'), '', '', '', '', '', '5', '5', '', '', '')."\r\n"; echo mathCaptcha()."\r\n"; echo ''; echo html_input('hidden', 'category', 'category', $categorySEF, '', '', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('hidden', 'id', 'id', $_ID, '', '', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('hidden', 'article', 'article', $art_value, '', '', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('hidden', 'commentspage', 'commentspage', $back_to_page, '', '', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '')."\r\n"; echo html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', 'comment', 'comment', l('submit'), '', 'button', '', '', '', '', '', '', '', '', '')."\r\n"; echo '