Changeset 793
- Timestamp:
- 02/21/09 00:49:57 (15 years ago)
- Location:
- plugins/newsletter/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/newsletter/trunk/_admin.php
r788 r793 57 57 $w->create(pluginNewsletter::pname(), __('Newsletter'), array('WidgetsNewsletter', 'widget')); 58 58 59 59 $w->newsletter->setting('title', __('Title:'), __('Newsletter')); 60 60 $w->newsletter->setting('showtitle', __('Show title'), 1, 'check'); 61 61 $w->newsletter->setting('homeonly', __('Home page only'), 0, 'check'); … … 72 72 * avant suppression du plugin par le gestionnaire, on le déinstalle proprement 73 73 */ 74 75 74 public static function pluginsBeforeDelete($plugin) 75 { 76 76 global $core; 77 try {78 $name = (string) $plugin['name'];79 if (strcmp($name, pluginNewsletter::pname()) == 0) {80 require dirname(__FILE__).'/class.admin.php';81 adminNewsletter::Uninstall();82 }77 try { 78 $name = (string) $plugin['name']; 79 if (strcmp($name, pluginNewsletter::pname()) == 0) { 80 require dirname(__FILE__).'/class.admin.php'; 81 adminNewsletter::Uninstall(); 82 } 83 83 } catch (Exception $e) { 84 84 $core->error->add($e->getMessage()); … … 89 89 * après création d'un billet dans l'admin 90 90 */ 91 92 93 94 91 public static function adminAutosend($cur, $post_id) 92 { 93 dcNewsletter::autosendNewsletter(); 94 } 95 95 } 96 96 -
plugins/newsletter/trunk/changelog.txt
r790 r793 6 6 * ajout d'une période de temps pour les billets de la newsletter (fixée à 1 mois dans cette version) 7 7 * remaniement du code 8 * resolution du Ticket #47 : bug d'affichage d'une page vide lors du submit8 * correction du Ticket #47 : bug d'affichage d'une page vide lors du submit 9 9 * resolution du Ticket #61 : bug avec le caratère '=' dans l'URL 10 10 * resolution du Ticket #62 : bug dans l'envoi automatique 11 11 * résolution du Ticket #65 : création de templates spécifiques 12 12 * résolution du Ticket #67 : définir l'intitulé du bouton "S'abonner" 13 13 * correction de la mise en page du widget 14 * résolution du Ticket #69 : inclure une partie du contenu du post dans la mail 15 * correction de la fonction suspend en mode page 14 16 15 17 3.4.2 -
plugins/newsletter/trunk/class.admin.php
r788 r793 290 290 try { 291 291 $blog = &$core->blog; 292 292 $auth = &$core->auth; 293 293 $url = &$core->url; 294 294 $themes = &$core->themes; … … 299 299 300 300 // paramétrage de l'état d'activation du plugin 301 302 301 if (pluginNewsletter::isActive()) 302 $pactive = 'checked'; 303 303 else 304 304 $pactive = ''; … … 310 310 311 311 $feditorname = pluginNewsletter::getEditorName(); 312 313 314 312 $feditoremail = pluginNewsletter::getEditorEmail(); 313 $fmode = pluginNewsletter::getSendMode(); 314 $fmaxposts = pluginNewsletter::getMaxPosts(); 315 315 $fautosend = pluginNewsletter::getAutosend(); 316 316 $fcaptcha = pluginNewsletter::getCaptcha(); 317 $f_view_content_post = pluginNewsletter::getViewContentPost(); 318 $f_size_content_post = pluginNewsletter::getSizeContentPost(); 317 319 /* 318 320 $f_subscribe_link = pluginNewsletter::getSubscribeLink(); … … 322 324 //*/ 323 325 324 325 326 326 $core->themes = new dcModules($core); 327 $core->themes->loadModules($blog->themes_path, NULL); 328 $theme = $blog->settings->theme; 327 329 $bthemes = array(); 328 330 foreach ($themes->getModules() as $k => $v) … … 332 334 } 333 335 334 336 echo 335 337 '<fieldset>' . 336 338 … … 378 380 form::combo(array('fmode'), $mode_combo, $fmode). 379 381 '</label></p>'. 382 '<p class="field">'. 383 form::checkbox('f_view_content_post',1,$f_view_content_post). 384 '<label class="classic" for="f_view_content_post">'.__('View contents posts'). 385 '</label></p>'. 386 '<p><label class="classic" for="f_size_content_post">'. __('Size contents posts').' : '. 387 form::field(array('f_size_content_post'),4,4, $f_size_content_post). 388 '</label></p>'. 380 389 /* for 3.5.1 : add period 381 390 '<p class="field">'. … … 450 459 } 451 460 //*/ 461 } catch (Exception $e) { 462 $core->error->add($e->getMessage()); 452 463 } 453 catch (Exception $e) { $core->error->add($e->getMessage()); }454 464 } 455 456 /**457 * notice d'utilisation458 */459 /* déplacée dans l'aide en ligne460 public static function Usage()461 {462 echo463 '<fieldset>' .464 '<legend>'.__('Gestion').'</legend>'.465 '</fieldset>'.466 '<fieldset>' .467 '<legend>'.__('Settings').'</legend>'.468 __('Change settings:').'<br /><a href="'.pluginNewsletter::admin().'&tab=settings" title="'.__('Clic here to edit your settings.').'">'.__('Clic here to edit your settings.').'</a>'.469 '</fieldset>'.470 '<fieldset>' .471 '<legend>'.__('Widget').'</legend>'.472 __('Widget manager:').'<br /><a href="'.pluginNewsletter::urlwidgets().'" title="'.__('Clic here to edit your widgets.').'">'.__('Clic here to edit your widgets.').'</a>'.473 '</fieldset>'.474 '<fieldset>' .475 '<legend>'.__('Theme').'</legend>'.476 __('Theme integration:').477 '<ul>'.478 '<li>'.479 __('You can add this code into your theme to display the Newsletter subscription form:').'<br />'.480 '<span class="tpl">{{tpl:NewsletterSubscription}}</span>'.481 '</li>'.482 '</ul>'.483 '</fieldset>';484 }485 //*/486 487 /**488 * à propos du plugin489 */490 /* déplacée dans l'aide en ligne491 public static function About()492 {493 echo494 '<fieldset>' .495 '<legend>'.__('Authors').'</legend>'.496 '<ul>'.497 '<li>'.'<a href="http://phoenix.cybride.net/" title="Olivier Le Bris">Olivier Le Bris</a>'.'</li>'.498 '</ul>'.499 '</fieldset>'.500 '<fieldset>' .501 '<legend>'.__('Licence').'</legend>'.502 '<ul>'.503 '<li>'.504 '<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/fr/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/2.0/fr/88x31.png" /></a>'.505 '</li>'.506 '<li>'.507 __('This work is released under a ').'<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/fr/">'.__('Creative Commons contract').'</a>.'.508 '</li>'.509 '</ul>'.510 '</fieldset>'.511 '<fieldset>' .512 '<legend>'.__('Greets').'</legend>'.513 '<ul>'.514 '<li>'.__('Flannelle (http://flannelle.cybride.net/)').'</li>'.515 '<li>'.__('Mumu (http://www.chez-mumu.com/blog/)').'</li>'.516 '<li>'.__('Guizbizet (http://guillaumebizet.free.fr/)').'</li>'.517 '<li>'.__('kinanveu').'</li>'.518 '<li>'.__('baboon, Richard, brol, Vincent, Nathalie').'</li>'.519 '<li>'.__('k-netweb.net, for Contact2 plugin for Dotclear 2').'</li>'.520 '<li>'.__('All the peoples who tested it !').'</li>'.521 '</ul>'.522 '</fieldset>'.523 '<fieldset>' .524 '<legend>'.__('Usefull informations').'</legend>'.525 '<ul>'.526 '<li>'.__('Support:').' <a href="http://www.cybride.net/redirect/support/'.pluginNewsletter::pname().'" title="'.__('Clic here to go to the support.').'">'.__('Clic here to go to the support.').'</a>'.'</li>'.527 '<li>'.__('Files:').' '.__('Read authors.txt and changelog.txt in the doc folder.').'</a>'.'</li>'.528 '<li>'.__('Dotclear:').' <a href="http://www.dotclear.net/" title="'.__('Clic here to go to Dotclear.').'">'.__('Clic here to go to Dotclear.').'</a>'.'</li>'.529 '</ul>'.530 '</fieldset>';531 }532 //*/533 465 534 466 /** … … 541 473 542 474 $datas = dcNewsletter::getlist(); 543 if (!is_object($datas)) 544 { 545 echo __('No subscriber for this blog.'); 546 } else { 475 if (!is_object($datas)) { 476 echo __('No subscriber for this blog.'); 477 } else { 547 478 global $core; 548 try 549 { 550 $blog = &$core->blog; 551 $settings = &$blog->settings; 552 553 // début du tableau et en-têtes 554 echo 555 '<form action="plugin.php" method="post" name="listblog">' . 556 $core->formNonce() . 557 form::hidden(array('p'),pluginNewsletter::pname()). 558 form::hidden(array('op'),'remove'). 559 form::hidden(array('id'),''). 560 '<table class="clear" id="userslist">'. 561 '<tr>'. 562 '<th> </th>'. 563 '<th class="nowrap">'.__('Subscriber').'</th>' . 564 '<th class="nowrap">'.__('Subscribed').'</th>' . 565 '<th class="nowrap">'.__('Status').'</th>' . 566 '<th class="nowrap">'.__('Last sent').'</th>' . 567 '<th class="nowrap" colspan="2">'.__('Edit').'</th>'. 568 '</tr>'; 569 570 // parcours la liste pour l'affichage 571 $datas->moveStart(); 572 while ($datas->fetch()) 573 { 574 $k = (integer)$datas->subscriber_id; 575 $editlink = 'onclick="ledit('.$k.'); return false"'; 576 $guilink = '<a href="#" '.$editlink.' title="'.__('Edit subscriber').'"><img src="images/edit-mini.png" alt="'.__('Edit subscriber').'" /></a>'; 577 578 if ($datas->subscribed != null) $subscribed = dt::dt2str('%d/%m/%Y', $datas->subscribed).' '.dt::dt2str('%H:%M', $datas->subscribed); 579 else $subscribed = __('Never'); 580 if ($datas->lastsent != null) $lastsent = dt::dt2str('%d/%m/%Y', $datas->lastsent).' '.dt::dt2str('%H:%M', $datas->lastsent); 581 else $lastsent = __('Never'); 582 583 echo 584 '<tr class="line">'. 585 '<td>'.form::checkbox(array('subscriber['.html::escapeHTML($k).']'), 1).'</td>'. 586 '<td class="maximal nowrap">'.html::escapeHTML(text::cutString($datas->email, 50)).'</td>'. 587 '<td class="minimal nowrap">'.html::escapeHTML(text::cutString($subscribed, 50)).'</td>'. 588 '<td class="minimal nowrap">'.html::escapeHTML(text::cutString(__($datas->state), 50)).'</td>'. 589 '<td class="minimal nowrap">'.html::escapeHTML(text::cutString($lastsent, 50)).'</td>'. 590 '<td class="status">'.$guilink.'</td>'. 591 '</tr>'; 592 } 593 594 $bstates = array(); 595 $bstates['-'] = '-'; 596 $bstates[__('Suspend')] = 'suspend'; 597 $bstates[__('Disable')] = 'disable'; 598 $bstates[__('Enable')] = 'enable'; 599 $bstates[__('Last sent')] = 'lastsent'; 600 601 $bmails = array(); 602 $bmails[__('Newsletter')] = 'send'; 603 $bmails[__('Confirm')] = 'sendconfirm'; 604 $bmails[__('Suspend')] = 'sendsuspend'; 605 $bmails[__('Disable')] = 'senddisable'; 606 $bmails[__('Enable')] = 'sendenable'; 607 608 // fermeture du tableau 609 echo 610 '</table>'. 611 612 479 try { 480 $blog = &$core->blog; 481 $settings = &$blog->settings; 482 483 // début du tableau et en-têtes 484 echo 485 '<form action="plugin.php" method="post" name="listblog">' . 486 $core->formNonce() . 487 form::hidden(array('p'),pluginNewsletter::pname()). 488 form::hidden(array('op'),'remove'). 489 form::hidden(array('id'),''). 490 '<table class="clear" id="userslist">'. 491 '<tr>'. 492 '<th> </th>'. 493 '<th class="nowrap">'.__('Subscriber').'</th>' . 494 '<th class="nowrap">'.__('Subscribed').'</th>' . 495 '<th class="nowrap">'.__('Status').'</th>' . 496 '<th class="nowrap">'.__('Last sent').'</th>' . 497 '<th class="nowrap" colspan="2">'.__('Edit').'</th>'. 498 '</tr>'; 499 500 // parcours la liste pour l'affichage 501 $datas->moveStart(); 502 while ($datas->fetch()) { 503 $k = (integer)$datas->subscriber_id; 504 $editlink = 'onclick="ledit('.$k.'); return false"'; 505 $guilink = '<a href="#" '.$editlink.' title="'.__('Edit subscriber').'"><img src="images/edit-mini.png" alt="'.__('Edit subscriber').'" /></a>'; 506 507 if ($datas->subscribed != null) 508 $subscribed = dt::dt2str('%d/%m/%Y', $datas->subscribed).' '.dt::dt2str('%H:%M', $datas->subscribed); 509 else 510 $subscribed = __('Never'); 511 512 if ($datas->lastsent != null) 513 $lastsent = dt::dt2str('%d/%m/%Y', $datas->lastsent).' '.dt::dt2str('%H:%M', $datas->lastsent); 514 else 515 $lastsent = __('Never'); 516 517 echo 518 '<tr class="line">'. 519 '<td>'.form::checkbox(array('subscriber['.html::escapeHTML($k).']'), 1).'</td>'. 520 '<td class="maximal nowrap">'.html::escapeHTML(text::cutString($datas->email, 50)).'</td>'. 521 '<td class="minimal nowrap">'.html::escapeHTML(text::cutString($subscribed, 50)).'</td>'. 522 '<td class="minimal nowrap">'.html::escapeHTML(text::cutString(__($datas->state), 50)).'</td>'. 523 '<td class="minimal nowrap">'.html::escapeHTML(text::cutString($lastsent, 50)).'</td>'. 524 '<td class="status">'.$guilink.'</td>'. 525 '</tr>'; 526 } 527 528 $bstates = array(); 529 $bstates['-'] = '-'; 530 $bstates[__('Suspend')] = 'suspend'; 531 $bstates[__('Disable')] = 'disable'; 532 $bstates[__('Enable')] = 'enable'; 533 $bstates[__('Last sent')] = 'lastsent'; 534 535 $bmails = array(); 536 $bmails[__('Newsletter')] = 'send'; 537 $bmails[__('Confirm')] = 'sendconfirm'; 538 $bmails[__('Suspend')] = 'sendsuspend'; 539 $bmails[__('Disable')] = 'senddisable'; 540 $bmails[__('Enable')] = 'sendenable'; 541 542 // fermeture du tableau 543 echo 544 '</table>'. 613 545 '<p>'. 614 546 '<a class="small" href="'.html::escapeHTML(pluginNewsletter::admin()).'">'.__('refresh').'</a> - ' . 615 547 '<a class="small" href="#" onclick="checkAll(\'userslist\'); return false">'.__('check all').'</a> - ' . 616 548 '<a class="small" href="#" onclick="uncheckAll(\'userslist\'); return false">'.__('uncheck all').'</a> - ' . 617 549 '<a class="small" href="#" onclick="invertcheckAll(\'userslist\'); return false">'.__('toggle check all').'</a></p>'. 618 619 620 550 551 '<p>'. 552 '<input type="submit" value="'.__('Delete').'" /><br /><br />'. 621 553 '<label for "fstates">'.__('Set state:').'</label>'. 622 554 form::combo('fstates', $bstates).'<input type="button" value="'.__('Set').'" onclick="lset(); return false" />'. 623 555 '<label for "fmails">'.__('Mail to send:').'</label>'. 624 556 form::combo('fmails', $bmails).'<input type="button" value="'.__('Send').'" onclick="lsend(); return false" />'. 625 '</p></form>'; 626 } 627 catch (Exception $e) { $core->error->add($e->getMessage()); } 557 '</p></form>'; 558 559 } catch (Exception $e) { 560 $core->error->add($e->getMessage()); 561 } 628 562 } 629 563 } -
plugins/newsletter/trunk/class.modele.php
r790 r793 56 56 } 57 57 58 // Fonction récupérée dans le plugin dCom 59 public static function cutString($str,$maxlength=false) 60 { 61 if (mb_strlen($str) > $maxlength && $maxlength) 62 return self::myCutString($str,$maxlength).'...'; 63 return $str; 64 } 65 66 // Fonction cutString() de Dotclear écrite par Olivier Meunier 67 // Corrigée pour supporter le UTF-8 68 // https://clearbricks.org/svn/trunk/common/lib.text.php [72] 69 public static function myCutString($str,$l) 70 { 71 $s = preg_split('/([\s]+)/u',$str,-1,PREG_SPLIT_DELIM_CAPTURE); 72 73 $res = ''; 74 $L = 0; 75 76 if (mb_strlen($s[0]) >= $l) { 77 return mb_substr($s[0],0,$l); 78 } 79 80 foreach ($s as $v) 81 { 82 $L = $L+strlen($v); 83 84 if ($L > $l) { 85 break; 86 } else { 87 $res .= $v; 88 } 89 } 90 91 return trim($res); 92 } 93 58 94 /** 59 95 * retourne le contenu total de la table sous forme de tableau de données brutes … … 392 428 { 393 429 // test sur la valeur de l'id qui doit être positive ou null 394 if ($id < 0) return null; 395 396 // modifie l'état des abonnés 397 else 398 { 399 // filtrage sur le code de status 400 switch ($_state) 401 { 402 case 'pending': 403 case 'enabled': 404 case 'suspended': 405 case 'disabled': 406 break; 407 408 default: 430 if ($id < 0) { 431 return null; 432 } else { 433 // modifie l'état des abonnés 434 435 // filtrage sur le code de status 436 switch ($_state) { 437 case 'pending': 438 case 'enabled': 439 case 'suspended': 440 case 'disabled': 441 break; 442 default: 409 443 return false; 410 } 411 412 global $core; 413 try 414 { 444 } 445 446 global $core; 447 try { 415 448 $blog = &$core->blog; 416 449 $con = &$core->con; 417 450 $blogid = $con->escape((string)$blog->id); 418 451 419 // mise en forme du tableau d'id 420 if (is_array($id)) $ids = implode(", ", $id); 421 else $ids = $id; 422 423 // génération de la requète 452 // mise en forme du tableau d'id 453 if (is_array($id)) 454 $ids = implode(", ", $id); 455 else 456 $ids = $id; 457 458 // génération de la requète 424 459 $cur = $con->openCursor($core->prefix.pluginNewsletter::pname()); 425 460 … … 428 463 $cur->update('WHERE blog_id=\''.$con->escape($blogid).'\' AND subscriber_id IN('.$ids.')'); 429 464 return true; 430 } 431 catch (Exception $e) { $core->error->add($e->getMessage()); } 432 } 465 } catch (Exception $e) { 466 $core->error->add($e->getMessage()); 467 } 468 } 433 469 } 434 470 … … 522 558 { 523 559 global $core; 524 560 try { 525 561 526 562 $con = &$core->con; … … 530 566 // pas de contenu, uniquement les billets publiés, sans mot de passe 531 567 $params = array(); 532 $params['no_content'] = true; 568 569 // Ticket #69 570 $params['no_content'] = (pluginNewsletter::getViewContentPost() ? false : true); 533 571 $params['post_type'] = 'post'; 534 572 $params['post_status'] = 1; … … 554 592 } 555 593 556 $year = dt::dt2str('%Y', $dt);557 $month = dt::dt2str('%m', $dt);558 $day = dt::dt2str('%d', $dt);559 $hours = dt::dt2str('%H', $dt);560 $minutes = dt::dt2str('%M', $dt);561 $seconds = dt::dt2str('%S', $dt);594 $year = dt::dt2str('%Y', $dt); 595 $month = dt::dt2str('%m', $dt); 596 $day = dt::dt2str('%d', $dt); 597 $hours = dt::dt2str('%H', $dt); 598 $minutes = dt::dt2str('%M', $dt); 599 $seconds = dt::dt2str('%S', $dt); 562 600 563 601 // depuis lastsent 564 $params['sql'] .= ' AND '.$con->dateFormat('P.post_dt','%Y-%m-%d %H:%M:%S')."> '$year-$month-$day $hours:$minutes:$seconds'";602 $params['sql'] .= ' AND '.$con->dateFormat('P.post_dt','%Y-%m-%d %H:%M:%S')."> '$year-$month-$day $hours:$minutes:$seconds'"; 565 603 566 604 // for 3.5.1 : définir un champ dans l'admin 567 605 // intervalle de récupération des messages (fixé à 1 mois pour le moment) 568 606 //$params['sql'] .= ' AND P.post_dt BETWEEN SUBDATE(CURDATE(), INTERVAL 1 MONTH) AND NOW() '; 569 607 // $params['sql'] .= ' AND P.post_dt BETWEEN SUBDATE(NOW(), INTERVAL 1 MONTH) AND NOW() '; 570 608 571 609 // récupération des billets 572 610 $rs = $blog->getPosts($params, false); 573 611 574 575 576 577 578 612 return($rs->isEmpty()?null:$rs); 613 614 } catch (Exception $e) { 615 $core->error->add($e->getMessage()); 616 } 579 617 } 580 618 … … 586 624 * convertit le texte en 7 bits 587 625 */ 588 589 626 private static function to7bit($text, $from_enc) 627 { 590 628 global $core; 591 629 try { … … 597 635 $core->error->add($e->getMessage()); 598 636 } 599 637 } 600 638 601 639 /** 602 640 * envoi de mail 603 641 */ 604 605 642 public static function Sendmail($_from, $_name, $_email, $_subject, $_body, $_type = 'text', $_lang = 'fr') 643 { 606 644 if (empty($_from) || empty($_email) || empty($_subject) || empty($_body)) { 607 645 return false; … … 718 756 719 757 // prise en compte du paramètres: liste d'id ou id simple 720 if (is_array($id)) $ids = $id; 721 else { $ids = array(); $ids[] = $id; } 758 if (is_array($id)) { 759 $ids = $id; 760 } else { 761 $ids = array(); 762 $ids[] = $id; 763 } 722 764 723 765 // initialisation du moteur de template … … 732 774 $mode = pluginNewsletter::getSendMode(); 733 775 $subject = text::toUTF8(__('Newsletter for ').$blogname); 776 /* 777 $view_content_post = pluginNewsletter::getViewContentPost(); 778 $size_content_post = pluginNewsletter::getSizeContentPost(); 779 //*/ 734 780 735 781 // boucle sur les ids des abonnés à mailer … … 741 787 // récupération des billets en fonction de l'abonné (date de dernier envoi et billets déja envoyés) 742 788 $posts = self::getPosts($subscriber->lastsent); 743 if ($posts == null) $send['nothing'][] = $subscriber->email; // rien à envoyer (aucun billet)744 else745 {789 if ($posts == null) { 790 $send['nothing'][] = $subscriber->email; // rien à envoyer (aucun billet) 791 } else { 746 792 $body = ''; 747 793 $bodies = array(); … … 754 800 while ($posts->fetch()) 755 801 { 756 802 $p_ids[] = $posts->post_id; 757 803 758 804 // récupération des informations du billet 759 $bodies[] = array( 760 'title' => $posts->post_title, 761 'url' => $posts->getURL(), 762 'date' => $posts->getDate($format), 763 'category' => $posts->getCategoryURL(), 764 'author' => $posts->getAuthorCN() 765 ); 805 if(pluginNewsletter::getViewContentPost()) { 806 $bodies[] = array( 807 'title' => $posts->post_title, 808 'url' => $posts->getURL(), 809 'date' => $posts->getDate($format), 810 'category' => $posts->getCategoryURL(), 811 'content' => html::escapeHTML(self::cutString(html::decodeEntities(html::clean($posts->getContent())),pluginNewsletter::getSizeContentPost())), 812 'author' => $posts->getAuthorCN() 813 ); 814 } else { 815 $bodies[] = array( 816 'title' => $posts->post_title, 817 'url' => $posts->getURL(), 818 'date' => $posts->getDate($format), 819 'category' => $posts->getCategoryURL(), 820 'author' => $posts->getAuthorCN() 821 ); 822 } 766 823 } 767 824 768 825 // intégration dans le template des billets en génération du rendu 769 770 826 nlTemplate::assign('urlSuspend', self::url('suspend/'.base64_encode($subscriber->email))); 827 nlTemplate::assign('urlDisable', self::url('disable/'.base64_encode($subscriber->email))); 771 828 nlTemplate::assign('posts', $bodies); 772 829 $body = nlTemplate::render('newsletter', $mode); 773 830 774 831 // envoi du mail et log 775 if (self::Sendmail($editorEmail, $editorName, $subscriber->email, $subject, $body, $mode)) 776 { 777 // prise en compte email envoyé et mise à jour de l'abonné (date de dernier envoi et liste de billets déja envoyés) 832 if (self::Sendmail($editorEmail, $editorName, $subscriber->email, $subject, $body, $mode)) { 833 // prise en compte email envoyé et mise à jour de l'abonné (date de dernier envoi et liste de billets déja envoyés) 778 834 $send['ok'][] = $subscriber->email; 779 $states[] = $subscriber->subscriber_id; 835 $states[] = $subscriber->subscriber_id; 836 } else { 837 // erreur d'envoi de mail 838 $send['error'][] = $subscriber->email; 780 839 } 781 // erreur d'envoi de mail 782 else $send['error'][] = $subscriber->email; 840 783 841 } 784 842 } … … 915 973 public static function sendSuspend($id = -1) 916 974 { 917 // test si le plugin est actif 918 if (!pluginNewsletter::isActive()) return false; 919 920 // test sur la valeur de l'id qui doit être positive ou null 921 else if ($id == -1) return false; 922 923 // envoi des mails aux abonnés 924 else 925 { 975 if (!pluginNewsletter::isActive()) { // test si le plugin est actif 976 return false; 977 978 } else if ($id == -1) { // test sur la valeur de l'id qui doit être positive ou null 979 return false; 980 } else { 981 // envoi des mails aux abonnés 926 982 global $core; 927 983 try … … 932 988 933 989 // prise en compte du paramètres: liste d'id ou id simple 934 if (is_array($id)) $ids = $id; 935 else { $ids = array(); $ids[] = $id; } 990 if (is_array($id)) 991 $ids = $id; 992 else { 993 $ids = array(); 994 $ids[] = $id; 995 } 936 996 937 997 // initialisation du moteur de template … … 1137 1197 } 1138 1198 1199 /** 1200 * envoi d'un resumé du compte 1201 */ 1202 public static function sendResume($id = -1) 1203 { 1204 if (!pluginNewsletter::isActive()) { // test si le plugin est actif 1205 return false; 1206 } else if ($id == -1) { // test sur la valeur de l'id qui doit être positive ou null 1207 return false; 1208 } else { 1209 // envoi des mails aux abonnés 1210 global $core; 1211 try 1212 { 1213 $url = &$core->url; 1214 $blog = &$core->blog; 1215 $blogurl = &$blog->url; 1216 1217 // prise en compte du paramètres: liste d'id ou id simple 1218 if (is_array($id)) 1219 $ids = $id; 1220 else { 1221 $ids = array(); 1222 $ids[] = $id; 1223 } 1224 1225 // initialisation du moteur de template 1226 $send_ok = array(); 1227 $send_error = array(); 1228 $states = array(); 1229 self::BeforeSendmailTo(__('Newsletter account resume for'), __('Have a nice day !')); 1230 1231 // initialisation des variables de travail 1232 $blogname = &$blog->name; 1233 $editorName = pluginNewsletter::getEditorName(); 1234 $editorEmail = pluginNewsletter::getEditorEmail(); 1235 $mode = pluginNewsletter::getSendMode(); 1236 $subject = text::toUTF8(__('Newsletter account resume for ').$blogname); 1237 1238 // boucle sur les ids des abonnés à mailer 1239 foreach ($ids as $subscriber_id) 1240 { 1241 // récupération de l'abonné et extraction des données 1242 $subscriber = self::get($subscriber_id); 1243 1244 // génération du rendu 1245 /* 1246 nlTemplate::assign('urlEnable', self::url('enable/'.base64_encode($subscriber->email))); 1247 //*/ 1248 //nlTemplate::assign('urlEnable', self::url('enable/'.str_replace('=','',base64_encode($subscriber->email)))); 1249 //$body = nlTemplate::render('suspend', $mode); 1250 1251 // envoi du mail et log 1252 if (self::Sendmail($editorEmail, $editorName, $subscriber->email, $subject, $body, $mode)) 1253 { 1254 $send_ok[] = $subscriber->email; 1255 $states[] = $subscriber_id; 1256 } 1257 else $send_error[] = $subscriber->email; 1258 } 1259 1260 /* 1261 // positionnement de l'état des comptes sur 'compte suspendu' 1262 if (is_array($states) && count($states) > 0) 1263 self::suspend($states); 1264 //*/ 1265 1266 $msg = ''; 1267 if (count($send_ok) > 0) $msg .= __('Successful mail sent for ').implode(', ', $send_ok); 1268 if (count($send_ok) > 0 && count($send_error) > 0) $msg .= '<br />'; 1269 if (count($send_error) > 0) $msg .= __('Mail sent error for ').implode(', ', $send_error); 1270 1271 return $msg; 1272 } 1273 catch (Exception $e) { $core->error->add($e->getMessage()); } 1274 } 1275 } 1276 1139 1277 /* ================================================== 1140 1278 gestion des comptes … … 1185 1323 global $core; 1186 1324 try { 1187 1188 1189 1190 1191 1325 $subscriber = self::getemail($email); 1326 $msg = null; 1327 if (!$subscriber || $subscriber->subscriber_id == null) 1328 return __('Email don\'t exist !'); 1329 else { 1192 1330 $msg = self::sendDisable($subscriber->subscriber_id); 1193 1194 1195 1331 self::delete($subscriber->subscriber_id); 1332 return $msg; 1333 } 1196 1334 } catch (Exception $e) { 1197 1335 $core->error->add($e->getMessage()); … … 1199 1337 } 1200 1338 } 1201 1339 1340 /** 1341 * suspension du compte 1342 */ 1343 static function accountSuspend($email = null) 1344 { 1345 if (!pluginNewsletter::isActive()) { // test si le plugin est actif 1346 return __('Newsletter is disabled.'); 1347 } else if ($email == null) { // l'email doit être renseigné 1348 return __('Bad email !'); 1349 } else { // suspension du compte 1350 global $core; 1351 try { 1352 $subscriber = self::getemail($email); 1353 $msg = null; 1354 if (!$subscriber || $subscriber->subscriber_id == null) 1355 return __('Email don\'t exist !'); 1356 else { 1357 $msg = self::sendSuspend($subscriber->subscriber_id); 1358 self::suspend($subscriber->subscriber_id); 1359 return $msg; 1360 } 1361 } catch (Exception $e) { 1362 $core->error->add($e->getMessage()); 1363 } 1364 } 1365 } 1366 1367 /** 1368 * information sur le compte 1369 */ 1370 static function accountResume($email = null) 1371 { 1372 if (!pluginNewsletter::isActive()) { // test si le plugin est actif 1373 return __('Newsletter is disabled.'); 1374 } else if ($email == null) { // l'email doit être renseigné 1375 return __('Bad email !'); 1376 } else { // information sur le compte 1377 global $core; 1378 try { 1379 $subscriber = self::getemail($email); 1380 $msg = null; 1381 if (!$subscriber || $subscriber->subscriber_id == null) 1382 return __('Email don\'t exist !'); 1383 else { 1384 $msg = self::sendResume($subscriber->subscriber_id); 1385 //self::resume($subscriber->subscriber_id); 1386 return $msg; 1387 } 1388 } catch (Exception $e) { 1389 $core->error->add($e->getMessage()); 1390 } 1391 } 1392 } 1393 1202 1394 /* ================================================== 1203 1395 templates … … 1208 1400 */ 1209 1401 public static function Newsletter() 1210 1402 { 1211 1403 if (isset($GLOBALS['newsletter']['cmd'])) 1212 1404 $cmd = (string) html::clean($GLOBALS['newsletter']['cmd']); 1213 1214 1405 else 1406 $cmd = 'about'; 1215 1407 1216 1217 1218 1219 1408 if (isset($GLOBALS['newsletter']['email'])) 1409 $email = (string) html::clean($GLOBALS['newsletter']['email']); 1410 else 1411 $email = null; 1220 1412 1221 1222 1223 1224 1225 1226 1413 if (isset($GLOBALS['newsletter']['code'])) 1414 $code = (string) html::clean($GLOBALS['newsletter']['code']); 1415 else 1416 $code = null; 1417 1418 switch ($cmd) { 1227 1419 case 'test': 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1420 $msg = __('Newsletter template successfully adapted.'); 1421 break; 1422 1423 case 'about': 1424 $msg = __('About Newsletter...'); 1425 break; 1426 1427 case 'confirm': 1428 if ($email == null || $code == null) 1429 $msg = __('Missing informations. '); 1430 else { 1431 $rs = self::getemail($email); 1432 if ($rs == null || $rs->regcode != $code) 1433 $msg = __('Your subscription code is invalid.'); 1434 else if ($rs->state == 'enabled') 1435 $msg = __('Account already confirmed.'); 1436 else { 1245 1437 self::sendEnable($rs->subscriber_id); 1246 $msg = __('Your subscription is confirmed.').'<br />'.__('You will soon receive an email.'); 1247 } 1248 } 1249 break; 1250 1251 case 'enable': 1252 if ($email == null) 1253 $msg = __('Missing informations. '); 1254 else { 1255 $rs = self::getemail($email); 1256 if ($rs == null) 1257 $msg = __('Unable to find you account informations.'); 1258 else if ($rs->state == 'enabled') 1259 $msg = __('Account already enabled.'); 1260 else { 1261 self::sendEnable($rs->subscriber_id); 1262 $msg = __('Your account is enabled.').'<br />'.__('You will soon receive an email.'); 1263 } 1264 } 1265 break; 1266 1267 case 'disable': 1268 if ($email == null) 1269 $msg = __('Missing informations. '); 1270 else { 1271 $rs = self::getemail($email); 1272 if ($rs == null) 1273 $msg = __('Unable to find you account informations.'); 1274 else if ($rs->state == 'disabled') 1275 $msg = __('Account already disabled.'); 1276 else { 1277 self::sendDisable($rs->subscriber_id); 1278 $msg = __('Your account is disabled.').'<br />'.__('You will soon receive an email.'); 1279 } 1280 } 1281 break; 1282 1283 case 'suspend': 1284 if ($email == null) 1285 $msg = __('Missing informations. '); 1286 else { 1287 $rs = self::getemail($email); 1288 if ($rs == null) 1289 $msg = __('Unable to find you account informations.'); 1290 else if ($rs->state == 'suspended') 1291 $msg = __('Account already suspended.'); 1292 else { 1293 self::sendSuspend($rs->subscriber_id); 1294 $msg = __('Your account is suspended.').'<br />'.__('You will soon receive an email.'); 1295 } 1296 } 1297 break; 1298 1299 case 'submit': 1300 $email = (string)html::clean($_POST['nl_email']); 1301 $option = (string)html::clean($_POST['nl_option']); 1302 $check = true; 1303 if (pluginNewsletter::getCaptcha()) { 1304 $captcha = (string)html::clean($_POST['nl_captcha']); 1305 1306 require_once dirname(__FILE__).'/class.captcha.php'; 1307 $read = Captcha::read(); 1308 if ($read != $captcha) 1309 $check = false; 1310 } 1311 1312 if (!$check) 1313 $msg = __('Bad captcha code.'); 1314 else switch ($option) { 1315 case 'subscribe': 1316 $msg = self::accountCreate($email); 1317 break; 1318 1319 case 'unsubscribe': 1320 $msg = self::accountDelete($email); 1321 break; 1322 1323 case 'suspend': 1324 break; 1325 1326 case 'resume': 1327 break; 1328 1329 default: 1330 $msg = __('Error in formular.'); 1331 break; 1332 } 1333 break; 1334 1335 default: 1336 $msg = ''; 1337 break; 1338 } 1339 1340 return $msg; 1438 $msg = __('Your subscription is confirmed.').'<br />'.__('You will soon receive an email.'); 1439 } 1440 } 1441 break; 1442 1443 case 'enable': 1444 if ($email == null) 1445 $msg = __('Missing informations. '); 1446 else { 1447 $rs = self::getemail($email); 1448 if ($rs == null) 1449 $msg = __('Unable to find you account informations.'); 1450 else if ($rs->state == 'enabled') 1451 $msg = __('Account already enabled.'); 1452 else { 1453 self::sendEnable($rs->subscriber_id); 1454 $msg = __('Your account is enabled.').'<br />'.__('You will soon receive an email.'); 1455 } 1456 } 1457 break; 1458 1459 case 'disable': 1460 if ($email == null) 1461 $msg = __('Missing informations. '); 1462 else { 1463 $rs = self::getemail($email); 1464 if ($rs == null) 1465 $msg = __('Unable to find you account informations.'); 1466 else if ($rs->state == 'disabled') 1467 $msg = __('Account already disabled.'); 1468 else { 1469 self::sendDisable($rs->subscriber_id); 1470 $msg = __('Your account is disabled.').'<br />'.__('You will soon receive an email.'); 1471 } 1472 } 1473 break; 1474 1475 case 'suspend': 1476 if ($email == null) 1477 $msg = __('Missing informations. '); 1478 else { 1479 $rs = self::getemail($email); 1480 if ($rs == null) 1481 $msg = __('Unable to find you account informations.'); 1482 else if ($rs->state == 'suspended') 1483 $msg = __('Account already suspended.'); 1484 else { 1485 self::sendSuspend($rs->subscriber_id); 1486 $msg = __('Your account is suspended.').'<br />'.__('You will soon receive an email.'); 1487 } 1488 } 1489 break; 1490 1491 case 'submit': 1492 $email = (string)html::clean($_POST['nl_email']); 1493 $option = (string)html::clean($_POST['nl_option']); 1494 $check = true; 1495 if (pluginNewsletter::getCaptcha()) { 1496 $captcha = (string)html::clean($_POST['nl_captcha']); 1497 require_once dirname(__FILE__).'/class.captcha.php'; 1498 $read = Captcha::read(); 1499 if ($read != $captcha) 1500 $check = false; 1501 } 1502 1503 if (!$check) 1504 $msg = __('Bad captcha code.'); 1505 else switch ($option) { 1506 case 'subscribe': 1507 $msg = self::accountCreate($email); 1508 break; 1509 1510 case 'unsubscribe': 1511 $msg = self::accountDelete($email); 1512 break; 1513 1514 case 'suspend': 1515 $msg = self::accountSuspend($email); 1516 break; 1517 1518 case 'resume': 1519 $msg = self::accountResume($email); 1520 break; 1521 1522 default: 1523 $msg = __('Error in formular.'); 1524 break; 1525 } 1526 break; 1527 1528 default: 1529 $msg = ''; 1530 break; 1531 } 1532 1533 return $msg; 1341 1534 } 1342 1535 -
plugins/newsletter/trunk/class.plugin.php
r788 r793 110 110 * nombre maximal de billet retournés 111 111 */ 112 113 114 115 112 public static function getMaxPosts() 113 { 114 return (integer)self::get('maxposts'); 115 } 116 116 117 117 /** … … 134 134 * envoi automatique 135 135 */ 136 public static function getAutosend() 137 { 138 return (boolean)self::get('autosend'); 139 } 136 public static function getAutosend() 137 { 138 return (boolean)self::get('autosend'); 139 } 140 141 /** 142 * indique si on doit envoyer automatiquement 143 */ 144 public static function setAutosend($val) 145 { 146 self::setB('autosend', (boolean)$val); 147 } 148 149 /** 150 * réinitialise l'indicateur d'envoi automatique 151 */ 152 public static function clearAutosend() 153 { 154 self::setAutosend(false); 155 } 156 157 /** 158 * utilisation d'un captcha 159 */ 160 public static function getCaptcha() 161 { 162 return (boolean)self::get('captcha'); 163 } 164 165 /** 166 * indique si on doit utiliser un captcha 167 */ 168 public static function setCaptcha($val) 169 { 170 self::setB('captcha', (boolean)$val); 171 } 172 173 /** 174 * réinitialise l'indicateur d'utilisation de captcha 175 */ 176 public static function clearCaptcha() 177 { 178 self::setCaptcha(false); 179 } 180 181 /* Ticket #69 182 Ajout du paramètre d'activation du post.content 183 Ajout de la définition de la taille maximale du post.content 184 //*/ 185 186 /** 187 * Affichage du contenu du post dans la newsletter 188 */ 189 public static function getViewContentPost() 190 { 191 return (boolean)self::get('view_content_post'); 192 } 193 194 /** 195 * indique si on doit afficher le contenu du post 196 */ 197 public static function setViewContentPost($val) 198 { 199 self::setB('view_content_post', (boolean)$val); 200 } 201 202 /** 203 * réinitialise l'indicateur d'affichage du contenu du post 204 */ 205 public static function clearViewContentPost() 206 { 207 self::setViewContentPost(false); 208 } 209 210 /** 211 * retourne la taille maximale du contenu du billet 212 */ 213 public static function getSizeContentPost() 214 { 215 return (integer)self::get('size_content_post'); 216 } 217 218 /** 219 * renseigne la taille maximale du contenu du billet 220 */ 221 public static function setSizeContentPost($val) 222 { 223 self::setI('size_content_post', (integer)$val); 224 } 140 225 141 226 /** 142 * indique si on doit envoyer automatiquement 143 */ 144 public static function setAutosend($val) 145 { 146 self::setB('autosend', (boolean)$val); 147 } 148 149 /** 150 * réinitialise l'indicateur d'envoi automatique 151 */ 152 public static function clearAutosend() 153 { 154 self::setAutosend(false); 155 } 156 157 /** 158 * utilisation d'un captcha 159 */ 160 public static function getCaptcha() 161 { 162 return (boolean)self::get('captcha'); 163 } 164 165 /** 166 * indique si on doit utiliser un captcha 167 */ 168 public static function setCaptcha($val) 169 { 170 self::setB('captcha', (boolean)$val); 171 } 172 173 /** 174 * réinitialise l'indicateur d'utilisation de captcha 175 */ 176 public static function clearCaptcha() 177 { 178 self::setCaptcha(false); 179 } 227 * efface/initialise la taille maximale du contenu du billet 228 */ 229 public static function clearSizeContentPost() 230 { 231 self::setSendMode(0); 232 } 233 234 /* 235 Ajout d'un commentaire perso avec la newsletter 236 //*/ 237 238 180 239 181 240 /** … … 193 252 self::setAutosend(false); 194 253 self::setCaptcha(false); 254 self::setViewContentPost(false); 255 self::setSizeContentPost(30); 195 256 196 257 self::Trigger(); … … 211 272 self::delete('autosend'); 212 273 self::delete('captcha'); 274 self::delete('view_content_post'); 275 self::delete('size_content_post'); 213 276 214 277 self::Trigger(); … … 665 728 * lecture d'une information particulière concernant un plugin (api dotclear 2) 666 729 */ 667 protected static function getInfo($info) 668 { 669 global $core; 670 try 671 { 730 protected static function getInfo($info) 731 { 732 global $core; 733 try { 672 734 $plugins = $core->plugins; 673 735 return $plugins->moduleInfo(self::pname(), $info); 736 } catch (Exception $e) { 737 $core->error->add($e->getMessage()); 674 738 } 675 catch (Exception $e) { $core->error->add($e->getMessage()); } 676 } 739 } 677 740 678 741 /** 679 742 * racine des fichiers du plugin 680 743 */ 681 682 683 684 744 public static function dcRoot() 745 { 746 return self::getInfo('root'); 747 } 685 748 686 749 /** 687 750 * nom du plugin 688 751 */ 689 690 691 692 752 public static function dcName() 753 { 754 return self::getInfo('name'); 755 } 693 756 694 757 /** 695 758 * description du plugin 696 759 */ 697 698 699 700 760 public static function dcDesc() 761 { 762 return self::getInfo('desc'); 763 } 701 764 702 765 /** 703 766 * auteur du plugin 704 767 */ 705 706 707 708 768 public static function dcAuthor() 769 { 770 return self::getInfo('author'); 771 } 709 772 710 773 /** 711 774 * version du plugin 712 775 */ 713 714 715 716 776 public static function dcVersion() 777 { 778 return self::getInfo('version'); 779 } 717 780 718 781 /** 719 782 * permissions du plugin 720 783 */ 721 722 723 724 784 public static function dcPermissions() 785 { 786 return self::getInfo('permissions'); 787 } 725 788 726 789 /** 727 790 * priorité du plugin 728 791 */ 729 730 731 732 792 public static function dcPriority() 793 { 794 return self::getInfo('priority'); 795 } 733 796 734 797 /** … … 751 814 self::readUpdate(); 752 815 if (self::hasDatas()) { 753 $v_current = self::dcVersion(); 754 $v_remote = self::Version(); 755 816 $v_current = self::dcVersion(); 817 $v_remote = self::Version(); 756 818 if (self::compareVersion($v_current, $v_remote) < 0) 757 819 self::$newversionavailable = true; … … 762 824 * génère le code html pour affichage dans l'admin des informations de mise à jour 763 825 */ 764 765 826 public static function htmlNewVersion($check = true) 827 { 766 828 if (!$check) 767 829 return ''; … … 770 832 self::checkUpdate(); 771 833 if (!self::isNewVersionAvailable()) 772 834 $msg .= __('No new version available.'); 773 835 else { 774 775 776 777 778 779 780 781 782 783 784 785 786 787 836 $msg .= __('New version available:').' '.self::Version().' '; 837 838 $m = array(); 839 if (self::hasPost() || self::hasPackage() || self::hasArchive()) 840 $msg .= '['; 841 if (self::hasPost()) 842 $m[] = '<a href="'.self::post().'" title="'.__('Read the post.').'">'.__('post').'</a>'; 843 if (self::hasPackage()) 844 $m[] = '<a href="'.self::Package().'" title="'.__('Installer.').'">'.__('pkg.gz').'</a>'; 845 if (self::hasArchive()) 846 $m[] = '<a href="'.self::Archive().'" title="'.__('Archive.').'">'.__('tar.gz').'</a>'; 847 848 if (self::hasPost() || self::hasPackage() || self::hasArchive()) 849 $msg .= (string) implode(" | ", $m) . ']'; 788 850 } 789 851 return $msg; 790 852 } 791 853 } … … 800 862 * compatible Dotclear 2.0 beta 6 ou SVN 801 863 */ 802 public static function dbVersion() 803 { 804 global $core; 805 try { 806 return (string)$core->getVersion('core'); 807 } catch (Exception $e) { 808 $core->error->add($e->getMessage()); 809 } 810 } 811 812 /** 813 * permet de savoir si la version de Dotclear installé une version finale 814 */ 815 public static function isRelease() 816 { 817 global $core; 818 try 819 { 820 $version = (string)self::dbVersion(); 821 if (!stripos($version, 'beta')) 822 return true; 823 else 824 return false; 864 public static function dbVersion() 865 { 866 global $core; 867 try { 868 return (string)$core->getVersion('core'); 825 869 } catch (Exception $e) { 826 870 $core->error->add($e->getMessage()); … … 829 873 830 874 /** 831 * permet de savoir si la version de Dotclear installé la beta 6832 */ 833 public static function isBeta($sub = '6')834 835 global $core; 836 837 838 if ( stripos($version, 'beta'.$sub))875 * permet de savoir si la version de Dotclear installé une version finale 876 */ 877 public static function isRelease() 878 { 879 global $core; 880 try { 881 $version = (string)self::dbVersion(); 882 if (!stripos($version, 'beta')) 839 883 return true; 840 841 884 else 885 return false; 842 886 } catch (Exception $e) { 843 887 $core->error->add($e->getMessage()); … … 846 890 847 891 /** 892 * permet de savoir si la version de Dotclear installé la beta 6 893 */ 894 public static function isBeta($sub = '6') 895 { 896 global $core; 897 try { 898 $version = (string)self::dbVersion(); 899 if (stripos($version, 'beta'.$sub)) 900 return true; 901 else 902 return false; 903 } catch (Exception $e) { 904 $core->error->add($e->getMessage()); 905 } 906 } 907 908 /** 848 909 * permet de savoir si la version de Dotclear installé est une version 'svn' 849 910 */ 850 851 852 853 911 public static function isSVN() 912 { 913 return !self::isRelease() && (!self::isBeta('6') || !self::isBeta('7')); 914 } 854 915 855 916 } -
plugins/newsletter/trunk/index.php
r777 r793 72 72 try 73 73 { 74 if (empty($_POST['feditoremail'])) $msg = __('You must input a valid email !'); 74 if (empty($_POST['feditoremail'])) 75 $msg = __('You must input a valid email !'); 75 76 else 76 77 { 77 78 // nom de l'éditeur 78 if (!empty($_POST['feditorname'])) pluginNewsletter::setEditorName($_POST['feditorname']); 79 else pluginNewsletter::clearEditorName(); 79 if (!empty($_POST['feditorname'])) 80 pluginNewsletter::setEditorName($_POST['feditorname']); 81 else 82 pluginNewsletter::clearEditorName(); 80 83 81 84 // email de l'éditeur 82 85 pluginNewsletter::setEditorEmail($_POST['feditoremail']); 83 86 84 87 // mode d'envoi 85 if (!empty($_POST['fmode'])) pluginNewsletter::setSendMode($_POST['fmode']); 86 else pluginNewsletter::clearSendMode(); 88 if (!empty($_POST['fmode'])) 89 pluginNewsletter::setSendMode($_POST['fmode']); 90 else 91 pluginNewsletter::clearSendMode(); 87 92 88 93 // nombre max. de billets 89 if (!empty($_POST['fmaxposts'])) pluginNewsletter::setMaxPosts($_POST['fmaxposts']); 90 else pluginNewsletter::clearMaxPosts(); 94 if (!empty($_POST['fmaxposts'])) 95 pluginNewsletter::setMaxPosts($_POST['fmaxposts']); 96 else 97 pluginNewsletter::clearMaxPosts(); 91 98 92 99 // envoi automatique 93 if (!empty($_POST['fautosend'])) pluginNewsletter::setAutosend($_POST['fautosend']); 94 else pluginNewsletter::setAutosend(); 100 if (!empty($_POST['fautosend'])) 101 pluginNewsletter::setAutosend($_POST['fautosend']); 102 else 103 pluginNewsletter::setAutosend(); 95 104 96 105 // captcha 97 if (!empty($_POST['fcaptcha'])) pluginNewsletter::setCaptcha($_POST['fcaptcha']); 98 else pluginNewsletter::setCaptcha(); 99 106 if (!empty($_POST['fcaptcha'])) 107 pluginNewsletter::setCaptcha($_POST['fcaptcha']); 108 else 109 pluginNewsletter::setCaptcha(); 110 111 // affichage du contenu du post 112 if (!empty($_POST['f_view_content_post'])) 113 pluginNewsletter::setViewContentPost($_POST['f_view_content_post']); 114 else 115 pluginNewsletter::setViewContentPost(); 116 117 // taille maximale du contenu du post 118 if (!empty($_POST['f_size_content_post'])) 119 pluginNewsletter::setSizeContentPost($_POST['f_size_content_post']); 120 else 121 pluginNewsletter::clearSizeContentPost(); 122 100 123 // notification de modification au blog et redirection 101 124 pluginNewsletter::Trigger(); … … 126 149 $plugin_tab = 'tab_listblog'; 127 150 128 try 129 { 130 if (!empty($_POST['femail'])) $email = $_POST['femail']; 131 else $email = null; 132 133 if ($email == null) $msg = __('Missing informations.'); 134 else 135 { 136 if (!dcNewsletter::add($email)) $msg = __('Error adding subscriber.'); 137 else $msg = __('Subscriber added.'); 138 } 139 } 140 catch (Exception $e) { $core->error->add($e->getMessage()); } 151 try { 152 if (!empty($_POST['femail'])) 153 $email = $_POST['femail']; 154 else 155 $email = null; 156 157 if ($email == null) { 158 $msg = __('Missing informations.'); 159 } else { 160 if (!dcNewsletter::add($email)) 161 $msg = __('Error adding subscriber.'); 162 else 163 $msg = __('Subscriber added.'); 164 } 165 } catch (Exception $e) { 166 $core->error->add($e->getMessage()); 167 } 141 168 } 142 169 break; … … 147 174 $plugin_tab = 'tab_listblog'; 148 175 149 try 150 { 151 if (!empty($_POST['id'])) $id = $_POST['id']; 152 else $id = null; 153 154 if (!empty($_POST['femail'])) $email = $_POST['femail']; 155 else $email = null; 156 157 if (!empty($_POST['fsubscribed'])) $subscribed = $_POST['fsubscribed']; 158 else $subscribed = null; 159 160 if (!empty($_POST['flastsent'])) $lastsent = $_POST['flastsent']; 161 else $lastsent = null; 162 163 if (!empty($_POST['fstate'])) $state = $_POST['fstate']; 164 else $state = null; 165 166 if ($email == null) 167 { 168 if ($id == null) $msg = __('Missing informations.'); 169 else $plugin_tab = 'tab_addedit'; 170 } 171 else 172 { 173 $regcode = null; 176 try { 177 if (!empty($_POST['id'])) 178 $id = $_POST['id']; 179 else 180 $id = null; 181 182 if (!empty($_POST['femail'])) 183 $email = $_POST['femail']; 184 else 185 $email = null; 186 187 if (!empty($_POST['fsubscribed'])) 188 $subscribed = $_POST['fsubscribed']; 189 else 190 $subscribed = null; 191 192 if (!empty($_POST['flastsent'])) 193 $lastsent = $_POST['flastsent']; 194 else 195 $lastsent = null; 196 197 if (!empty($_POST['fstate'])) 198 $state = $_POST['fstate']; 199 else 200 $state = null; 201 202 if ($email == null) { 203 if ($id == null) 204 $msg = __('Missing informations.'); 205 else 206 $plugin_tab = 'tab_addedit'; 207 } else { 208 $regcode = null; 174 209 175 if (!dcNewsletter::update($id, $email, $state, $regcode, $subscribed, $lastsent)) $msg = __('Error updating subscriber.'); 176 else $msg = __('Subscriber updated.'); 177 } 178 } 179 catch (Exception $e) { $core->error->add($e->getMessage()); } 210 if (!dcNewsletter::update($id, $email, $state, $regcode, $subscribed, $lastsent)) 211 $msg = __('Error updating subscriber.'); 212 else 213 $msg = __('Subscriber updated.'); 214 } 215 } catch (Exception $e) { 216 $core->error->add($e->getMessage()); 217 } 180 218 } 181 219 break; … … 186 224 $plugin_tab = 'tab_listblog'; 187 225 188 try 189 { 190 $msg = __('No account removed.'); 191 if (is_array($_POST['subscriber'])) 192 { 193 $ids = array(); 194 foreach (array_keys($_POST['subscriber']) as $id) { $ids[] = $id; } 195 if (dcNewsletter::delete($ids)) $msg = __('Account(s) successfully removed.'); 196 } 197 } 198 catch (Exception $e) { $core->error->add($e->getMessage()); } 226 try { 227 $msg = __('No account removed.'); 228 if (is_array($_POST['subscriber'])) { 229 $ids = array(); 230 foreach (array_keys($_POST['subscriber']) as $id) 231 { 232 $ids[] = $id; 233 } 234 if (dcNewsletter::delete($ids)) 235 $msg = __('Account(s) successfully removed.'); 236 } 237 } catch (Exception $e) { 238 $core->error->add($e->getMessage()); 239 } 199 240 } 200 241 break; … … 205 246 $plugin_tab = 'tab_listblog'; 206 247 207 try 208 { 209 $msg = __('No account suspended.'); 210 if (is_array($_POST['subscriber'])) 211 { 212 $ids = array(); 213 foreach (array_keys($_POST['subscriber']) as $id) { $ids[] = $id; } 214 if (dcNewsletter::suspend($ids)) $msg = __('Account(s) successfully suspended.'); 215 } 216 } 217 catch (Exception $e) { $core->error->add($e->getMessage()); } 248 try { 249 $msg = __('No account suspended.'); 250 if (is_array($_POST['subscriber'])) { 251 $ids = array(); 252 foreach (array_keys($_POST['subscriber']) as $id) 253 { 254 $ids[] = $id; 255 } 256 if (dcNewsletter::suspend($ids)) 257 $msg = __('Account(s) successfully suspended.'); 258 } 259 } catch (Exception $e) { 260 $core->error->add($e->getMessage()); 261 } 218 262 } 219 263 break; … … 224 268 $plugin_tab = 'tab_listblog'; 225 269 226 try 227 { 228 $msg = __('No account enabled.'); 229 if (is_array($_POST['subscriber'])) 230 { 231 $ids = array(); 232 foreach (array_keys($_POST['subscriber']) as $id) { $ids[] = $id; } 233 if (dcNewsletter::enable($ids)) $msg = __('Account(s) successfully enabled.'); 234 } 235 } 236 catch (Exception $e) { $core->error->add($e->getMessage()); } 270 try { 271 $msg = __('No account enabled.'); 272 if (is_array($_POST['subscriber'])) { 273 $ids = array(); 274 foreach (array_keys($_POST['subscriber']) as $id) 275 { 276 $ids[] = $id; 277 } 278 if (dcNewsletter::enable($ids)) 279 $msg = __('Account(s) successfully enabled.'); 280 } 281 } catch (Exception $e) { 282 $core->error->add($e->getMessage()); 283 } 237 284 } 238 285 break; … … 243 290 $plugin_tab = 'tab_listblog'; 244 291 245 try 246 { 247 $msg = __('No account disabled.'); 248 if (is_array($_POST['subscriber'])) 249 { 250 $ids = array(); 251 foreach (array_keys($_POST['subscriber']) as $id) { $ids[] = $id; } 252 if (dcNewsletter::disable($ids)) $msg = __('Account(s) successfully disabled.'); 253 } 254 } 255 catch (Exception $e) { $core->error->add($e->getMessage()); } 292 try { 293 $msg = __('No account disabled.'); 294 if (is_array($_POST['subscriber'])) { 295 $ids = array(); 296 foreach (array_keys($_POST['subscriber']) as $id) 297 { 298 $ids[] = $id; 299 } 300 if (dcNewsletter::disable($ids)) 301 $msg = __('Account(s) successfully disabled.'); 302 } 303 } catch (Exception $e) { 304 $core->error->add($e->getMessage()); 305 } 256 306 } 257 307 break; … … 262 312 $plugin_tab = 'tab_listblog'; 263 313 264 try 265 { 266 $ids = array(); 267 foreach (array_keys($_POST['subscriber']) as $id) { $ids[] = $id; } 268 $msg = dcNewsletter::sendNewsletter($ids); 269 } 270 catch (Exception $e) { $core->error->add($e->getMessage()); } 314 try { 315 $ids = array(); 316 foreach (array_keys($_POST['subscriber']) as $id) 317 { 318 $ids[] = $id; 319 } 320 $msg = dcNewsletter::sendNewsletter($ids); 321 } catch (Exception $e) { 322 $core->error->add($e->getMessage()); 323 } 271 324 } 272 325 break; -
plugins/newsletter/trunk/locales/fr/help/help.html
r788 r793 17 17 <li><strong>Code visuel de vérification</strong> : ajout d'un code visuel pour éviter les robots</li> 18 18 <li><strong>Mode</strong> : défini le format d'envoi</li> 19 <li><strong>Période</strong> : défini l'intervalle de temps des billets récupérés pour la newsletter (pour le moment fixé à 1 mois)</li> 19 <li><strong>Affiche le contenu des billets</strong> : affiche le contenu des billets dans la newsletter</li> 20 <li><strong>Taille maximale du contenu des billets</strong> : définir la taille du contenu des billets dans la newsletter</li> 20 21 </ul></dd> 21 22 <dt>Adaptation du template de thème :</dt> -
plugins/newsletter/trunk/locales/fr/main.lang.php
r790 r793 43 43 $GLOBALS['__l10n']['Automatic send'] = "Envoi automatique"; 44 44 $GLOBALS['__l10n']['Captcha'] = "Code visuel"; 45 $GLOBALS['__l10n']['View contents posts'] = "Affiche le contenu des billets"; 46 $GLOBALS['__l10n']['Size contents posts'] = "Taille maximale du contenu des billets"; 45 47 $GLOBALS['__l10n']['Defaults'] = "Défauts"; 46 48 $GLOBALS['__l10n']['Theme template adaptation'] = "Adaptation du template de thème"; … … 166 168 $GLOBALS['__l10n']['Newsletter account removal for'] = "Suppression d'abonnement à la lettre d'information pour"; 167 169 $GLOBALS['__l10n']['Newsletter account removal for '] = "Suppression d'abonnement à la lettre d'information pour "; 170 $GLOBALS['__l10n']['Newsletter account resume for'] = "Information sur l'abonnement à la lettre d'information pour"; 171 $GLOBALS['__l10n']['Newsletter account resume for '] = "Information sur l'abonnement à la lettre d'information pour "; 168 172 169 173 $GLOBALS['__l10n']['Newsletter is disabled.'] = "Newsletter est désactivé."; -
plugins/newsletter/trunk/templates/newsletter.html
r777 r793 19 19 <b><a href="posts.url">posts.title</a></b>{nl} 20 20 (posts.date, {$txtBy} posts.author){nl} 21 posts.content{nl} 21 22 </p> 22 23 {/loop} -
plugins/newsletter/trunk/templates/newsletter.txt
r777 r793 7 7 {loop:posts} 8 8 posts.title (posts.date, {$txtBy} posts.author) 9 posts.url{nl}{nl} 9 posts.url 10 posts.content{nl}{nl} 10 11 {/loop} 11 12 -
plugins/newsletter/trunk/todo.txt
r777 r793 1 A faire ... 2 3 @paddock 4 - la fonction resume ne donne toujours pas d'indication 5 - Ticket #73 : le probleme de rafraichissement du code en cas d'erreur se pose aussi bien en mode widget qu'en mode page 6 - configurer la possibilité d'ajouter un commentaire avec le mail 7 - à la premiere installation j'ai eu un message d'erreur (que j'ai malheureusement pas noté mais de tête il s'agissait d'une erreur de creaction de table DC 8 9 @SiK_22 10 - Ticket #66 : La possibilité de filtrer par catégorie (ou tags ou auteurs) correspond à mon besoin. 11 - Ticket #71 : Régler la fréquence d'envois des mails (choix par l'utilisateur ?) 12 - Ticket #70 : Le choix pour l'utilisateur entre texte & HTML (ex : ceux qui regardent leurs mails sur portables) 13 14 @Gilsoub 15 - Ticket #74 : Problème URL avec un sujet de billet qui finit par des points de suspension 16
Note: See TracChangeset
for help on using the changeset viewer.