Ignore:
Timestamp:
Nov 24, 2013, 2:48:30 PM (10 years ago)
Author:
mistic100
Message:

fixc empty share key field after addition
fix javascript errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/include/UserCollection.class.php

    r24421 r25674  
    327327   * @return: array errors
    328328   */
    329   function addShare($share, $abord_on_duplicate=true)
     329  function addShare(&$share, $abord_on_duplicate=true)
    330330  {
    331331    global $conf, $page;
     
    342342    else
    343343    {
    344       $share['share_key'] = $this->data['id'].'-'.str2url($share['share_key']);
     344      $share['share_key'] = str2url($share['share_key']);
     345      $share_key = $this->data['id'].'-'.$share['share_key'];
    345346     
    346347      $query = '
    347348SELECT id FROM '.COLLECTION_SHARES_TABLE.'
    348349  WHERE col_id = '.$this->data['id'].'
    349   AND share_key = "'.$share['share_key'].'"
     350  AND share_key = "'.$share_key.'"
    350351;';
    351352      $result = pwg_query($query);
     
    358359        else
    359360        {
    360           return USER_COLLEC_PUBLIC . 'view/' . $share['share_key'];
     361          return USER_COLLEC_PUBLIC . 'view/' . $share_key;
    361362        }
    362363      }
     
    373374    if (!empty($share['password']))
    374375    {
    375       $share['password'] = sha1($conf['secret_key'].$share['password'].$share['share_key']);
     376      $share['password'] = sha1($conf['secret_key'].$share['password'].$share_key);
    376377    }
    377378   
     
    392393  VALUES(
    393394    '.$this->data['id'].',
    394     "'.$share['share_key'].'",
     395    "'.$share_key.'",
    395396    "'.pwg_db_real_escape_string($params).'",
    396397    "'.date('Y-m-d H:i:s').'"
     
    399400      pwg_query($query);
    400401     
    401       return USER_COLLEC_PUBLIC . 'view/' . $share['share_key'];
     402      return USER_COLLEC_PUBLIC . 'view/' . $share_key;
    402403    }
    403404   
Note: See TracChangeset for help on using the changeset viewer.