BVB Source Codes

Guide image application for phpwind UTF8 8.7 Show imagedaogou.php Source code

Return Download Guide image application for phpwind UTF8 8.7: download imagedaogou.php Source code - Download Guide image application for phpwind UTF8 8.7 Source code - Type:.php
  1. <?php
  2.  
  3. define('DAOGOU_IS_CLOSED', 1);
  4. define('DAOGOU_NO_PERMISSION', 2);
  5. define('DAOGOU_THREAD_IS_NOT_EXISTS', 3);
  6. define('DAOGOU_PICTURE_IS_EMPTY', 4);
  7. define('DAOGOU_NOT_LOGIN', 5);
  8.  
  9. require_once ('global.php');
  10.  
  11. if (!$db_daogou_open) {
  12.         echo pwJsonEncode(array('success' => 0, 'msg' => DAOGOU_IS_CLOSED));
  13.         exit;
  14. }
  15. if (!$winduid) {
  16.         echo pwJsonEncode(array('success' => 0, 'msg' => DAOGOU_NOT_LOGIN));
  17.         exit;
  18. }
  19. if (!in_array($groupid, $db_daogou_groups)) {
  20.         echo pwJsonEncode(array('success' => 0, 'msg' => DAOGOU_NO_PERMISSION));
  21.         exit;
  22. }
  23.  
  24. S::gp(array('action'));
  25.  
  26. if ($action == 'getImageList') {
  27.  
  28.         S::gp(array('articleId', 'page'), '', 2);
  29.         $page < 1 && $page = 1;
  30.         $threadList = $aids = $attachList = $list = array();
  31.  
  32.         $read = $db->get_one("SELECT t.* ,tm.* FROM pw_threads t LEFT JOIN " . S::sqlMetadata(GetTtable($articleId)) . " tm ON t.tid=tm.tid WHERE t.tid=" . S::sqlEscape($articleId) . ' AND t.ifcheck=1');
  33.         if (!$read || $read['fid'] == 0) {
  34.                 $response = array('success' => 0, 'msg' => DAOGOU_THREAD_IS_NOT_EXISTS);
  35.                 echo pwJsonEncode($response);exit;
  36.         }
  37.         L::loadClass('forum', 'forum', false);
  38.         $pwforum = new PwForum($read['fid']);
  39.         $forumset =& $pwforum->forumset;
  40.         if ($winddb['p_num']) {
  41.                 $db_readperpage = $winddb['p_num'];
  42.         } elseif ($forumset['readnum']) {
  43.                 $db_readperpage = $forumset['readnum'];
  44.         }
  45.  
  46.         list($start, $limit) = array(($page-1)*$db_readperpage, $db_readperpage);
  47.  
  48.         if ($page == 1) {
  49.                 $read['pid'] = 0;
  50.                 $threadList[] = $read;
  51.                 $read['aid'] && $aids[] = '0';
  52.                 $limit--;
  53.         } else {
  54.                 $start--;
  55.         }
  56.         $pw_posts = getPtable($read['ptable']);
  57.         $order = 'postdate';
  58.         $limit = S::sqlLimit($start, $limit);
  59.  
  60.         $query = $db->query("SELECT * FROM $pw_posts WHERE tid=" . S::sqlEscape($articleId) . " AND ifcheck='1' ORDER BY $order $limit");
  61.         while ($read = $db->fetch_array($query)) {
  62.                 $threadList[] = $read;
  63.                 $read['aid'] && $aids[] = $read['pid'];
  64.         }
  65.         if ($aids) {
  66.                 $query = $db->query('SELECT * FROM pw_attachs WHERE tid=' . S::sqlEscape($articleId) . " AND pid IN (" . S::sqlImplode($aids) . ") AND type='img'");
  67.                 while ($rt = $db->fetch_array($query)) {
  68.                         $attachList[$rt['pid']][] = $rt;
  69.                 }
  70.         }
  71.        
  72.         foreach ($threadList as $key => $value) {
  73.                 $value['content'] = str_replace("p_w_upload", $db_attachname, $value['content']);
  74.                 $value['content'] = str_replace("p_w_picpath", $db_picpath, $value['content']);
  75.                 $atts = array();
  76.                 if (isset($attachList[$value['pid']])) {
  77.                         $atts = findImageFromAttach($attachList[$value['pid']]);
  78.                         $value['content'] = preg_replace('/\[(attachment|p_w_upload|p_w_picpath)=(\d+)\]/eis', "attach2img('\\2', \$atts)", $value['content']);
  79.                 }
  80.                 $list = array_merge($list, findImageFromContent($value['content']));
  81.                 $atts && $list = array_merge($list, array_values($atts));
  82.         }
  83.         $list = array_values(array_unique($list));
  84.  
  85.         if ($list) {
  86.                 $response = array(
  87.                         'success' => 1,
  88.                         'data' => array(
  89.                                 'picPaths' => $list
  90.                         )
  91.                 );
  92.         } else {
  93.                 $response = array('success' => 0, 'msg' => DAOGOU_PICTURE_IS_EMPTY);
  94.         }
  95.         echo pwJsonEncode($response);exit;
  96.  
  97. } elseif ($action == 'getIframeKey') {
  98.  
  99.         S::gp(array('articleId', 'picPath'));
  100.        
  101.         require_once(R_P . 'require/posthost.php');
  102.         $result = PostHost('http://huabao.taobao.com/psc/json/time.htm');
  103.  
  104.         L::loadClass('json', 'utility', false);
  105.         $Json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
  106.         $result = $Json->decode($result);
  107.        
  108.         //$result = array(0 => array('time' => $timestamp * 1000));
  109.  
  110.         $md5_key = md5($db_daogou_key . $db_daogou_siteid . $articleId . $result[0]['time'] . $winduid . $picPath);
  111.         echo pwJsonEncode(array(
  112.                 'success' => 1,
  113.                 'data' => array(
  114.                         'key' => $md5_key,
  115.                         'time' => $result[0]['time']
  116.                 )
  117.         ));exit;
  118.  
  119. } elseif ($action == 'setAuctionFlag') {
  120.        
  121.         S::gp(array('articleId'));
  122.        
  123.         $threadService = L::loadClass('threads', 'forum');
  124.         $threadService->setTpcStatusByThreadId($articleId, 9);
  125.  
  126.         echo pwJsonEncode(array('success' => 1));
  127.         exit;
  128. }
  129.  
  130. function attach2img($aid, &$atts) {
  131.         if (isset($atts[$aid])) {
  132.                 $path = $atts[$aid];
  133.                 unset($atts[$aid]);
  134.                 return '[img]' . $path . '[/img]';
  135.         }
  136.         return '[attachment=' . $aid . ']';
  137. }
  138.  
  139. function findImageFromContent($content) {
  140.         global $db_bbsurl;
  141.         $array = array();
  142.         preg_match_all("/\[img\]([^\<\r\n\"']+?)\[\/img\]/is", $content, $matchs);
  143.         if ($matchs) {
  144.                 foreach ($matchs[1] as $key => $value) {
  145.                         list($url) = explode('?', $value, 2);
  146.                         $ext = strtolower(substr(strrchr($url, '.'), 1));
  147.                         if (in_array($ext, array('jpg','jpeg','png', 'bmp'))) {
  148.                                 $array[] = (substr($value, 0, 4) != 'http' ? rtrim($db_bbsurl, '/') . '/' : '') . $value;
  149.                         }
  150.                 }
  151.         }
  152.         return $array;
  153. }
  154.  
  155. function findImageFromAttach($attachs) {
  156.         global $db_bbsurl;
  157.         $list = array();
  158.         foreach ($attachs as $key => $value) {
  159.                 $ext = strtolower(substr(strrchr($value['attachurl'], '.'), 1));
  160.                 if (!in_array($ext, array('jpg','jpeg','png', 'bmp'))) {
  161.                         continue;
  162.                 }
  163.                 $a_url = geturl($value['attachurl'], 'show', $value['ifthumb'] & 1);
  164.                 if (is_array($a_url)) {
  165.                         $list[$value['aid']] = (($a_url[1] == 'Local' && substr($a_url[0], 0, 4) != 'http') ? rtrim($db_bbsurl, '/') . '/' : '') . $a_url[0];
  166.                 }
  167.         }
  168.         return $list;
  169. }
  170. ?>
downloadimagedaogou.php Source code - Download Guide image application for phpwind UTF8 8.7 Source code
Related Source Codes/Software:
Link grid edition v2.0 beautification - Function description: 2016-10-18
Beautify the edition/PHP order submission system with the function of E-mail and SMS alerts - Program description: Currently most downloadable A... 2016-10-18
Optimal source v2.02 moxa english-chinese translation translation - The background of new online editing template the ... 2016-10-18
8 boy simple m table v2.0 - Multi-purpose domain meters super easy procedure, ... 2016-10-18
Canphp framework v1.5 (PHP framework) - CanPHP framework (CP for short) is a simple, free,... 2016-10-18
Black tea bus system v1.0 generated photographs - Welcome to download to use bus system generated ph... 2016-10-18
Youtube android smartphone v1.1.1 self-build system - A station system could lead to a trend of the time... 2016-10-18
Link automatic collection system v3.0 utf8 - Link automatic collection system background automa... 2016-10-18
Hpmailer mail class v5.1 - PHPMailer is a PHP function for sending e-mail pac... 2016-10-18
Mobile phone number belongs to query v1.0 - Phone number contains 160000 data query applicatio... 2016-10-18
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top