XoopsModules25x /
mylinks
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | // $Id: qrcode.php 11158 2013-03-05 14:10:36Z zyspec $ |
||
| 3 | // ------------------------------------------------------------------------ // |
||
| 4 | // XOOPS - PHP Content Management System // |
||
| 5 | // Copyright (c) 2000 XOOPS.org // |
||
| 6 | // <http://www.xoops.org/> // |
||
| 7 | // ------------------------------------------------------------------------- // |
||
| 8 | // This program is free software; you can redistribute it and/or modify // |
||
| 9 | // it under the terms of the GNU General Public License as published by // |
||
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
||
| 11 | // (at your option) any later version. // |
||
| 12 | // // |
||
| 13 | // You may not change or alter any portion of this comment or credits // |
||
| 14 | // of supporting developers from this source code or any supporting // |
||
| 15 | // source code which is considered copyrighted (c) material of the // |
||
| 16 | // original comment or credit authors. // |
||
| 17 | // // |
||
| 18 | // This program is distributed in the hope that it will be useful, // |
||
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
| 21 | // GNU General Public License for more details. // |
||
| 22 | // // |
||
| 23 | // You should have received a copy of the GNU General Public License // |
||
| 24 | // along with this program; if not, write to the Free Software // |
||
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
| 26 | // ------------------------------------------------------------------------ // |
||
| 27 | |||
| 28 | include 'header.php'; |
||
| 29 | include_once './class/utility.php'; |
||
| 30 | //xoops_load('utility', $xoopsModule->getVar('dirname')); |
||
| 31 | |||
| 32 | $lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min'=>0)); |
||
| 33 | $cid = mylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min'=>0)); |
||
| 34 | if ( empty($lid) || empty($cid) ) { |
||
| 35 | redirect_header('index.php', 3, _MD_MYLINKS_IDERROR); |
||
| 36 | } |
||
| 37 | /* |
||
| 38 | $lid = isset($_GET['lid']) ? intval($_GET['lid']) : 0; |
||
| 39 | $cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0; |
||
| 40 | if ( empty($lid) ) { |
||
| 41 | die("No lid!"); |
||
| 42 | } elseif ( empty($cid) ) { |
||
| 43 | die("No cid!"); |
||
| 44 | } |
||
| 45 | */ |
||
| 46 | $result = $xoopsDB->query('SELECT l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . " t where l.lid={$lid} AND l.lid=t.lid and status>0"); |
||
| 47 | if (!$result) { |
||
| 48 | redirect_header('index.php', 3, _MD_MYLINKS_NORECORDFOUND); |
||
| 49 | exit(); |
||
| 50 | } |
||
| 51 | |||
| 52 | list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result); |
||
| 53 | |||
| 54 | //qrcode func |
||
| 55 | View Code Duplication | switch ($mylinks_can_qrcode) { |
|
| 56 | case _MD_MYLINKS_MEMBERONLY: |
||
| 57 | $can_qrcode = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW; |
||
| 58 | break; |
||
| 59 | case _MD_MYLINKS_ALLOW: |
||
| 60 | $can_qrcode = _MD_MYLINKS_ALLOW; |
||
| 61 | break; |
||
| 62 | case _MD_MYLINKS_DISALLOW: |
||
| 63 | default: |
||
| 64 | $can_qrcode = _MD_MYLINKS_DISALLOW; |
||
| 65 | break; |
||
| 66 | } |
||
| 67 | /* |
||
| 68 | if ( _MD_MYLINKS_DISALLOW == $can_qrcode ) { |
||
| 69 | $xoopsTpl->assign( 'mylinksextrafuncqrcode' , false ); |
||
| 70 | } else { |
||
| 71 | $xoopsTpl->assign( 'mylinksextrafuncqrcode' , true ); |
||
| 72 | } |
||
| 73 | |||
| 74 | $can_qrcode = 0; |
||
| 75 | if ( $mylinks_can_qrcode == 0 ) { |
||
| 76 | $can_qrcode = 0; |
||
| 77 | } |
||
| 78 | else if ( $mylinks_can_qrcode == 1) { |
||
| 79 | $can_qrcode = 1; |
||
| 80 | } |
||
| 81 | else if ( $mylinks_can_qrcode == 2) { |
||
| 82 | if ( $xoopsUser ) { |
||
| 83 | $can_qrcode =1; |
||
| 84 | } |
||
| 85 | else { |
||
| 86 | $can_qrcode =0; |
||
| 87 | } |
||
| 88 | } |
||
| 89 | else { |
||
| 90 | $can_qrcode = 0; |
||
| 91 | } |
||
| 92 | */ |
||
| 93 | if ( _MD_MYLINKS_DISALLOW == $can_qrcode ) { |
||
| 94 | redirect_header('index.php', 3, _MD_MYLINKS_QRCODEDISALLOWED); |
||
| 95 | exit(); |
||
| 96 | } |
||
| 97 | |||
| 98 | $myts =& MyTextSanitizer::getInstance(); |
||
| 99 | |||
| 100 | View Code Duplication | function mylinks_qrcode_convert_encoding($str, $to = 'SJIS', $from = _CHARSET) |
|
|
0 ignored issues
–
show
|
|||
| 101 | { |
||
| 102 | if (function_exists('mb_convert_encoding')) { |
||
| 103 | if (is_array($str)) { |
||
| 104 | foreach ($str as $key=>$val) { |
||
| 105 | $str[$key] = mylinks_qrcode_convert_encoding($val, $to, $from); |
||
| 106 | } |
||
| 107 | |||
| 108 | return $str; |
||
| 109 | } else { |
||
| 110 | return mb_convert_encoding($str, $to, $from); |
||
| 111 | } |
||
| 112 | } else { |
||
| 113 | return $str; |
||
| 114 | } |
||
| 115 | } |
||
| 116 | |||
| 117 | function mylinks_qrcode_encoding($data= '') |
||
| 118 | { |
||
| 119 | $data = mylinks_qrcode_convert_encoding($data); |
||
| 120 | $data = rawurlencode($data); |
||
| 121 | $data = preg_replace('/%20/', '+', $data); |
||
| 122 | |||
| 123 | return $data; |
||
| 124 | } |
||
| 125 | |||
| 126 | $link_data = array(); |
||
| 127 | $link_data['text'] = $myts->displayTarea($myts->stripSlashesGPC($description, 0)); |
||
| 128 | $link_data['title'] = $myts->htmlSpecialChars($myts->stripSlashesGPC($ltitle)); |
||
| 129 | $link_data['url'] = $myts->htmlSpecialChars($url); |
||
| 130 | $data = "{$link_data['title']}\r\n{$link_data['url']}\r\n{$link_data['text']}"; |
||
| 131 | $qrcodedata = mylinks_qrcode_encoding($data); |
||
| 132 | $linkqrcode = "<img alt='qrcode of linkdata' title='qrcode of linkdata'src='" . XOOPS_URL . "/modules/qrcode/qrcode_image.php?d={$qrcodedata}&e=M&s=4&v=0&t=P&rgb=000000'>\n"; |
||
| 133 | |||
| 134 | echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n" |
||
| 135 | ."<html>\n" |
||
| 136 | ."<head>\n" |
||
| 137 | . '<title>' . $xoopsConfig['sitename'] . "</title>\n" |
||
| 138 | ."<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n" |
||
| 139 | ."<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "'>\n" |
||
| 140 | ."<meta name='COPYRIGHT' content='Copyright (c) " . date('Y') . ' by ' . $xoopsConfig['sitename'] . "'>\n" |
||
| 141 | ."<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n" |
||
| 142 | ."<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n" |
||
| 143 | ."</head>\n" |
||
| 144 | ."<body style='background-color: #ffffff; color: #000000;'>\n" |
||
| 145 | ." <div style='width: 750px; border: 1px solid #000; padding: 20px;'>\n" |
||
| 146 | ." <div style='text-align: center; display: block; margin: 0 0 6px 0;'>\n" |
||
| 147 | ." <h2 style='margin: 0px;'>" . _MD_MYLINKS_SITETITLE . " {$link_data['title']}</h2>\n" |
||
| 148 | ." </div>\n" |
||
| 149 | ." <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" |
||
| 150 | ." <div style='text-align: left'>" . _MD_MYLINKS_SITEURL . " : {$link_data['url']}</div>\n" |
||
| 151 | ." <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" |
||
| 152 | ." <div style='text-align: left'>"._MD_MYLINKS_DESCRIPTIONC . '<br>' . $link_data['text'] . "</div>\n" |
||
| 153 | ." <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" |
||
| 154 | ." <div style='text-align: left'>LINK DATA QRCODE<br>{$linkqrcode}</div>\n" |
||
| 155 | ." <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>\n" |
||
| 156 | . ' <p>From: ' . XOOPSMYLINKURL . "/singlelink.php?cid={$cid}&lid={$lid}</p>\n" |
||
| 157 | ." </div>\n" |
||
| 158 | ." <br>\n" |
||
| 159 | ." <br>\n" |
||
| 160 | ."</body>\n" |
||
| 161 | . '</html>'; |
||
| 162 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.