Location: PHPKode > projects > OpenBizMap > obm2007.1/mydata/script/run_request.txt
<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

/*
Action execution

IN $id - current record id
*/

$reqbag=get('reqbag');
$access=get('access');
$days=get('days');

// Adding new access request

if($access)
{
  $variable_array=array();

  $variable_array['sysGroupBy']='bagaccess';
  $variable_array['sysComment']='Access request';

  $variable_array['sysId']='';
  $variable_array['sysValidTo']=date('Ymd',mktime(0,0,0,date('m'),date('d')+$days,date('Y')));
  $variable_array['sysValid']=1;

  $variable_array['User']=USERNAME;
  $variable_array['Bag']=$reqbag;
  $variable_array['Access']=$access;
  $variable_array['MyBag']='access';

  set_access('access',2);
  save($variable_array);



  $passwd_array=array();
  $passwd_array=unserialize(base64_decode(file_get_contents(cfg_sso_path.'/data/.passwd.txt')));
  $email2=$passwd_array[md5(purename(USERNAME.'email'))];

  if($access==1)
    $access_str='Guest';
  elseif($access==2)
    $access_str='User';
  elseif($access==3)
    $access_str='Owner';
  else
    $access_str='Unknown ('.$access.')';


  $result_array=search('bagaccess access=3 bag=\''.$mybag.'\' MyBag=access');
  $sizeof=count($result_array);
  for($ii=0;$ii<$sizeof;$ii++)
  {
    $owner=strtolower(read($result_array[$ii],'User'));
    if(strpos('_'.$owner_list,$owner)==0)
    {
      $owner_list.=' '.$owner;
      $email=$passwd_array[md5(purename($owner.'email'))];
      sendmail($email,'accessrequest',array('USERNAME' => USERNAME, 'EMAIL' => $email2, 'BAG' => $reqbag, 'ACCESS' => $access_str, 'PERIOD' => $days, 'LINK' => $selflink));
      //echo '<br />email to '.$email;
    }
  }


  $passwd_array=array();
}

?>
Return current item: OpenBizMap