Topic: (Hack) Sort News By (CuteNews Panel)
The hack 'Sort News By (CuteNews Panel)' by dooshek to sort news in Edit News panel by: Title, Category, Date and Author ascending and descending found here:
https://cutephp.com/forum/index.php?showtopic=17867
Gives the error
Warning: uksort() expects parameter 1 to be array, null given in /home/?????/public_html/cnews/inc/editnews.mdu on line ??
Warning: array_reverse() expects parameter 1 to be array, null given in /home/?????/public_html/cnews/inc/editnews.mdu on line ??
The correction to the code is:
open inc/editnews.mdu
Find:
if(!empty($all_db)){
add below:
if (!isset($sortby)) { $sortby="0"; } if (!isset($sortad)) { $sortad="d"; } if (isset($sortby)) { $every_news = $all_db; if (!function_exists('sortcmp')) { function sortcmp($a, $b) { global $every_news, $sortby; $news_a = explode('|', $every_news[$a]); $news_b = explode('|', $every_news[$b]); return strnatcasecmp($news_a[$sortby], $news_b[$sortby]); } } uksort($all_db, 'sortcmp'); if ($sortad=="d") { $all_db = array_reverse($all_db); } unset($sortby, $sortad); }
The rest of the hack is correct.