function output_HotlinksList()
 {
     global $application;
     $html_code = '';
     foreach ($this->PFHotlinks as $k => $hl_info) {
         $finfo = modApiFunc('Product_Files', 'getPFileInfo', $hl_info['file_id']);
         $template_contents = array('FileName' => ($finfo != null and file_exists($finfo['file_path']) and is_file($finfo['file_path'])) ? $finfo['file_name'] : '<span style="color: red;">' . getMsg('PF', 'FILE_WAS_DELETED') . '</span>', 'HotlinkKey' => str_rev_pad($hl_info['hotlink_value'], 90), 'HotlinkValue' => $hl_info['hotlink_value'], 'HotlinkExpireDate' => date("d M Y, H:i", $hl_info['expire_date']), 'jsHotlinkED' => date("Y/m/d/H/i", $hl_info['expire_date']), 'HotlinkTries' => $hl_info['was_try'] . '/' . $hl_info['max_try'], 'HotlinkStatus' => $hl_info['status'], 'ZeroTriesButton' => '<a class="btn btn-default green' . ($hl_info['was_try'] == 0 ? ' button_disabled' : '') . '" onClick="' . ($hl_info['was_try'] == 0 ? '' : 'go(\'popup_window.php?asc_action=zero_hotlink_tries&opid=' . $this->opid . '&hl_id=' . $hl_info['hotlink_id'] . '\')') . '">' . getMsg('PF', 'BTN_ZERO_TRIES') . '</a>', 'HotlinkID' => $hl_info['hotlink_id'], 'OPID' => $this->opid);
         $this->_Template_Contents = $template_contents;
         $application->registerAttributes($this->_Template_Contents);
         $this->mTmplFiller =& $application->getInstance('TmplFiller');
         $html_code .= $this->mTmplFiller->fill("product_files/order_hotlinks/", "one-hotlink.tpl.html", array());
     }
     return $html_code;
 }
 function __formatAsVisibleRow($row)
 {
     # REVERSE_NUMBER
     $row['reverse_number'] .= '.';
     $row['reverse_number'] = $this->__colorizeValue($row['reverse_number'], $row['online_status']);
     # SEANCE_TIME
     $row['seance_time'] = modApiFunc("Localization", "SQL_date_format", $row['creation_time']);
     //.'<br>'.modApiFunc("Localization", "SQL_time_format", $row['creation_time']);
     $row['seance_time'] = $this->__colorizeValue($row['seance_time'], $row['online_status']);
     # REFERER
     //: "referer" field name should be used instead of "referrer".
     if (empty($row['referrer'])) {
         $row['referer'] = getMsg('RPTS', 'DIRECT_ACCESS');
         $row['referer'] = $this->__colorizeValue($row['referer'], $row['online_status']);
     } else {
         $u = @parse_url($row['referrer']);
         if (count($u) == 1) {
             $u = @parse_url("http://" . $row['referrer']);
             $row['referrer'] = "http://" . $row['referrer'];
         }
         $host = $u['host'];
         $hint = '<span onmouseover="return overlib(\'' . $row['referrer'] . '\');" onmouseout="return nd();">';
         $row['referer_host'] = $this->__colorizeValue(getMsg('RPTS', 'GO') . ' ' . $host, $row['online_status']);
         $row['referer'] = $hint . '<A target="_blank" style="text-decoration: none;" href="' . $row['referrer'] . '">' . $row['referer_host'] . '</A></span>';
     }
     # ENTRY_PAGE
     $parsed = @parse_url($row['entry_page']);
     if (isset($parsed['path']) and !empty($parsed['path'])) {
         $row['entry_page'] = $parsed['path'];
     }
     //        ,
     $cut_entry_page = str_rev_pad($row['entry_page'], 40);
     if ($cut_entry_page != $row['entry_page']) {
         //              ,
         $hint = '<span onmouseover="return overlib(\'<nobr>' . $row['entry_page'] . '</nobr>\');" onmouseout="return nd();">';
         $row['entry_page'] = $this->__colorizeValue($cut_entry_page, $row['online_status']);
         $row['entry_page'] = $hint . $row['entry_page'] . '</span>';
     } else {
         $row['entry_page'] = $this->__colorizeValue($row['entry_page'], $row['online_status']);
     }
     # DEPTH_OF_VISIT
     $c = 1;
     $restr = intval(modApiFunc('Settings', 'getParamValue', 'REPORTS_AND_STATISTICS', 'VIEWED_PAGES_TO_SHOW'));
     $cr = count($row['click_path']) - 1;
     if ($cr > $restr) {
         for ($ii = $restr; $ii <= $cr; $ii++) {
             unset($row['click_path'][$ii]);
         }
     }
     foreach ($row['click_path'] as $k => $v) {
         $row['click_path'][$k] = '<nobr><b>' . $c++ . ':</b> ' . $v . '</nobr>';
     }
     $msg = implode('<br>', $row['click_path']);
     if ($cr > $restr) {
         $msg .= "<br>...";
     }
     $p = $row['visit_depth'] > 1 ? getMsg('RPTS', 'PAGES') : getMsg('RPTS', 'PAGE');
     $hint = '<span onmouseover="return overlib(\'' . $msg . '\');" onmouseout="return nd();">';
     $row['visit_depth'] = $this->__colorizeValue(getMsg('RPTS', 'GO') . ' ' . $row['visit_depth'] . ' ' . $p, $row['online_status']);
     $href = 'javascript:void(0)';
     $onclick = "javascript:openURLinNewWindow('reports_click_path.php?type=robot&id=" . $row['visitor_id'] . "', 'ReportsClickPath');";
     $row['depth_of_visit'] = $hint . '<A onclick="' . $onclick . '" href="' . $href . '"  style="text-decoration: none;">' . $row['visit_depth'] . '</A></span>';
     # REMOTE_IP && REMOTE_ADDR
     $row['remote_ip'] = $this->__colorizeValue($row['remote_ip'], $row['online_status']);
     $row['remote_addr'] = $this->__colorizeValue($row['remote_addr'], $row['online_status']);
     #CRAWLER_ID
     $row['name'] = $this->__colorizeValue($row['name'], $row['online_status']);
     # VISITOR_OS_BROWSER
     /*$row['visitor_os_browser'] = $row['visitor_browser'];
             $row['visitor_os_browser'] = $this->__colorizeValue($row['visitor_os_browser'], $row['online_status']);
     
             # ONLINE_FLAG
             if ($row['online_status'] == true)
             {
                 $row['online_flag'] = getMsg('RPTS','VISITOR_STATUS_ONLINE');
             }
             else
             {
                 $row['online_flag'] = getMsg('RPTS','VISITOR_STATUS_OFFLINE');
             }
             $row['online_flag'] = $this->__colorizeValue($row['online_flag'], $row['online_status']);*/
     return $row;
 }
 function __prepareLongString($str, $len = 40, $add_hint = true)
 {
     $cut_str = str_rev_pad($str, $len);
     if ($add_hint and $cut_str != $str) {
         //              ,
         $cut_str = $this->__getHint($cut_str, $str);
     }
     return $cut_str;
 }
 function getTag($tag)
 {
     $value = null;
     if (preg_match("/^local_(.+)\$/i", $tag, $matches)) {
         switch (_ml_strtolower($matches[1])) {
             case 'orderinfolink':
                 $r = new Request();
                 $r->setView('CustomerOrderInfo');
                 $r->setKey('order_id', $this->order_id);
                 $value = $r->getURL();
                 break;
             case 'orderid':
                 $value = sprintf("%05d", $this->order_id);
                 break;
             case 'orderedproductname':
                 $value = $this->ordered_product_info['order_product_name'];
                 break;
             case 'hotlinkslist':
                 $value = $this->out_HotlinksList();
                 break;
             case 'filename':
                 $finfo = modApiFunc('Product_Files', 'getPFileInfo', $this->current_hotlink_info['file_id']);
                 $value = $finfo != null ? $finfo['file_name'] : '<span style="color: red;">' . getMsg('PF', 'FILE_WAS_DELETED') . '</span>';
                 break;
             case 'hotlinkstatus':
                 $value = $this->current_hotlink_info['status'];
                 break;
             case 'hotlinkvalue':
                 $value = $this->current_hotlink_info['hotlink_value'];
                 break;
             case 'hotlinkkey':
                 $value = str_rev_pad($this->current_hotlink_info['hotlink_value'], 90);
                 break;
             case 'hotlinkexpiredate':
                 $value = modApiFunc('Localization', 'timestamp_date_format', $this->current_hotlink_info['expire_date']) . ' ' . modApiFunc('Localization', 'timestamp_time_format', $this->current_hotlink_info['expire_date']);
                 break;
             case 'hotlinktries':
                 $value = $this->current_hotlink_info['was_try'] . '/' . $this->current_hotlink_info['max_try'];
                 break;
         }
     }
     return $value;
 }