| 1 |
<?php |
<?php |
| 2 |
// $Id: flag_content.module,v 1.6.2.12.2.1 2008/03/11 23:50:52 kbahey Exp $ |
// $Id: flag_content.module,v 1.6.2.12.2.2 2008/05/03 14:46:42 kbahey Exp $ |
| 3 |
|
|
| 4 |
// Copyright 2006-2007 Khalid Baheyeldin http://2bits.com |
// Copyright 2006-2007 Khalid Baheyeldin http://2bits.com |
| 5 |
|
|
| 13 |
define('FLAG_CONTENT_TYPE_NODE', 'node'); |
define('FLAG_CONTENT_TYPE_NODE', 'node'); |
| 14 |
define('FLAG_CONTENT_TYPE_USER', 'user'); |
define('FLAG_CONTENT_TYPE_USER', 'user'); |
| 15 |
define('FLAG_CONTENT_TYPE_COMMENT', 'comment'); |
define('FLAG_CONTENT_TYPE_COMMENT', 'comment'); |
| 16 |
|
define('FLAG_CONTENT_TRANS_LINK', 'flag_content_trans_link'); |
| 17 |
|
|
| 18 |
|
/** |
| 19 |
|
* Purpose: Returns an array of common translation placeholders |
| 20 |
|
*/ |
| 21 |
|
function flag_content_translation() { |
| 22 |
|
static $trans; |
| 23 |
|
|
| 24 |
|
if (!isset($trans)) { |
| 25 |
|
$trans = array( |
| 26 |
|
'!link' => variable_get(FLAG_CONTENT_TRANS_LINK, 'Report this page'), |
| 27 |
|
); |
| 28 |
|
} |
| 29 |
|
return $trans; |
| 30 |
|
} |
| 31 |
|
|
| 32 |
function flag_content_help($section) { |
function flag_content_help($section) { |
| 33 |
switch ($section) { |
switch ($section) { |
| 115 |
'#default_value' => variable_get(FLAG_CONTENT_COMMENT, 0), |
'#default_value' => variable_get(FLAG_CONTENT_COMMENT, 0), |
| 116 |
); |
); |
| 117 |
|
|
| 118 |
|
$form['link'][FLAG_CONTENT_TRANS_LINK] = array( |
| 119 |
|
'#type' => 'textfield', |
| 120 |
|
'#title' => t('Link text'), |
| 121 |
|
'#default_value' => variable_get(FLAG_CONTENT_TRANS_LINK, 'Report this page'), |
| 122 |
|
'#description' => t('Phrase used in the hyperlink that users click to report an inappropriate post.'), |
| 123 |
|
'#size' => 30, |
| 124 |
|
'#maxlength' => 30, |
| 125 |
|
); |
| 126 |
|
|
| 127 |
$form['email'][FLAG_CONTENT_EMAIL] = array( |
$form['email'][FLAG_CONTENT_EMAIL] = array( |
| 128 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 129 |
'#title' => t('Email address'), |
'#title' => t('Email address'), |
| 220 |
if (!_flag_content_check($eid, $type)) { |
if (!_flag_content_check($eid, $type)) { |
| 221 |
// Not already flagged, flag it for admin |
// Not already flagged, flag it for admin |
| 222 |
$links['flag_content_add'] = array( |
$links['flag_content_add'] = array( |
| 223 |
'title' => t('report this page'), |
'title' => t('!link', flag_content_translation()), |
| 224 |
'href' => "flag_content/add/$eid/$type", |
'href' => "flag_content/add/$eid/$type", |
| 225 |
'attributes' => array( |
'attributes' => array( |
| 226 |
'class' => 'flag_content', |
'class' => 'flag_content', |
| 311 |
|
|
| 312 |
return confirm_form( |
return confirm_form( |
| 313 |
$form, |
$form, |
| 314 |
t('Are you sure you want to flag the @type @title', array('@type' => $type_label, '@title' => $title)), |
t('Are you sure you want to flag the @type "@title"', array('@type' => $type_label, '@title' => $title)) .'?', |
| 315 |
$_GET['destination'] ? $_GET['destination'] : $path, |
$_GET['destination'] ? $_GET['destination'] : $path, |
| 316 |
t(''), |
t(''), |
| 317 |
t('Flag'), |
t('Flag'), |