예제 #1
0
 function show_handler($params, $node)
 {
     global $FUNCS, $CTX;
     if (!count($node->children)) {
         return;
     }
     extract($FUNCS->get_named_vars(array('var' => ''), $params));
     $var = trim($var);
     if ($var) {
         // get the data array from CTX
         $obj =& $CTX->get_object($var);
         if ($obj) {
             // set component values as $CTX variables
             $CTX->set('file_id', $obj['file_id']);
             $CTX->set('file_name', $obj['file_name']);
             $CTX->set('file_ext', $obj['file_ext']);
             $is_image = SecureFile::_is_image($obj['file_ext']) ? 1 : 0;
             $CTX->set('file_is_image', $is_image);
             $CTX->set('file_size', $obj['file_size']);
             // and call the children tags
             foreach ($node->children as $child) {
                 $html .= $child->get_HTML();
             }
         }
         return $html;
     }
 }
예제 #2
0
 function show_handler($params, $node)
 {
     global $FUNCS, $CTX, $DB;
     if (!count($node->children)) {
         return;
     }
     extract($FUNCS->get_named_vars(array('var' => '', 'with_hits' => '0'), $params));
     $var = trim($var);
     $with_hits = $with_hits == 1 ? 1 : 0;
     if ($var) {
         // get the data array from CTX
         $obj =& $CTX->get_object($var);
         if ($obj) {
             // set component values as $CTX variables
             $CTX->set('file_id', $obj['file_id']);
             $CTX->set('file_name', $obj['file_name']);
             $CTX->set('file_ext', $obj['file_ext']);
             $is_image = SecureFile::_is_image($obj['file_ext']) ? 1 : 0;
             $CTX->set('file_is_image', $is_image);
             $CTX->set('file_size', $obj['file_size']);
             // hit count
             $hit_count = '0';
             if ($with_hits) {
                 $rs = $DB->select(K_TBL_ATTACHMENTS, array('hit_count'), "attach_id='" . $DB->sanitize($obj['file_id']) . "'");
                 if (count($rs)) {
                     $hit_count = $rs[0]['hit_count'];
                 }
             }
             $CTX->set('file_hit_count', $hit_count);
             // and call the children tags
             foreach ($node->children as $child) {
                 $html .= $child->get_HTML();
             }
         }
         return $html;
     }
 }