現在位置: Top/CPGの改造
CPGの改造
Coppermine Photo Galleryは写真を管理するウェブアプリケーションです。
ブログとの連携
ブログと組み合わせると便利なのですが、写真のリンクソースを表示させる改造をします。
editOnePic.php
// If this is the users gallery icon then check it
と書いてある行の前に下記のソースを挿入。
$homepage = "http://photo.tpot.tk/";
print <<<EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
リンクのソース
</td>
<td width="100%" class="tableb" valign="top" colspan="2" >
<input type="text" style="width: 100%" name="user4"
maxlength="255" value='<a href="$homepage$thumb_link">
<img src="$homepage$thumb_url" class="image" border="0"
alt="{$CURRENT_PIC['title']}"/></a>' class="textinput" />
</td>
</tr>
EOT;
これをUTF-8で保存。
editOnePic.php
function form_options()
{
global $CURRENT_PIC, $lang_editpics_php;
$isgalleryicon_selected = …
$isgalleryicon_disabled = …
の後に下記のソースを挿入
$thumb_url = get_pic_url($CURRENT_PIC, 'thumb');
$thumb_link = 'displayimage.php?&pos='.(-$CURRENT_PIC['pid']);
$homepage = "http://photo.tpot.tk/";
print <<<EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
リンクのソース
</td>
<td width="100%" class="tableb" valign="top" colspan="2" >
<input type="text" style="width: 100%" name="user4" maxlength="255"
value='<a href="$homepage$thumb_link"><img src="$homepage$thumb_url"
class="image" border="0" alt="{$CURRENT_PIC['title']}"/></a>'
class="textinput" />
</td>
</tr>
EOT;
xreaのデータベース対策
include/function.php
function cpg_db_connect()
{
global $CONFIG;
$result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'],
$CONFIG['dbpass']);
if (!$result) {
return false;
}
mysql_query("SET NAMES utf8", $result);
if (!mysql_select_db($CONFIG['dbname']))
return false;
return $result;
}

