| 498 | | /** |
| 499 | | * returns the link of upload menu |
| 500 | | * |
| 501 | | * @param null |
| 502 | | * @return string or null |
| 503 | | */ |
| 504 | | function get_upload_menu_link() |
| 505 | | { |
| 506 | | global $conf, $page, $user; |
| 507 | | |
| 508 | | $show_link = false; |
| 509 | | $arg_link = null; |
| 510 | | |
| 511 | | if (is_autorize_status($conf['upload_user_access'])) |
| 512 | | { |
| 513 | | if (isset($page['category']) and $page['category']['uploadable'] ) |
| 514 | | { |
| 515 | | // upload a picture in the category |
| 516 | | $show_link = true; |
| 517 | | $arg_link = 'cat='.$page['category']['id']; |
| 518 | | } |
| 519 | | else |
| 520 | | if ($conf['upload_link_everytime']) |
| 521 | | { |
| 522 | | // upload a picture in the category |
| 523 | | $query = ' |
| 524 | | SELECT |
| 525 | | 1 |
| 526 | | FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' |
| 527 | | ON id = cat_id and user_id = '.$user['id'].' |
| 528 | | WHERE |
| 529 | | uploadable = \'true\' |
| 530 | | '.get_sql_condition_FandF |
| 531 | | ( |
| 532 | | array |
| 533 | | ( |
| 534 | | 'visible_categories' => 'id', |
| 535 | | ), |
| 536 | | 'AND' |
| 537 | | ).' |
| 538 | | LIMIT 1'; |
| 539 | | |
| 540 | | $show_link = pwg_db_num_rows(pwg_query($query)) <> 0; |
| 541 | | } |
| 542 | | } |
| 543 | | if ($show_link) |
| 544 | | { |
| 545 | | return get_root_url().'upload.php'.(empty($arg_link) ? '' : '?'.$arg_link); |
| 546 | | } |
| 547 | | else |
| 548 | | { |
| 549 | | return; |
| 550 | | } |
| 551 | | } |
| 552 | | |