Ignore:
Timestamp:
Dec 24, 2013, 1:25:03 AM (10 years ago)
Author:
mistic100
Message:

change layout of form (use colorbox for standalone) + cleaning of subscriptions page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Subscribe_to_comments/include/events.inc.php

    r26139 r26144  
    7878        }
    7979      }
    80     }
    81     else
    82     {
    83       $template->assign('STC_MODE', $_POST['stc_mode']);
     80
     81      unset($_POST['stc_mode']);
    8482    }
    8583  }
     
    160158        break;
    161159    }
     160    unset($_POST['stc_mode']);
    162161  }
    163162  else if (isset($_GET['stc_unsubscribe']))
     
    167166      $page['infos'][] = l10n('Successfully unsubscribed your email address from receiving notifications.');
    168167    }
     168  }
     169
     170  $tpl_vars = array(
     171    'ASK_MAIL' => is_a_guest() or empty($user['email']),
     172    'ON_PICTURE' => true,
     173    'ALLOW_ALBUM_IMAGES' => !empty($page['category']['id']),
     174    'ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(),
     175    );
     176
     177  if (!empty($_POST['stc_mode']))
     178  {
     179    $tpl_vars['MODE'] = $_POST['stc_mode'];
    169180  }
    170181
     
    220231    if ($subscribed)
    221232    {
    222       $template->assign(array(
    223         'SUBSCRIBED' => $subscribed,
    224         'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)),
    225         ));
    226     }
    227   }
    228   else
    229   {
    230     $template->assign('STC_ASK_MAIL', true);
     233      $tpl_vars['SUBSCRIBED'] = $subscribed;
     234      $tpl_vars['U_UNSUB'] = add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id));
     235    }
    231236  }
    232237
    233238  $template->assign(array(
    234     'STC_ON_PICTURE' => true,
    235     'STC_ALLOW_ALBUM_IMAGES' => !empty($page['category']['id']),
    236     'STC_ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(),
    237239    'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH,
     240    'STC' => $tpl_vars,
    238241    ));
    239242
     
    249252  global $page, $template, $user, $conf;
    250253
    251   if (
    252       !defined('COA_ID') or script_basename() != 'index' or
    253       @$page['section'] != 'categories' or !isset($page['category'])
    254     )
    255   {
    256     return;
    257   }
    258 
    259         // standalone subscription
     254  // standalone subscription
    260255  if (isset($_POST['stc_submit']))
    261256  {
     
    269264        break;
    270265    }
     266    unset($_POST['stc_mode']);
    271267  }
    272268  else if (isset($_GET['stc_unsubscribe']))
     
    278274  }
    279275
     276  $tpl_vars = array(
     277    'ASK_MAIL' => is_a_guest() or empty($user['email']),
     278    'ON_ALBUM' => true,
     279    'ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(),
     280    );
     281
     282  if (!empty($_POST['stc_mode']))
     283  {
     284    $tpl_vars['MODE'] = $_POST['stc_mode'];
     285  }
     286
    280287  // if registered user we check if already subscribed
    281   if ( !is_a_guest() and !empty($user['email']) )
    282   {
    283     $element_url = make_index_url(array(
    284       'section' => 'categories',
    285       'category' => $page['category'],
    286       ));
    287 
     288  if (!is_a_guest() and !empty($user['email']))
     289  {
    288290    $subscribed = false;
    289291
     
    322324    if ($subscribed)
    323325    {
    324       $template->assign(array(
    325         'SUBSCRIBED' => $subscribed,
    326         'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)),
     326      $element_url = make_index_url(array(
     327        'section' => 'categories',
     328        'category' => $page['category'],
    327329        ));
    328     }
    329   }
    330   else
    331   {
    332     $template->assign('STC_ASK_MAIL', true);
     330
     331      $tpl_vars['SUBSCRIBED'] = $subscribed;
     332      $tpl_vars['U_UNSUB'] = add_url_params($element_url, array('stc_unsubscribe'=>$stc_id));
     333    }
    333334  }
    334335
    335336  $template->assign(array(
    336     'STC_ON_ALBUM' => true,
    337     'STC_ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(),
     337    'STC' => $tpl_vars,
    338338    'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH,
    339339    ));
     
    346346 * main prefilter
    347347 */
    348 function stc_main_prefilter($content, &$smarty)
     348function stc_main_prefilter($content)
    349349{
    350350  ## subscribe at any moment ##
    351   $search = '{if isset($comments)}';
    352   $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_standalone.tpl');
    353   $content = str_replace($search, $replace.$search, $content);
     351  $search = '{if isset($comment_add)}';
     352  $add = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_outside.tpl');
     353  $content = str_replace($search, $search.$add, $content);
    354354
    355355  ## subscribe while add a comment ##
    356356  $search = '{$comment_add.CONTENT}</textarea></p>';
    357   $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_comment.tpl');
    358   $content = str_replace($search, $search.$replace, $content);
     357  $add = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_inside.tpl');
     358  $content = str_replace($search, $search.$add, $content);
    359359
    360360  return $content;
Note: See TracChangeset for help on using the changeset viewer.