buachompoox โพสต์ 2007-12-19 05:30:35

AP services plug-in beta version For Discuz! 6.0.0/5.5.0/5.0.0

เป็นปลั้กอินที่เอาไว้จัดการเกี่ยวกับการโพสรูปภาพทีล่ะมากๆสะดวกต่อผู้ชม

DEMO : http://www.v9vv.com/bbs/

ก่อนการติดตั้งโปรดสำรองข้อมูลไว้ก่อนนะครับ

- อัพโหลดไฟล์ที่แตกซิบออกมาไว้ตามที่อยู่
- CHMOD 777    viewimages.html ,   viewthread.html ,   post_js.html ,post_editor.htmlใน\templates\default
- ทำการติดตั้งรัน image_install.php ==> http://www.yourdomain.com/image_install.php
- ติดตั้งเสร็จลบไฟล image_install.php ออก เป็นอันจบ
- เข้าไปที่ admincp ===> Extended Conf.===> AP functionเลือกBinding AP account

http://img210.imageshack.us/img210/5059/flash002qi6.jpg

ใน Binding AP account ให้เราใส่ อีเมล์ ลงไป(ส่วนใหญ่ตอนติดตั้งจะติดปัญหาตรงนี้บ่อยๆพยายามลองๆหลาย อีเมล์ดู)
ถ้าทำผ่านระบบจะส่งหรัสเอาไว้ล็อคอินเข้าตรง เมนูParameter setting ได้

http://img209.imageshack.us/img209/9056/flash003ih1.jpg

ใน Parameter setting จะเป็นการเปิดใช้งาน AP service

http://img65.imageshack.us/img65/2133/flash004vn2.jpg

อย่าลืมUpdate Caches ด้วยนะครับ !!!

เพิ่มเติมด้านล่างสำหรับคนที่MODเยอะแล้วอยากลงแต่กลัวมานตีกาน

**** Hidden Message *****') === FALSE)&& (isattachmentimage($pid) || strpos($message, '') !== FALSE)) {
                updateimaget($pid, $tid, 1, intval(strpos($message, '') !== FALSE));
      }

      if($qihoo_image_openp && $phid) {

                updateimagep($pid, $tid, $phid);
               
                if(empty($subject)) {
                        $threadsubject = $db->fetch_array($db->query("SELECT subject FROM {$tablepre}threads WHERE tid='$tid'"));
                        $subject = $threadsubject['subject'];
                }

                        dfopen($isiteurl."/discuz/update.php?sid=$isiteid&code=".urlencode(authcode("spassword=$ipassword&phid=$phid&tid=$tid&pid=$pid&uid=".$postinfo['authorid']."&ctime=".$postinfo['dateline']."&mtime=$timestamp", '', $ikey))."&title=".urlencode($subject)."&content=".urlencode(spacecutstr($message, 500)), 10000, '', '', TRUE, '', 20, FALSE);
      }Preservation, and withdraw from the
==========================================
13. Include \ newthread.inc.php
Find      if($iscircle && $sgid) {
                supe_dbconnect();
                $query = $supe['db']->query("UPDATE {$supe}groups SET lastpost='$timestamp' WHERE gid='$sgid'", 'SILENT');
      }In addition, above      //Note qihoo theme of the open map circumstances, upload pictures annex, the contents of articles call updateimaget function.
      if($qihoo_image_opent && (strpos($message, '') === FALSE) && (isattachmentimage($pid) || strpos($message, '') !== FALSE)) {
                updateimaget($pid, $tid, 1, intval(strpos($message, '') !== FALSE));
      }

      if($qihoo_image_openp && $phid) {

                updateimagep($pid, $tid, $phid);
                dfopen($isiteurl."/discuz/update.php?sid=$isiteid&code=".urlencode(authcode("spassword=$ipassword&phid=$phid&tid=$tid&pid=$pid&uid=".$postinfo['authorid']."&ctime=".$postinfo['dateline']."&mtime=$timestamp", '', $ikey))."&title=".urlencode($subject)."&content=".urlencode(spacecutstr($message, 500)), 10000, '', '', TRUE, '', 20, FALSE);
      }Preservation, and withdraw from the
=====================================
14. Include \ post.func.php
Findfunction arrayslice($array, $offset, $length) {
      if(PHP_VERSION >= '5.0.2') {
                return array_slice($array, $offset, $length, TRUE);
      } else {
                $array = array_chunk($array, $length, TRUE);
                return $array[$offset / $length];
      }
}Below thefunction isattachmentimage($pid) {
      global $db, $tablepre;

      $isattachmentimage = 0;
      $query = $db->query("SELECT isimage FROM {$tablepre}attachments WHERE pid='$pid'");
      while($imageinfo = $db->fetch_array($query)) {
                $isattachmentimage = empty($imageinfo['isimage']) ? $isattachmentimage : $imageinfo['isimage'];
      }
      return $isattachmentimage;
}
function isubbimage($pid) {
      global $db, $tablepre;

      $isubbimage = 0;
      $query = $db->query("SELECT hasimage FROM {$tablepre}qihooimages WHERE pid='$pid'");
      while($imageinfo = $db->fetch_array($query)) {
                $isubbimage = empty($imageinfo['hasimage']) ? $isubbimage : $imageinfo['hasimage'];
      }
      return $isubbimage;
}

function updateimaget($pid, $tid, $type, $hasimage) {
      global $db, $tablepre, $timestamp;

      $hasimage = $hasimage ? '1' : '0';

      if($type == 2 || $type == 1) {

                $postimageurl = $db->fetch_array($db->query("SELECT * FROM {$tablepre}qihooimages WHERE pid='$pid'"));
                if($postimageurl['pid']) {
                        $sqlmode = 'UPDATE';
                        $sqltype = $postimageurl['type'] == '1' && $postimageurl['status'] == '1' ? '1' : '2';
                        $sqlconditions = "WHERE pid='$pid'";
                } else {
                        $sqlmode = 'INSERT INTO';
                        $sqltype = '1';
                        $sqlconditions = '';
                }
                $sql = "$sqlmode {$tablepre}qihooimages SET pid='$pid', tid='$tid', dateline='$timestamp', hasimage='$hasimage', type='$sqltype', status='1' $sqlconditions";

      } elseif($type == 3) {
                $sql = "UPDATE {$tablepre}qihooimages SET dateline='$timestamp', hasimage='$hasimage', type='3', status='1' WHERE pid='$pid'";
      }
//echo $sql; exit;
      if(!empty($sql)) {
                $db->query($sql);
                updatetoqihoo();
      }
}
function updateimagep($pid, $tid, $phid) {
      global $db, $tablepre;

      $postimagep = $db->fetch_array($db->query("SELECT pid FROM {$tablepre}qihooimages WHERE pid='$pid'"));
      if($postimagep['pid']) {
                $sqlmode = 'UPDATE';
                $sqlconditions = "WHERE pid='$pid'";
      } else {
                $sqlmode = 'INSERT INTO';
                $sqlconditions = '';
      }

      $db->query("$sqlmode {$tablepre}qihooimages SET pid='$pid', tid='$tid', phid='$phid' $sqlconditions");
}

function updatetoqihoo ($type = '0') {
      global $db, $tablepre, $isiteid, $ikey, $ipassword,$updatetoqihoo, $pid, $tid,$timestamp,$isiteurl;
      
      if(empty($updatetoqihoo)) {
                $returninfo = dfopen($isiteurl."/discuz/notify.php?sid=$isiteid&code=".urlencode(authcode('spassword='.$ipassword, '', $ikey)), 10000, '', '', TRUE, '', 20, FALSE);
                $updatetoqihoo = '1';
      }
      if($type == '2') {
                $db->query("UPDATE {$tablepre}qihooimages SET type='2', dateline='$timestamp',status='1' WHERE pid='$pid'");
      }
}

function spacecutstr($str, $length) {
      global $_DCACHE;
      include_once DISCUZ_ROOT.'./forumdata/cache/cache_post.php';
      $bbcodes = 'b|i|u|color|size|font|align|list|indent|url|email|code|free|table|tr|td|img|swf|payto|float'.($_DCACHE['bbcodes_display'] ? '|'.implode('|', array_keys($_DCACHE['bbcodes_display'])) : '');
      $str = dhtmlspecialchars(cutstr(strip_tags(preg_replace(array(
                        "/\(.+?)\[\/hide\]/is",
                        "/\(.*)\[\/quote]/siU",
                        "/\[($bbcodes)=?.*\]/iU",
                        "/\[\/($bbcodes)\]/i",
                        "/\(\d+)\[\/attach\]/i",
                        "/\\s*([^\[\<\r\n]+?)\s*\[\/media\]/i",
                ), array(
                        '',
                        '',
                        '',
                        '',
                        '',
                        "\\5"
                ), $str)), $length));
      $find = array("/http:\/\/+?\.(jpg|gif|png|bmp)/is", "/(\n|\r|\r\n){2,}/", "/\s{2,}/");
      $replace = array("<img onload=\"if(this.width>320) {this.resized=true;this.width=320;}\" src=\"\\0\">", "\r\n", '');
      $str = preg_replace($find, $replace, $str);
      return trim(nl2br($str));
}Preservation, and withdraw from the
============================================
15. \ Templates \ default \ post_editor.htm
Find                                        <!--{if $forum['allowmediacode']}-->
                                                <div class="popupmenu_popup" id="{$editorid}_popup_media_menu" style="width: 240px;display: none">
                                                <input type="hidden" id="{$editorid}_mediatype" value="ra">
                                                <input type="hidden" id="{$editorid}_mediaautostart" value="0">
                                                <table cellpadding="4" cellspacing="0" border="0" unselectable="on">
                                                <tr class="popupmenu_option">In the above plus                                                <div class="popupmenu_popup" id="{$editorid}_popup_image_menu" style="width: 240px;display: none" unselectable="on">
                                                                {lang post_discuzcode_imageurl}:

                                                                <input id="{$editorid}_imageurl" size="40" value=""/>

                                                                Photo Description:
                                                                <input id="{$editorid}_imagedescription" size="40" value=""/>
                                                                <center><input type="button" size="8" value="{lang submit}" onclick="setimagecode('$editorid')"> <input type="button" onclick="hideMenu()" value="{lang cancel}" /></center>
                                                </div>Continue to look for                <!--{if $allowpostattach}-->
                        <table class="box" summary="Upload" cellspacing="0" cellpadding="0">
                              <thead>In addition, above                <!--{if $qihoo_image_openp}-->
                        <script type="text/javascript">
                              var qihoo_image_openp = 1;
                              lang['phidstatus'] = 'Please complete Flash preserved, otherwise they will be lost data!;
                              function setImageInfo(phid, phidstatus) {
                                        $('phid').value = phid;
                                        $('phidstatus').value = phidstatus;
                              }
                        </script>
                        <!--{eval $phidstring = empty($postinfo) ? '' : '&phid='.$postinfo;}-->
                        <!--{eval $code = "&spassword=$ipassword&tid=$tid&pid=$pid".$phidstring;}-->
                        <!--{eval $code = urlencode(authcode($code,"",$ikey))}-->
                        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="uploadimages" width="750" height="240" align="middle">
                        <param name="allowScriptAccess" value="always" />
                        <param name="FlashVars" value="sid=$isiteid&code=$code{$phidstring}">
                        <param name="movie" value="http://p.qihoo.com/flash/upload.swf" />
                        <param name="quality" value="high" />
                        <param name="bgcolor" value="#FFFFFF" />
                        <embed src="http://p.qihoo.com/flash/upload.swf" quality="high" bgcolor="#FFFFFF" width="750" height="240" swLiveConnect=true id="uploadimages" name="uploadimages" align="middle" allowScriptAccess="always" FlashVars="sid=$isiteid&code=$code{$phidstring}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
                        </object>
                        <input type="hidden" name="phid" id="phid" value="$postinfo" />
                        <input type="hidden" name="phidstatus" id="phidstatus" value="0" />
                <!--{/if}-->Preservation, and withdraw from the
==============================================
16. Templates \ default \ viewthread.htm
Find                                                      <div id="postmessage_$post" class="t_msgfont">$post</div>Note: Add two-step
1. Added in the above                                                <!--{if $post['first'] == 1 && $qihoo_image_opent && !$post['attachment']}-->
                                                      <!--{if $issetthid && empty($qihoothid)}-->
                                                      <div class="qihooimage" style="float:right;"><a href="viewimages.php?tid=$post&pid=$post" target="_blank"><img src="images/common/viewimage.gif"></a></div>
                                                      <!--{elseif $qihoothid}-->
                                                      <!--{eval $thidstring = $qihoothid;}-->
                                                      <!--{eval $code = "&spassword=$ipassword&thid=$thidstring&ctime=$timestamp";}-->
                                                      <!--{eval $code = urlencode(authcode($code,"",$ikey))}-->
                                                      <div class="qihooimage" style="float:right;">
                                                                <script type="text/javascript" src="include/javascript/qihooimage.js"></script>
                                                                <script language="javascript" type="text/javascript">
                                                                        //<![CDATA[
                                                                        flashTagIns.setNew("http://p.qihoo.com/flash/miniature.swf?sid=$isiteid&code=$code", 215, 60);
                                                                        flashTagIns.setVersion("7,0,19,0");
                                                                        flashTagIns.write(document);
                                                                        //]]>
                                                                </script>
                                                      </div>
                                                      <!--{/if}-->
                                                <!--{/if}-->2. Add below                                                      <!--{if $post['qipid'] && $post['phid']}-->
                                                      <!--{eval $phidtemp = $post;}-->
                                                      <!--{eval $code = "&spassword=$ipassword&phid=$phidtemp&ctime=$timestamp";}-->
                                                      <!--{eval $code = urlencode(authcode($code,"",$ikey))}-->
                                                      <script type="text/javascript" src="include/javascript/qihooimage.js"></script>
                                                      <div class="swf">
                                                      <script language="javascript" type="text/javascript">
                                                                //<![CDATA[
                                                                flashTagIns.setNew("http://p.qihoo.com/flash/pic_view.swf?sid=$isiteid&code=$code&auto={$post['first']}", 575, 475);
                                                                flashTagIns.setVersion("7,0,19,0");
                                                                flashTagIns.write(document);
                                                                //]]>
                                                      </script>
                                                      </div>
                                                      <!--{/if}-->เป็นอันเสร็จครับ ยาวได้ใจจริงๆ   (~66~) (~66~) (~66~)


[ แก้ไขล่าสุด buachompoox เมื่อ 2007-12-19 10:21 ]

thairpg โพสต์ 2007-12-19 06:45:13

~~ ของเล่นมาใหม่อีกแล้ว
~~ ชอบมากๆ
ขอบคุณครับ~~

suthida โพสต์ 2007-12-19 07:48:10

~~ ขอบคุณมากค่ะ เยี่ยมๆ

tapo โพสต์ 2007-12-19 08:30:50

สุดยอดเลยครับ ขอบคุณจริงๆ:handshake

acaz โพสต์ 2007-12-19 09:02:04

เจ๋งดีอ่ะ....

สนุกกันละงานนี้ :lol

siammove โพสต์ 2007-12-19 13:51:33

ขอบคุณครับ:lol :lol

darkdvd โพสต์ 2007-12-19 16:13:15

ขอบคุณคับ ~~

powerppl โพสต์ 2007-12-19 16:20:44

what is?
see
thanks:victory:

ssveess โพสต์ 2007-12-19 23:18:42

ขอลองหน่อยครับ อิอิ
ปล. ขอบคุณมากครับผม :)

9vut โพสต์ 2007-12-27 23:30:08

ช่วงลองขอขอรับไปลองครับ
หน้า: [1] 2 3
ดูในรูปแบบกติ: AP services plug-in beta version For Discuz! 6.0.0/5.5.0/5.0.0