| 1 |
<?php |
<?php |
| 2 |
// $Id: flag_content.module,v 1.6.2.12.2.4 2008/06/19 18:38:11 kbahey Exp $ |
// $Id: flag_content.module,v 1.6.2.12.2.5 2008/09/18 18:14:03 kbahey Exp $ |
| 3 |
|
|
| 4 |
// Copyright 2006-2007 Khalid Baheyeldin http://2bits.com |
// Copyright 2006-2007 Khalid Baheyeldin http://2bits.com |
| 5 |
|
|
| 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'); |
define('FLAG_CONTENT_TRANS_LINK', 'flag_content_trans_link'); |
| 17 |
|
define('FLAG_CONTENT_FORM_REQUIRE_NAME', 'flag_content_form_require_name'); |
| 18 |
|
define('FLAG_CONTENT_FORM_REQUIRE_EMAIL', 'flag_content_form_require_email'); |
| 19 |
|
define('FLAG_CONTENT_FORM_REQUIRE_REASON', 'flag_content_form_require_reason'); |
| 20 |
|
|
| 21 |
/** |
/** |
| 22 |
* Purpose: Returns an array of common translation placeholders |
* Purpose: Returns an array of common translation placeholders |
| 118 |
'#default_value' => variable_get(FLAG_CONTENT_COMMENT, 0), |
'#default_value' => variable_get(FLAG_CONTENT_COMMENT, 0), |
| 119 |
); |
); |
| 120 |
|
|
| 121 |
|
$form['flag_form'] = array( |
| 122 |
|
'#type' => 'fieldset', |
| 123 |
|
'#title' => t('Required fields when flagging'), |
| 124 |
|
); |
| 125 |
|
$form['flag_form'][FLAG_CONTENT_FORM_REQUIRE_NAME] = array( |
| 126 |
|
'#type' => 'checkbox', |
| 127 |
|
'#title' => t('Require name'), |
| 128 |
|
'#return_value' => 1, |
| 129 |
|
'#default_value' => variable_get(FLAG_CONTENT_FORM_REQUIRE_NAME,0), |
| 130 |
|
); |
| 131 |
|
$form['flag_form'][FLAG_CONTENT_FORM_REQUIRE_EMAIL] = array( |
| 132 |
|
'#type' => 'checkbox', |
| 133 |
|
'#title' => t('Require email'), |
| 134 |
|
'#return_value' => 1, |
| 135 |
|
'#default_value' => variable_get(FLAG_CONTENT_FORM_REQUIRE_EMAIL,0), |
| 136 |
|
); |
| 137 |
|
$form['flag_form'][FLAG_CONTENT_FORM_REQUIRE_REASON] = array( |
| 138 |
|
'#type' => 'checkbox', |
| 139 |
|
'#title' => t('Require reason'), |
| 140 |
|
'#return_value' => 1, |
| 141 |
|
'#default_value' => variable_get(FLAG_CONTENT_FORM_REQUIRE_REASON,0), |
| 142 |
|
); |
| 143 |
|
|
| 144 |
$form['link'][FLAG_CONTENT_TRANS_LINK] = array( |
$form['link'][FLAG_CONTENT_TRANS_LINK] = array( |
| 145 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 146 |
'#title' => t('Link text'), |
'#title' => t('Link text'), |
| 318 |
$form['name'] = array( |
$form['name'] = array( |
| 319 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 320 |
'#title' => t('Name'), |
'#title' => t('Name'), |
| 321 |
'#required' => TRUE, |
'#required' => variable_get(FLAG_CONTENT_FORM_REQUIRE_NAME,0), |
| 322 |
'#default_value' => ($user->name) ? $user->name : '' |
'#default_value' => ($user->name) ? $user->name : '' |
| 323 |
); |
); |
| 324 |
|
|
| 325 |
$form['mail'] = array( |
$form['mail'] = array( |
| 326 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 327 |
'#title' => t('Email'), |
'#title' => t('Email'), |
| 328 |
'#required' => TRUE, |
'#required' => variable_get(FLAG_CONTENT_FORM_REQUIRE_EMAIL,0), |
| 329 |
'#default_value' => ($user->mail) ? $user->mail : '' |
'#default_value' => ($user->mail) ? $user->mail : '' |
| 330 |
); |
); |
| 331 |
|
|
| 332 |
$form['reason'] = array( |
$form['reason'] = array( |
| 333 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 334 |
'#title' => t('Reason'), |
'#title' => t('Reason'), |
| 335 |
'#required' => TRUE, |
'#required' => variable_get(FLAG_CONTENT_FORM_REQUIRE_REASON,0), |
| 336 |
'#rows' => 8, |
'#rows' => 8, |
| 337 |
'#description' => t('Why are you flagging this item?') |
'#description' => t('Why are you flagging this item?') |
| 338 |
); |
); |
| 482 |
$ops .= ' ' . l(t('unflag'), "flag_content/unflag/$entry->eid/$entry->type"); |
$ops .= ' ' . l(t('unflag'), "flag_content/unflag/$entry->eid/$entry->type"); |
| 483 |
$ops .= ' ' . l(t('delete'), $delete); |
$ops .= ' ' . l(t('delete'), $delete); |
| 484 |
$rows[] = array($item, $type, $by, $timestamp, $ops); |
$rows[] = array($item, $type, $by, $timestamp, $ops); |
| 485 |
$rows[] = array(array('data' => 'Reason: '.$entry->reason, 'colspan' => 5)); |
$rows[] = array(array('data' => 'Reason: '. check_markup($entry->reason), 'colspan' => 5)); |
| 486 |
} |
} |
| 487 |
} |
} |
| 488 |
else { |
else { |
| 562 |
'@manage' => url('admin/content/flag_content', NULL, NULL, 1), |
'@manage' => url('admin/content/flag_content', NULL, NULL, 1), |
| 563 |
)); |
)); |
| 564 |
|
|
| 565 |
|
$body = check_markup($body); |
| 566 |
|
|
| 567 |
$to = check_plain($to); |
$to = check_plain($to); |
| 568 |
$mail = check_plain($mail); |
$mail = check_plain($mail); |
| 569 |
$name = check_plain($name); |
$name = check_plain($name); |