Ticket #666: cookies.diff
| File cookies.diff, 1.7 KB (added by omry, 5 years ago) |
|---|
-
subscribe-to-comments.php
19 19 <?php /* ------------------------------------------------------------------- */ ?> 20 20 <?php /* This is the text that is displayed for users who are NOT subscribed */ ?> 21 21 <?php /* ------------------------------------------------------------------- */ ?> 22 <script type="text/javascript"> 23 function stc_createCookie(name,value,days) { 24 if (days) { 25 var date = new Date(); 26 date.setTime(date.getTime()+(days*24*60*60*1000)); 27 var expires = "; expires="+date.toGMTString(); 28 } 29 else var expires = ""; 30 document.cookie = name+"="+value+expires+"; path=/"; 31 } 22 32 33 function stc_state_changed(){ 34 var e = document.getElementById("subscribe"); 35 stc_createCookie('subscribed_to_comments',e.checked,100000); 36 } 37 </script> 23 38 <p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments"> 24 <input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;" <?php if ($sg_subscribe->default_subscribed) echo 'checked="checked" '; ?>/> 39 <?php 40 if (isset($_COOKIE["subscribed_to_comments"])) 41 { 42 $checked = $_COOKIE["subscribed_to_comments"]== 'true' ? 'checked="checked"': ''; 43 } 44 else 45 { 46 if ($sg_subscribe->default_subscribed) $checked = 'checked="checked"'; 47 } 48 ?> 49 <input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;" <?php echo "$checked" ?> onclick='stc_state_changed()'/> 25 50 <label for="subscribe"><?php echo $sg_subscribe->not_subscribed_text; ?></label> 26 51 </p> 27 52
