<?php if($GLOBALS['Auth']->getUserType() == USERTYPE_USER) { ?>
      <table class="mb10" border=0 width="100%" cellspacing=0 cellpadding=0 height=22>
      <tr>
        <td align=left height=22>
        	<table>
        	<?php if (($GLOBALS['Auth']->getSetting('Aff_link_style') == LINK_STYLE_NEW) && ($this->a_Auth->getSetting('Aff_main_site_url') != '') && ($this->a_Auth->getSetting('Aff_default_campaign') != '_')) {

                //静态化URL处理
                $staticrule = $this->a_Auth->getSetting('Aff_main_site_url_static_rule');
                //$staticrule = '[domain]/affiliates/[key]/[value].html';
                if(
                    $staticrule == '' ||
                    !preg_match('[domain]',$staticrule) ||
                    !preg_match('[key]',$staticrule) ||
                    !preg_match('[value]',$staticrule)
                ) {
                    //URL智能化
                    $safeurl = $GLOBALS['Auth']->getSetting('Aff_main_site_url');
                    $urldata = explode('/',$safeurl);
                    $dkey = count($urldata) - 1;
                    if($urldata[$dkey]=='') {  //结尾是 "/"
                        $safeurl .= '?';
                    }else {
                        //结尾带参数 “?name=value”
                        if(preg_match("/\?[a-zA-Z0-9]+=[a-zA-Z0-9]+/",$urldata[$dkey]))
                            $safeurl .= '&';
                        else {
                        //结尾不是"/"，也没有带参数
                            $pathinfo = pathinfo($urldata[$dkey]);
                            if(!empty($pathinfo['extension']) && !empty($pathinfo['filename']))
                                $safeurl .= '?';
                            else
                                $safeurl .= '/?';
                        }
                    }

                    $final_link = $safeurl.PARAM_A_AID.'='.$GLOBALS['Auth']->getRefD();
                }else {
                    preg_match('#https?://(.*?)($|/)#m', $GLOBALS['Auth']->getSetting('Aff_main_site_url'), $r);
                    $safeurl = $r[0];
                    if(substr($r[0],-1)=="/") {
                        $safeurl = substr($safeurl,0,strlen($safeurl)-1);
                    }
                    $final_link = str_replace('[domain]',$safeurl,$staticrule);
                    $final_link = str_replace('[key]',PARAM_A_AID,$final_link);
                    $final_link = str_replace('[value]',$GLOBALS['Auth']->getRefD(),$final_link);
                }
            ?>
        		<tr><td width="100"><b><?php echo L_G_YOURAFFILIATELINK?>：</b></td>
        			<td><?php echo  ' <font color="#ff0000">'.$final_link.'</font>'; ?>&nbsp;&nbsp;<?php showQuickHelp(L_G_HLP_GENAFFLINK); ?></td>
        		</tr>
        	<?php } ?>
        	<?php if (($GLOBALS['Auth']->getSetting('Aff_replication_enable') == '1') && ($this->a_Auth->getSetting('Aff_replication_url') != '')) { ?>
        		<tr><td><b><?php echo L_G_YOURSITELINK?>：</b></td>
        			<td><?php echo  ' <font color="#ff0000">'.rtrim($GLOBALS['Auth']->getSetting('Aff_replication_url'), "/\\").'/'.$GLOBALS['Auth']->getRefD().'.html</font>'; ?>&nbsp;&nbsp;<?php showQuickHelp(L_G_HLP_SITELINK); ?></td>
        		</tr>
        	<?php } ?>
        	</table>
        </td>
        <?php $ballance = $GLOBALS['Auth']->getEarnedCommissions()?>
        <td align=right><b><?php echo L_G_YOURBALANCE?>:
        	<font color="#ff0000"><?php echo L_G_APPROVED?> <?php echo Affiliate_Merchants_Bl_Settings::showCurrency($ballance['approved'])?></font>
        	</b>
        	(<font color="#000000"><?php echo L_G_PENDING?> <?php echo Affiliate_Merchants_Bl_Settings::showCurrency($ballance['pending'])?></font>)
        </td>
      </tr>
      </table>
<?php } ?>