| 1 |
<?php |
<?php |
| 2 |
// $Id: user_tags.module,v 1.14.2.7 2007/10/09 09:03:31 flk Exp $ |
// $Id: user_tags.module,v 1.14.2.8 2008/05/06 19:12:40 deekayen Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 183 |
} |
} |
| 184 |
|
|
| 185 |
foreach ($vocab as $vid => $tid) { |
foreach ($vocab as $vid => $tid) { |
| 186 |
foreach ($tid as $term_tid=>$term_name) { |
foreach ($tid as $term_tid => $term_name) { |
| 187 |
$rows[] = array(l($term_name, "tag/user/$term_tid")); |
$rows[] = array(l($term_name, "tag/user/$term_tid")); |
| 188 |
} |
} |
| 189 |
} |
} |
| 254 |
* @param array $account : user details |
* @param array $account : user details |
| 255 |
* @return array : taxonomy form |
* @return array : taxonomy form |
| 256 |
*/ |
*/ |
| 257 |
function user_tags_form_tags($category, $account){ |
function user_tags_form_tags($category, $account) { |
| 258 |
if ($category != 'tags') { |
if ($category != 'tags') { |
| 259 |
return; |
return; |
| 260 |
} |
} |
| 331 |
* |
* |
| 332 |
* @param object $account : User Object for modifying (passed ByRef) |
* @param object $account : User Object for modifying (passed ByRef) |
| 333 |
*/ |
*/ |
| 334 |
function user_tags_load_tags(&$account){ |
function user_tags_load_tags(&$account) { |
| 335 |
$result = db_query('SELECT t.* FROM {term_data} t INNER JOIN {term_user} tu WHERE tu.tid = t.tid AND tu.uid = %d ORDER BY weight, name', $account->uid); |
$result = db_query('SELECT t.* FROM {term_data} t INNER JOIN {term_user} tu WHERE tu.tid = t.tid AND tu.uid = %d ORDER BY weight, name', $account->uid); |
| 336 |
$account->taxonomy = array(); |
$account->taxonomy = array(); |
| 337 |
while ($term = db_fetch_object($result)) { |
while ($term = db_fetch_object($result)) { |
| 345 |
* |
* |
| 346 |
* @param object $account : User Object |
* @param object $account : User Object |
| 347 |
*/ |
*/ |
| 348 |
function user_tags_delete_tags($account){ |
function user_tags_delete_tags($account) { |
| 349 |
db_query('DELETE FROM {term_user} WHERE uid = %d', $account->uid); |
db_query('DELETE FROM {term_user} WHERE uid = %d', $account->uid); |
| 350 |
} |
} |
| 351 |
|
|
| 357 |
* @param array $edit : the values returned from the submitted form |
* @param array $edit : the values returned from the submitted form |
| 358 |
* @param object $account : The User Object |
* @param object $account : The User Object |
| 359 |
*/ |
*/ |
| 360 |
function user_tags_submit_tags($category, $edit, $account){ |
function user_tags_submit_tags($category, $edit, $account) { |
| 361 |
if ($category != 'tags') { |
if ($category != 'tags') { |
| 362 |
return; |
return; |
| 363 |
} |
} |
| 366 |
|
|
| 367 |
if (is_array($edit['taxonomy'])) { |
if (is_array($edit['taxonomy'])) { |
| 368 |
if (isset($edit['taxonomy']['freetags'])) { |
if (isset($edit['taxonomy']['freetags'])) { |
| 369 |
foreach ($edit['taxonomy']['freetags'] as $key => $value){ |
foreach ($edit['taxonomy']['freetags'] as $key => $value) { |
| 370 |
$vid = $key; |
$vid = $key; |
| 371 |
$regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x'; |
$regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x'; |
| 372 |
preg_match_all($regexp, $value, $matches); |
preg_match_all($regexp, $value, $matches); |
| 416 |
* @param object $account : User account object (from user_load() function) |
* @param object $account : User account object (from user_load() function) |
| 417 |
* @return array : nested array |
* @return array : nested array |
| 418 |
*/ |
*/ |
| 419 |
function user_tags_view_tags($account){ |
function user_tags_view_tags($account) { |
| 420 |
$list = array(); |
$list = array(); |
| 421 |
foreach ($account->taxonomy as $tid => $term) { |
foreach ($account->taxonomy as $tid => $term) { |
| 422 |
$list[] = array('value' => l($term->name, "tag/user/$tid")); |
$list[] = array('value' => l($term->name, "tag/user/$tid")); |