[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/template/inc_script/frontend_render/disabled/ -> access_dialog.php (source)

   1  <?php
   2  
   3  $ACCESS                    = array();
   4  
   5  $ACCESS['prefix']        = '<!-- Access //-->';
   6  $ACCESS['suffix']        = '<!-- Access Close //-->';
   7  
   8  $ACCESS['error']        = false;
   9  $ACCESS['error_js']        = 'You have to agree.';
  10  
  11  // file which contains dialog info located under 'template/inc_script/access/'
  12  $ACCESS['source_data']    = 'access_template.html';
  13  
  14  $redirect_id    = $content['struct'][ $content['cat_id'] ]['acat_struct'];
  15  $redirect        = empty($content['struct'][ $redirect_id ]['acat_alias']) ? '?id=' . $redirect_id : '?' . $content['struct'][ $redirect_id ]['acat_alias'];
  16  $redirect        = PHPWCMS_URL.'index.php'.$redirect;
  17  
  18  if(!empty($_SERVER['HTTP_REFERER']) && strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower(PHPWCMS_URL)) !== FALSE) {
  19      $redirect = $_SERVER['HTTP_REFERER'];
  20  }
  21  
  22  if(isset($_POST['agree_reject'])) {
  23  
  24      if(isset($_SESSION['phpwcmsAgree'])) {
  25          unset($_SESSION['phpwcmsAgree']);
  26      }
  27      setcookie('phpwcmsAgree', '0', time()-1000000, '/');
  28      
  29      if(isset($_POST['agree_redirect'])) {
  30          $redirect = clean_slweg($_POST['agree_redirect']);
  31      }
  32      
  33      headerRedirect($redirect);
  34  
  35  } elseif(isset($_POST['agree_agree'])) {
  36  
  37      if(empty($_POST['access_agree']) || $_POST['access_agree'] != 'agree') {
  38      
  39          $ACCESS['error'] = true;
  40      
  41      } else {
  42      
  43          setcookie('phpwcmsAgree', '1', 0, '/');
  44          $_SESSION['phpwcmsAgree'] = true;
  45  
  46      }
  47  
  48  }
  49  
  50  if(!empty($_SESSION['phpwcmsAgree']) || ( isset($_COOKIE['phpwcmsAgree']) && $_COOKIE['phpwcmsAgree'] == 1)) {
  51  
  52      $content['all'] = str_replace($ACCESS['prefix'], '', $content['all']);
  53      $content['all'] = str_replace($ACCESS['suffix'], '', $content['all']);
  54  
  55  } elseif( strpos($content['all'], $ACCESS['prefix']) !== FALSE && strpos($content['all'], $ACCESS['suffix']) !== FALSE ) {
  56  
  57      $block['custom_htmlhead']['mootools.js'] = '  <script src="'.TEMPLATE_PATH.'inc_js/mootools/mootools.js" type="text/javascript"></script>';
  58      $block['custom_htmlhead']['access.js']   = '  <script src="'.TEMPLATE_PATH.'inc_script/access/access.js" type="text/javascript"></script>';
  59      $block['custom_htmlhead']['set_vars']    = '  <script type="text/javascript">'.LF.'  <!--'.LF;
  60      $block['custom_htmlhead']['set_vars']   .= '  var redirect="'.$redirect.'";' . LF;
  61      $block['custom_htmlhead']['set_vars']   .= '  var erroralert="'.$ACCESS['error_js'].'";';
  62      $block['custom_htmlhead']['set_vars']   .= LF.'  //-->'.LF.'  </script>';
  63      $block['custom_htmlhead']['access.css']  = '  <link rel="stylesheet" type="text/css" href="'.TEMPLATE_PATH.'inc_script/access/access.css" />';
  64      
  65      $ACCESS['source_data'] = @file_get_contents(PHPWCMS_TEMPLATE.'inc_script/access/'.$ACCESS['source_data']);
  66      
  67      if($ACCESS['source_data']) {
  68      
  69          $ACCESS['source_data']  = render_cnt_template($ACCESS['source_data'], 'ERROR', $ACCESS['error'] ? '-' : '');
  70      
  71          $ACCESS['source_data']  = str_replace('{CURRENT_URL}', FE_CURRENT_URL, $ACCESS['source_data']);
  72          $ACCESS['source_data']  = str_replace('{REDIRECT}', html_specialchars($redirect), $ACCESS['source_data']);
  73  
  74          $ACCESS['dialog']  = '<div id="access_dialog">' . LF . $ACCESS['source_data'] . LF . '</div>' . LF ;
  75          $ACCESS['dialog'] .= '<div id="access_save" style="display:none">';
  76          
  77          $content['all'] = str_replace($ACCESS['prefix'], $ACCESS['dialog'], $content['all']);
  78          $content['all'] = str_replace($ACCESS['suffix'], LF . '</div>', $content['all']);
  79  
  80      }
  81  
  82  } else {
  83  
  84      $content['all'] = str_replace($ACCESS['prefix'], '', $content['all']);
  85      $content['all'] = str_replace($ACCESS['suffix'], '', $content['all']);
  86      
  87  }
  88  
  89  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7