Changeset 21608


Ignore:
Timestamp:
03/16/13 20:32:05 (7 years ago)
Author:
mistic100
Message:

code clean, add admin list of all subscribers

Location:
extensions/Subscribe_to_comments
Files:
5 added
7 edited
3 copied
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/Subscribe_to_comments/admin.php

    r15641 r21608  
    11<?php 
    2 if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     2if (!defined('SUBSCRIBE_TO_PATH')) die('Hacking attempt!'); 
    33 
    4 // +-----------------------------------------------------------------------+ 
    5 //                         Save configuration                              | 
    6 // +-----------------------------------------------------------------------+ 
    7 if (isset($_POST['config_submit']))  
    8 { 
    9   $conf['Subscribe_to_Comments'] = array( 
    10     'notify_admin_on_subscribe' => isset($_POST['notify_admin_on_subscribe']), 
    11     'allow_global_subscriptions' => isset($_POST['allow_global_subscriptions']), 
    12     ); 
    13    
    14   conf_update_param('Subscribe_to_Comments', serialize($conf['Subscribe_to_Comments'])); 
    15   array_push($page['infos'], l10n('Information data registered in database')); 
    16  
     4global $template, $page, $conf; 
    175 
    186 
    19 // +-----------------------------------------------------------------------+ 
    20 //                               Template                                  | 
    21 // +-----------------------------------------------------------------------+   
     7// tabsheet 
     8include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 
     9$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : 'subscriptions'; 
     10   
     11$tabsheet = new tabsheet(); 
     12$tabsheet->add('subscriptions', l10n('Manage'), SUBSCRIBE_TO_ADMIN . '-subscriptions'); 
     13$tabsheet->add('config', l10n('Configuration'), SUBSCRIBE_TO_ADMIN . '-config'); 
     14$tabsheet->select($page['tab']); 
     15$tabsheet->assign(); 
     16 
     17 
     18// include page 
     19include(SUBSCRIBE_TO_PATH . 'admin/' . $page['tab'] . '.php'); 
     20 
     21// template 
    2222$template->assign(array( 
    2323  'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH, 
    24   'notify_admin_on_subscribe' => $conf['Subscribe_to_Comments']['notify_admin_on_subscribe'], 
    25   'allow_global_subscriptions' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'], 
     24  'SUBSCRIBE_TO_ADMIN' => SUBSCRIBE_TO_ADMIN, 
    2625  )); 
    27  
    28 $template->set_filename('plugin_admin_content', dirname(__FILE__).'/template/admin.tpl'); 
    29 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
     26   
     27$template->assign_var_from_handle('ADMIN_CONTENT', 'stc_admin'); 
    3028 
    3129?> 
  • extensions/Subscribe_to_comments/admin/config.php

    r21421 r21608  
    11<?php 
    2 if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     2if (!defined('SUBSCRIBE_TO_PATH')) die('Hacking attempt!'); 
    33 
    44// +-----------------------------------------------------------------------+ 
     
    2020//                               Template                                  | 
    2121// +-----------------------------------------------------------------------+   
    22 $template->assign(array( 
    23   'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH, 
    24   'notify_admin_on_subscribe' => $conf['Subscribe_to_Comments']['notify_admin_on_subscribe'], 
    25   'allow_global_subscriptions' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'], 
    26   )); 
     22$template->assign($conf['Subscribe_to_Comments']); 
    2723 
    28 $template->set_filename('plugin_admin_content', dirname(__FILE__).'/template/admin.tpl'); 
    29 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
     24$template->set_filename('stc_admin', realpath(SUBSCRIBE_TO_PATH . 'admin/template/config.tpl')); 
    3025 
    3126?> 
  • extensions/Subscribe_to_comments/include/functions.inc.php

    r21441 r21608  
    11<?php 
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     2if (!defined('SUBSCRIBE_TO_PATH')) die('Hacking attempt!'); 
    33 
    44include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
     
    9090  $subject = '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name']; 
    9191     
    92   $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/notification.tpl'); 
     92  $template->set_filename('stc_mail', realpath(SUBSCRIBE_TO_PATH . 'template/mail/notification.tpl')); 
    9393 
    9494  foreach ($subscriptions as $row) 
     
    225225    set_make_full_url(); 
    226226     
    227     $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/confirm.tpl'); 
     227    $template->set_filename('stc_mail', realpath(SUBSCRIBE_TO_PATH . 'template/mail/confirm.tpl')); 
    228228     
    229229    $subject = '['.strip_tags($conf['gallery_title']).'] '.l10n('Confirm your subscribtion to comments'); 
     
    375375  load_language('plugin.lang', SUBSCRIBE_TO_PATH); 
    376376   
    377   $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/admin.tpl'); 
     377  $template->set_filename('stc_mail', realpath(SUBSCRIBE_TO_PATH . 'template/mail/admin.tpl')); 
    378378     
    379379  $subject = '['.strip_tags($conf['gallery_title']).'] '.sprintf(l10n('%s has subscribed to comments on %s.'), is_a_guest()?$email:$user['username'], null); 
     
    515515  // template 
    516516  $template->set_filenames(array( 
    517     'stc_mail_header' => dirname(__FILE__).'/../template/mail/header.tpl', 
    518     'stc_mail_footer' => dirname(__FILE__).'/../template/mail/footer.tpl', 
     517    'stc_mail_header' => realpath(SUBSCRIBE_TO_PATH . 'template/mail/header.tpl'), 
     518    'stc_mail_footer' => realpath(SUBSCRIBE_TO_PATH . 'template/mail/footer.tpl'), 
    519519    )); 
    520   $stc_mail_css = file_get_contents(dirname(__FILE__).'/../template/mail/style.css'); 
     520  $stc_mail_css = file_get_contents(realpath(SUBSCRIBE_TO_PATH . 'template/mail/style.css')); 
    521521     
    522522  $template->assign(array( 
     
    570570    $element['name'] = get_name_from_file($element['file']); 
    571571  } 
    572    
    573   $url_params = array('image_id' => $element['id']); 
    574   $element['url'] = make_picture_url($url_params); 
     572  $element['name'] = trigger_event('render_element_name', $element['name']); 
     573   
     574  $element['url'] = make_picture_url(array( 
     575    'image_id'=>$element['id'] 
     576    )); 
    575577   
    576578  if ($with_thumb) 
     
    616618    'category'=>$element, 
    617619    )); 
     620     
     621  $element['name'] = trigger_event('render_category_name', $element['name']); 
    618622   
    619623  if ($with_thumb) 
  • extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php

    r21441 r21608  
    11<?php 
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     2if (!defined('SUBSCRIBE_TO_PATH')) die('Hacking attempt!'); 
    33 
    44/** 
  • extensions/Subscribe_to_comments/include/subscribtions_page.inc.php

    r21441 r21608  
    11<?php  
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     2if (!defined('SUBSCRIBE_TO_PATH')) die('Hacking attempt!'); 
    33 
    44global $template, $conf, $page, $user; 
     
    251251} 
    252252 
    253 $template->set_filenames(array('index'=> dirname(__FILE__).'/../template/subscribtions_page.tpl')); 
     253$template->set_filename('index', realpath(SUBSCRIBE_TO_PATH . 'template/subscribtions_page.tpl')); 
    254254 
    255255?> 
  • extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php

    r21340 r21608  
    4646$lang['comments on all pictures of an album'] = 'comments on all pictures of an album'; 
    4747$lang['comments on an album'] = 'comments on an album'; 
     48$lang['First subscription'] = 'First subscription'; 
     49$lang['Last subscription'] = 'Last subscription'; 
     50$lang['All album photos'] = 'All album photos'; 
     51$lang['&#9733; : registered users'] = '&#9733; : registered users'; 
     52$lang['No result'] = 'No result'; 
    4853 
    4954?> 
  • extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php

    r21341 r21608  
    1313$lang['Return to item page'] = 'Retourner à la page de l\'élément'; 
    1414$lang['New comment on'] = 'Nouveau commentaire sur'; 
    15  
    1615$lang['%s has subscribed to comments on'] = '%s s\'est inscrit aux commentaires de'; 
    1716$lang['Allow users to subscribe to global notifications'] = 'Autoriser les utilisateurs à s\'inscrire de façon globale'; 
     
    5453$lang['You are currently subscribed to comments on %s.'] = 'Vous êtes inscrits aux commentaires sur %s.'; 
    5554$lang['You requested to subscribe by email to comments on %s'] = 'Vous avez demandez à vous inscrire aux commentaires sur %s.'; 
     55$lang['First subscription'] = 'Premier abonnement'; 
     56$lang['Last subscription'] = 'Dernier abonnement'; 
     57$lang['All album photos'] = 'Toutes les images d\'un album'; 
     58$lang['&#9733; : registered users'] = '&#9733; : utilisateurs enregistrées'; 
     59 
    5660?> 
  • extensions/Subscribe_to_comments/main.inc.php

    r21441 r21608  
    99*/ 
    1010 
    11 /* 
    12  * potential problem : if the permissions of a user change, he receives notifications 
    13  * about photos and albums he can't see anymore 
    14  */ 
    15  
    1611if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    1712 
     
    2116define('SUBSCRIBE_TO_PATH' ,   PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/'); 
    2217define('SUBSCRIBE_TO_TABLE',   $prefixeTable . 'subscribe_to_comments'); 
     18define('SUBSCRIBE_TO_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SUBSCRIBE_TO_ID); 
    2319define('SUBSCRIBE_TO_VERSION', 'auto'); 
    2420 
     
    9894  array_push($menu, array( 
    9995    'NAME' => 'Subscribe to Comments', 
    100     'URL' => get_root_url().'admin.php?page=plugin-' . SUBSCRIBE_TO_ID, 
     96    'URL' => SUBSCRIBE_TO_ADMIN, 
    10197  )); 
    10298  return $menu; 
Note: See TracChangeset for help on using the changeset viewer.