public static function cache_start($tag_arg, &$smarty)
 {
     if (!cms_cache_handler::can_cache()) {
         return '{';
     }
     $tmp = debug_backtrace();
     $bt = array();
     foreach ($tmp as $elem) {
         $bt[] = $elem['file'] . ':' . $elem['line'];
     }
     if (!is_array(self::$_cge_cache_keys)) {
         self::$_cge_cache_keys = array();
         self::$_cge_cache_keystack = array();
     }
     $nn = '';
     while ($nn == '' || $nn < 100) {
         $keyr = 'v' . md5(serialize($bt) . cms_utils::get_current_pageid() . cge_url::current_url());
         $key = $keyr . $nn;
         if (!in_array($key, self::$_cge_cache_keys)) {
             break;
         }
         if ($nn == '') {
             $nn = 1;
         }
         $nn = $nn++;
     }
     if ($key == '') {
         return '{';
     }
     self::$_cge_cache_keys[] = $key;
     self::$_cge_cache_keystack[] = $key;
     $output = "\${$key}=cms_cache_handler::get_instance()->get('{$key}','cge_cache'); if(\${$key}!=''){echo '<!--cge_cache-->'.\${$key};}else{ob_start();";
     return $output;
 }
 public static function redirect_http($url = '', $force = false)
 {
     if (empty($url)) {
         $url = cge_url::current_url();
     }
     if (startswith($url, 'http:')) {
         // nothing to do.
         return;
     }
     $config = cmsms()->GetConfig();
     if ($force) {
         $new_url = str_replace('https:', 'http:', $url);
         redirect($new_url);
     } else {
         if (startswith($url, $config['ssl_url']) && isset($config['ssl_url'])) {
             $new_url = str_replace($config['ssl_url'], $config['root_url'], $url);
             redirect($new_url);
         }
     }
 }
 public static function cache_start($tag_arg, $smarty)
 {
     $output = '';
     if (!cms_cache_handler::get_instance()->can_cache()) {
         $output = '{';
     } else {
         $bt = debug_backtrace();
         if (!is_array(self::$_cge_cache_keys)) {
             self::$_cge_cache_keys = array();
             self::$_cge_cache_keystack = array();
         }
         $nn = '';
         while ($nn == '' || $nn < 100) {
             $keyr = 'v' . md5(serialize($bt) . cms_utils::get_current_pageid() . cge_url::current_url());
             $key = $keyr . $nn;
             if (!in_array($key, self::$_cge_cache_keys)) {
                 break;
             }
             if ($nn == '') {
                 $nn = 1;
             }
             $nn = $nn++;
         }
         if ($key == '') {
             return '{';
         }
         self::$_cge_cache_keys[] = $key;
         self::$_cge_cache_keystack[] = $key;
         $output = "\${$key}=cms_cache_handler::get_instance()->get('{$key}','cge_cache'); if(\${$key}!=''){echo '<!--cge_cache-->'.\${$key};}else{ob_start();";
     }
     if (version_compare(CMS_VERSION, '1.11-alpha0') < 0) {
         return $output;
     }
     return '<?php ' . $output . ' ?>';
 }
    $smarty->assign('captcha', $captcha->getCaptcha());
}
$username = isset($params['feu_input_username']) ? $params['feu_input_username'] : '';
$password = isset($params['feu_input_password']) ? $params['feu_input_password'] : '';
$rememberme = isset($params['feu_rememberme']) ? $params['feu_rememberme'] : '';
$inline = true;
if (isset($params['noinline'])) {
    $inline = false;
}
// if( !isset($params['returnto']) )
//   {
//     $params['returnto'] = $returnid;
//   }
$cge = $this->GetModuleInstance('CGExtensions');
if ($cge && isset($params['returnlast'])) {
    $this_url = cge_url::current_url();
    $_SESSION['feu_prelogin_url'] = $this_url;
    $smarty->assign('feu_prelogin_url', $this_url);
}
$smarty->assign('error', isset($params['error']) ? $params['error'] : '');
$smarty->assign('startform', $this->feCreateFormStart($id, 'do_login', $returnid, $inline, 'post', '', '', $params));
$smarty->assign('id_username', $id . 'feu_input_username');
if ($this->GetPreference('username_is_email')) {
    $smarty->assign('prompt_username', $this->Lang('prompt_email'));
} else {
    $smarty->assign('prompt_username', $this->Lang('prompt_username'));
}
/*
$smarty->assign('input_username', 
		$this->CreateInputText( $id, 'feu_input_username',
					$username,
$smarty->clear_assign('error');
//
// Give everything to smarty
//
$params['key1'] = $comment->key1;
$params['key2'] = $comment->key2;
$params['key3'] = $comment->key3;
if (!empty($error)) {
    $smarty->assign('error', $error);
} else {
    if (!empty($message)) {
        $smarty->assign('message', $message);
    }
}
if (!isset($params['destpage']) && !isset($params['feedback_origurl'])) {
    $params['feedback_origurl'] = cge_url::current_url();
}
$tmp = array_keys($tfields);
foreach ($tmp as $fid) {
    switch ($tfields[$fid]['type']) {
        case 2:
            $val = $comment->get_field_by_id($fid);
            if ($val == '') {
                if (isset($tfields[$fid]['dfltcontent'])) {
                    $val = $tfields[$fid]['defaultcontent'];
                }
            }
            $tfields[$fid]['input'] = $this->CreateTextArea(isset($tfields[$fid]['attrib']['usewysiwyg']) && $tfields[$fid]['attrib']['usewysiwyg'] == 1 && $this->GetPreference('allow_comment_wysiwyg', 0), $id, $val, 'field_' . $tfields[$fid]['id']);
            break;
    }
}
            $str .= '}';
            $onerow->control = $this->ProcessTemplateFromData($str);
            break;
    }
    $rowarray[$onerow->name] = $onerow;
}
$inline = $this->GetPreference('inline_forms', true);
if (isset($params['noinline'])) {
    $inline = false;
}
// and the rest of the stuff
$smarty->assign('startform', $this->CreateFormStart($id, 'reguser', $returnid, 'post', '', $inline));
$smarty->assign('endform', $this->CreateFormEnd());
$smarty->assign('title', $this->Lang('user_registration'));
$allow_overwrite = isset($params['allowoverwrite']) ? $params['allowoverwrite'] : 0;
$smarty->assign('hidden', $this->CreateInputHidden($id, 'orig_url', cge_url::current_url()) . $this->CreateInputHidden($id, 'group_id', $grpid) . $this->CreateInputHidden($id, 'pkg', $params['pkg']), $this->CreateInputHidden($id, 'group', $params['group']) . $this->CreateInputHidden($id, 'allowoverwrite', $allow_overwrite));
$smarty->assign('controls', $rowarray);
$smarty->assign('controlcount', count($rowarray));
$smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', $this->Lang('submit')));
$smarty->assign('msg_sendanotheremail', $this->Lang('msg_sendanotheremail'));
$smarty->assign('link_sendanotheremail', $this->CreateLink($id, 'default', $returnid, $this->Lang('clickhere'), array('mode' => 'sendanotheremail'), '', false, true));
$captcha =& $this->GetModuleInstance('Captcha');
if (is_object($captcha) && !isset($params['nocaptcha'])) {
    $smarty->assign('captcha_title', $this->Lang('captcha_title'));
    $smarty->assign('captcha', $captcha->getCaptcha());
    $smarty->assign('input_captcha', $this->CreateInputText($id, 'input_captcha', '', 10));
}
// todo, put this into the database and let the admin play with it.
echo $this->ProcessTemplateFromDatabase('selfreg_reg1template');
#
# EOF