| @@ -27,13 +27,13 @@ discard block | ||
| 27 | 27 | include __DIR__ . '/header.php'; | 
| 28 | 28 | |
| 29 | 29 |  if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) { | 
| 30 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; | |
| 31 | - exit(); | |
| 30 | + include XOOPS_ROOT_PATH . '/include/notification_update.php'; | |
| 31 | + exit(); | |
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 |  if ($REQUEST_URI_parsed = planet_parse_args($args_num, $args, $args_str)) { | 
| 35 | - $args['start'] = @$args_num[0]; | |
| 36 | - $args['sort'] = @$args_str[0]; | |
| 35 | + $args['start'] = @$args_num[0]; | |
| 36 | + $args['sort'] = @$args_str[0]; | |
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 | /* Start */ | 
| @@ -51,34 +51,34 @@ discard block | ||
| 51 | 51 | |
| 52 | 52 | // restore $_SERVER['REQUEST_URI'] | 
| 53 | 53 |  if (!empty($REQUEST_URI_parsed)) { | 
| 54 | - $args_REQUEST_URI = array(); | |
| 55 | -    $_args            = array('start', 'sort', 'uid', 'list'); | |
| 56 | -    foreach ($_args as $arg) { | |
| 57 | -        if (!empty(${$arg})) { | |
| 58 | -            $args_REQUEST_URI[] = $arg . '=' . ${$arg}; | |
| 59 | - } | |
| 60 | - } | |
| 61 | -    if (!empty($blog_id)) { | |
| 62 | - $args_REQUEST_URI[] = 'blog=' . $blog_id; | |
| 63 | - } | |
| 64 | -    if (!empty($category_id)) { | |
| 65 | - $args_REQUEST_URI[] = 'category=' . $category_id; | |
| 66 | - } | |
| 67 | - $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 68 | -                              . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI)); | |
| 54 | + $args_REQUEST_URI = array(); | |
| 55 | +	$_args            = array('start', 'sort', 'uid', 'list'); | |
| 56 | +	foreach ($_args as $arg) { | |
| 57 | +		if (!empty(${$arg})) { | |
| 58 | +			$args_REQUEST_URI[] = $arg . '=' . ${$arg}; | |
| 59 | + } | |
| 60 | + } | |
| 61 | +	if (!empty($blog_id)) { | |
| 62 | + $args_REQUEST_URI[] = 'blog=' . $blog_id; | |
| 63 | + } | |
| 64 | +	if (!empty($category_id)) { | |
| 65 | + $args_REQUEST_URI[] = 'category=' . $category_id; | |
| 66 | + } | |
| 67 | + $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 68 | +							  . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI)); | |
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | 71 |  $xoopsOption['template_main'] = planet_getTemplate('index'); | 
| 72 | 72 | $xoops_module_header = ' | 
| 73 | 73 |      <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rss" href="' | 
| 74 | - . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rss/c' | |
| 75 | - . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> | |
| 74 | + . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rss/c' | |
| 75 | + . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> | |
| 76 | 76 |      <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rdf" href="' | 
| 77 | - . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rdf/c' | |
| 78 | - . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> | |
| 77 | + . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rdf/c' | |
| 78 | + . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> | |
| 79 | 79 |      <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name') . ' atom" href="' | 
| 80 | - . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."atom/c' | |
| 81 | - . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> | |
| 80 | + . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."atom/c' | |
| 81 | + . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> | |
| 82 | 82 | '; | 
| 83 | 83 | |
| 84 | 84 | $xoopsOption['xoops_module_header'] = $xoops_module_header; | 
| @@ -96,74 +96,74 @@ discard block | ||
| 96 | 96 | $article_prefix = ''; | 
| 97 | 97 | /* Specific category */ | 
| 98 | 98 |  if ($category_id > 0) { | 
| 99 | - $category_obj = $category_handler->get($category_id); | |
| 100 | -    $criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 101 | - $uid = 0; | |
| 102 | - $blog_id = 0; | |
| 103 | -    $category_data  = array('id' => $category_id, 'title' => $category_obj->getVar('cat_title')); | |
| 104 | - $query_type = 'category'; | |
| 105 | - $article_prefix = 'a.'; | |
| 99 | + $category_obj = $category_handler->get($category_id); | |
| 100 | +	$criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 101 | + $uid = 0; | |
| 102 | + $blog_id = 0; | |
| 103 | +	$category_data  = array('id' => $category_id, 'title' => $category_obj->getVar('cat_title')); | |
| 104 | + $query_type = 'category'; | |
| 105 | + $article_prefix = 'a.'; | |
| 106 | 106 | } | 
| 107 | 107 | /* Specific blog */ | 
| 108 | 108 |  if ($blog_id > 0) { | 
| 109 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 110 | -    if ($blog_obj->getVar('blog_status') | |
| 111 | - || (is_object($xoopsUser) | |
| 112 | -            && $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter')) | |
| 113 | -    ) { | |
| 114 | -        $criteria->add(new Criteria('blog_id', $blog_id)); | |
| 115 | - $category_id = 0; | |
| 116 | - $uid = 0; | |
| 117 | -        $bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); | |
| 118 | - $blog_data = array( | |
| 119 | - 'id' => $blog_id, | |
| 120 | -            'title' => $blog_obj->getVar('blog_title'), | |
| 121 | - 'image' => $blog_obj->getImage(), | |
| 122 | -            'title' => $blog_obj->getVar('blog_title'), | |
| 123 | -            'feed'  => $blog_obj->getVar('blog_feed'), | |
| 124 | -            'link'  => $blog_obj->getVar('blog_link'), | |
| 125 | -            'desc'  => $blog_obj->getVar('blog_desc'), | |
| 126 | - 'time' => $blog_obj->getTime(), | |
| 127 | - 'star' => $blog_obj->getStar(), | |
| 128 | -            'rates' => $blog_obj->getVar('blog_rates'), | |
| 129 | -            'marks' => $blog_obj->getVar('blog_marks') | |
| 130 | - ); | |
| 131 | - } | |
| 132 | - $query_type = 'blog'; | |
| 133 | - $article_prefix = ''; | |
| 109 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 110 | +	if ($blog_obj->getVar('blog_status') | |
| 111 | + || (is_object($xoopsUser) | |
| 112 | +			&& $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter')) | |
| 113 | +	) { | |
| 114 | +		$criteria->add(new Criteria('blog_id', $blog_id)); | |
| 115 | + $category_id = 0; | |
| 116 | + $uid = 0; | |
| 117 | +		$bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); | |
| 118 | + $blog_data = array( | |
| 119 | + 'id' => $blog_id, | |
| 120 | +			'title' => $blog_obj->getVar('blog_title'), | |
| 121 | + 'image' => $blog_obj->getImage(), | |
| 122 | +			'title' => $blog_obj->getVar('blog_title'), | |
| 123 | +			'feed'  => $blog_obj->getVar('blog_feed'), | |
| 124 | +			'link'  => $blog_obj->getVar('blog_link'), | |
| 125 | +			'desc'  => $blog_obj->getVar('blog_desc'), | |
| 126 | + 'time' => $blog_obj->getTime(), | |
| 127 | + 'star' => $blog_obj->getStar(), | |
| 128 | +			'rates' => $blog_obj->getVar('blog_rates'), | |
| 129 | +			'marks' => $blog_obj->getVar('blog_marks') | |
| 130 | + ); | |
| 131 | + } | |
| 132 | + $query_type = 'blog'; | |
| 133 | + $article_prefix = ''; | |
| 134 | 134 | } | 
| 135 | 135 | /* User bookmarks(favorites) */ | 
| 136 | 136 |  if ($uid > 0) { | 
| 137 | -    $criteria->add(new Criteria('bm.bm_uid', $uid)); | |
| 138 | - $category_id = 0; | |
| 139 | - $blog_id = 0; | |
| 140 | -    $bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); | |
| 141 | - $user_data = array( | |
| 142 | - 'uid' => $uid, | |
| 143 | - 'name' => XoopsUser::getUnameFromId($uid), | |
| 144 | -        'marks' => $bookmark_handler->getCount(new Criteria('bm_uid', $uid)) | |
| 145 | - ); | |
| 146 | - $query_type = 'bookmark'; | |
| 147 | - $article_prefix = 'a.'; | |
| 137 | +	$criteria->add(new Criteria('bm.bm_uid', $uid)); | |
| 138 | + $category_id = 0; | |
| 139 | + $blog_id = 0; | |
| 140 | +	$bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); | |
| 141 | + $user_data = array( | |
| 142 | + 'uid' => $uid, | |
| 143 | + 'name' => XoopsUser::getUnameFromId($uid), | |
| 144 | +		'marks' => $bookmark_handler->getCount(new Criteria('bm_uid', $uid)) | |
| 145 | + ); | |
| 146 | + $query_type = 'bookmark'; | |
| 147 | + $article_prefix = 'a.'; | |
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | 150 | /* Sort */ | 
| 151 | 151 | $order = 'DESC'; | 
| 152 | 152 | $sort = empty($sort) ? 'time' : $sort; | 
| 153 | 153 |  switch ($sort) { | 
| 154 | - case 'views': | |
| 155 | - $sortby = $article_prefix . 'art_views'; | |
| 156 | - break; | |
| 157 | - case 'rating': | |
| 158 | - $sortby = $article_prefix . 'art_rating'; | |
| 159 | - break; | |
| 160 | - case 'time': | |
| 161 | - $sortby = $article_prefix . 'art_time'; | |
| 162 | - break; | |
| 163 | - case 'default': | |
| 164 | - default: | |
| 165 | - $sortby = ''; | |
| 166 | - break; | |
| 154 | + case 'views': | |
| 155 | + $sortby = $article_prefix . 'art_views'; | |
| 156 | + break; | |
| 157 | + case 'rating': | |
| 158 | + $sortby = $article_prefix . 'art_rating'; | |
| 159 | + break; | |
| 160 | + case 'time': | |
| 161 | + $sortby = $article_prefix . 'art_time'; | |
| 162 | + break; | |
| 163 | + case 'default': | |
| 164 | + default: | |
| 165 | + $sortby = ''; | |
| 166 | + break; | |
| 167 | 167 | } | 
| 168 | 168 | $criteria->setSort($sortby); | 
| 169 | 169 | $criteria->setOrder($order); | 
| @@ -171,120 +171,120 @@ discard block | ||
| 171 | 171 | $criteria->setLimit($limit); | 
| 172 | 172 | |
| 173 | 173 | $tags = empty($list) ? '' : array( | 
| 174 | - $article_prefix . 'art_title', | |
| 175 | - $article_prefix . 'blog_id', | |
| 176 | - $article_prefix . 'art_time' | |
| 174 | + $article_prefix . 'art_title', | |
| 175 | + $article_prefix . 'blog_id', | |
| 176 | + $article_prefix . 'art_time' | |
| 177 | 177 | ); | 
| 178 | 178 |  switch ($query_type) { | 
| 179 | - case 'category': | |
| 180 | - $articles_obj =& $article_handler->getByCategory($criteria, $tags); | |
| 181 | - $count_article = $article_handler->getCountByCategory($criteria); | |
| 182 | - break; | |
| 183 | - case 'bookmark': | |
| 184 | - $articles_obj =& $article_handler->getByBookmark($criteria, $tags); | |
| 185 | - $count_article = $article_handler->getCountByBookmark($criteria); | |
| 186 | - break; | |
| 187 | - default: | |
| 188 | - $articles_obj =& $article_handler->getAll($criteria, $tags); | |
| 189 | - $count_article = $article_handler->getCount($criteria); | |
| 190 | - break; | |
| 179 | + case 'category': | |
| 180 | + $articles_obj =& $article_handler->getByCategory($criteria, $tags); | |
| 181 | + $count_article = $article_handler->getCountByCategory($criteria); | |
| 182 | + break; | |
| 183 | + case 'bookmark': | |
| 184 | + $articles_obj =& $article_handler->getByBookmark($criteria, $tags); | |
| 185 | + $count_article = $article_handler->getCountByBookmark($criteria); | |
| 186 | + break; | |
| 187 | + default: | |
| 188 | + $articles_obj =& $article_handler->getAll($criteria, $tags); | |
| 189 | + $count_article = $article_handler->getCount($criteria); | |
| 190 | + break; | |
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | 193 |  if (!empty($blog_data)) { | 
| 194 | - $blogs[$blog_data['id']] = $blog_data['title']; | |
| 194 | + $blogs[$blog_data['id']] = $blog_data['title']; | |
| 195 | 195 |  } else { | 
| 196 | - $blog_array = array(); | |
| 197 | -    foreach (array_keys($articles_obj) as $id) { | |
| 198 | -        $blog_array[$articles_obj[$id]->getVar('blog_id')] = 1; | |
| 199 | - } | |
| 200 | -    $criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); | |
| 201 | - $blogs = $blog_handler->getList($criteria_blog); | |
| 196 | + $blog_array = array(); | |
| 197 | +	foreach (array_keys($articles_obj) as $id) { | |
| 198 | +		$blog_array[$articles_obj[$id]->getVar('blog_id')] = 1; | |
| 199 | + } | |
| 200 | +	$criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); | |
| 201 | + $blogs = $blog_handler->getList($criteria_blog); | |
| 202 | 202 | } | 
| 203 | 203 | |
| 204 | 204 | /* Objects to array */ | 
| 205 | 205 | $articles = array(); | 
| 206 | 206 |  foreach (array_keys($articles_obj) as $id) { | 
| 207 | - $_article = array( | |
| 208 | - 'id' => $id, | |
| 209 | -        'title' => $articles_obj[$id]->getVar('art_title'), | |
| 210 | - 'time' => $articles_obj[$id]->getTime(), | |
| 211 | - 'blog' => array( | |
| 212 | -            'id'    => $articles_obj[$id]->getVar('blog_id'), | |
| 213 | -            'title' => $blogs[$articles_obj[$id]->getVar('blog_id')] | |
| 214 | - ) | |
| 215 | - ); | |
| 216 | -    if (empty($list)) { | |
| 217 | - $_article = array_merge($_article, array( | |
| 218 | -            'author'   => $articles_obj[$id]->getVar('art_author'), | |
| 219 | -            'views'    => $articles_obj[$id]->getVar('art_views'), | |
| 220 | -            'comments' => $articles_obj[$id]->getVar('art_comments'), | |
| 221 | - 'star' => $articles_obj[$id]->getStar(), | |
| 222 | -            'rates'    => $articles_obj[$id]->getVar('art_rates') | |
| 223 | - )); | |
| 224 | -        if (!empty($xoopsModuleConfig['display_summary'])) { | |
| 225 | - $_article['content'] = $articles_obj[$id]->getSummary(); | |
| 226 | -        } else { | |
| 227 | -            $_article['content'] = $articles_obj[$id]->getVar('art_content'); | |
| 228 | - } | |
| 229 | - } | |
| 230 | - $articles[] = $_article; | |
| 231 | - unset($_article); | |
| 207 | + $_article = array( | |
| 208 | + 'id' => $id, | |
| 209 | +		'title' => $articles_obj[$id]->getVar('art_title'), | |
| 210 | + 'time' => $articles_obj[$id]->getTime(), | |
| 211 | + 'blog' => array( | |
| 212 | +			'id'    => $articles_obj[$id]->getVar('blog_id'), | |
| 213 | +			'title' => $blogs[$articles_obj[$id]->getVar('blog_id')] | |
| 214 | + ) | |
| 215 | + ); | |
| 216 | +	if (empty($list)) { | |
| 217 | + $_article = array_merge($_article, array( | |
| 218 | +			'author'   => $articles_obj[$id]->getVar('art_author'), | |
| 219 | +			'views'    => $articles_obj[$id]->getVar('art_views'), | |
| 220 | +			'comments' => $articles_obj[$id]->getVar('art_comments'), | |
| 221 | + 'star' => $articles_obj[$id]->getStar(), | |
| 222 | +			'rates'    => $articles_obj[$id]->getVar('art_rates') | |
| 223 | + )); | |
| 224 | +		if (!empty($xoopsModuleConfig['display_summary'])) { | |
| 225 | + $_article['content'] = $articles_obj[$id]->getSummary(); | |
| 226 | +		} else { | |
| 227 | +			$_article['content'] = $articles_obj[$id]->getVar('art_content'); | |
| 228 | + } | |
| 229 | + } | |
| 230 | + $articles[] = $_article; | |
| 231 | + unset($_article); | |
| 232 | 232 | } | 
| 233 | 233 | unset($articles_obj); | 
| 234 | 234 | |
| 235 | 235 |  if ($count_article > $limit) { | 
| 236 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 237 | - $start_link = array(); | |
| 238 | -    if ($sort) { | |
| 239 | - $start_link[] = 'sort=' . $sort; | |
| 240 | - } | |
| 241 | -    if ($category_id) { | |
| 242 | - $start_link[] = 'category=' . $category_id; | |
| 243 | - } | |
| 244 | -    if ($blog_id) { | |
| 245 | - $start_link[] = 'blog=' . $blog_id; | |
| 246 | - } | |
| 247 | -    if ($list) { | |
| 248 | - $start_link[] = 'list=' . $list; | |
| 249 | - } | |
| 250 | -    $nav     = new XoopsPageNav($count_article, $limit, $start, 'start', implode('&', $start_link)); | |
| 251 | - $pagenav = $nav->renderNav(4); | |
| 236 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 237 | + $start_link = array(); | |
| 238 | +	if ($sort) { | |
| 239 | + $start_link[] = 'sort=' . $sort; | |
| 240 | + } | |
| 241 | +	if ($category_id) { | |
| 242 | + $start_link[] = 'category=' . $category_id; | |
| 243 | + } | |
| 244 | +	if ($blog_id) { | |
| 245 | + $start_link[] = 'blog=' . $blog_id; | |
| 246 | + } | |
| 247 | +	if ($list) { | |
| 248 | + $start_link[] = 'list=' . $list; | |
| 249 | + } | |
| 250 | +	$nav     = new XoopsPageNav($count_article, $limit, $start, 'start', implode('&', $start_link)); | |
| 251 | + $pagenav = $nav->renderNav(4); | |
| 252 | 252 |  } else { | 
| 253 | - $pagenav = ''; | |
| 253 | + $pagenav = ''; | |
| 254 | 254 | } | 
| 255 | 255 | |
| 256 | 256 |  $xoopsTpl->assign('xoops_module_header', $xoops_module_header); | 
| 257 | 257 |  $xoopsTpl->assign('dirname', $GLOBALS['moddirname']); | 
| 258 | 258 | |
| 259 | 259 |  if ($category_id || $blog_id || $uid) { | 
| 260 | -    $xoopsTpl->assign('link_index', | |
| 261 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" | |
| 262 | -                      . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>'); | |
| 260 | +	$xoopsTpl->assign('link_index', | |
| 261 | + "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" | |
| 262 | +					  . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>'); | |
| 263 | 263 | } | 
| 264 | 264 | |
| 265 | 265 | $link_switch = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | 
| 266 | - . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) | |
| 267 | - . (empty($blog_id) ? '' : '/b' . $blog_id) . (empty($list) ? '/l1' : '') . "\" title=\"" | |
| 268 | -               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . "\">" | |
| 269 | -               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . '</a>'; | |
| 266 | + . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) | |
| 267 | + . (empty($blog_id) ? '' : '/b' . $blog_id) . (empty($list) ? '/l1' : '') . "\" title=\"" | |
| 268 | +			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . "\">" | |
| 269 | +			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . '</a>'; | |
| 270 | 270 |  $xoopsTpl->assign('link_switch', $link_switch); | 
| 271 | 271 | |
| 272 | 272 | $link_blogs = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' | 
| 273 | - . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" | |
| 274 | -              . planet_constant('MD_BLOGS') . "\">" . planet_constant('MD_BLOGS') . '</a>'; | |
| 273 | + . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" | |
| 274 | +			  . planet_constant('MD_BLOGS') . "\">" . planet_constant('MD_BLOGS') . '</a>'; | |
| 275 | 275 |  $xoopsTpl->assign('link_blogs', $link_blogs); | 
| 276 | 276 | |
| 277 | 277 |  if (empty($uid) && is_object($xoopsUser)) { | 
| 278 | -    $xoopsTpl->assign('link_bookmark', | |
| 279 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER | |
| 280 | -                      . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') | |
| 281 | -                      . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>'); | |
| 278 | +	$xoopsTpl->assign('link_bookmark', | |
| 279 | + "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER | |
| 280 | +					  . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') | |
| 281 | +					  . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>'); | |
| 282 | 282 | } | 
| 283 | 283 | |
| 284 | 284 |  if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) { | 
| 285 | -    $xoopsTpl->assign('link_submit', | |
| 286 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" | |
| 287 | - . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>'); | |
| 285 | +	$xoopsTpl->assign('link_submit', | |
| 286 | + "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" | |
| 287 | + . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>'); | |
| 288 | 288 | } | 
| 289 | 289 | |
| 290 | 290 |  $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_ARTICLES')); | 
| @@ -298,25 +298,25 @@ discard block | ||
| 298 | 298 |  $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); | 
| 299 | 299 |  if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { | 
| 300 | 300 |  } elseif ($blog_id > 0) { | 
| 301 | -    $xoopsTpl->assign('canrate', 1); | |
| 301 | +	$xoopsTpl->assign('canrate', 1); | |
| 302 | 302 | } | 
| 303 | 303 | |
| 304 | 304 | $sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' | 
| 305 | - . $category_id) | |
| 306 | - . (empty($uid) ? '' : '/u' . $uid) . (empty($blog_id) ? '' : '/b' . $blog_id) | |
| 307 | - . (empty($list) ? '' : '/l1'); | |
| 305 | + . $category_id) | |
| 306 | + . (empty($uid) ? '' : '/u' . $uid) . (empty($blog_id) ? '' : '/b' . $blog_id) | |
| 307 | + . (empty($list) ? '' : '/l1'); | |
| 308 | 308 | $valid_sorts = array( | 
| 309 | -    'views'   => planet_constant('MD_VIEWS'), | |
| 310 | -    'rating'  => planet_constant('MD_RATING'), | |
| 311 | -    'time'    => planet_constant('MD_TIME'), | |
| 312 | -    'default' => planet_constant('MD_DEFAULT') | |
| 309 | +	'views'   => planet_constant('MD_VIEWS'), | |
| 310 | +	'rating'  => planet_constant('MD_RATING'), | |
| 311 | +	'time'    => planet_constant('MD_TIME'), | |
| 312 | +	'default' => planet_constant('MD_DEFAULT') | |
| 313 | 313 | ); | 
| 314 | 314 | $sortlinks = array(); | 
| 315 | 315 |  foreach ($valid_sorts as $val => $name) { | 
| 316 | -    if ($val == $sort) { | |
| 317 | - continue; | |
| 318 | - } | |
| 319 | - $sortlinks[] = "<a href=\"" . $sort_link . '/' . $val . "\">" . $name . '</a>'; | |
| 316 | +	if ($val == $sort) { | |
| 317 | + continue; | |
| 318 | + } | |
| 319 | + $sortlinks[] = "<a href=\"" . $sort_link . '/' . $val . "\">" . $name . '</a>'; | |
| 320 | 320 | } | 
| 321 | 321 |  $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks)); | 
| 322 | 322 |  $xoopsTpl->assign('version', $xoopsModule->getVar('version')); | 
| @@ -325,8 +325,8 @@ discard block | ||
| 325 | 325 | |
| 326 | 326 | // for notification | 
| 327 | 327 |  if (!empty($blog_id)) { | 
| 328 | - //$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php"; | |
| 329 | - $_GET['blog'] = $blog_id; | |
| 328 | + //$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php"; | |
| 329 | + $_GET['blog'] = $blog_id; | |
| 330 | 330 | } | 
| 331 | 331 | |
| 332 | 332 | include_once __DIR__ . '/footer.php'; | 
| @@ -32,15 +32,15 @@ discard block | ||
| 32 | 32 |  $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; | 
| 33 | 33 | |
| 34 | 34 |  if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { | 
| 35 | -    redirect_header('index.php', 2, _NOPERM); | |
| 35 | +	redirect_header('index.php', 2, _NOPERM); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 |  if ($op === 'save' && !empty($_POST['fetch'])) { | 
| 39 | - $op = 'edit'; | |
| 39 | + $op = 'edit'; | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 |  if ($op === 'save' && !$GLOBALS['xoopsSecurity']->check()) { | 
| 43 | -    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); | |
| 43 | +	redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); | |
| 44 | 44 | } | 
| 45 | 45 | include XOOPS_ROOT_PATH . '/header.php'; | 
| 46 | 46 |  include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; | 
| @@ -49,111 +49,111 @@ discard block | ||
| 49 | 49 |  $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | 
| 50 | 50 | |
| 51 | 51 |  switch ($op) { | 
| 52 | - /* save a single blog */ | |
| 53 | - case 'save': | |
| 54 | - | |
| 55 | -        if ($blog_id) { | |
| 56 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 57 | -            if ($xoopsUser->isAdmin()) { | |
| 58 | -                $blog_obj->setVar('blog_status', @$_POST['blog_status']); | |
| 59 | - } | |
| 60 | -        } else { | |
| 61 | -            if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', | |
| 62 | - $myts->addSlashes(trim($_POST['blog_feed'])))) | |
| 63 | -            ) { | |
| 64 | -                redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); | |
| 65 | - } | |
| 66 | - | |
| 67 | - $blog_obj =& $blog_handler->create(); | |
| 68 | -            $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : planet_getIP(true)); | |
| 69 | - | |
| 70 | -            switch ($xoopsModuleConfig['newblog_submit']) { | |
| 71 | - case 2: | |
| 72 | -                    if (!is_object($xoopsUser)) { | |
| 73 | - $status = 0; | |
| 74 | -                    } else { | |
| 75 | - $status = 1; | |
| 76 | - } | |
| 77 | - break; | |
| 78 | - case 0: | |
| 79 | - case 3: | |
| 80 | - $status = 1; | |
| 81 | - break; | |
| 82 | - case 1: | |
| 83 | - default: | |
| 84 | -                    if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { | |
| 85 | - $status = 0; | |
| 86 | -                    } else { | |
| 87 | - $status = 1; | |
| 88 | - } | |
| 89 | - break; | |
| 90 | - } | |
| 91 | - | |
| 92 | -            $blog_obj->setVar('blog_status', $status); | |
| 93 | - } | |
| 94 | - | |
| 95 | -        $blog_obj->setVar('blog_title', $_POST['blog_title']); | |
| 96 | -        $blog_obj->setVar('blog_desc', $_POST['blog_desc']); | |
| 97 | -        $blog_obj->setVar('blog_image', $_POST['blog_image']); | |
| 98 | -        $blog_obj->setVar('blog_feed', $_POST['blog_feed']); | |
| 99 | -        $blog_obj->setVar('blog_link', $_POST['blog_link']); | |
| 100 | -        $blog_obj->setVar('blog_language', $_POST['blog_language']); | |
| 101 | -        $blog_obj->setVar('blog_charset', $_POST['blog_charset']); | |
| 102 | -        $blog_obj->setVar('blog_trackback', $_POST['blog_trackback']); | |
| 103 | -        if ($blog_obj->isNew()) { | |
| 104 | -            $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : planet_getIP(true)); | |
| 105 | - } | |
| 106 | - | |
| 107 | -        if (!$blog_handler->insert($blog_obj)) { | |
| 108 | -        } elseif (!empty($_POST['categories'])) { | |
| 109 | -            $blog_id = $blog_obj->getVar('blog_id'); | |
| 110 | -            if (in_array(0, $_POST['categories'])) { | |
| 111 | - $_POST['categories'] = array(); | |
| 112 | - } | |
| 113 | - $blog_handler->setCategories($blog_id, $_POST['categories']); | |
| 114 | - } | |
| 115 | -        $message = planet_constant('MD_DBUPDATED'); | |
| 116 | -        redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); | |
| 117 | - | |
| 118 | - /* edit a single blog */ | |
| 119 | - case 'edit': | |
| 120 | - default: | |
| 121 | -        if (!empty($_POST['fetch'])) { | |
| 122 | - $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); | |
| 123 | -            $blog_obj->setVar('blog_id', $blog_id); | |
| 124 | -        } else { | |
| 125 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 126 | - } | |
| 127 | - $categories = isset($_POST['categories']) ? $_POST['categories'] : array(); | |
| 128 | -        if (in_array('-1', $categories)) { | |
| 129 | - $categories = array(); | |
| 130 | - } | |
| 131 | -        if (empty($categories) && $blog_id > 0) { | |
| 132 | -            $crit       = new Criteria('bc.blog_id', $blog_id); | |
| 133 | - $categories = array_keys($category_handler->getByBlog($crit)); | |
| 134 | - } | |
| 135 | -        if (empty($categories)) { | |
| 136 | - $categories = array(0 => _NONE); | |
| 137 | - } | |
| 138 | - | |
| 139 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; | |
| 140 | - echo '<br>'; | |
| 141 | -        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { | |
| 142 | -            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); | |
| 143 | - $blogs_obj =& $blog_handler->getList($criteria); | |
| 144 | -            if (count($blogs_obj) > 0) { | |
| 145 | -                echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); | |
| 146 | -                foreach (array_keys($blogs_obj) as $bid) { | |
| 147 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 148 | - . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; | |
| 149 | - } | |
| 150 | - echo '</div>'; | |
| 151 | - unset($blogs_obj, $criteria); | |
| 152 | - } | |
| 153 | - } | |
| 154 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; | |
| 155 | - echo '</fieldset>'; | |
| 156 | - break; | |
| 52 | + /* save a single blog */ | |
| 53 | + case 'save': | |
| 54 | + | |
| 55 | +		if ($blog_id) { | |
| 56 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 57 | +			if ($xoopsUser->isAdmin()) { | |
| 58 | +				$blog_obj->setVar('blog_status', @$_POST['blog_status']); | |
| 59 | + } | |
| 60 | +		} else { | |
| 61 | +			if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', | |
| 62 | + $myts->addSlashes(trim($_POST['blog_feed'])))) | |
| 63 | +			) { | |
| 64 | +				redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); | |
| 65 | + } | |
| 66 | + | |
| 67 | + $blog_obj =& $blog_handler->create(); | |
| 68 | +			$blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : planet_getIP(true)); | |
| 69 | + | |
| 70 | +			switch ($xoopsModuleConfig['newblog_submit']) { | |
| 71 | + case 2: | |
| 72 | +					if (!is_object($xoopsUser)) { | |
| 73 | + $status = 0; | |
| 74 | +					} else { | |
| 75 | + $status = 1; | |
| 76 | + } | |
| 77 | + break; | |
| 78 | + case 0: | |
| 79 | + case 3: | |
| 80 | + $status = 1; | |
| 81 | + break; | |
| 82 | + case 1: | |
| 83 | + default: | |
| 84 | +					if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { | |
| 85 | + $status = 0; | |
| 86 | +					} else { | |
| 87 | + $status = 1; | |
| 88 | + } | |
| 89 | + break; | |
| 90 | + } | |
| 91 | + | |
| 92 | +			$blog_obj->setVar('blog_status', $status); | |
| 93 | + } | |
| 94 | + | |
| 95 | +		$blog_obj->setVar('blog_title', $_POST['blog_title']); | |
| 96 | +		$blog_obj->setVar('blog_desc', $_POST['blog_desc']); | |
| 97 | +		$blog_obj->setVar('blog_image', $_POST['blog_image']); | |
| 98 | +		$blog_obj->setVar('blog_feed', $_POST['blog_feed']); | |
| 99 | +		$blog_obj->setVar('blog_link', $_POST['blog_link']); | |
| 100 | +		$blog_obj->setVar('blog_language', $_POST['blog_language']); | |
| 101 | +		$blog_obj->setVar('blog_charset', $_POST['blog_charset']); | |
| 102 | +		$blog_obj->setVar('blog_trackback', $_POST['blog_trackback']); | |
| 103 | +		if ($blog_obj->isNew()) { | |
| 104 | +			$blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : planet_getIP(true)); | |
| 105 | + } | |
| 106 | + | |
| 107 | +		if (!$blog_handler->insert($blog_obj)) { | |
| 108 | +		} elseif (!empty($_POST['categories'])) { | |
| 109 | +			$blog_id = $blog_obj->getVar('blog_id'); | |
| 110 | +			if (in_array(0, $_POST['categories'])) { | |
| 111 | + $_POST['categories'] = array(); | |
| 112 | + } | |
| 113 | + $blog_handler->setCategories($blog_id, $_POST['categories']); | |
| 114 | + } | |
| 115 | +		$message = planet_constant('MD_DBUPDATED'); | |
| 116 | +		redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); | |
| 117 | + | |
| 118 | + /* edit a single blog */ | |
| 119 | + case 'edit': | |
| 120 | + default: | |
| 121 | +		if (!empty($_POST['fetch'])) { | |
| 122 | + $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); | |
| 123 | +			$blog_obj->setVar('blog_id', $blog_id); | |
| 124 | +		} else { | |
| 125 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 126 | + } | |
| 127 | + $categories = isset($_POST['categories']) ? $_POST['categories'] : array(); | |
| 128 | +		if (in_array('-1', $categories)) { | |
| 129 | + $categories = array(); | |
| 130 | + } | |
| 131 | +		if (empty($categories) && $blog_id > 0) { | |
| 132 | +			$crit       = new Criteria('bc.blog_id', $blog_id); | |
| 133 | + $categories = array_keys($category_handler->getByBlog($crit)); | |
| 134 | + } | |
| 135 | +		if (empty($categories)) { | |
| 136 | + $categories = array(0 => _NONE); | |
| 137 | + } | |
| 138 | + | |
| 139 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; | |
| 140 | + echo '<br>'; | |
| 141 | +		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { | |
| 142 | +			$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); | |
| 143 | + $blogs_obj =& $blog_handler->getList($criteria); | |
| 144 | +			if (count($blogs_obj) > 0) { | |
| 145 | +				echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); | |
| 146 | +				foreach (array_keys($blogs_obj) as $bid) { | |
| 147 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 148 | + . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; | |
| 149 | + } | |
| 150 | + echo '</div>'; | |
| 151 | + unset($blogs_obj, $criteria); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; | |
| 155 | + echo '</fieldset>'; | |
| 156 | + break; | |
| 157 | 157 | } | 
| 158 | 158 | |
| 159 | 159 | include XOOPS_ROOT_PATH . '/footer.php'; | 
| @@ -37,167 +37,167 @@ | ||
| 37 | 37 | $charset = trim($_POST['charset']); | 
| 38 | 38 | |
| 39 | 39 |  if (empty($xoopsModuleConfig['trackback_option'])) { | 
| 40 | - planet_trackback_response(1, 'Trackback is closed'); | |
| 40 | + planet_trackback_response(1, 'Trackback is closed'); | |
| 41 | 41 | } | 
| 42 | 42 |  if (!strlen($title . $url . $blog_name)) { | 
| 43 | -    planet_trackback_response(1, planet_constant('MD_INVALID')); | |
| 43 | +	planet_trackback_response(1, planet_constant('MD_INVALID')); | |
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | 46 |  if (!empty($article_id) && !empty($url)) { | 
| 47 | -    $trackback_handler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); | |
| 48 | -    $criteria          = new CriteriaCompo(new Criteria('art_id', $article_id)); | |
| 49 | -    $criteria->add(new Criteria('tb_url', $url)); | |
| 50 | -    if ($trackback_handler->getCount($criteria) > 0) { | |
| 51 | - planet_trackback_response(1, 'We already have a ping from that URI for this article.'); | |
| 52 | - } | |
| 47 | +	$trackback_handler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); | |
| 48 | +	$criteria          = new CriteriaCompo(new Criteria('art_id', $article_id)); | |
| 49 | +	$criteria->add(new Criteria('tb_url', $url)); | |
| 50 | +	if ($trackback_handler->getCount($criteria) > 0) { | |
| 51 | + planet_trackback_response(1, 'We already have a ping from that URI for this article.'); | |
| 52 | + } | |
| 53 | 53 | |
| 54 | - $charset = empty($charset) ? 'utf-8' : $charset; | |
| 55 | - $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); | |
| 56 | - $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); | |
| 57 | - $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); | |
| 58 | - $tb_status = (int)$xoopsModuleConfig['trackback_option']; | |
| 54 | + $charset = empty($charset) ? 'utf-8' : $charset; | |
| 55 | + $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); | |
| 56 | + $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); | |
| 57 | + $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); | |
| 58 | + $tb_status = (int)$xoopsModuleConfig['trackback_option']; | |
| 59 | 59 | |
| 60 | - $com_pid = 0; | |
| 61 | - $com_itemid = $article_id; | |
| 62 | - $com_rootid = 0; | |
| 63 | - $com_title = $title; | |
| 64 | - $com_text = $excerpt; | |
| 65 | - $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; | |
| 66 | -    if (!empty($url)) { | |
| 67 | - $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; | |
| 68 | -    } else { | |
| 69 | - $com_text .= $blog_name; | |
| 70 | - } | |
| 71 | -    $com_modid = $xoopsModule->getVar('mid'); | |
| 60 | + $com_pid = 0; | |
| 61 | + $com_itemid = $article_id; | |
| 62 | + $com_rootid = 0; | |
| 63 | + $com_title = $title; | |
| 64 | + $com_text = $excerpt; | |
| 65 | + $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; | |
| 66 | +	if (!empty($url)) { | |
| 67 | + $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; | |
| 68 | +	} else { | |
| 69 | + $com_text .= $blog_name; | |
| 70 | + } | |
| 71 | +	$com_modid = $xoopsModule->getVar('mid'); | |
| 72 | 72 | |
| 73 | -    $comment_handler = xoops_getHandler('comment'); | |
| 74 | - $comment = $comment_handler->create(); | |
| 75 | -    $comment->setVar('com_created', time()); | |
| 76 | -    $comment->setVar('com_pid', $com_pid); | |
| 77 | -    $comment->setVar('com_itemid', $com_itemid); | |
| 78 | -    $comment->setVar('com_rootid', $com_rootid); | |
| 79 | -    $comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR')); | |
| 80 | -    switch ($tb_status) { | |
| 81 | - case 2: | |
| 82 | -            $comment->setVar('com_status', 2); | |
| 83 | - $call_approvefunc = true; | |
| 84 | - $call_updatefunc = true; | |
| 85 | - $notify_event = 'comment'; | |
| 86 | - break; | |
| 87 | - case 1: | |
| 88 | - default: | |
| 89 | -            $comment->setVar('com_status', 1); | |
| 90 | - $notify_event = 'comment_submit'; | |
| 91 | - break; | |
| 92 | - } | |
| 93 | -    $comment->setVar('com_uid', 0); | |
| 94 | - $com_title = xoops_trim($com_title); | |
| 95 | - $com_title = empty($com_title) ? _NOTITLE : $com_title; | |
| 96 | -    $comment->setVar('com_title', $com_title); | |
| 97 | -    $comment->setVar('com_text', $com_text); | |
| 98 | -    $comment->setVar('dohtml', 0); | |
| 99 | -    $comment->setVar('dosmiley', 0); | |
| 100 | -    $comment->setVar('doxcode', 1); | |
| 101 | -    $comment->setVar('doimage', 0); | |
| 102 | -    $comment->setVar('dobr', 1); | |
| 103 | -    $comment->setVar('com_icon', ''); | |
| 104 | -    $comment->setVar('com_modified', time()); | |
| 105 | -    $comment->setVar('com_modid', $com_modid); | |
| 106 | -    if (false != $comment_handler->insert($comment)) { | |
| 107 | -        $newcid = $comment->getVar('com_id'); | |
| 73 | +	$comment_handler = xoops_getHandler('comment'); | |
| 74 | + $comment = $comment_handler->create(); | |
| 75 | +	$comment->setVar('com_created', time()); | |
| 76 | +	$comment->setVar('com_pid', $com_pid); | |
| 77 | +	$comment->setVar('com_itemid', $com_itemid); | |
| 78 | +	$comment->setVar('com_rootid', $com_rootid); | |
| 79 | +	$comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR')); | |
| 80 | +	switch ($tb_status) { | |
| 81 | + case 2: | |
| 82 | +			$comment->setVar('com_status', 2); | |
| 83 | + $call_approvefunc = true; | |
| 84 | + $call_updatefunc = true; | |
| 85 | + $notify_event = 'comment'; | |
| 86 | + break; | |
| 87 | + case 1: | |
| 88 | + default: | |
| 89 | +			$comment->setVar('com_status', 1); | |
| 90 | + $notify_event = 'comment_submit'; | |
| 91 | + break; | |
| 92 | + } | |
| 93 | +	$comment->setVar('com_uid', 0); | |
| 94 | + $com_title = xoops_trim($com_title); | |
| 95 | + $com_title = empty($com_title) ? _NOTITLE : $com_title; | |
| 96 | +	$comment->setVar('com_title', $com_title); | |
| 97 | +	$comment->setVar('com_text', $com_text); | |
| 98 | +	$comment->setVar('dohtml', 0); | |
| 99 | +	$comment->setVar('dosmiley', 0); | |
| 100 | +	$comment->setVar('doxcode', 1); | |
| 101 | +	$comment->setVar('doimage', 0); | |
| 102 | +	$comment->setVar('dobr', 1); | |
| 103 | +	$comment->setVar('com_icon', ''); | |
| 104 | +	$comment->setVar('com_modified', time()); | |
| 105 | +	$comment->setVar('com_modid', $com_modid); | |
| 106 | +	if (false != $comment_handler->insert($comment)) { | |
| 107 | +		$newcid = $comment->getVar('com_id'); | |
| 108 | 108 | |
| 109 | - // set own id as root id | |
| 110 | - $com_rootid = $newcid; | |
| 111 | -        if (!$comment_handler->updateByField($comment, 'com_rootid', $com_rootid)) { | |
| 112 | - $comment_handler->delete($comment); | |
| 113 | - planet_trackback_response(1, xoops_error()); | |
| 114 | - } | |
| 109 | + // set own id as root id | |
| 110 | + $com_rootid = $newcid; | |
| 111 | +		if (!$comment_handler->updateByField($comment, 'com_rootid', $com_rootid)) { | |
| 112 | + $comment_handler->delete($comment); | |
| 113 | + planet_trackback_response(1, xoops_error()); | |
| 114 | + } | |
| 115 | 115 | |
| 116 | - // call custom approve function if any | |
| 117 | - if (false != $call_approvefunc && isset($comment_config['callback']['approve']) | |
| 118 | - && trim($comment_config['callback']['approve']) != '' | |
| 119 | -        ) { | |
| 120 | - $skip = false; | |
| 121 | -            if (!function_exists($comment_config['callback']['approve'])) { | |
| 122 | -                if (isset($comment_config['callbackFile'])) { | |
| 123 | - $callbackfile = trim($comment_config['callbackFile']); | |
| 124 | - if ($callbackfile != '' | |
| 125 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile) | |
| 126 | -                    ) { | |
| 127 | - include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; | |
| 128 | - } | |
| 129 | -                    if (!function_exists($comment_config['callback']['approve'])) { | |
| 130 | - $skip = true; | |
| 131 | - } | |
| 132 | -                } else { | |
| 133 | - $skip = true; | |
| 134 | - } | |
| 135 | - } | |
| 136 | -            if (!$skip) { | |
| 137 | - $comment_config['callback']['approve']($comment); | |
| 138 | - } | |
| 139 | - } | |
| 116 | + // call custom approve function if any | |
| 117 | + if (false != $call_approvefunc && isset($comment_config['callback']['approve']) | |
| 118 | + && trim($comment_config['callback']['approve']) != '' | |
| 119 | +		) { | |
| 120 | + $skip = false; | |
| 121 | +			if (!function_exists($comment_config['callback']['approve'])) { | |
| 122 | +				if (isset($comment_config['callbackFile'])) { | |
| 123 | + $callbackfile = trim($comment_config['callbackFile']); | |
| 124 | + if ($callbackfile != '' | |
| 125 | + && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile) | |
| 126 | +					) { | |
| 127 | + include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; | |
| 128 | + } | |
| 129 | +					if (!function_exists($comment_config['callback']['approve'])) { | |
| 130 | + $skip = true; | |
| 131 | + } | |
| 132 | +				} else { | |
| 133 | + $skip = true; | |
| 134 | + } | |
| 135 | + } | |
| 136 | +			if (!$skip) { | |
| 137 | + $comment_config['callback']['approve']($comment); | |
| 138 | + } | |
| 139 | + } | |
| 140 | 140 | |
| 141 | - // call custom update function if any | |
| 142 | - if (false != $call_updatefunc && isset($comment_config['callback']['update']) | |
| 143 | - && trim($comment_config['callback']['update']) != '' | |
| 144 | -        ) { | |
| 145 | - $skip = false; | |
| 146 | -            if (!function_exists($comment_config['callback']['update'])) { | |
| 147 | -                if (isset($comment_config['callbackFile'])) { | |
| 148 | - $callbackfile = trim($comment_config['callbackFile']); | |
| 149 | - if ($callbackfile != '' | |
| 150 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile) | |
| 151 | -                    ) { | |
| 152 | - include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; | |
| 153 | - } | |
| 154 | -                    if (!function_exists($comment_config['callback']['update'])) { | |
| 155 | - $skip = true; | |
| 156 | - } | |
| 157 | -                } else { | |
| 158 | - $skip = true; | |
| 159 | - } | |
| 160 | - } | |
| 161 | -            if (!$skip) { | |
| 162 | -                $criteria = new CriteriaCompo(new Criteria('com_modid', $com_modid)); | |
| 163 | -                $criteria->add(new Criteria('com_itemid', $com_itemid)); | |
| 164 | -                $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); | |
| 165 | - $comment_count = $comment_handler->getCount($criteria); | |
| 166 | - $func = $comment_config['callback']['update']; | |
| 167 | -                call_user_func_array($func, array($com_itemid, $comment_count, $comment->getVar('com_id'))); | |
| 168 | - } | |
| 169 | - } | |
| 141 | + // call custom update function if any | |
| 142 | + if (false != $call_updatefunc && isset($comment_config['callback']['update']) | |
| 143 | + && trim($comment_config['callback']['update']) != '' | |
| 144 | +		) { | |
| 145 | + $skip = false; | |
| 146 | +			if (!function_exists($comment_config['callback']['update'])) { | |
| 147 | +				if (isset($comment_config['callbackFile'])) { | |
| 148 | + $callbackfile = trim($comment_config['callbackFile']); | |
| 149 | + if ($callbackfile != '' | |
| 150 | + && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile) | |
| 151 | +					) { | |
| 152 | + include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; | |
| 153 | + } | |
| 154 | +					if (!function_exists($comment_config['callback']['update'])) { | |
| 155 | + $skip = true; | |
| 156 | + } | |
| 157 | +				} else { | |
| 158 | + $skip = true; | |
| 159 | + } | |
| 160 | + } | |
| 161 | +			if (!$skip) { | |
| 162 | +				$criteria = new CriteriaCompo(new Criteria('com_modid', $com_modid)); | |
| 163 | +				$criteria->add(new Criteria('com_itemid', $com_itemid)); | |
| 164 | +				$criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); | |
| 165 | + $comment_count = $comment_handler->getCount($criteria); | |
| 166 | + $func = $comment_config['callback']['update']; | |
| 167 | +				call_user_func_array($func, array($com_itemid, $comment_count, $comment->getVar('com_id'))); | |
| 168 | + } | |
| 169 | + } | |
| 170 | 170 | |
| 171 | - // RMV-NOTIFY | |
| 172 | - // trigger notification event if necessary | |
| 173 | -        if ($notify_event) { | |
| 174 | - $not_modid = $com_modid; | |
| 175 | - include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; | |
| 176 | - $not_catinfo =& notificationCommentCategoryInfo($not_modid); | |
| 177 | - $not_category = $not_catinfo['name']; | |
| 178 | - $not_itemid = $com_itemid; | |
| 179 | - $not_event = $notify_event; | |
| 180 | - // Build an ABSOLUTE URL to view the comment. Make sure we | |
| 181 | - // point to a viewable page (i.e. not the system administration | |
| 182 | - // module). | |
| 183 | - $comment_tags = array(); | |
| 184 | - $not_module =& $xoopsModule; | |
| 185 | -            if (!isset($comment_url)) { | |
| 186 | -                $com_config  =& $not_module->getInfo('comments'); | |
| 187 | - $comment_url = $com_config['pageName'] . '?'; | |
| 188 | - $comment_url .= $com_config['itemName']; | |
| 189 | - } | |
| 190 | -            $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' | |
| 191 | - . $comment_url . '=' . $com_itemid . '&com_id=' . $newcid | |
| 192 | - . '&com_rootid=' . $com_rootid . '&com_mode=' . $com_mode | |
| 193 | - . '&com_order=' . $com_order . '#comment' . $newcid; | |
| 194 | -            $notification_handler          = xoops_getHandler('notification'); | |
| 195 | - $notification_handler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, | |
| 196 | - $not_modid); | |
| 197 | - } | |
| 171 | + // RMV-NOTIFY | |
| 172 | + // trigger notification event if necessary | |
| 173 | +		if ($notify_event) { | |
| 174 | + $not_modid = $com_modid; | |
| 175 | + include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; | |
| 176 | + $not_catinfo =& notificationCommentCategoryInfo($not_modid); | |
| 177 | + $not_category = $not_catinfo['name']; | |
| 178 | + $not_itemid = $com_itemid; | |
| 179 | + $not_event = $notify_event; | |
| 180 | + // Build an ABSOLUTE URL to view the comment. Make sure we | |
| 181 | + // point to a viewable page (i.e. not the system administration | |
| 182 | + // module). | |
| 183 | + $comment_tags = array(); | |
| 184 | + $not_module =& $xoopsModule; | |
| 185 | +			if (!isset($comment_url)) { | |
| 186 | +				$com_config  =& $not_module->getInfo('comments'); | |
| 187 | + $comment_url = $com_config['pageName'] . '?'; | |
| 188 | + $comment_url .= $com_config['itemName']; | |
| 189 | + } | |
| 190 | +			$comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' | |
| 191 | + . $comment_url . '=' . $com_itemid . '&com_id=' . $newcid | |
| 192 | + . '&com_rootid=' . $com_rootid . '&com_mode=' . $com_mode | |
| 193 | + . '&com_order=' . $com_order . '#comment' . $newcid; | |
| 194 | +			$notification_handler          = xoops_getHandler('notification'); | |
| 195 | + $notification_handler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, | |
| 196 | + $not_modid); | |
| 197 | + } | |
| 198 | 198 | |
| 199 | - planet_trackback_response(0); | |
| 200 | -    } else { | |
| 201 | - planet_trackback_response(1, xoops_error($comment->getHtmlErrors())); | |
| 202 | - } | |
| 199 | + planet_trackback_response(0); | |
| 200 | +	} else { | |
| 201 | + planet_trackback_response(1, xoops_error($comment->getHtmlErrors())); | |
| 202 | + } | |
| 203 | 203 | } | 
| @@ -27,13 +27,13 @@ discard block | ||
| 27 | 27 | include __DIR__ . '/header.php'; | 
| 28 | 28 | |
| 29 | 29 |  if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) { | 
| 30 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; | |
| 31 | - exit(); | |
| 30 | + include XOOPS_ROOT_PATH . '/include/notification_update.php'; | |
| 31 | + exit(); | |
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 |  if ($REQUEST_URI_parsed = planet_parse_args($args_num, $args, $args_str)) { | 
| 35 | - $args['start'] = @$args_num[0]; | |
| 36 | - $args['sort'] = @$args_str[0]; | |
| 35 | + $args['start'] = @$args_num[0]; | |
| 36 | + $args['sort'] = @$args_str[0]; | |
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 | /* Start */ | 
| @@ -80,28 +80,28 @@ discard block | ||
| 80 | 80 | $blog_prefix = ''; | 
| 81 | 81 | /* Specific category */ | 
| 82 | 82 |  if ($category_id > 0) { | 
| 83 | - $category_obj = $category_handler->get($category_id); | |
| 84 | -    $criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 85 | - $uid = 0; | |
| 86 | - $blog_id = 0; | |
| 87 | -    $category_data = array('id' => $category_id, 'title' => $category_obj->getVar('cat_title')); | |
| 88 | - $query_type = 'category'; | |
| 89 | - $blog_prefix = 'b.'; | |
| 83 | + $category_obj = $category_handler->get($category_id); | |
| 84 | +	$criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 85 | + $uid = 0; | |
| 86 | + $blog_id = 0; | |
| 87 | +	$category_data = array('id' => $category_id, 'title' => $category_obj->getVar('cat_title')); | |
| 88 | + $query_type = 'category'; | |
| 89 | + $blog_prefix = 'b.'; | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | /* User bookmarks(favorites) */ | 
| 93 | 93 |  if ($uid > 0) { | 
| 94 | -    $criteria->add(new Criteria('bm.bm_uid', $uid)); | |
| 95 | - $category_id = 0; | |
| 96 | - $blog_id = 0; | |
| 97 | -    $bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); | |
| 98 | - $user_data = array( | |
| 99 | - 'uid' => $uid, | |
| 100 | - 'name' => XoopsUser::getUnameFromId($uid), | |
| 101 | -        'marks' => $bookmark_handler->getCount(new Criteria('bm_uid', $uid)) | |
| 102 | - ); | |
| 103 | - $query_type = 'bookmark'; | |
| 104 | - $blog_prefix = 'b.'; | |
| 94 | +	$criteria->add(new Criteria('bm.bm_uid', $uid)); | |
| 95 | + $category_id = 0; | |
| 96 | + $blog_id = 0; | |
| 97 | +	$bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); | |
| 98 | + $user_data = array( | |
| 99 | + 'uid' => $uid, | |
| 100 | + 'name' => XoopsUser::getUnameFromId($uid), | |
| 101 | +		'marks' => $bookmark_handler->getCount(new Criteria('bm_uid', $uid)) | |
| 102 | + ); | |
| 103 | + $query_type = 'bookmark'; | |
| 104 | + $blog_prefix = 'b.'; | |
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | $criteria->add(new Criteria($blog_prefix . 'blog_status', 0, '>')); | 
| @@ -110,20 +110,20 @@ discard block | ||
| 110 | 110 | $order = 'DESC'; | 
| 111 | 111 | $sort = empty($sort) ? 'default' : $sort; | 
| 112 | 112 |  switch ($sort) { | 
| 113 | - case 'marks': | |
| 114 | - $sortby = $blog_prefix . 'blog_marks'; | |
| 115 | - break; | |
| 116 | - case 'rating': | |
| 117 | - $sortby = $blog_prefix . 'blog_rating'; | |
| 118 | - break; | |
| 119 | - case 'time': | |
| 120 | - $sortby = $blog_prefix . 'blog_time'; | |
| 121 | - break; | |
| 122 | - case 'default': | |
| 123 | - default: | |
| 124 | - $sort = 'default'; | |
| 125 | - $sortby = $blog_prefix . 'blog_id'; | |
| 126 | - break; | |
| 113 | + case 'marks': | |
| 114 | + $sortby = $blog_prefix . 'blog_marks'; | |
| 115 | + break; | |
| 116 | + case 'rating': | |
| 117 | + $sortby = $blog_prefix . 'blog_rating'; | |
| 118 | + break; | |
| 119 | + case 'time': | |
| 120 | + $sortby = $blog_prefix . 'blog_time'; | |
| 121 | + break; | |
| 122 | + case 'default': | |
| 123 | + default: | |
| 124 | + $sort = 'default'; | |
| 125 | + $sortby = $blog_prefix . 'blog_id'; | |
| 126 | + break; | |
| 127 | 127 | } | 
| 128 | 128 | $criteria->setSort($sortby); | 
| 129 | 129 | $criteria->setOrder($order); | 
| @@ -132,97 +132,97 @@ discard block | ||
| 132 | 132 | |
| 133 | 133 | $tags = empty($list) ? '' : array($blog_prefix . 'blog_title', $blog_prefix . 'blog_time'); | 
| 134 | 134 |  switch ($query_type) { | 
| 135 | - case 'category': | |
| 136 | - $blogs_obj =& $blog_handler->getByCategory($criteria, $tags); | |
| 137 | - $count_blog = $blog_handler->getCountByCategory($criteria); | |
| 138 | - break; | |
| 139 | - case 'bookmark': | |
| 140 | - $blogs_obj =& $blog_handler->getByBookmark($criteria, $tags); | |
| 141 | - $count_blog = $blog_handler->getCountByBookmark($criteria); | |
| 142 | - break; | |
| 143 | - default: | |
| 144 | - $blogs_obj =& $blog_handler->getAll($criteria, $tags); | |
| 145 | - $count_blog = $blog_handler->getCount($criteria); | |
| 146 | - break; | |
| 135 | + case 'category': | |
| 136 | + $blogs_obj =& $blog_handler->getByCategory($criteria, $tags); | |
| 137 | + $count_blog = $blog_handler->getCountByCategory($criteria); | |
| 138 | + break; | |
| 139 | + case 'bookmark': | |
| 140 | + $blogs_obj =& $blog_handler->getByBookmark($criteria, $tags); | |
| 141 | + $count_blog = $blog_handler->getCountByBookmark($criteria); | |
| 142 | + break; | |
| 143 | + default: | |
| 144 | + $blogs_obj =& $blog_handler->getAll($criteria, $tags); | |
| 145 | + $count_blog = $blog_handler->getCount($criteria); | |
| 146 | + break; | |
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 | /* Objects to array */ | 
| 150 | 150 | $blogs = array(); | 
| 151 | 151 |  foreach (array_keys($blogs_obj) as $id) { | 
| 152 | - $_blog = array( | |
| 153 | - 'id' => $id, | |
| 154 | -        'title' => $blogs_obj[$id]->getVar('blog_title'), | |
| 155 | - 'time' => $blogs_obj[$id]->getTime() | |
| 156 | - ); | |
| 157 | -    if (empty($list)) { | |
| 158 | - $_blog = array_merge($_blog, array( | |
| 159 | - 'image' => $blogs_obj[$id]->getImage(), | |
| 160 | -            'feed'  => $blogs_obj[$id]->getVar('blog_feed'), | |
| 161 | -            'link'  => $blogs_obj[$id]->getVar('blog_link'), | |
| 162 | -            'desc'  => $blogs_obj[$id]->getVar('blog_desc'), | |
| 163 | - 'star' => $blogs_obj[$id]->getStar(), | |
| 164 | -            'rates' => $blogs_obj[$id]->getVar('blog_rates'), | |
| 165 | -            'marks' => $blogs_obj[$id]->getVar('blog_marks') | |
| 166 | - )); | |
| 167 | - } | |
| 168 | - $blogs[] = $_blog; | |
| 169 | - unset($_blog); | |
| 152 | + $_blog = array( | |
| 153 | + 'id' => $id, | |
| 154 | +		'title' => $blogs_obj[$id]->getVar('blog_title'), | |
| 155 | + 'time' => $blogs_obj[$id]->getTime() | |
| 156 | + ); | |
| 157 | +	if (empty($list)) { | |
| 158 | + $_blog = array_merge($_blog, array( | |
| 159 | + 'image' => $blogs_obj[$id]->getImage(), | |
| 160 | +			'feed'  => $blogs_obj[$id]->getVar('blog_feed'), | |
| 161 | +			'link'  => $blogs_obj[$id]->getVar('blog_link'), | |
| 162 | +			'desc'  => $blogs_obj[$id]->getVar('blog_desc'), | |
| 163 | + 'star' => $blogs_obj[$id]->getStar(), | |
| 164 | +			'rates' => $blogs_obj[$id]->getVar('blog_rates'), | |
| 165 | +			'marks' => $blogs_obj[$id]->getVar('blog_marks') | |
| 166 | + )); | |
| 167 | + } | |
| 168 | + $blogs[] = $_blog; | |
| 169 | + unset($_blog); | |
| 170 | 170 | } | 
| 171 | 171 | unset($blogs_obj); | 
| 172 | 172 | |
| 173 | 173 |  if ($count_blog > $limit) { | 
| 174 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 175 | - $start_link = array(); | |
| 176 | -    if ($sort) { | |
| 177 | - $start_link[] = 'sort=' . $sort; | |
| 178 | - } | |
| 179 | -    if ($category_id) { | |
| 180 | - $start_link[] = 'category=' . $category_id; | |
| 181 | - } | |
| 182 | -    if ($list) { | |
| 183 | - $start_link[] = 'list=' . $list; | |
| 184 | - } | |
| 185 | -    $nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link)); | |
| 186 | - $pagenav = $nav->renderNav(4); | |
| 174 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 175 | + $start_link = array(); | |
| 176 | +	if ($sort) { | |
| 177 | + $start_link[] = 'sort=' . $sort; | |
| 178 | + } | |
| 179 | +	if ($category_id) { | |
| 180 | + $start_link[] = 'category=' . $category_id; | |
| 181 | + } | |
| 182 | +	if ($list) { | |
| 183 | + $start_link[] = 'list=' . $list; | |
| 184 | + } | |
| 185 | +	$nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link)); | |
| 186 | + $pagenav = $nav->renderNav(4); | |
| 187 | 187 |  } else { | 
| 188 | - $pagenav = ''; | |
| 188 | + $pagenav = ''; | |
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | 191 |  $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']); | 
| 192 | 192 |  $xoopsTpl->assign('link_home', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" | 
| 193 | -                               . planet_constant('MD_HOME') . "\" target=\"_self\">" . planet_constant('MD_HOME') | |
| 194 | - . '</a>'); | |
| 193 | +							   . planet_constant('MD_HOME') . "\" target=\"_self\">" . planet_constant('MD_HOME') | |
| 194 | + . '</a>'); | |
| 195 | 195 | |
| 196 | 196 |  if ($category_id || $uid) { | 
| 197 | -    $xoopsTpl->assign('link_index', | |
| 198 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/view.blogs.php\" title=\"" | |
| 199 | -                      . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>'); | |
| 197 | +	$xoopsTpl->assign('link_index', | |
| 198 | + "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/view.blogs.php\" title=\"" | |
| 199 | +					  . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>'); | |
| 200 | 200 | |
| 201 | - $link_articles = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 202 | - . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) | |
| 203 | -                     . "\" title=\"" . planet_constant('MD_ARTICLES') . "\">" . planet_constant('MD_ARTICLES') . '</a>'; | |
| 204 | -    $xoopsTpl->assign('link_articles', $link_articles); | |
| 201 | + $link_articles = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 202 | + . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) | |
| 203 | +					 . "\" title=\"" . planet_constant('MD_ARTICLES') . "\">" . planet_constant('MD_ARTICLES') . '</a>'; | |
| 204 | +	$xoopsTpl->assign('link_articles', $link_articles); | |
| 205 | 205 | } | 
| 206 | 206 | |
| 207 | 207 | $link_switch = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' | 
| 208 | - . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) | |
| 209 | - . (empty($list) ? '/l1' : '') . "\" title=\"" | |
| 210 | -               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . "\">" | |
| 211 | -               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . '</a>'; | |
| 208 | + . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) | |
| 209 | + . (empty($list) ? '/l1' : '') . "\" title=\"" | |
| 210 | +			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . "\">" | |
| 211 | +			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . '</a>'; | |
| 212 | 212 |  $xoopsTpl->assign('link_switch', $link_switch); | 
| 213 | 213 | |
| 214 | 214 |  if (empty($uid) && is_object($xoopsUser)) { | 
| 215 | -    $xoopsTpl->assign('link_bookmark', | |
| 216 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' | |
| 217 | -                      . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" | |
| 218 | -                      . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') | |
| 219 | - . '</a>'); | |
| 215 | +	$xoopsTpl->assign('link_bookmark', | |
| 216 | + "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' | |
| 217 | +					  . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" | |
| 218 | +					  . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') | |
| 219 | + . '</a>'); | |
| 220 | 220 | } | 
| 221 | 221 | |
| 222 | 222 |  if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) { | 
| 223 | -    $xoopsTpl->assign('link_submit', | |
| 224 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" | |
| 225 | - . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>'); | |
| 223 | +	$xoopsTpl->assign('link_submit', | |
| 224 | + "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" | |
| 225 | + . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>'); | |
| 226 | 226 | } | 
| 227 | 227 | |
| 228 | 228 |  $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS')); | 
| @@ -236,35 +236,35 @@ discard block | ||
| 236 | 236 |  $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); | 
| 237 | 237 |  if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { | 
| 238 | 238 |  } elseif (!$list) { | 
| 239 | -    $xoopsTpl->assign('canrate', 1); | |
| 239 | +	$xoopsTpl->assign('canrate', 1); | |
| 240 | 240 | } | 
| 241 | 241 | |
| 242 | 242 | $sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER; | 
| 243 | 243 | $vars = array(); | 
| 244 | 244 |  if (!empty($category_id)) { | 
| 245 | - $vars[] = 'c' . $category_id; | |
| 245 | + $vars[] = 'c' . $category_id; | |
| 246 | 246 | } | 
| 247 | 247 |  if (!empty($uid)) { | 
| 248 | - $vars[] = 'u' . $uid; | |
| 248 | + $vars[] = 'u' . $uid; | |
| 249 | 249 | } | 
| 250 | 250 |  if (!empty($list)) { | 
| 251 | - $vars[] = 'li'; | |
| 251 | + $vars[] = 'li'; | |
| 252 | 252 | } | 
| 253 | 253 |  if (!empty($vars)) { | 
| 254 | -    $sort_link .= implode('/', $vars) . '/'; | |
| 254 | +	$sort_link .= implode('/', $vars) . '/'; | |
| 255 | 255 | } | 
| 256 | 256 | $sortlinks = array(); | 
| 257 | 257 | $valid_sorts = array( | 
| 258 | -    'marks'   => planet_constant('MD_BOOKMARKS'), | |
| 259 | -    'rating'  => planet_constant('MD_RATING'), | |
| 260 | -    'time'    => planet_constant('MD_TIME'), | |
| 261 | -    'default' => planet_constant('MD_DEFAULT') | |
| 258 | +	'marks'   => planet_constant('MD_BOOKMARKS'), | |
| 259 | +	'rating'  => planet_constant('MD_RATING'), | |
| 260 | +	'time'    => planet_constant('MD_TIME'), | |
| 261 | +	'default' => planet_constant('MD_DEFAULT') | |
| 262 | 262 | ); | 
| 263 | 263 |  foreach ($valid_sorts as $val => $name) { | 
| 264 | -    if ($val == $sort) { | |
| 265 | - continue; | |
| 266 | - } | |
| 267 | - $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>'; | |
| 264 | +	if ($val == $sort) { | |
| 265 | + continue; | |
| 266 | + } | |
| 267 | + $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>'; | |
| 268 | 268 | } | 
| 269 | 269 |  $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks)); | 
| 270 | 270 | |
| @@ -27,8 +27,8 @@ | ||
| 27 | 27 | include __DIR__ . '/header.php'; | 
| 28 | 28 | $com_itemid = isset($_GET['com_itemid']) ? (int)$_GET['com_itemid'] : 0; | 
| 29 | 29 |  if ($com_itemid > 0) { | 
| 30 | -    $article_handler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); | |
| 31 | - $article_obj =& $article_handler->get($com_itemid); | |
| 32 | -    $com_replytitle  = $article_obj->getVar('art_title'); | |
| 33 | - include_once XOOPS_ROOT_PATH . '/include/comment_new.php'; | |
| 30 | +	$article_handler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); | |
| 31 | + $article_obj =& $article_handler->get($com_itemid); | |
| 32 | +	$com_replytitle  = $article_obj->getVar('art_title'); | |
| 33 | + include_once XOOPS_ROOT_PATH . '/include/comment_new.php'; | |
| 34 | 34 | } | 
| @@ -30,48 +30,48 @@ discard block | ||
| 30 | 30 | error_reporting(0); | 
| 31 | 31 | |
| 32 | 32 |  if (empty($_POST['print_data'])) { | 
| 33 | -    if (planet_parse_args($args_num, $args, $args_str)) { | |
| 34 | - $args['article'] = @$args_num[0]; | |
| 35 | - } | |
| 33 | +	if (planet_parse_args($args_num, $args, $args_str)) { | |
| 34 | + $args['article'] = @$args_num[0]; | |
| 35 | + } | |
| 36 | 36 | |
| 37 | - $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); | |
| 37 | + $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); | |
| 38 | 38 | |
| 39 | -    $article_handler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); | |
| 40 | - $article_obj =& $article_handler->get($article_id); | |
| 39 | +	$article_handler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); | |
| 40 | + $article_obj =& $article_handler->get($article_id); | |
| 41 | 41 | |
| 42 | - $article_data = array(); | |
| 42 | + $article_data = array(); | |
| 43 | 43 | |
| 44 | - // title | |
| 45 | -    $article_data['title'] = $article_obj->getVar('art_title'); | |
| 44 | + // title | |
| 45 | +	$article_data['title'] = $article_obj->getVar('art_title'); | |
| 46 | 46 | |
| 47 | -    $article_data['author'] = $article_obj->getVar('art_author'); | |
| 47 | +	$article_data['author'] = $article_obj->getVar('art_author'); | |
| 48 | 48 | |
| 49 | - // source | |
| 50 | -    $article_data['source'] = $article_obj->getVar('art_link'); | |
| 49 | + // source | |
| 50 | +	$article_data['source'] = $article_obj->getVar('art_link'); | |
| 51 | 51 | |
| 52 | - // publish time | |
| 53 | -    $article_data['time'] = $article_obj->getTime('l'); | |
| 52 | + // publish time | |
| 53 | +	$article_data['time'] = $article_obj->getTime('l'); | |
| 54 | 54 | |
| 55 | - // summary | |
| 56 | - $article_data['summary'] =& $article_obj->getSummary(); | |
| 55 | + // summary | |
| 56 | + $article_data['summary'] =& $article_obj->getSummary(); | |
| 57 | 57 | |
| 58 | - // text of page | |
| 59 | -    $article_data['text'] = $article_obj->getVar('art_content'); | |
| 58 | + // text of page | |
| 59 | +	$article_data['text'] = $article_obj->getVar('art_content'); | |
| 60 | 60 | |
| 61 | - $print_data['title'] = $article_data['title']; | |
| 62 | - $print_data['author'] = $article_data['author']; | |
| 63 | - $print_data['date'] = $article_data['time']; | |
| 64 | -    $print_data['summary'] = empty($article_data['summary']) ? '' : planet_constant('MD_SUMMARY') . ': ' | |
| 65 | - . $article_data['summary']; | |
| 66 | - $print_data['content'] = $article_data['text']; | |
| 67 | -    $print_data['url']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/view.article.php' | |
| 68 | - . URL_DELIMITER . 'c' . $category_id . '/' . $article_id . '/p' . $page; | |
| 61 | + $print_data['title'] = $article_data['title']; | |
| 62 | + $print_data['author'] = $article_data['author']; | |
| 63 | + $print_data['date'] = $article_data['time']; | |
| 64 | +	$print_data['summary'] = empty($article_data['summary']) ? '' : planet_constant('MD_SUMMARY') . ': ' | |
| 65 | + . $article_data['summary']; | |
| 66 | + $print_data['content'] = $article_data['text']; | |
| 67 | +	$print_data['url']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/view.article.php' | |
| 68 | + . URL_DELIMITER . 'c' . $category_id . '/' . $article_id . '/p' . $page; | |
| 69 | 69 |  } else { | 
| 70 | - $print_data = unserialize(base64_decode($_POST['print_data'])); | |
| 70 | + $print_data = unserialize(base64_decode($_POST['print_data'])); | |
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | 73 |  $print_data['image']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' | 
| 74 | -                        . $xoopsModule->getInfo('image'); | |
| 74 | +						. $xoopsModule->getInfo('image'); | |
| 75 | 75 |  $print_data['module'] = $xoopsModule->getVar('name') . ' V' . $xoopsModule->getInfo('version'); | 
| 76 | 76 | |
| 77 | 77 |  header('Content-Type: text/html; charset=' . _CHARSET); | 
| @@ -99,19 +99,19 @@ discard block | ||
| 99 | 99 | </style>\n"; | 
| 100 | 100 | echo "</head>\n"; | 
| 101 | 101 | echo "<body style='background-color:#ffffff; color:#000000; font-family: Arial' onload='window.print()'>\n" | 
| 102 | - . "<div style='float:center; width: 750px; border: 1px solid #000; padding: 20px;'>\n" | |
| 103 | - . "<div style='text-align: center; display: block; margin: 0 0 6px 0; padding: 5px;'>\n" . "<img src='" | |
| 104 | - . $print_data['image'] . "' border='0' alt='" . $print_data['module'] . "' />\n" . '<h2>' . $print_data['title'] | |
| 105 | - . "</h2>\n" . "</div>\n" | |
| 106 | - . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n"; | |
| 102 | + . "<div style='float:center; width: 750px; border: 1px solid #000; padding: 20px;'>\n" | |
| 103 | + . "<div style='text-align: center; display: block; margin: 0 0 6px 0; padding: 5px;'>\n" . "<img src='" | |
| 104 | + . $print_data['image'] . "' border='0' alt='" . $print_data['module'] . "' />\n" . '<h2>' . $print_data['title'] | |
| 105 | + . "</h2>\n" . "</div>\n" | |
| 106 | + . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n"; | |
| 107 | 107 |  echo (empty($print_data['author']) ? '' : '<div>' . planet_constant('MD_AUTHOR') . ': ' . $print_data['author'] | 
| 108 | -                                          . "</div>\n") . '<div>' . planet_constant('MD_DATE') . ': ' | |
| 109 | - . $print_data['date'] . "</div>\n" | |
| 110 | - . (empty($article_data['summary']) ? '' : "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n" | |
| 111 | - . '<div>' . $print_data['summary'] . "</div>\n") | |
| 112 | - . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n" . '<div>' | |
| 113 | - . $print_data['content'] . "</div>\n" | |
| 114 | - . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n" . '<div>' | |
| 115 | - . $print_data['module'] . "</div>\n" . '<div>URL: ' . $print_data['url'] . "</div>\n" . "</div>\n" | |
| 116 | - . "</body>\n</html>\n"; | |
| 108 | +										  . "</div>\n") . '<div>' . planet_constant('MD_DATE') . ': ' | |
| 109 | + . $print_data['date'] . "</div>\n" | |
| 110 | + . (empty($article_data['summary']) ? '' : "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n" | |
| 111 | + . '<div>' . $print_data['summary'] . "</div>\n") | |
| 112 | + . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n" . '<div>' | |
| 113 | + . $print_data['content'] . "</div>\n" | |
| 114 | + . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n" . '<div>' | |
| 115 | + . $print_data['module'] . "</div>\n" . '<div>URL: ' . $print_data['url'] . "</div>\n" . "</div>\n" | |
| 116 | + . "</body>\n</html>\n"; | |
| 117 | 117 | exit(); | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | //echo '<label>' . '<strong>MySQL Version:</strong>' . ':</label><text>' . mysqli_get_server_info() . '</text><br>'; | 
| 57 | 57 | echo '<label>' . '<strong>XOOPS Version:</strong>' . ':</label><text>' . XOOPS_VERSION . '</text><br>'; | 
| 58 | 58 |  echo '<label>' . '<strong>Module Version:</strong>' . ':</label><text>' . $xoopsModule->getInfo('version') | 
| 59 | - . '</text><br>'; | |
| 59 | + . '</text><br>'; | |
| 60 | 60 | echo '</div>'; | 
| 61 | 61 | echo "<div style='padding: 8px;'>"; | 
| 62 | 62 |  echo '<label>' . planet_constant('AM_SAFEMODE') . ':</label><text>'; | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | echo '</text><br>'; | 
| 107 | 107 |  echo '<label>' . planet_constant('AM_TOTAL_BLOGS') . ':</label><text>' . $blog_count; | 
| 108 | 108 |  if ($blog_count_pending > 0) { | 
| 109 | - echo " (<font color=\"red\">" . $blog_count_pending . '</font>)'; | |
| 109 | + echo " (<font color=\"red\">" . $blog_count_pending . '</font>)'; | |
| 110 | 110 | } | 
| 111 | 111 | echo '</text><br>'; | 
| 112 | 112 |  echo '<label>' . planet_constant('AM_TOTAL_ARTICLES') . ':</label><text>' . $article_count; | 
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | */ | 
| 19 | 19 | |
| 20 | 20 | echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" | 
| 21 | -     . "    <a href='http://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" | |
| 22 | - . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>'; | |
| 21 | +	 . "    <a href='http://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" | |
| 22 | + . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>'; | |
| 23 | 23 | |
| 24 | 24 | xoops_cp_footer(); | 
| @@ -50,347 +50,347 @@ | ||
| 50 | 50 |  $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | 
| 51 | 51 | |
| 52 | 52 |  if ('save' === $op && !empty($_POST['fetch'])) { | 
| 53 | - $op = 'edit'; | |
| 53 | + $op = 'edit'; | |
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | 56 |  switch ($op) { | 
| 57 | - /* save a single blog */ | |
| 58 | - case 'save': | |
| 57 | + /* save a single blog */ | |
| 58 | + case 'save': | |
| 59 | 59 | |
| 60 | -        if ($blog_id) { | |
| 61 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 62 | -        } else { | |
| 63 | -            if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', $_POST['blog_feed']))) { | |
| 64 | -                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); | |
| 65 | - } | |
| 66 | - $blog_obj =& $blog_handler->create(); | |
| 67 | -            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); | |
| 68 | - } | |
| 60 | +		if ($blog_id) { | |
| 61 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 62 | +		} else { | |
| 63 | +			if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', $_POST['blog_feed']))) { | |
| 64 | +				redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); | |
| 65 | + } | |
| 66 | + $blog_obj =& $blog_handler->create(); | |
| 67 | +			$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); | |
| 68 | + } | |
| 69 | 69 | |
| 70 | -        $blog_obj->setVar('blog_title', $_POST['blog_title']); | |
| 71 | -        $blog_obj->setVar('blog_desc', $_POST['blog_desc']); | |
| 72 | -        $blog_obj->setVar('blog_image', $_POST['blog_image']); | |
| 73 | -        $blog_obj->setVar('blog_feed', $_POST['blog_feed']); | |
| 74 | -        $blog_obj->setVar('blog_link', $_POST['blog_link']); | |
| 75 | -        $blog_obj->setVar('blog_language', $_POST['blog_language']); | |
| 76 | -        $blog_obj->setVar('blog_charset', $_POST['blog_charset']); | |
| 77 | -        $blog_obj->setVar('blog_trackback', $_POST['blog_trackback']); | |
| 78 | -        $blog_obj->setVar('blog_status', $_POST['blog_status']); | |
| 70 | +		$blog_obj->setVar('blog_title', $_POST['blog_title']); | |
| 71 | +		$blog_obj->setVar('blog_desc', $_POST['blog_desc']); | |
| 72 | +		$blog_obj->setVar('blog_image', $_POST['blog_image']); | |
| 73 | +		$blog_obj->setVar('blog_feed', $_POST['blog_feed']); | |
| 74 | +		$blog_obj->setVar('blog_link', $_POST['blog_link']); | |
| 75 | +		$blog_obj->setVar('blog_language', $_POST['blog_language']); | |
| 76 | +		$blog_obj->setVar('blog_charset', $_POST['blog_charset']); | |
| 77 | +		$blog_obj->setVar('blog_trackback', $_POST['blog_trackback']); | |
| 78 | +		$blog_obj->setVar('blog_status', $_POST['blog_status']); | |
| 79 | 79 | |
| 80 | -        if (!$blog_handler->insert($blog_obj)) { | |
| 81 | -        } elseif (!empty($_POST['categories'])) { | |
| 82 | -            $blog_id = $blog_obj->getVar('blog_id'); | |
| 83 | -            if (in_array(0, $_POST['categories'])) { | |
| 84 | - $_POST['categories'] = array(); | |
| 85 | - } | |
| 86 | - $blog_handler->setCategories($blog_id, $_POST['categories']); | |
| 87 | - } | |
| 88 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 89 | -        redirect_header('admin.blog.php', 2, $message); | |
| 80 | +		if (!$blog_handler->insert($blog_obj)) { | |
| 81 | +		} elseif (!empty($_POST['categories'])) { | |
| 82 | +			$blog_id = $blog_obj->getVar('blog_id'); | |
| 83 | +			if (in_array(0, $_POST['categories'])) { | |
| 84 | + $_POST['categories'] = array(); | |
| 85 | + } | |
| 86 | + $blog_handler->setCategories($blog_id, $_POST['categories']); | |
| 87 | + } | |
| 88 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 89 | +		redirect_header('admin.blog.php', 2, $message); | |
| 90 | 90 | |
| 91 | - /* fetch and add a list of blogs to a category */ | |
| 92 | - case 'add': | |
| 93 | - $links =& planet_parseLinks($_POST['links']); | |
| 94 | - $blogs = array(); | |
| 95 | -        foreach ($links as $link) { | |
| 96 | -            if ($blog_exist = $blog_handler->getCount(new Criteria('blog_feed', $link['url']))) { | |
| 97 | - continue; | |
| 98 | - } | |
| 99 | - $blog_obj =& $blog_handler->fetch($link['url']); | |
| 100 | -            if (!empty($link['title'])) { | |
| 101 | -                $blog_obj->setVar('blog_title', $link['title']); | |
| 102 | - } | |
| 103 | - $blog_handler->insert($blog_obj); | |
| 104 | -            $blogs[] = $blog_obj->getVar('blog_id'); | |
| 105 | - unset($blog_obj); | |
| 106 | - } | |
| 107 | -        if (!empty($_POST['categories'])) { | |
| 108 | -            $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 109 | -            foreach ($_POST['categories'] as $cat_id) { | |
| 110 | - $category_handler->addBlogs($cat_id, $blogs); | |
| 111 | - } | |
| 112 | - } | |
| 113 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 114 | -        redirect_header('admin.blog.php', 2, $message); | |
| 91 | + /* fetch and add a list of blogs to a category */ | |
| 92 | + case 'add': | |
| 93 | + $links =& planet_parseLinks($_POST['links']); | |
| 94 | + $blogs = array(); | |
| 95 | +		foreach ($links as $link) { | |
| 96 | +			if ($blog_exist = $blog_handler->getCount(new Criteria('blog_feed', $link['url']))) { | |
| 97 | + continue; | |
| 98 | + } | |
| 99 | + $blog_obj =& $blog_handler->fetch($link['url']); | |
| 100 | +			if (!empty($link['title'])) { | |
| 101 | +				$blog_obj->setVar('blog_title', $link['title']); | |
| 102 | + } | |
| 103 | + $blog_handler->insert($blog_obj); | |
| 104 | +			$blogs[] = $blog_obj->getVar('blog_id'); | |
| 105 | + unset($blog_obj); | |
| 106 | + } | |
| 107 | +		if (!empty($_POST['categories'])) { | |
| 108 | +			$category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 109 | +			foreach ($_POST['categories'] as $cat_id) { | |
| 110 | + $category_handler->addBlogs($cat_id, $blogs); | |
| 111 | + } | |
| 112 | + } | |
| 113 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 114 | +		redirect_header('admin.blog.php', 2, $message); | |
| 115 | 115 | |
| 116 | - /* update a list of blogs */ | |
| 117 | - case 'update': | |
| 118 | -        foreach ($blog_id as $bid) { | |
| 119 | - $blog_obj =& $blog_handler->fetch($bid); | |
| 120 | -            if (!$blog_handler->insert($blog_obj)) { | |
| 121 | - } | |
| 122 | - unset($blog_obj); | |
| 123 | - } | |
| 124 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 125 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 116 | + /* update a list of blogs */ | |
| 117 | + case 'update': | |
| 118 | +		foreach ($blog_id as $bid) { | |
| 119 | + $blog_obj =& $blog_handler->fetch($bid); | |
| 120 | +			if (!$blog_handler->insert($blog_obj)) { | |
| 121 | + } | |
| 122 | + unset($blog_obj); | |
| 123 | + } | |
| 124 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 125 | +		redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 126 | 126 | |
| 127 | - /* add a list of blogs to a category */ | |
| 128 | - case 'register': | |
| 129 | -        if (!empty($_POST['category_dest'])) { | |
| 130 | -            if (!is_array($blog_id)) { | |
| 131 | - $blog_id = array($blog_id); | |
| 132 | - } | |
| 133 | -            $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 134 | - $category_handler->addBlogs($_POST['category_dest'], $blog_id); | |
| 135 | - } | |
| 136 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 137 | -        redirect_header('admin.blog.php?category=' . $_POST['category_dest'] . '&start=' . $start, 2, $message); | |
| 127 | + /* add a list of blogs to a category */ | |
| 128 | + case 'register': | |
| 129 | +		if (!empty($_POST['category_dest'])) { | |
| 130 | +			if (!is_array($blog_id)) { | |
| 131 | + $blog_id = array($blog_id); | |
| 132 | + } | |
| 133 | +			$category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 134 | + $category_handler->addBlogs($_POST['category_dest'], $blog_id); | |
| 135 | + } | |
| 136 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 137 | +		redirect_header('admin.blog.php?category=' . $_POST['category_dest'] . '&start=' . $start, 2, $message); | |
| 138 | 138 | |
| 139 | - /* remove a list of blogs from a category */ | |
| 140 | - case 'remove': | |
| 141 | -        if (!is_array($blog_id)) { | |
| 142 | - $blog_id = array($blog_id); | |
| 143 | - } | |
| 144 | -        if (!empty($category_id)) { | |
| 145 | -            $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 146 | - $category_handler->removeBlogs($category_id, $blog_id); | |
| 147 | - } | |
| 148 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 149 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 139 | + /* remove a list of blogs from a category */ | |
| 140 | + case 'remove': | |
| 141 | +		if (!is_array($blog_id)) { | |
| 142 | + $blog_id = array($blog_id); | |
| 143 | + } | |
| 144 | +		if (!empty($category_id)) { | |
| 145 | +			$category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 146 | + $category_handler->removeBlogs($category_id, $blog_id); | |
| 147 | + } | |
| 148 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 149 | +		redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 150 | 150 | |
| 151 | - /* delete a single blog or a list blogs */ | |
| 152 | - case 'del': | |
| 153 | -        if (!is_array($blog_id)) { | |
| 154 | - $blog_id = array($blog_id); | |
| 155 | - } | |
| 156 | -        foreach ($blog_id as $bid) { | |
| 157 | - $blog_obj =& $blog_handler->get($bid); | |
| 158 | -            if (!$blog_handler->delete($blog_obj, true)) { | |
| 159 | - } | |
| 160 | - unset($blog_obj); | |
| 161 | - } | |
| 162 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 163 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 151 | + /* delete a single blog or a list blogs */ | |
| 152 | + case 'del': | |
| 153 | +		if (!is_array($blog_id)) { | |
| 154 | + $blog_id = array($blog_id); | |
| 155 | + } | |
| 156 | +		foreach ($blog_id as $bid) { | |
| 157 | + $blog_obj =& $blog_handler->get($bid); | |
| 158 | +			if (!$blog_handler->delete($blog_obj, true)) { | |
| 159 | + } | |
| 160 | + unset($blog_obj); | |
| 161 | + } | |
| 162 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 163 | +		redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 164 | 164 | |
| 165 | - /* empty a single blog or a list blogs */ | |
| 166 | - case 'empty': | |
| 167 | -        if (!is_array($blog_id)) { | |
| 168 | - $blog_id = array($blog_id); | |
| 169 | - } | |
| 170 | -        foreach ($blog_id as $bid) { | |
| 171 | - $blog_obj =& $blog_handler->get($bid); | |
| 172 | -            if (!$blog_handler->do_empty($blog_obj)) { | |
| 173 | - } | |
| 174 | - } | |
| 175 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 176 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 165 | + /* empty a single blog or a list blogs */ | |
| 166 | + case 'empty': | |
| 167 | +		if (!is_array($blog_id)) { | |
| 168 | + $blog_id = array($blog_id); | |
| 169 | + } | |
| 170 | +		foreach ($blog_id as $bid) { | |
| 171 | + $blog_obj =& $blog_handler->get($bid); | |
| 172 | +			if (!$blog_handler->do_empty($blog_obj)) { | |
| 173 | + } | |
| 174 | + } | |
| 175 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 176 | +		redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 177 | 177 | |
| 178 | - /* approve a single blog or a list blogs */ | |
| 179 | - case 'approve': | |
| 180 | -        if (!is_array($blog_id)) { | |
| 181 | - $blog_id = array($blog_id); | |
| 182 | - } | |
| 183 | -        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 184 | -        $blog_handler->updateAll('blog_status', 1, $criteria, true); | |
| 185 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 186 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 178 | + /* approve a single blog or a list blogs */ | |
| 179 | + case 'approve': | |
| 180 | +		if (!is_array($blog_id)) { | |
| 181 | + $blog_id = array($blog_id); | |
| 182 | + } | |
| 183 | +		$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 184 | +		$blog_handler->updateAll('blog_status', 1, $criteria, true); | |
| 185 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 186 | +		redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 187 | 187 | |
| 188 | - /* mark a single blog or a list blogs as featured */ | |
| 189 | - case 'feature': | |
| 190 | -        if (!is_array($blog_id)) { | |
| 191 | - $blog_id = array($blog_id); | |
| 192 | - } | |
| 193 | -        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 194 | -        $blog_handler->updateAll('blog_status', 2, $criteria, true); | |
| 195 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 196 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 188 | + /* mark a single blog or a list blogs as featured */ | |
| 189 | + case 'feature': | |
| 190 | +		if (!is_array($blog_id)) { | |
| 191 | + $blog_id = array($blog_id); | |
| 192 | + } | |
| 193 | +		$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 194 | +		$blog_handler->updateAll('blog_status', 2, $criteria, true); | |
| 195 | +		$message = planet_constant('AM_DBUPDATED'); | |
| 196 | +		redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 197 | 197 | |
| 198 | - /* edit a single blog */ | |
| 199 | - case 'edit': | |
| 200 | -        if (!empty($_POST['fetch'])) { | |
| 201 | - $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); | |
| 202 | -            $blog_obj->setVar('blog_id', $blog_id); | |
| 203 | -        } else { | |
| 204 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 205 | - } | |
| 206 | - $categories = @$_POST['categories']; | |
| 207 | -        if (empty($categories) && $blog_id > 0) { | |
| 208 | -            $crit       = new Criteria('bc.blog_id', $blog_id); | |
| 209 | - $categories = array_keys($category_handler->getByBlog($crit)); | |
| 210 | - } | |
| 211 | -        if (empty($categories)) { | |
| 212 | - $categories = array(0 => _NONE); | |
| 213 | - } | |
| 198 | + /* edit a single blog */ | |
| 199 | + case 'edit': | |
| 200 | +		if (!empty($_POST['fetch'])) { | |
| 201 | + $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); | |
| 202 | +			$blog_obj->setVar('blog_id', $blog_id); | |
| 203 | +		} else { | |
| 204 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 205 | + } | |
| 206 | + $categories = @$_POST['categories']; | |
| 207 | +		if (empty($categories) && $blog_id > 0) { | |
| 208 | +			$crit       = new Criteria('bc.blog_id', $blog_id); | |
| 209 | + $categories = array_keys($category_handler->getByBlog($crit)); | |
| 210 | + } | |
| 211 | +		if (empty($categories)) { | |
| 212 | + $categories = array(0 => _NONE); | |
| 213 | + } | |
| 214 | 214 | |
| 215 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; | |
| 216 | - echo '<br>'; | |
| 217 | -        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { | |
| 218 | -            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); | |
| 219 | - $blogs_obj =& $blog_handler->getList($criteria); | |
| 220 | -            if (count($blogs_obj) > 0) { | |
| 221 | -                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); | |
| 222 | -                foreach (array_keys($blogs_obj) as $bid) { | |
| 223 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 224 | - . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; | |
| 225 | - } | |
| 226 | - echo '</div>'; | |
| 227 | - } | |
| 228 | - unset($blogs_obj, $criteria); | |
| 229 | - } | |
| 230 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; | |
| 231 | - echo '</fieldset>'; | |
| 232 | - break; | |
| 215 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; | |
| 216 | + echo '<br>'; | |
| 217 | +		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { | |
| 218 | +			$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); | |
| 219 | + $blogs_obj =& $blog_handler->getList($criteria); | |
| 220 | +			if (count($blogs_obj) > 0) { | |
| 221 | +				echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); | |
| 222 | +				foreach (array_keys($blogs_obj) as $bid) { | |
| 223 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 224 | + . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; | |
| 225 | + } | |
| 226 | + echo '</div>'; | |
| 227 | + } | |
| 228 | + unset($blogs_obj, $criteria); | |
| 229 | + } | |
| 230 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; | |
| 231 | + echo '</fieldset>'; | |
| 232 | + break; | |
| 233 | 233 | |
| 234 | - default: | |
| 234 | + default: | |
| 235 | 235 | |
| 236 | -        $crit = new Criteria('1', 1); | |
| 237 | -        $crit->setSort('cat_order'); | |
| 238 | -        $crit->setOrder('ASC'); | |
| 239 | - $categories = $category_handler->getList($crit); | |
| 236 | +		$crit = new Criteria('1', 1); | |
| 237 | +		$crit->setSort('cat_order'); | |
| 238 | +		$crit->setOrder('ASC'); | |
| 239 | + $categories = $category_handler->getList($crit); | |
| 240 | 240 | |
| 241 | - // Display category option form | |
| 242 | -        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); | |
| 243 | -        $op_select = new XoopsFormSelect('', 'category', $category_id); | |
| 244 | -        $op_select->setExtra('onchange="document.forms.opform.submit()"'); | |
| 245 | - $options = array( | |
| 246 | - '0' => _ALL, | |
| 247 | -            '-1' => planet_constant('MD_ACTIVE'), | |
| 248 | -            '-2' => planet_constant('MD_FEATURED'), | |
| 249 | -            '-3' => planet_constant('MD_PENDING') | |
| 250 | - ); | |
| 251 | -        foreach (array_keys($categories) as $key) { | |
| 252 | - $options[$key] = $categories[$key]; | |
| 253 | - } | |
| 254 | - $op_select->addOptionArray($options); | |
| 255 | - $opform->addElement($op_select); | |
| 256 | - $opform->display(); | |
| 241 | + // Display category option form | |
| 242 | +		$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); | |
| 243 | +		$op_select = new XoopsFormSelect('', 'category', $category_id); | |
| 244 | +		$op_select->setExtra('onchange="document.forms.opform.submit()"'); | |
| 245 | + $options = array( | |
| 246 | + '0' => _ALL, | |
| 247 | +			'-1' => planet_constant('MD_ACTIVE'), | |
| 248 | +			'-2' => planet_constant('MD_FEATURED'), | |
| 249 | +			'-3' => planet_constant('MD_PENDING') | |
| 250 | + ); | |
| 251 | +		foreach (array_keys($categories) as $key) { | |
| 252 | + $options[$key] = $categories[$key]; | |
| 253 | + } | |
| 254 | + $op_select->addOptionArray($options); | |
| 255 | + $opform->addElement($op_select); | |
| 256 | + $opform->display(); | |
| 257 | 257 | |
| 258 | -        if ($category_id > 0) { | |
| 259 | -            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); | |
| 260 | -            $criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 261 | - $blog_count = $blog_handler->getCountByCategory($criteria); | |
| 262 | - $criteria->setStart($start); | |
| 263 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 264 | - $blog_objs =& $blog_handler->getByCategory($criteria); | |
| 265 | -        } else { | |
| 266 | - /* All active blogs */ | |
| 267 | -            if ($category_id == 0) { | |
| 268 | -                $criteria = new Criteria('1', 1); | |
| 269 | - $criteria->setStart($start); | |
| 270 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 271 | - /* Active blogs */ | |
| 272 | -            } elseif ($category_id == -1) { | |
| 273 | -                $criteria = new Criteria('blog_status', 1); | |
| 274 | - $criteria->setStart($start); | |
| 275 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 276 | - /* Featured blogs */ | |
| 277 | -            } elseif ($category_id == -2) { | |
| 278 | -                $criteria = new Criteria('blog_status', 2); | |
| 279 | - $criteria->setStart($start); | |
| 280 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 281 | - /* Pending blogs */ | |
| 282 | -            } else { | |
| 283 | -                $criteria = new Criteria('blog_status', 0); | |
| 284 | - $criteria->setStart($start); | |
| 285 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 286 | - } | |
| 287 | - $blog_count = $blog_handler->getCount($criteria); | |
| 288 | - $blog_objs =& $blog_handler->getAll($criteria); | |
| 289 | - } | |
| 258 | +		if ($category_id > 0) { | |
| 259 | +			$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); | |
| 260 | +			$criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 261 | + $blog_count = $blog_handler->getCountByCategory($criteria); | |
| 262 | + $criteria->setStart($start); | |
| 263 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 264 | + $blog_objs =& $blog_handler->getByCategory($criteria); | |
| 265 | +		} else { | |
| 266 | + /* All active blogs */ | |
| 267 | +			if ($category_id == 0) { | |
| 268 | +				$criteria = new Criteria('1', 1); | |
| 269 | + $criteria->setStart($start); | |
| 270 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 271 | + /* Active blogs */ | |
| 272 | +			} elseif ($category_id == -1) { | |
| 273 | +				$criteria = new Criteria('blog_status', 1); | |
| 274 | + $criteria->setStart($start); | |
| 275 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 276 | + /* Featured blogs */ | |
| 277 | +			} elseif ($category_id == -2) { | |
| 278 | +				$criteria = new Criteria('blog_status', 2); | |
| 279 | + $criteria->setStart($start); | |
| 280 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 281 | + /* Pending blogs */ | |
| 282 | +			} else { | |
| 283 | +				$criteria = new Criteria('blog_status', 0); | |
| 284 | + $criteria->setStart($start); | |
| 285 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 286 | + } | |
| 287 | + $blog_count = $blog_handler->getCount($criteria); | |
| 288 | + $blog_objs =& $blog_handler->getAll($criteria); | |
| 289 | + } | |
| 290 | 290 | |
| 291 | -        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; | |
| 292 | - echo "<br style=\"clear:both\" />"; | |
| 291 | +		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; | |
| 292 | + echo "<br style=\"clear:both\" />"; | |
| 293 | 293 | |
| 294 | -        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; | |
| 295 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; | |
| 296 | - echo "<tr align='center'>"; | |
| 297 | -        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\" /></td>"; | |
| 298 | -        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; | |
| 299 | -        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; | |
| 300 | -        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; | |
| 301 | - // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; | |
| 302 | - // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; | |
| 303 | -        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; | |
| 304 | - echo '</tr>'; | |
| 294 | +		echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; | |
| 295 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; | |
| 296 | + echo "<tr align='center'>"; | |
| 297 | +		echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\" /></td>"; | |
| 298 | +		echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; | |
| 299 | +		echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; | |
| 300 | +		echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; | |
| 301 | + // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; | |
| 302 | + // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; | |
| 303 | +		echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; | |
| 304 | + echo '</tr>'; | |
| 305 | 305 | |
| 306 | - $status = array( | |
| 307 | -            '0' => planet_constant('MD_PENDING'), | |
| 308 | -            '1' => planet_constant('MD_ACTIVE'), | |
| 309 | -            '2' => planet_constant('MD_FEATURED') | |
| 310 | - ); | |
| 311 | -        foreach (array_keys($blog_objs) as $bid) { | |
| 312 | - echo "<tr class='odd' align='left'>"; | |
| 313 | - echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox' /></td>"; | |
| 314 | - echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' | |
| 315 | -                 . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; | |
| 316 | -            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; | |
| 317 | -            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; | |
| 318 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT | |
| 319 | - . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> | |
| 306 | + $status = array( | |
| 307 | +			'0' => planet_constant('MD_PENDING'), | |
| 308 | +			'1' => planet_constant('MD_ACTIVE'), | |
| 309 | +			'2' => planet_constant('MD_FEATURED') | |
| 310 | + ); | |
| 311 | +		foreach (array_keys($blog_objs) as $bid) { | |
| 312 | + echo "<tr class='odd' align='left'>"; | |
| 313 | + echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox' /></td>"; | |
| 314 | + echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' | |
| 315 | +				 . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; | |
| 316 | +			echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; | |
| 317 | +			echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; | |
| 318 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT | |
| 319 | + . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> | |
| 320 | 320 | <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" | 
| 321 | - . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>  | |
| 321 | + . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>  | |
| 322 | 322 | <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" | 
| 323 | -                 . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT | |
| 324 | -                 . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; | |
| 323 | +				 . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT | |
| 324 | +				 . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; | |
| 325 | 325 | |
| 326 | - echo '</tr>'; | |
| 327 | - } | |
| 328 | - echo "<tr class='even' align='center'>"; | |
| 329 | - echo "<td colspan='7'>"; | |
| 330 | -        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; | |
| 331 | - echo "<option value=''>" . _SELECT . '</option>'; | |
| 332 | - echo "<option value='del'>" . _DELETE . '</option>'; | |
| 333 | -        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; | |
| 334 | -        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; | |
| 335 | -        if ($category_id > 0) { | |
| 336 | -            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; | |
| 337 | - } | |
| 338 | -        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; | |
| 339 | -        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; | |
| 340 | -        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; | |
| 341 | - echo '</select>'; | |
| 342 | - echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; | |
| 343 | - echo "<select name='category_dest'>"; | |
| 344 | - echo "<option value=''>" . _SELECT . '</option>'; | |
| 345 | -        foreach ($categories as $cid => $name) { | |
| 346 | - echo "<option value='" . $cid . "'>" . $name . '</option>'; | |
| 347 | - } | |
| 348 | - echo '</select>'; | |
| 349 | - echo '</div>'; | |
| 350 | - echo "<input name='start' value='" . $start . "' type='hidden' />"; | |
| 351 | - echo "<input name='category' value='" . $category_id . "' type='hidden' />"; | |
| 352 | - echo "<input name='submit' value='" . _SUBMIT . "' type='submit' />"; | |
| 353 | - echo "<input name='' value='" . _CANCEL . "' type='reset' />"; | |
| 354 | - echo '</td>'; | |
| 355 | - echo '</tr>'; | |
| 356 | -        if ($blog_count > $xoopsModuleConfig['list_perpage']) { | |
| 357 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 358 | - $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', | |
| 359 | - 'category=' . $category_id); | |
| 360 | - $pagenav = $nav->renderNav(4); | |
| 361 | - echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; | |
| 362 | - } | |
| 363 | - echo '</table></form>'; | |
| 364 | - echo "</fieldset><br style='clear:both;'>"; | |
| 326 | + echo '</tr>'; | |
| 327 | + } | |
| 328 | + echo "<tr class='even' align='center'>"; | |
| 329 | + echo "<td colspan='7'>"; | |
| 330 | +		echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; | |
| 331 | + echo "<option value=''>" . _SELECT . '</option>'; | |
| 332 | + echo "<option value='del'>" . _DELETE . '</option>'; | |
| 333 | +		echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; | |
| 334 | +		echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; | |
| 335 | +		if ($category_id > 0) { | |
| 336 | +			echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; | |
| 337 | + } | |
| 338 | +		echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; | |
| 339 | +		echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; | |
| 340 | +		echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; | |
| 341 | + echo '</select>'; | |
| 342 | + echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; | |
| 343 | + echo "<select name='category_dest'>"; | |
| 344 | + echo "<option value=''>" . _SELECT . '</option>'; | |
| 345 | +		foreach ($categories as $cid => $name) { | |
| 346 | + echo "<option value='" . $cid . "'>" . $name . '</option>'; | |
| 347 | + } | |
| 348 | + echo '</select>'; | |
| 349 | + echo '</div>'; | |
| 350 | + echo "<input name='start' value='" . $start . "' type='hidden' />"; | |
| 351 | + echo "<input name='category' value='" . $category_id . "' type='hidden' />"; | |
| 352 | + echo "<input name='submit' value='" . _SUBMIT . "' type='submit' />"; | |
| 353 | + echo "<input name='' value='" . _CANCEL . "' type='reset' />"; | |
| 354 | + echo '</td>'; | |
| 355 | + echo '</tr>'; | |
| 356 | +		if ($blog_count > $xoopsModuleConfig['list_perpage']) { | |
| 357 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 358 | + $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', | |
| 359 | + 'category=' . $category_id); | |
| 360 | + $pagenav = $nav->renderNav(4); | |
| 361 | + echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; | |
| 362 | + } | |
| 363 | + echo '</table></form>'; | |
| 364 | + echo "</fieldset><br style='clear:both;'>"; | |
| 365 | 365 | |
| 366 | -        if (empty($start) && empty($category_id)) { | |
| 367 | -            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF')); | |
| 368 | -            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); | |
| 369 | -            $form->addElement(new XoopsFormHidden('op', 'edit')); | |
| 370 | -            $button_tray = new XoopsFormElementTray('', ''); | |
| 371 | -            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); | |
| 372 | - $button_tray->addElement($butt_save); | |
| 373 | -            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 374 | - $button_tray->addElement($butt_cancel); | |
| 375 | - $form->addElement($button_tray); | |
| 366 | +		if (empty($start) && empty($category_id)) { | |
| 367 | +			$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF')); | |
| 368 | +			$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); | |
| 369 | +			$form->addElement(new XoopsFormHidden('op', 'edit')); | |
| 370 | +			$button_tray = new XoopsFormElementTray('', ''); | |
| 371 | +			$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); | |
| 372 | + $button_tray->addElement($butt_save); | |
| 373 | +			$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 374 | + $button_tray->addElement($butt_cancel); | |
| 375 | + $form->addElement($button_tray); | |
| 376 | 376 | |
| 377 | -            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF')); | |
| 378 | -            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); | |
| 379 | -            $form_add->addElement(new XoopsFormHidden('op', 'add')); | |
| 380 | -            $button_tray = new XoopsFormElementTray('', ''); | |
| 381 | -            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); | |
| 382 | - $button_tray->addElement($butt_save); | |
| 383 | -            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 384 | - $button_tray->addElement($butt_cancel); | |
| 385 | - $form_add->addElement($button_tray); | |
| 377 | +			$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF')); | |
| 378 | +			$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); | |
| 379 | +			$form_add->addElement(new XoopsFormHidden('op', 'add')); | |
| 380 | +			$button_tray = new XoopsFormElementTray('', ''); | |
| 381 | +			$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); | |
| 382 | + $button_tray->addElement($butt_save); | |
| 383 | +			$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 384 | + $button_tray->addElement($butt_cancel); | |
| 385 | + $form_add->addElement($button_tray); | |
| 386 | 386 | |
| 387 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; | |
| 388 | - echo '<br>'; | |
| 389 | - $form->display(); | |
| 390 | - $form_add->display(); | |
| 391 | - echo '</fieldset>'; | |
| 392 | - } | |
| 393 | - break; | |
| 387 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; | |
| 388 | + echo '<br>'; | |
| 389 | + $form->display(); | |
| 390 | + $form_add->display(); | |
| 391 | + echo '</fieldset>'; | |
| 392 | + } | |
| 393 | + break; | |
| 394 | 394 | } | 
| 395 | 395 | |
| 396 | 396 | xoops_cp_footer(); | 
| @@ -55,342 +55,342 @@ | ||
| 55 | 55 | |
| 56 | 56 |  switch ($op) { | 
| 57 | 57 | /* save a single blog */ | 
| 58 | - case 'save': | |
| 58 | + case 'save': | |
| 59 | 59 | |
| 60 | -        if ($blog_id) { | |
| 61 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 62 | -        } else { | |
| 63 | -            if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', $_POST['blog_feed']))) { | |
| 64 | -                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); | |
| 65 | - } | |
| 66 | - $blog_obj =& $blog_handler->create(); | |
| 67 | -            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); | |
| 68 | - } | |
| 60 | +        	if ($blog_id) { | |
| 61 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 62 | +        	} else { | |
| 63 | +            	if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', $_POST['blog_feed']))) { | |
| 64 | +                	redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); | |
| 65 | + } | |
| 66 | + $blog_obj =& $blog_handler->create(); | |
| 67 | +            	$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); | |
| 68 | + } | |
| 69 | 69 | |
| 70 | -        $blog_obj->setVar('blog_title', $_POST['blog_title']); | |
| 71 | -        $blog_obj->setVar('blog_desc', $_POST['blog_desc']); | |
| 72 | -        $blog_obj->setVar('blog_image', $_POST['blog_image']); | |
| 73 | -        $blog_obj->setVar('blog_feed', $_POST['blog_feed']); | |
| 74 | -        $blog_obj->setVar('blog_link', $_POST['blog_link']); | |
| 75 | -        $blog_obj->setVar('blog_language', $_POST['blog_language']); | |
| 76 | -        $blog_obj->setVar('blog_charset', $_POST['blog_charset']); | |
| 77 | -        $blog_obj->setVar('blog_trackback', $_POST['blog_trackback']); | |
| 78 | -        $blog_obj->setVar('blog_status', $_POST['blog_status']); | |
| 70 | +        	$blog_obj->setVar('blog_title', $_POST['blog_title']); | |
| 71 | +        	$blog_obj->setVar('blog_desc', $_POST['blog_desc']); | |
| 72 | +        	$blog_obj->setVar('blog_image', $_POST['blog_image']); | |
| 73 | +        	$blog_obj->setVar('blog_feed', $_POST['blog_feed']); | |
| 74 | +        	$blog_obj->setVar('blog_link', $_POST['blog_link']); | |
| 75 | +        	$blog_obj->setVar('blog_language', $_POST['blog_language']); | |
| 76 | +        	$blog_obj->setVar('blog_charset', $_POST['blog_charset']); | |
| 77 | +        	$blog_obj->setVar('blog_trackback', $_POST['blog_trackback']); | |
| 78 | +        	$blog_obj->setVar('blog_status', $_POST['blog_status']); | |
| 79 | 79 | |
| 80 | -        if (!$blog_handler->insert($blog_obj)) { | |
| 81 | -        } elseif (!empty($_POST['categories'])) { | |
| 82 | -            $blog_id = $blog_obj->getVar('blog_id'); | |
| 83 | -            if (in_array(0, $_POST['categories'])) { | |
| 84 | - $_POST['categories'] = array(); | |
| 85 | - } | |
| 86 | - $blog_handler->setCategories($blog_id, $_POST['categories']); | |
| 87 | - } | |
| 88 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 89 | -        redirect_header('admin.blog.php', 2, $message); | |
| 80 | +        	if (!$blog_handler->insert($blog_obj)) { | |
| 81 | +        	} elseif (!empty($_POST['categories'])) { | |
| 82 | +            	$blog_id = $blog_obj->getVar('blog_id'); | |
| 83 | +            	if (in_array(0, $_POST['categories'])) { | |
| 84 | + $_POST['categories'] = array(); | |
| 85 | + } | |
| 86 | + $blog_handler->setCategories($blog_id, $_POST['categories']); | |
| 87 | + } | |
| 88 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 89 | +        	redirect_header('admin.blog.php', 2, $message); | |
| 90 | 90 | |
| 91 | - /* fetch and add a list of blogs to a category */ | |
| 92 | - case 'add': | |
| 93 | - $links =& planet_parseLinks($_POST['links']); | |
| 94 | - $blogs = array(); | |
| 95 | -        foreach ($links as $link) { | |
| 96 | -            if ($blog_exist = $blog_handler->getCount(new Criteria('blog_feed', $link['url']))) { | |
| 97 | - continue; | |
| 98 | - } | |
| 99 | - $blog_obj =& $blog_handler->fetch($link['url']); | |
| 100 | -            if (!empty($link['title'])) { | |
| 101 | -                $blog_obj->setVar('blog_title', $link['title']); | |
| 102 | - } | |
| 103 | - $blog_handler->insert($blog_obj); | |
| 104 | -            $blogs[] = $blog_obj->getVar('blog_id'); | |
| 105 | - unset($blog_obj); | |
| 106 | - } | |
| 107 | -        if (!empty($_POST['categories'])) { | |
| 108 | -            $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 109 | -            foreach ($_POST['categories'] as $cat_id) { | |
| 110 | - $category_handler->addBlogs($cat_id, $blogs); | |
| 111 | - } | |
| 112 | - } | |
| 113 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 114 | -        redirect_header('admin.blog.php', 2, $message); | |
| 91 | + /* fetch and add a list of blogs to a category */ | |
| 92 | + case 'add': | |
| 93 | + $links =& planet_parseLinks($_POST['links']); | |
| 94 | + $blogs = array(); | |
| 95 | +        	foreach ($links as $link) { | |
| 96 | +            	if ($blog_exist = $blog_handler->getCount(new Criteria('blog_feed', $link['url']))) { | |
| 97 | + continue; | |
| 98 | + } | |
| 99 | + $blog_obj =& $blog_handler->fetch($link['url']); | |
| 100 | +            	if (!empty($link['title'])) { | |
| 101 | +                	$blog_obj->setVar('blog_title', $link['title']); | |
| 102 | + } | |
| 103 | + $blog_handler->insert($blog_obj); | |
| 104 | +            	$blogs[] = $blog_obj->getVar('blog_id'); | |
| 105 | + unset($blog_obj); | |
| 106 | + } | |
| 107 | +        	if (!empty($_POST['categories'])) { | |
| 108 | +            	$category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 109 | +            	foreach ($_POST['categories'] as $cat_id) { | |
| 110 | + $category_handler->addBlogs($cat_id, $blogs); | |
| 111 | + } | |
| 112 | + } | |
| 113 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 114 | +        	redirect_header('admin.blog.php', 2, $message); | |
| 115 | 115 | |
| 116 | - /* update a list of blogs */ | |
| 117 | - case 'update': | |
| 118 | -        foreach ($blog_id as $bid) { | |
| 119 | - $blog_obj =& $blog_handler->fetch($bid); | |
| 120 | -            if (!$blog_handler->insert($blog_obj)) { | |
| 121 | - } | |
| 122 | - unset($blog_obj); | |
| 123 | - } | |
| 124 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 125 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 116 | + /* update a list of blogs */ | |
| 117 | + case 'update': | |
| 118 | +        	foreach ($blog_id as $bid) { | |
| 119 | + $blog_obj =& $blog_handler->fetch($bid); | |
| 120 | +            	if (!$blog_handler->insert($blog_obj)) { | |
| 121 | + } | |
| 122 | + unset($blog_obj); | |
| 123 | + } | |
| 124 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 125 | +        	redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 126 | 126 | |
| 127 | - /* add a list of blogs to a category */ | |
| 128 | - case 'register': | |
| 129 | -        if (!empty($_POST['category_dest'])) { | |
| 130 | -            if (!is_array($blog_id)) { | |
| 131 | - $blog_id = array($blog_id); | |
| 132 | - } | |
| 133 | -            $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 134 | - $category_handler->addBlogs($_POST['category_dest'], $blog_id); | |
| 135 | - } | |
| 136 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 137 | -        redirect_header('admin.blog.php?category=' . $_POST['category_dest'] . '&start=' . $start, 2, $message); | |
| 127 | + /* add a list of blogs to a category */ | |
| 128 | + case 'register': | |
| 129 | +        	if (!empty($_POST['category_dest'])) { | |
| 130 | +            	if (!is_array($blog_id)) { | |
| 131 | + $blog_id = array($blog_id); | |
| 132 | + } | |
| 133 | +            	$category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 134 | + $category_handler->addBlogs($_POST['category_dest'], $blog_id); | |
| 135 | + } | |
| 136 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 137 | +        	redirect_header('admin.blog.php?category=' . $_POST['category_dest'] . '&start=' . $start, 2, $message); | |
| 138 | 138 | |
| 139 | - /* remove a list of blogs from a category */ | |
| 140 | - case 'remove': | |
| 141 | -        if (!is_array($blog_id)) { | |
| 142 | - $blog_id = array($blog_id); | |
| 143 | - } | |
| 144 | -        if (!empty($category_id)) { | |
| 145 | -            $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 146 | - $category_handler->removeBlogs($category_id, $blog_id); | |
| 147 | - } | |
| 148 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 149 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 139 | + /* remove a list of blogs from a category */ | |
| 140 | + case 'remove': | |
| 141 | +        	if (!is_array($blog_id)) { | |
| 142 | + $blog_id = array($blog_id); | |
| 143 | + } | |
| 144 | +        	if (!empty($category_id)) { | |
| 145 | +            	$category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); | |
| 146 | + $category_handler->removeBlogs($category_id, $blog_id); | |
| 147 | + } | |
| 148 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 149 | +        	redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 150 | 150 | |
| 151 | - /* delete a single blog or a list blogs */ | |
| 152 | - case 'del': | |
| 153 | -        if (!is_array($blog_id)) { | |
| 154 | - $blog_id = array($blog_id); | |
| 155 | - } | |
| 156 | -        foreach ($blog_id as $bid) { | |
| 157 | - $blog_obj =& $blog_handler->get($bid); | |
| 158 | -            if (!$blog_handler->delete($blog_obj, true)) { | |
| 159 | - } | |
| 160 | - unset($blog_obj); | |
| 161 | - } | |
| 162 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 163 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 151 | + /* delete a single blog or a list blogs */ | |
| 152 | + case 'del': | |
| 153 | +        	if (!is_array($blog_id)) { | |
| 154 | + $blog_id = array($blog_id); | |
| 155 | + } | |
| 156 | +        	foreach ($blog_id as $bid) { | |
| 157 | + $blog_obj =& $blog_handler->get($bid); | |
| 158 | +            	if (!$blog_handler->delete($blog_obj, true)) { | |
| 159 | + } | |
| 160 | + unset($blog_obj); | |
| 161 | + } | |
| 162 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 163 | +        	redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 164 | 164 | |
| 165 | - /* empty a single blog or a list blogs */ | |
| 166 | - case 'empty': | |
| 167 | -        if (!is_array($blog_id)) { | |
| 168 | - $blog_id = array($blog_id); | |
| 169 | - } | |
| 170 | -        foreach ($blog_id as $bid) { | |
| 171 | - $blog_obj =& $blog_handler->get($bid); | |
| 172 | -            if (!$blog_handler->do_empty($blog_obj)) { | |
| 173 | - } | |
| 174 | - } | |
| 175 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 176 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 165 | + /* empty a single blog or a list blogs */ | |
| 166 | + case 'empty': | |
| 167 | +        	if (!is_array($blog_id)) { | |
| 168 | + $blog_id = array($blog_id); | |
| 169 | + } | |
| 170 | +        	foreach ($blog_id as $bid) { | |
| 171 | + $blog_obj =& $blog_handler->get($bid); | |
| 172 | +            	if (!$blog_handler->do_empty($blog_obj)) { | |
| 173 | + } | |
| 174 | + } | |
| 175 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 176 | +        	redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 177 | 177 | |
| 178 | - /* approve a single blog or a list blogs */ | |
| 179 | - case 'approve': | |
| 180 | -        if (!is_array($blog_id)) { | |
| 181 | - $blog_id = array($blog_id); | |
| 182 | - } | |
| 183 | -        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 184 | -        $blog_handler->updateAll('blog_status', 1, $criteria, true); | |
| 185 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 186 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 178 | + /* approve a single blog or a list blogs */ | |
| 179 | + case 'approve': | |
| 180 | +        	if (!is_array($blog_id)) { | |
| 181 | + $blog_id = array($blog_id); | |
| 182 | + } | |
| 183 | +        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 184 | +        	$blog_handler->updateAll('blog_status', 1, $criteria, true); | |
| 185 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 186 | +        	redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 187 | 187 | |
| 188 | - /* mark a single blog or a list blogs as featured */ | |
| 189 | - case 'feature': | |
| 190 | -        if (!is_array($blog_id)) { | |
| 191 | - $blog_id = array($blog_id); | |
| 192 | - } | |
| 193 | -        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 194 | -        $blog_handler->updateAll('blog_status', 2, $criteria, true); | |
| 195 | -        $message = planet_constant('AM_DBUPDATED'); | |
| 196 | -        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 188 | + /* mark a single blog or a list blogs as featured */ | |
| 189 | + case 'feature': | |
| 190 | +        	if (!is_array($blog_id)) { | |
| 191 | + $blog_id = array($blog_id); | |
| 192 | + } | |
| 193 | +        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); | |
| 194 | +        	$blog_handler->updateAll('blog_status', 2, $criteria, true); | |
| 195 | +        	$message = planet_constant('AM_DBUPDATED'); | |
| 196 | +        	redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); | |
| 197 | 197 | |
| 198 | - /* edit a single blog */ | |
| 199 | - case 'edit': | |
| 200 | -        if (!empty($_POST['fetch'])) { | |
| 201 | - $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); | |
| 202 | -            $blog_obj->setVar('blog_id', $blog_id); | |
| 203 | -        } else { | |
| 204 | - $blog_obj =& $blog_handler->get($blog_id); | |
| 205 | - } | |
| 206 | - $categories = @$_POST['categories']; | |
| 207 | -        if (empty($categories) && $blog_id > 0) { | |
| 208 | -            $crit       = new Criteria('bc.blog_id', $blog_id); | |
| 209 | - $categories = array_keys($category_handler->getByBlog($crit)); | |
| 210 | - } | |
| 211 | -        if (empty($categories)) { | |
| 212 | - $categories = array(0 => _NONE); | |
| 213 | - } | |
| 198 | + /* edit a single blog */ | |
| 199 | + case 'edit': | |
| 200 | +        	if (!empty($_POST['fetch'])) { | |
| 201 | + $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); | |
| 202 | +            	$blog_obj->setVar('blog_id', $blog_id); | |
| 203 | +        	} else { | |
| 204 | + $blog_obj =& $blog_handler->get($blog_id); | |
| 205 | + } | |
| 206 | + $categories = @$_POST['categories']; | |
| 207 | +        	if (empty($categories) && $blog_id > 0) { | |
| 208 | +            	$crit       = new Criteria('bc.blog_id', $blog_id); | |
| 209 | + $categories = array_keys($category_handler->getByBlog($crit)); | |
| 210 | + } | |
| 211 | +        	if (empty($categories)) { | |
| 212 | + $categories = array(0 => _NONE); | |
| 213 | + } | |
| 214 | 214 | |
| 215 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; | |
| 216 | - echo '<br>'; | |
| 217 | -        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { | |
| 218 | -            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); | |
| 219 | - $blogs_obj =& $blog_handler->getList($criteria); | |
| 220 | -            if (count($blogs_obj) > 0) { | |
| 221 | -                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); | |
| 222 | -                foreach (array_keys($blogs_obj) as $bid) { | |
| 223 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 224 | - . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; | |
| 225 | - } | |
| 226 | - echo '</div>'; | |
| 227 | - } | |
| 228 | - unset($blogs_obj, $criteria); | |
| 229 | - } | |
| 230 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; | |
| 231 | - echo '</fieldset>'; | |
| 232 | - break; | |
| 215 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; | |
| 216 | + echo '<br>'; | |
| 217 | +        	if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { | |
| 218 | +            	$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); | |
| 219 | + $blogs_obj =& $blog_handler->getList($criteria); | |
| 220 | +            	if (count($blogs_obj) > 0) { | |
| 221 | +                	echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); | |
| 222 | +                	foreach (array_keys($blogs_obj) as $bid) { | |
| 223 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' | |
| 224 | + . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; | |
| 225 | + } | |
| 226 | + echo '</div>'; | |
| 227 | + } | |
| 228 | + unset($blogs_obj, $criteria); | |
| 229 | + } | |
| 230 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; | |
| 231 | + echo '</fieldset>'; | |
| 232 | + break; | |
| 233 | 233 | |
| 234 | - default: | |
| 234 | + default: | |
| 235 | 235 | |
| 236 | -        $crit = new Criteria('1', 1); | |
| 237 | -        $crit->setSort('cat_order'); | |
| 238 | -        $crit->setOrder('ASC'); | |
| 239 | - $categories = $category_handler->getList($crit); | |
| 236 | +        	$crit = new Criteria('1', 1); | |
| 237 | +        	$crit->setSort('cat_order'); | |
| 238 | +        	$crit->setOrder('ASC'); | |
| 239 | + $categories = $category_handler->getList($crit); | |
| 240 | 240 | |
| 241 | - // Display category option form | |
| 242 | -        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); | |
| 243 | -        $op_select = new XoopsFormSelect('', 'category', $category_id); | |
| 244 | -        $op_select->setExtra('onchange="document.forms.opform.submit()"'); | |
| 245 | - $options = array( | |
| 246 | - '0' => _ALL, | |
| 247 | -            '-1' => planet_constant('MD_ACTIVE'), | |
| 248 | -            '-2' => planet_constant('MD_FEATURED'), | |
| 249 | -            '-3' => planet_constant('MD_PENDING') | |
| 250 | - ); | |
| 251 | -        foreach (array_keys($categories) as $key) { | |
| 252 | - $options[$key] = $categories[$key]; | |
| 253 | - } | |
| 254 | - $op_select->addOptionArray($options); | |
| 255 | - $opform->addElement($op_select); | |
| 256 | - $opform->display(); | |
| 241 | + // Display category option form | |
| 242 | +        	$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); | |
| 243 | +        	$op_select = new XoopsFormSelect('', 'category', $category_id); | |
| 244 | +        	$op_select->setExtra('onchange="document.forms.opform.submit()"'); | |
| 245 | + $options = array( | |
| 246 | + '0' => _ALL, | |
| 247 | +            	'-1' => planet_constant('MD_ACTIVE'), | |
| 248 | +            	'-2' => planet_constant('MD_FEATURED'), | |
| 249 | +            	'-3' => planet_constant('MD_PENDING') | |
| 250 | + ); | |
| 251 | +        	foreach (array_keys($categories) as $key) { | |
| 252 | + $options[$key] = $categories[$key]; | |
| 253 | + } | |
| 254 | + $op_select->addOptionArray($options); | |
| 255 | + $opform->addElement($op_select); | |
| 256 | + $opform->display(); | |
| 257 | 257 | |
| 258 | -        if ($category_id > 0) { | |
| 259 | -            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); | |
| 260 | -            $criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 261 | - $blog_count = $blog_handler->getCountByCategory($criteria); | |
| 262 | - $criteria->setStart($start); | |
| 263 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 264 | - $blog_objs =& $blog_handler->getByCategory($criteria); | |
| 265 | -        } else { | |
| 266 | - /* All active blogs */ | |
| 267 | -            if ($category_id == 0) { | |
| 268 | -                $criteria = new Criteria('1', 1); | |
| 269 | - $criteria->setStart($start); | |
| 270 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 271 | - /* Active blogs */ | |
| 272 | -            } elseif ($category_id == -1) { | |
| 273 | -                $criteria = new Criteria('blog_status', 1); | |
| 274 | - $criteria->setStart($start); | |
| 275 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 276 | - /* Featured blogs */ | |
| 277 | -            } elseif ($category_id == -2) { | |
| 278 | -                $criteria = new Criteria('blog_status', 2); | |
| 279 | - $criteria->setStart($start); | |
| 280 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 281 | - /* Pending blogs */ | |
| 282 | -            } else { | |
| 283 | -                $criteria = new Criteria('blog_status', 0); | |
| 284 | - $criteria->setStart($start); | |
| 285 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 286 | - } | |
| 287 | - $blog_count = $blog_handler->getCount($criteria); | |
| 288 | - $blog_objs =& $blog_handler->getAll($criteria); | |
| 289 | - } | |
| 258 | +        	if ($category_id > 0) { | |
| 259 | +            	$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); | |
| 260 | +            	$criteria->add(new Criteria('bc.cat_id', $category_id)); | |
| 261 | + $blog_count = $blog_handler->getCountByCategory($criteria); | |
| 262 | + $criteria->setStart($start); | |
| 263 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 264 | + $blog_objs =& $blog_handler->getByCategory($criteria); | |
| 265 | +        	} else { | |
| 266 | + /* All active blogs */ | |
| 267 | +            	if ($category_id == 0) { | |
| 268 | +                	$criteria = new Criteria('1', 1); | |
| 269 | + $criteria->setStart($start); | |
| 270 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 271 | + /* Active blogs */ | |
| 272 | +            	} elseif ($category_id == -1) { | |
| 273 | +                	$criteria = new Criteria('blog_status', 1); | |
| 274 | + $criteria->setStart($start); | |
| 275 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 276 | + /* Featured blogs */ | |
| 277 | +            	} elseif ($category_id == -2) { | |
| 278 | +                	$criteria = new Criteria('blog_status', 2); | |
| 279 | + $criteria->setStart($start); | |
| 280 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 281 | + /* Pending blogs */ | |
| 282 | +            	} else { | |
| 283 | +                	$criteria = new Criteria('blog_status', 0); | |
| 284 | + $criteria->setStart($start); | |
| 285 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); | |
| 286 | + } | |
| 287 | + $blog_count = $blog_handler->getCount($criteria); | |
| 288 | + $blog_objs =& $blog_handler->getAll($criteria); | |
| 289 | + } | |
| 290 | 290 | |
| 291 | -        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; | |
| 292 | - echo "<br style=\"clear:both\" />"; | |
| 291 | +        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; | |
| 292 | + echo "<br style=\"clear:both\" />"; | |
| 293 | 293 | |
| 294 | -        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; | |
| 295 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; | |
| 296 | - echo "<tr align='center'>"; | |
| 297 | -        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\" /></td>"; | |
| 298 | -        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; | |
| 299 | -        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; | |
| 300 | -        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; | |
| 301 | - // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; | |
| 302 | - // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; | |
| 303 | -        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; | |
| 304 | - echo '</tr>'; | |
| 294 | +        	echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; | |
| 295 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; | |
| 296 | + echo "<tr align='center'>"; | |
| 297 | +        	echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\" /></td>"; | |
| 298 | +        	echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; | |
| 299 | +        	echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; | |
| 300 | +        	echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; | |
| 301 | + // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; | |
| 302 | + // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; | |
| 303 | +        	echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; | |
| 304 | + echo '</tr>'; | |
| 305 | 305 | |
| 306 | - $status = array( | |
| 307 | -            '0' => planet_constant('MD_PENDING'), | |
| 308 | -            '1' => planet_constant('MD_ACTIVE'), | |
| 309 | -            '2' => planet_constant('MD_FEATURED') | |
| 310 | - ); | |
| 311 | -        foreach (array_keys($blog_objs) as $bid) { | |
| 312 | - echo "<tr class='odd' align='left'>"; | |
| 313 | - echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox' /></td>"; | |
| 314 | - echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' | |
| 315 | -                 . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; | |
| 316 | -            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; | |
| 317 | -            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; | |
| 318 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT | |
| 319 | - . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> | |
| 306 | + $status = array( | |
| 307 | +            	'0' => planet_constant('MD_PENDING'), | |
| 308 | +            	'1' => planet_constant('MD_ACTIVE'), | |
| 309 | +            	'2' => planet_constant('MD_FEATURED') | |
| 310 | + ); | |
| 311 | +        	foreach (array_keys($blog_objs) as $bid) { | |
| 312 | + echo "<tr class='odd' align='left'>"; | |
| 313 | + echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox' /></td>"; | |
| 314 | + echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' | |
| 315 | +                 	. $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; | |
| 316 | +            	echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; | |
| 317 | +            	echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; | |
| 318 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT | |
| 319 | + . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> | |
| 320 | 320 | <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" | 
| 321 | - . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>  | |
| 321 | + . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>  | |
| 322 | 322 | <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" | 
| 323 | -                 . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT | |
| 324 | -                 . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; | |
| 323 | +                 	. planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT | |
| 324 | +                 	. " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; | |
| 325 | 325 | |
| 326 | - echo '</tr>'; | |
| 327 | - } | |
| 328 | - echo "<tr class='even' align='center'>"; | |
| 329 | - echo "<td colspan='7'>"; | |
| 330 | -        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; | |
| 331 | - echo "<option value=''>" . _SELECT . '</option>'; | |
| 332 | - echo "<option value='del'>" . _DELETE . '</option>'; | |
| 333 | -        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; | |
| 334 | -        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; | |
| 335 | -        if ($category_id > 0) { | |
| 336 | -            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; | |
| 337 | - } | |
| 338 | -        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; | |
| 339 | -        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; | |
| 340 | -        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; | |
| 341 | - echo '</select>'; | |
| 342 | - echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; | |
| 343 | - echo "<select name='category_dest'>"; | |
| 344 | - echo "<option value=''>" . _SELECT . '</option>'; | |
| 345 | -        foreach ($categories as $cid => $name) { | |
| 346 | - echo "<option value='" . $cid . "'>" . $name . '</option>'; | |
| 347 | - } | |
| 348 | - echo '</select>'; | |
| 349 | - echo '</div>'; | |
| 350 | - echo "<input name='start' value='" . $start . "' type='hidden' />"; | |
| 351 | - echo "<input name='category' value='" . $category_id . "' type='hidden' />"; | |
| 352 | - echo "<input name='submit' value='" . _SUBMIT . "' type='submit' />"; | |
| 353 | - echo "<input name='' value='" . _CANCEL . "' type='reset' />"; | |
| 354 | - echo '</td>'; | |
| 355 | - echo '</tr>'; | |
| 356 | -        if ($blog_count > $xoopsModuleConfig['list_perpage']) { | |
| 357 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 358 | - $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', | |
| 359 | - 'category=' . $category_id); | |
| 360 | - $pagenav = $nav->renderNav(4); | |
| 361 | - echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; | |
| 362 | - } | |
| 363 | - echo '</table></form>'; | |
| 364 | - echo "</fieldset><br style='clear:both;'>"; | |
| 326 | + echo '</tr>'; | |
| 327 | + } | |
| 328 | + echo "<tr class='even' align='center'>"; | |
| 329 | + echo "<td colspan='7'>"; | |
| 330 | +        	echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; | |
| 331 | + echo "<option value=''>" . _SELECT . '</option>'; | |
| 332 | + echo "<option value='del'>" . _DELETE . '</option>'; | |
| 333 | +        	echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; | |
| 334 | +        	echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; | |
| 335 | +        	if ($category_id > 0) { | |
| 336 | +            	echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; | |
| 337 | + } | |
| 338 | +        	echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; | |
| 339 | +        	echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; | |
| 340 | +        	echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; | |
| 341 | + echo '</select>'; | |
| 342 | + echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; | |
| 343 | + echo "<select name='category_dest'>"; | |
| 344 | + echo "<option value=''>" . _SELECT . '</option>'; | |
| 345 | +        	foreach ($categories as $cid => $name) { | |
| 346 | + echo "<option value='" . $cid . "'>" . $name . '</option>'; | |
| 347 | + } | |
| 348 | + echo '</select>'; | |
| 349 | + echo '</div>'; | |
| 350 | + echo "<input name='start' value='" . $start . "' type='hidden' />"; | |
| 351 | + echo "<input name='category' value='" . $category_id . "' type='hidden' />"; | |
| 352 | + echo "<input name='submit' value='" . _SUBMIT . "' type='submit' />"; | |
| 353 | + echo "<input name='' value='" . _CANCEL . "' type='reset' />"; | |
| 354 | + echo '</td>'; | |
| 355 | + echo '</tr>'; | |
| 356 | +        	if ($blog_count > $xoopsModuleConfig['list_perpage']) { | |
| 357 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; | |
| 358 | + $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', | |
| 359 | + 'category=' . $category_id); | |
| 360 | + $pagenav = $nav->renderNav(4); | |
| 361 | + echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; | |
| 362 | + } | |
| 363 | + echo '</table></form>'; | |
| 364 | + echo "</fieldset><br style='clear:both;'>"; | |
| 365 | 365 | |
| 366 | -        if (empty($start) && empty($category_id)) { | |
| 367 | -            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF')); | |
| 368 | -            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); | |
| 369 | -            $form->addElement(new XoopsFormHidden('op', 'edit')); | |
| 370 | -            $button_tray = new XoopsFormElementTray('', ''); | |
| 371 | -            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); | |
| 372 | - $button_tray->addElement($butt_save); | |
| 373 | -            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 374 | - $button_tray->addElement($butt_cancel); | |
| 375 | - $form->addElement($button_tray); | |
| 366 | +        	if (empty($start) && empty($category_id)) { | |
| 367 | +            	$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF')); | |
| 368 | +            	$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); | |
| 369 | +            	$form->addElement(new XoopsFormHidden('op', 'edit')); | |
| 370 | +            	$button_tray = new XoopsFormElementTray('', ''); | |
| 371 | +            	$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); | |
| 372 | + $button_tray->addElement($butt_save); | |
| 373 | +            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 374 | + $button_tray->addElement($butt_cancel); | |
| 375 | + $form->addElement($button_tray); | |
| 376 | 376 | |
| 377 | -            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF')); | |
| 378 | -            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); | |
| 379 | -            $form_add->addElement(new XoopsFormHidden('op', 'add')); | |
| 380 | -            $button_tray = new XoopsFormElementTray('', ''); | |
| 381 | -            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); | |
| 382 | - $button_tray->addElement($butt_save); | |
| 383 | -            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 384 | - $button_tray->addElement($butt_cancel); | |
| 385 | - $form_add->addElement($button_tray); | |
| 377 | +            	$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF')); | |
| 378 | +            	$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); | |
| 379 | +            	$form_add->addElement(new XoopsFormHidden('op', 'add')); | |
| 380 | +            	$button_tray = new XoopsFormElementTray('', ''); | |
| 381 | +            	$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); | |
| 382 | + $button_tray->addElement($butt_save); | |
| 383 | +            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); | |
| 384 | + $button_tray->addElement($butt_cancel); | |
| 385 | + $form_add->addElement($button_tray); | |
| 386 | 386 | |
| 387 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; | |
| 388 | - echo '<br>'; | |
| 389 | - $form->display(); | |
| 390 | - $form_add->display(); | |
| 391 | - echo '</fieldset>'; | |
| 392 | - } | |
| 393 | - break; | |
| 387 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; | |
| 388 | + echo '<br>'; | |
| 389 | + $form->display(); | |
| 390 | + $form_add->display(); | |
| 391 | + echo '</fieldset>'; | |
| 392 | + } | |
| 393 | + break; | |
| 394 | 394 | } | 
| 395 | 395 | |
| 396 | 396 | xoops_cp_footer(); |