差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
web:cpg [2008/01/01] administratorweb:cpg [不明な日付] (現在) – 外部編集 (不明な日付) 127.0.0.1
行 1: 行 1:
 +====== CPGの改造 ======
 +Coppermine Photo Galleryは写真を管理するウェブアプリケーションです。
  
 +===== ブログとの連携 =====
 +
 +ブログと組み合わせると便利なのですが、写真のリンクソースを表示させる改造をします。
 +  - editOnePic.php<code php>// If this is the users gallery icon then check it</code>と書いてある行の前に下記のソースを挿入。<code php>$homepage = $CONFIG['site_url'];
 +
 +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;</code>これをUTF-8で保存。
 +  - editpics.php<code php>function form_options()
 +{
 +    global $CURRENT_PIC, $lang_editpics_php;
 +
 +    $isgalleryicon_selected = …
 +    $isgalleryicon_disabled = …</code>の後に下記のソースを挿入<code php>       $thumb_url = get_pic_url($CURRENT_PIC, 'thumb');
 +       $thumb_link = 'displayimage.php?&amp;pos='.(-$CURRENT_PIC['pid']);
 +
 +$homepage = $CONFIG['site_url'];
 +
 +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;</code>globalを追加<code php>    global $CONFIG;</code>
 +
 +
 +===== xreaのデータベース対策 =====
 +
 +include/function.inc.php<code 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;
 +}</code>
 +
 +
 +===== キーワードのデリミタを適切にする =====
 +
 +キーワードは、半角スペースで区切ります。
 +全角で入力してしまった場合、一括で置換しましょう。
 +
 +<code sql>update cpg132_pictures set keywords=replace(keywords,' ',' ')</code>
 +
 +===== CPGのコメントスパム対策 =====
 +
 +Coppermine Photo Galleryは写真を管理するウェブアプリケーションです。
 +このコメントスパム対策をします。
 +元の記事は
 +http://coppermine-gallery.net/forum/index.php?topic=33827.0
 +
 +==== ダウンロード ====
 +
 +  - Akismet API keyを入手する http://wordpress.com/api-keys/
 +  - ライブラリを入手
 +    * PHP4用 http://miphp.net/blog/view/php4_akismet_class
 +    * PHP5用 http://www.achingbrain.net/stuff/akismet/
 +  - 解凍した中にあるAkismet.class.phpをCPGのルートへアップロードする。
 +
 +==== 設定 ====
 +
 +db_input.phpを開く
 +
 +  - 最初の方に<code php>include 'Akismet.class.php';</code>を加える。
 +  - $insert = cpg_db_queryを含む行が2つありますが、その最初の方の行の前に<code php>$WordPressAPIKey =  'your Akismet API key goes here';
 +$MyBlogURL = 'http://www.example.com/coppermine_root_dir/';
 +$name = $msg_author;
 +$comment = $msg_body;
 +
 +$akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
 +$akismet->setCommentAuthor($name);
 +$akismet->setCommentAuthorEmail($email);
 +$akismet->setCommentAuthorURL($url);
 +$akismet->setCommentContent($comment);
 +$akismet->setPermalink('http://www.example.com/blog/alex/someurl/');
 +
 +if($akismet->isCommentSpam())
 +// store the comment but mark it as spam (in case of a mis-diagnosis)
 +cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
 +else</code>を挿入する。
 +
 +  * このelseの後ろで、<code php>$insert = cpg_db_query("INSERT INTO {$CONFIG…</code>という行が実行される。