Ticket #300: dgm.patch
| File dgm.patch, 11.5 kB (added by shalligan@…, 6 years ago) |
|---|
-
php/themes/dgm/templates/cache_pager.tpl
1 2 {if count($data.pages) > 1} 1 {if $pages.total > 1} 3 2 <div align="center"> 4 {if $offset > 0} 5 <a href="list-cache.php{$msid}cache_type={$cache_type}&offset={$data.prev}"><< {$lang.link_prev} </a> | 6 {/if} 7 {strip} 8 {foreach key=page item=start from=$data.pages} 9 {if $start != $offset} 10 <a href="list-cache.php{$msid}cache_type={$cache_type}&offset={$start}">{$page}</a> 11 {else} 12 {$page} 13 {/if} 14 {if $page < count($data.pages)} 15 | 16 {/if} 17 {/foreach} 18 {/strip} 19 {if $data.to < $data.numrows} 20 | <a href="list-cache.php{$msid}cache_type={$cache_type}&offset={$data.next}">{$lang.link_next}>></a> 21 {/if} 3 {$links} 22 4 </div> 23 5 {/if} 24 6 <div> -
php/themes/dgm/templates/list-cache-table.tpl
47 47 </div> 48 48 *} 49 49 <div class="cache_select"> 50 <input type="checkbox" class="cachecheck" name="cache_item[ {$row[hamloop].id}]" value="{$row[hamloop].id}">50 <input type="checkbox" class="cachecheck" name="cache_item[generic][{$row[hamloop].id}]" value="{$row[hamloop].id}"> 51 51 </div> 52 52 </div> <!-- cache row --> 53 53 {/strip} -
php/themes/dgm/templates/viewmail.tpl
7 7 {if ! $error} 8 8 <div class="viewmail_container"> 9 9 <form action="list-cache.php{$msid}cache_type={$cache_type}" name="cache" method="post"> 10 <input type="hidden" name="cache_item[ {$id}]" value="{$id}">10 <input type="hidden" name="cache_item[generic][{$id}]" value="{$id}"> 11 11 12 12 <div class="viewmail_table"> 13 13 {include file="viewmail_menu.tpl" showraw=true} -
php/cache.php
205 205 } 206 206 207 207 function set_select() { 208 $this->select_stmt = "SELECT maia_mail.id, maia_mail.received_date, maia_mail.score, " . 209 "maia_mail.sender_email, maia_mail.subject, maia_mail.envelope_to " . 208 $this->select_count = "SELECT COUNT(*) " . 210 209 "FROM maia_mail, maia_mail_recipients " . 211 210 "WHERE maia_mail.id = maia_mail_recipients.mail_id " . 212 211 "AND maia_mail_recipients.type = '". $this->get_sort_abbrev() ."' " . 213 "AND maia_mail_recipients.recipient_id = ? " . 214 "ORDER BY maia_mail." . $this->sortby['column'] . " " . $this->sort_order; 212 "AND maia_mail_recipients.recipient_id = ? "; 213 214 $this->select_stmt = "SELECT maia_mail.id, maia_mail.received_date, maia_mail.score, " . 215 "maia_mail.sender_email, maia_mail.subject, maia_mail.envelope_to " . 216 "FROM maia_mail, maia_mail_recipients " . 217 "WHERE maia_mail.id = maia_mail_recipients.mail_id " . 218 "AND maia_mail_recipients.type = '". $this->get_sort_abbrev() ."' " . 219 "AND maia_mail_recipients.recipient_id = ? " . 220 " ORDER BY maia_mail." . $this->sortby['column'] . " " . $this->sort_order; 221 215 222 } 216 223 217 224 function confirm_cache($euid) { … … 222 229 $rescued = 0; 223 230 global $_POST, $lang; 224 231 $items = $_POST['cache_item']; 225 foreach ($items as $mail_id => $value) { 226 // report item 227 if ($_POST['submit'] == "spam") { 228 switch ($this->type) { 229 case 'ham': 230 // Mark the item as Confirmed Spam 231 $update = "UPDATE maia_mail_recipients SET type = 'C' " . 232 "WHERE recipient_id = ? AND mail_id = ?"; 233 $this->dbh->query($update, array($euid, $mail_id)); 234 record_mail_stats($euid, $mail_id, "fn"); 235 $reported++; 236 break; 237 case 'spam': 238 confirm_spam($euid, $mail_id); 239 $confirmed++; 240 default: 241 } 242 //send item 243 } elseif ($_POST['submit'] == "ham") { 244 switch ($this->type) { 245 case 'ham': 246 confirm_ham($euid, $mail_id); 247 $confirmed++; 248 break; 249 default: 250 $result = rescue_item($euid, $mail_id); 251 if (strncmp($result, "2", 1) == 0) { 252 $rescued++; 253 } else { 254 $message .= $result . "\n"; 255 } 256 } 232 foreach ($items as $type => $mail_item) { 233 foreach ($mail_item as $mail_id => $value) { 234 if ($type == "generic") { 235 $newtype = $_POST['submit']; 236 } else { 237 $newtype = $type; 238 } 239 // report item 240 if ($newtype == "spam") { 241 switch ($this->type) { 242 case 'ham': 243 // Mark the item as Confirmed Spam 244 $update = "UPDATE maia_mail_recipients SET type = 'C' " . 245 "WHERE recipient_id = ? AND mail_id = ?"; 246 $this->dbh->query($update, array($euid, $mail_id)); 247 record_mail_stats($euid, $mail_id, "fn"); 248 $reported++; 249 break; 250 case 'spam': 251 confirm_spam($euid, $mail_id); 252 $confirmed++; 253 default: 254 } 255 //send item 256 } elseif ($newtype == "ham") { 257 switch ($this->type) { 258 case 'ham': 259 confirm_ham($euid, $mail_id); 260 $confirmed++; 261 break; 262 default: 263 $result = rescue_item($euid, $mail_id); 264 if (strncmp($result, "2", 1) == 0) { 265 $rescued++; 266 } else { 267 $message .= $result . "\n"; 268 } 269 } 257 270 258 271 259 //delete item.260 } elseif ($_POST['submit']== "delete") {272 //delete item. 273 } elseif ($newtype == "delete") { 261 274 262 delete_mail_reference($euid, $mail_id);263 $deleted++;275 delete_mail_reference($euid, $mail_id); 276 $deleted++; 264 277 265 } 266 } 267 278 } 279 } 280 } 281 $message = "confirmed = " . $confirmed . "<br>reported = " . $reported . "<br>"; 268 282 //$sth->free(); */ 269 283 update_mail_stats($euid, "suspected_ham"); 270 284 if ($confirmed > 0) { 271 $message .= sprintf($lang['text_ham_confirmed'], $confirmed) . ".<br>"; 285 if ($this->type == "ham") { 286 $message .= sprintf($lang['text_ham_confirmed'], $confirmed) . ".<br>"; 287 } else { 288 $message .= sprintf($lang['text_spam_confirmed'], $confirmed) . ".<br>"; 289 } 272 290 } 273 291 274 292 if ($reported > 0) { 275 293 $message .= sprintf($lang['text_spam_reported'], $reported) . ".<br>"; 276 294 } 277 295 if ($deleted > 0) { 278 $message .= sprintf($lang['text_ham_deleted'], $deleted) . ".<br>"; 296 if ( $this->type == "ham") { 297 $message .= sprintf($lang['text_ham_deleted'], $deleted) . ".<br>"; 298 } else { 299 $message .= sprintf($lang['text_spam_deleted'], $deleted) . ".<br>"; 300 } 301 } 302 if ($rescued > 0) { 303 $message .= sprintf($lang['text_spam_rescued'], $rescued) . ".<br>"; 279 304 } 280 $this->smarty->assign("message", $message);305 $this->smarty->assign("message", $message); 281 306 282 307 } 283 308 … … 285 310 global $lang, $msid, $html_charset, $offset; 286 311 $magic_quotes = get_magic_quotes_gpc(); 287 312 $nothing_to_show = true; 288 313 $offset = 0; 289 314 $this->smarty->assign("msid", $msid); 290 315 $this->smarty->assign("lang", $lang); 291 292 $sth = $this->dbh->query($this->select_stmt, array($euid)); 293 if ($sth->numRows() > 0) 316 error_log($this->select_count,0); 317 error_log($euid,0); 318 $numRows = $this->dbh->getOne($this->select_count, array($euid)); 319 error_log($numRows,0); 320 if ($numRows > 0) 294 321 { 295 322 $select2 = "SELECT email FROM users WHERE maia_user_id = ?"; 296 323 $sth2 = $this->dbh->query($select2, array($euid)); … … 301 328 $personal_addresses = array_flip($personal_addresses); 302 329 $domain_default = is_a_domain_default_user($euid); 303 330 $per_page = get_user_value($euid, "items_per_page"); 304 $pager = new DB_Pager($sth, $offset, $per_page); 305 $data = $pager->build(); 331 332 $pagerOptions = array( 333 'mode' => 'Sliding', 334 'delta' => 5, 335 'perPage' => $per_page, 336 'totalItems' => $numRows, 337 ); 338 339 $paged_data = Pager_Wrapper_DB($this->dbh, $this->select_stmt, $pagerOptions, null, null, array($euid)); 340 //$paged_data['data']; //paged data 341 //$paged_data['links']; //xhtml links for page navigation 342 //$paged_data['page_numbers']; //array('current', 'total'); 343 344 345 346 347 //$pager = new DB_Pager($sth, $offset, $per_page); 348 //$data = $pager->build(); 306 349 $maxid = 0; 307 350 $nothing_to_show = false; 308 351 309 $this->smarty->assign("data", $ data);352 $this->smarty->assign("data", $paged_data['data']); 310 353 $this->smarty->assign("offset", $offset); 354 print_r($paged_data['page_numbers']); 355 $this->smarty->assign("pages", $paged_data['page_numbers']); 311 356 312 313 if ($sth->numrows() == 1) { 357 if ($numRows == 1) { 314 358 $item_text = $lang['text_item']; 315 359 } else { 316 360 $item_text = $lang['text_items']; … … 319 363 $count = 0; 320 364 $rows = array(); 321 365 322 while ($row = $pager->fetchrow())366 foreach ($paged_data['data'] as $row) 323 367 { 324 368 if ($row["id"] > $maxid) { 325 369 $maxid = $row["id"]; … … 357 401 $rows[$count]['subject'] = $subject; 358 402 $count++; 359 403 } 360 $sth->free();404 //$sth->free(); 361 405 $this->smarty->assign("row", $rows); 362 406 $this->smarty->assign("maxid", $maxid); 407 //print_r($paged_data['links']); 408 $this->smarty->assign("links", $paged_data['links']); 363 409 } 364 410 $this->smarty->assign("nothing_to_show", $nothing_to_show); 365 411 $this->smarty->display("list-cache.tpl");

