Ignore:
Timestamp:
Aug 26, 2010, 7:57:55 PM (14 years ago)
Author:
nikrou
Message:

Add permissions on add tags widget
Use default theme jquery library
Add help

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/user_tags/include/t4u_content.class.php

    r6798 r6806  
    2525    $this->plugin_config = $config;
    2626
    27     if (preg_match('!/t4u_addtags.*!', $_SERVER['QUERY_STRING']) && !empty($_POST['tags'])) {
     27    if (preg_match('!/t4u_addtags.*!', $_SERVER['QUERY_STRING'])
     28        && !empty($_POST['tags'])
     29        && hasPermission('add')) {
    2830      include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    2931
    30       /* TODO: add permissions */
    3132      $tag_ids = get_fckb_tag_ids($_POST['tags']);
    3233      set_tags($tag_ids, $_POST['image_id']);
     
    3435    }
    3536
    36     if (preg_match('!/t4u_gettags.*!', $_SERVER['QUERY_STRING'])) {
     37    if (preg_match('!/t4u_gettags.*!', $_SERVER['QUERY_STRING'])
     38        && hasPermission('add')) {
    3739      include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    3840
    39       /* TODO: add permissions */
    4041      $query = '
    4142SELECT
     
    5253    global $template;
    5354
    54     /* TODO: add permissions */
    55     if (!is_autorize_status(ACCESS_CLASSIC)) { return;}
     55    if (!$this->hasPermission('add')) {
     56      return false;
     57    }
    5658
    5759    $template->func_known_script(array('id' => 'jquery',
    58                                        'src' => get_root_url().T4U_JS. '/jquery-1.4.2.js'
     60                                       'src' => get_root_url().'themes/default/js/jquery.packed.js'
    5961                                       ),
    6062                                 $template->smarty
     
    6870    $template->assign('T4U_IMAGE_ID', $picture['id']);
    6971    $template->assign('T4U_REFERER', htmlentities($picture['url']));
     72    $template->assign('T4U_PERMISSION_DELETE', $this->hasPermission('delete'));
     73
    7074    $related_tags = array();
    7175    if (!empty($template->smarty->_tpl_vars['related_tags'])) {
     
    103107    return $url;
    104108  }
     109
     110  private function hasPermission($permission='add') {
     111    return
     112      (($this->plugin_config->getPermission($permission)!='')
     113       and is_autorize_status(get_access_type_status($this->plugin_config->getPermission($permission))));
     114  }
    105115}
    106116?>
Note: See TracChangeset for help on using the changeset viewer.