| 12 |
* Email : info@plaatsoft.nl |
* Email : info@plaatsoft.nl |
| 13 |
*/ |
*/ |
| 14 |
|
|
| 15 |
// Addressbook module URLs |
// Addressbook module URLs. |
| 16 |
define('URL_FAMILY_LIST', 'addressbook/family/list'); |
define('URL_FAMILY_LIST', 'addressbook/family/list'); |
| 17 |
define('URL_FAMILY_VIEW', 'addressbook/family/view'); |
define('URL_FAMILY_VIEW', 'addressbook/family/view'); |
| 18 |
define('URL_FAMILY_EDIT', 'addressbook/family/edit'); |
define('URL_FAMILY_EDIT', 'addressbook/family/edit'); |
| 162 |
} |
} |
| 163 |
|
|
| 164 |
/** |
/** |
| 165 |
* Valid permisions for this module |
* Valid permissions for this module. |
| 166 |
* @return array an array of valid permission for the module |
* @return array an array of valid permission for the module |
| 167 |
*/ |
*/ |
| 168 |
function addressbook_perm() { |
function addressbook_perm() { |
| 171 |
} |
} |
| 172 |
|
|
| 173 |
/** |
/** |
| 174 |
* Module configuration settings |
* Module configuration settings. |
| 175 |
* @return settings HTML or deny access |
* @return settings HTML or deny access |
| 176 |
*/ |
*/ |
| 177 |
function addressbook_settings() { |
function addressbook_settings() { |
| 188 |
'#title' => t('Name format '), |
'#title' => t('Name format '), |
| 189 |
'#default_value' => variable_get('addressbook_name_format',1), |
'#default_value' => variable_get('addressbook_name_format',1), |
| 190 |
'#options' => array( 0 => t('middle last, first'), 1 => t('first middle last') ), |
'#options' => array( 0 => t('middle last, first'), 1 => t('first middle last') ), |
| 191 |
'#description' => t('Set with name format with will be used in the general addressbook list page.')); |
'#description' => t('Set the name format which will be used in the general addressbook list page.')); |
| 192 |
|
|
| 193 |
$form['settings_general']['addressbook_show_sort_bar'] = array( |
$form['settings_general']['addressbook_show_sort_bar'] = array( |
| 194 |
'#type' => 'select', |
'#type' => 'select', |
| 195 |
'#title' => t('Enable sort bar'), |
'#title' => t('Enable sort bar'), |
| 196 |
'#default_value' => variable_get('addressbook_show_sort_bar',1), |
'#default_value' => variable_get('addressbook_show_sort_bar',1), |
| 197 |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
| 198 |
'#description' => t('Enable / Disable sort bart in general addressbook list page.')); |
'#description' => t('Enable / disable sort bar in general addressbook list page.')); |
| 199 |
|
|
| 200 |
$form['settings_general']['addressbook_roles'] = array( |
$form['settings_general']['addressbook_roles'] = array( |
| 201 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 202 |
'#title' => t('Roles'), |
'#title' => t('Roles'), |
| 203 |
'#default_value' => variable_get('addressbook_roles', ''), |
'#default_value' => variable_get('addressbook_roles', ''), |
| 204 |
'#rows' => 1, |
'#rows' => 1, |
| 205 |
'#description' => t("Enter roles with a person can have (Seperated items with commas. No space allowed).") ); |
'#description' => t("Enter the roles which a person can have (Seperate items with commas (,). No spaces allowed).") ); |
| 206 |
|
|
| 207 |
$form['settings_general']['addressbook_country'] = array( |
$form['settings_general']['addressbook_country'] = array( |
| 208 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 217 |
'#title' => t('Show thumbnails pictures in list views'), |
'#title' => t('Show thumbnails pictures in list views'), |
| 218 |
'#default_value' => variable_get('addressbook_show_thumbnails',0), |
'#default_value' => variable_get('addressbook_show_thumbnails',0), |
| 219 |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
| 220 |
'#description' => t('Enable / Disable thumbnails pictures in family list and family member list.')); |
'#description' => t('Enable / disable thumbnail pictures in family list and family member list.')); |
| 221 |
|
|
| 222 |
$form['settings_general']['addressbook_email_manitory'] = array( |
$form['settings_general']['addressbook_email_manitory'] = array( |
| 223 |
'#type' => 'select', |
'#type' => 'select', |
| 224 |
'#title' => t('Email field manitory'), |
'#title' => t('Email field manitory'), |
| 225 |
'#default_value' => variable_get('addressbook_email_manitory',1), |
'#default_value' => variable_get('addressbook_email_manitory',1), |
| 226 |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
| 227 |
'#description' => t('Enable / Disable email field as manitory field.')); |
'#description' => t('Enable / disable email field as mandatory field.')); |
| 228 |
|
|
| 229 |
$form['settings_general']['addressbook_wiki_edit_mode'] = array( |
$form['settings_general']['addressbook_wiki_edit_mode'] = array( |
| 230 |
'#type' => 'select', |
'#type' => 'select', |
| 231 |
'#title' => t('Wiki edit mode'), |
'#title' => t('Wiki edit mode'), |
| 232 |
'#default_value' => variable_get('addressbook_wiki_edit_mode',0), |
'#default_value' => variable_get('addressbook_wiki_edit_mode',0), |
| 233 |
'#options' => array( 0 => t('Disable'), 1 => t('Enable') ), |
'#options' => array( 0 => t('Disable'), 1 => t('Enable') ), |
| 234 |
'#description' => t('Enable (Every one can modify existing addresses), Disable (Only owner can modify created addresses).')); |
'#description' => t('Enable (anyone can modify existing addresses), Disable (only owner can modify created addresses).')); |
| 235 |
|
|
| 236 |
|
|
| 237 |
|
|
| 248 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 249 |
'#title' => t('Free www.map24.com access key'), |
'#title' => t('Free www.map24.com access key'), |
| 250 |
'#default_value' => variable_get('addressbook_map_key', ''), |
'#default_value' => variable_get('addressbook_map_key', ''), |
| 251 |
'#description' => t("Enter access key (Visit http://www.map24.com to get a free key)"), |
'#description' => t("Enter access key (Visit http://www.map24.com to obtain a free key)"), |
| 252 |
'#maxlength' => '50', |
'#maxlength' => '50', |
| 253 |
'#size' => '50'); |
'#size' => '50'); |
| 254 |
|
|
| 261 |
'#title' => t('Birthday email notification'), |
'#title' => t('Birthday email notification'), |
| 262 |
'#default_value' => variable_get('addressbook_birthday_notification',0), |
'#default_value' => variable_get('addressbook_birthday_notification',0), |
| 263 |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
'#options' => array( 0 => t('No'), 1 => t('Yes') ), |
| 264 |
'#description' => t('Enable / Disable email birthday notification.')); |
'#description' => t('Enable / disable email birthday notification.')); |
| 265 |
|
|
| 266 |
$form['birthday']['addressbook_birthday_subject'] = array( |
$form['birthday']['addressbook_birthday_subject'] = array( |
| 267 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 268 |
'#title' => t('Subject of birtday e-mail'), |
'#title' => t('Subject of birtday e-mail'), |
| 269 |
'#default_value' => variable_get('addressbook_birthday_subject','Happy birthday %username from %site_name'), |
'#default_value' => variable_get('addressbook_birthday_subject','Happy birthday %username from %site_name'), |
| 270 |
'#maxlength' => 180, |
'#maxlength' => 180, |
| 271 |
'#description' => t('Customize the subject of your birthday e-mail, which is sent to members upon there birtday.') .' '. t('Available variables are:') .' %username, %site_name'); |
'#description' => t('Customize the subject of your birthday e-mail, which is sent to members upon their birthday.') .' '. t('Available variables are:') .' %username, %site_name'); |
| 272 |
|
|
| 273 |
$form['birthday']['addressbook_birthday_body'] = array( |
$form['birthday']['addressbook_birthday_body'] = array( |
| 274 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 275 |
'#title' => t('Body of birthday e-mail'), |
'#title' => t('Body of birthday e-mail'), |
| 276 |
'#default_value' => variable_get('addressbook_birthday_body',"Dear %username,\r\n\r\nCongratulation with your %user_age ste birthday.\r\nHave a nice day!\r\n"), |
'#default_value' => variable_get('addressbook_birthday_body',"Dear %username,\r\n\r\nCongratulation with your %user_age ste birthday.\r\nHave a nice day!\r\n"), |
| 277 |
'#rows' => 15, |
'#rows' => 15, |
| 278 |
'#description' => t('Customize the body of the birtday e-mail, which is sent to members upon there birtday.') .' '. t('Available variables are:') .' %username, %user_age, %site_name'); |
'#description' => t('Customize the body of the birthday e-mail, which is sent to members upon their birthday.') .' '. t('Available variables are:') .' %username, %user_age, %site_name'); |
| 279 |
|
|
| 280 |
return system_settings_form($form); |
return system_settings_form($form); |
| 281 |
|
|
| 282 |
} |
} |
| 283 |
|
|
| 284 |
/** |
/** |
| 285 |
* Find all family member with are celebrating there birth_day to day and send a email. |
* Find all family members which are celebrating their birthday to day and send them an email. |
| 286 |
* @return emails |
* @return emails |
| 287 |
*/ |
*/ |
| 288 |
function addressbook_cron() { |
function addressbook_cron() { |
| 290 |
// If birthday notification is enabled check all family members. |
// If birthday notification is enabled check all family members. |
| 291 |
if ( variable_get('addressbook_birthday_notification',0)==1 ) { |
if ( variable_get('addressbook_birthday_notification',0)==1 ) { |
| 292 |
|
|
| 293 |
// Send only one time the birthday notications per day (crontab runs every hour) |
// Send the birthday notication only once in any given day (crontab may run more frequently) |
| 294 |
$current_day=date('-m-d'); |
$current_day=date('-m-d'); |
| 295 |
$current_time=date('H'); |
$current_time=date('H'); |
| 296 |
|
|
| 297 |
if ($current_time==0) |
if ($current_time==0) { |
|
{ |
|
| 298 |
watchdog('cron', t('Addressbook birthday cron')); |
watchdog('cron', t('Addressbook birthday cron')); |
| 299 |
|
|
| 300 |
// Fetch all members with are celebrating there birtday |
// Fetch all members with are celebrating there birtday |
| 301 |
$query='SELECT first_name, middle_name, last_name, email, birth_day FROM {addressbook_member} WHERE birth_day LIKE "%'.$current_day.'"'; |
$query='SELECT first_name, middle_name, last_name, email, birth_day FROM {addressbook_member} WHERE birth_day LIKE "%'.$current_day.'"'; |
| 302 |
$queryResult = db_query($query); |
$queryResult = db_query($query); |
| 303 |
while ($data = db_fetch_object($queryResult)) |
while ($data = db_fetch_object($queryResult)) { |
|
{ |
|
|
|
|
| 304 |
$username=view_name($data->first_name,$data->middle_name,$data->last_name,true); |
$username=view_name($data->first_name,$data->middle_name,$data->last_name,true); |
| 305 |
|
|
| 306 |
$email = $data->email; |
$email = $data->email; |
| 311 |
$user_age = date('Y')-$year; |
$user_age = date('Y')-$year; |
| 312 |
|
|
| 313 |
// if family member have a email address send a email |
// if family member have a email address send a email |
| 314 |
if (($email!='') && ($user_age<100)) |
if (($email!='') && ($user_age<100)) { |
|
{ |
|
| 315 |
$from=$site_name.'<'.variable_get('site_mail', ini_get('sendmail_from')).'>'; |
$from=$site_name.'<'.variable_get('site_mail', ini_get('sendmail_from')).'>'; |
| 316 |
|
|
| 317 |
$subject=variable_get('addressbook_birthday_subject','Happy birthday %username from %site_name'); |
$subject=variable_get('addressbook_birthday_subject','Happy birthday %username from %site_name'); |
| 338 |
} |
} |
| 339 |
|
|
| 340 |
/** |
/** |
| 341 |
* Find all family member with are celebrating there birth_day to day and make a block of it. |
* Find all family members which are celebrating their birthday today and make a block of it. |
| 342 |
* @return emails |
* @return emails |
| 343 |
*/ |
*/ |
| 344 |
function addressbook_block($op='list', $delta=0) { |
function addressbook_block($op='list', $delta=0) { |
| 491 |
$query = 'SELECT uid, name FROM {users}'; |
$query = 'SELECT uid, name FROM {users}'; |
| 492 |
$queryResult = db_query($query); |
$queryResult = db_query($query); |
| 493 |
|
|
| 494 |
// Workarround Drupal first entry in users table is always empty. Skip this entry |
// Workaround Drupal first entry in users table is always empty. Skip this entry |
| 495 |
$tmp = db_fetch_object($queryResult); |
$tmp = db_fetch_object($queryResult); |
| 496 |
|
|
| 497 |
$page.='<select name="owner">'; |
$page.='<select name="owner">'; |
| 545 |
|
|
| 546 |
if ( $readonly=='0' ) { |
if ( $readonly=='0' ) { |
| 547 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 548 |
$page .= '<b>'.t('Please enter the roles you currently forfilling and please enter the roles you are now or in the near future interesed in!').'</b><br/>'; |
$page .= '<b>'.t('Please enter the roles you currently fulfilling and please enter the roles you are interesed in now or in the near future!').'</b><br/>'; |
| 549 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 550 |
} |
} |
| 551 |
|
|
| 705 |
} |
} |
| 706 |
|
|
| 707 |
/* |
/* |
| 708 |
* Function valid number imput |
* Function valid number input |
| 709 |
* @returns true if valid number (only numeric string), false if not |
* @returns true if valid number (only numeric string), false if not |
| 710 |
*/ |
*/ |
| 711 |
function check_number($str) { |
function check_number($str) { |
| 1050 |
} |
} |
| 1051 |
$page .= '</table>'; |
$page .= '</table>'; |
| 1052 |
|
|
| 1053 |
// Only administrators can access the csv upload functionaly |
// Only administrators can access the csv upload functionality |
| 1054 |
if (user_access('access administration pages')) { |
if (user_access('access administration pages')) { |
| 1055 |
//$page .= '<br/>'; |
//$page .= '<br/>'; |
| 1056 |
$page .= '<table border="0" width="100%">'; |
$page .= '<table border="0" width="100%">'; |
| 1139 |
$picture_found=0; |
$picture_found=0; |
| 1140 |
while ($data = db_fetch_object($queryResult)) |
while ($data = db_fetch_object($queryResult)) |
| 1141 |
{ |
{ |
| 1142 |
// Show each picture with is found |
// Show each picture which is found |
| 1143 |
$picture_found++; |
$picture_found++; |
| 1144 |
$page .= '<td valign="top">'; |
$page .= '<td valign="top">'; |
| 1145 |
$page .= '<a href="'.url(URL_PICTURE_VIEW.'/'.$data->pid).'" >'; |
$page .= '<a href="'.url(URL_PICTURE_VIEW.'/'.$data->pid).'" >'; |
| 1263 |
$page .= '</form>'; |
$page .= '</form>'; |
| 1264 |
$page .= '</td>'; |
$page .= '</td>'; |
| 1265 |
|
|
| 1266 |
// Maximum three pictures allowed |
// Maximum of three pictures allowed |
| 1267 |
if ($picture_found<3) |
if ($picture_found<3) |
| 1268 |
{ |
{ |
| 1269 |
$page .= '<td align="left">'; |
$page .= '<td align="left">'; |
| 1582 |
$page .= '</td>'; |
$page .= '</td>'; |
| 1583 |
|
|
| 1584 |
if ($fid!='0') { |
if ($fid!='0') { |
| 1585 |
// Only exiting families can be be deleted |
// Only existing families can be deleted |
| 1586 |
$page .= '<td valign="top">'; |
$page .= '<td valign="top">'; |
| 1587 |
$page .= '<form action="'.url(URL_FAMILY_EDIT.'/').$fid.'" method="POST">'; |
$page .= '<form action="'.url(URL_FAMILY_EDIT.'/').$fid.'" method="POST">'; |
| 1588 |
$page .= '<input type="hidden" name="fid" value="'.$fid.'" />'; |
$page .= '<input type="hidden" name="fid" value="'.$fid.'" />'; |
| 1741 |
$page .= '<table width=100% border=1 cellpadding=3 cellspacing=3>'; |
$page .= '<table width=100% border=1 cellpadding=3 cellspacing=3>'; |
| 1742 |
|
|
| 1743 |
// Show Banner |
// Show Banner |
| 1744 |
// Only administrators can access the csv upload functionaly |
// Only administrators can access the csv upload functionality |
| 1745 |
$page .= '<tr><td>'; |
$page .= '<tr><td>'; |
| 1746 |
if (user_access('access administration pages')) |
if (user_access('access administration pages')) |
| 1747 |
{ |
{ |
| 2101 |
if (drupal_mail('Addressbook', 'send', $email, user_preferred_language($user), array('subject'=>$subject,'body'=>$body))) |
if (drupal_mail('Addressbook', 'send', $email, user_preferred_language($user), array('subject'=>$subject,'body'=>$body))) |
| 2102 |
{ |
{ |
| 2103 |
watchdog('Addressbook', t('Sent group email to ').$email); |
watchdog('Addressbook', t('Sent group email to ').$email); |
| 2104 |
$page .= t('Email is sent to '.$email); |
$page .= t('Email has be sent to '.$email); |
| 2105 |
} |
} |
| 2106 |
else |
else |
| 2107 |
{ |
{ |
| 2167 |
$middle_name=$_POST['middle_name']; |
$middle_name=$_POST['middle_name']; |
| 2168 |
$last_name=ucfirst($_POST['last_name']); |
$last_name=ucfirst($_POST['last_name']); |
| 2169 |
|
|
| 2170 |
// Fill in some field with default values when new meber is created |
// Fill in some fields with default values when a new member has been created |
| 2171 |
if (($mid=='0') && ($commit=='0')) { |
if (($mid=='0') && ($commit=='0')) { |
| 2172 |
$query = 'SELECT middle_name, last_name FROM {addressbook_family} WHERE fid='.$fid; |
$query = 'SELECT middle_name, last_name FROM {addressbook_family} WHERE fid='.$fid; |
| 2173 |
$queryResult = db_query($query); |
$queryResult = db_query($query); |
| 2231 |
} |
} |
| 2232 |
} |
} |
| 2233 |
|
|
| 2234 |
// Delete "are you sure" form |
// Delete "Are you sure?" form |
| 2235 |
if (($member_delete=='1') && ($mid!='0') && ($go_delete=='0')) { |
if (($member_delete=='1') && ($mid!='0') && ($go_delete=='0')) { |
| 2236 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2237 |
$page .= t('Are you sure you want to delete this family member?'); |
$page .= t('Are you sure you want to delete this family member?'); |
| 2302 |
$birth_day = $birthday_year.'-'.$birthday_month.'-'.$birthday_day; |
$birth_day = $birthday_year.'-'.$birthday_month.'-'.$birthday_day; |
| 2303 |
|
|
| 2304 |
if (($owner==0) && !user_access('access administration pages')) { |
if (($owner==0) && !user_access('access administration pages')) { |
| 2305 |
// Set new owner because items did not found owner yet!) |
// Set new owner, because items did not find owner yet!) |
| 2306 |
$owner=$user->uid; |
$owner=$user->uid; |
| 2307 |
} |
} |
| 2308 |
|
|
| 2387 |
$queryResult = db_query($query); |
$queryResult = db_query($query); |
| 2388 |
$tmp = db_fetch_object($queryResult); |
$tmp = db_fetch_object($queryResult); |
| 2389 |
|
|
| 2390 |
// If no data is found. Show anti hacking message |
// If no data has been found. Show anti hacking message |
| 2391 |
if ($tmp==null) { |
if ($tmp==null) { |
| 2392 |
return hacker_warning(); |
return hacker_warning(); |
| 2393 |
} |
} |
| 2450 |
{ |
{ |
| 2451 |
$picture_found++; |
$picture_found++; |
| 2452 |
|
|
| 2453 |
// Show each picture with is found |
// Show each picture which has been found |
| 2454 |
$page .= '<a href="'.url(URL_PICTURE_VIEW.'/').$data->pid.'">'; |
$page .= '<a href="'.url(URL_PICTURE_VIEW.'/').$data->pid.'">'; |
| 2455 |
$filename=url(THUMBNAILS_DIR.'/'.$data->picture); |
$filename=url(THUMBNAILS_DIR.'/'.$data->picture); |
| 2456 |
$filename=str_replace(array("?q="), "", $filename); |
$filename=str_replace(array("?q="), "", $filename); |
| 2531 |
$page .= '</td>'; |
$page .= '</td>'; |
| 2532 |
} |
} |
| 2533 |
|
|
| 2534 |
// Only exiting member can be be deleted |
// Only existing member can be deleted |
| 2535 |
$page .= '<td valign="top">'; |
$page .= '<td valign="top">'; |
| 2536 |
$page .= '<form action="'.url(URL_MEMBER_EDIT.'/').$mid.'" method="POST">'; |
$page .= '<form action="'.url(URL_MEMBER_EDIT.'/').$mid.'" method="POST">'; |
| 2537 |
$page .= '<input type="hidden" name="fid" value="'.$fid.'" />'; |
$page .= '<input type="hidden" name="fid" value="'.$fid.'" />'; |
| 2540 |
$page .= '</td>'; |
$page .= '</td>'; |
| 2541 |
} |
} |
| 2542 |
|
|
| 2543 |
// Cancel new created member |
// Cancel newly created member |
| 2544 |
$page .= '<td valign="top">'; |
$page .= '<td valign="top">'; |
| 2545 |
if ($_SESSION["list"]=='member') { |
if ($_SESSION["list"]=='member') { |
| 2546 |
$page .= '<form action="'.url(URL_MEMBER_LIST.'/'.$_SESSION["sort"]).'" method="POST">'; |
$page .= '<form action="'.url(URL_MEMBER_LIST.'/'.$_SESSION["sort"]).'" method="POST">'; |
| 2593 |
$queryResult = db_query($query); |
$queryResult = db_query($query); |
| 2594 |
$tmp = db_fetch_object($queryResult); |
$tmp = db_fetch_object($queryResult); |
| 2595 |
|
|
| 2596 |
// If no data is found. Show anti hacking message |
// If no data has been found. Show anti hacking message |
| 2597 |
if ($tmp==null) { |
if ($tmp==null) { |
| 2598 |
return hacker_warning(); |
return hacker_warning(); |
| 2599 |
} |
} |
| 2600 |
|
|
| 2601 |
// Delete are you sure form |
// Delete 'Are you sure?' form |
| 2602 |
if (($picture_delete=='1') && ($pid!='0') && ($go_delete=='0')) { |
if (($picture_delete=='1') && ($pid!='0') && ($go_delete=='0')) { |
| 2603 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2604 |
$page .= t('Are you sure you want to delete the picture?'); |
$page .= t('Are you sure you want to delete the picture?'); |
| 2635 |
if ($result==1) |
if ($result==1) |
| 2636 |
{ |
{ |
| 2637 |
// Query succesfull |
// Query succesfull |
| 2638 |
watchdog('user', 'Picture '.$pid.' is deleted in the addressbook'); |
watchdog('user', 'Picture '.$pid.' is deleted from the addressbook'); |
| 2639 |
|
|
| 2640 |
$page .= '<td valign="top">'; |
$page .= '<td valign="top">'; |
| 2641 |
$page .= '<form action="'.url(URL_PICTURE_VIEW.'/'.$pid).'" method="POST">'; |
$page .= '<form action="'.url(URL_PICTURE_VIEW.'/'.$pid).'" method="POST">'; |
| 2659 |
else { |
else { |
| 2660 |
// Query failed |
// Query failed |
| 2661 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2662 |
$page .= t('Failed to delete picture, try again'); |
$page .= t('Failed to delete picture, please try again'); |
| 2663 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2664 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2665 |
if ($mid!='0') { |
if ($mid!='0') { |
| 2763 |
$queryResult = db_query($query); |
$queryResult = db_query($query); |
| 2764 |
$tmp = db_fetch_object($queryResult); |
$tmp = db_fetch_object($queryResult); |
| 2765 |
|
|
| 2766 |
// If no data is found. Show anti hacking message |
// f no data has been found. Show anti hacking message |
| 2767 |
if ($tmp==null) { |
if ($tmp==null) { |
| 2768 |
return hacker_warning(); |
return hacker_warning(); |
| 2769 |
} |
} |
| 2838 |
} |
} |
| 2839 |
else |
else |
| 2840 |
{ |
{ |
| 2841 |
// Not resize needed, move file to storage place |
// No resize needed, move file to storage |
| 2842 |
copy($_FILES['uploadedfile']['tmp_name'],IMAGE_DIR.'/'.$filename); |
copy($_FILES['uploadedfile']['tmp_name'],IMAGE_DIR.'/'.$filename); |
| 2843 |
} |
} |
| 2844 |
|
|
| 2886 |
{ |
{ |
| 2887 |
if (!image_scale(IMAGE_DIR.'/'.$filename, file_create_path(THUMBNAILS_DIR.'/'.$filename), $width, $height)) { |
if (!image_scale(IMAGE_DIR.'/'.$filename, file_create_path(THUMBNAILS_DIR.'/'.$filename), $width, $height)) { |
| 2888 |
$page .= '<br>'; |
$page .= '<br>'; |
| 2889 |
$page .= t('434Unable to create thumbnails image. Is Gd library active in apache php module?'); |
$page .= t('Unable to create thumbnails image. Is the GD library active in the Apache PHP module?'); |
| 2890 |
$error='1'; |
$error='1'; |
| 2891 |
$page .= '<br>'; |
$page .= '<br>'; |
| 2892 |
} |
} |
| 2897 |
} |
} |
| 2898 |
else |
else |
| 2899 |
{ |
{ |
| 2900 |
// Not resize needed, move file to storage place |
// No resize needed, move file to storage |
| 2901 |
copy(IMAGE_DIR.'/'.$filename, THUMBNAILS_DIR.'/'.$filename); |
copy(IMAGE_DIR.'/'.$filename, THUMBNAILS_DIR.'/'.$filename); |
| 2902 |
} |
} |
| 2903 |
|
|
| 2913 |
if ($result==1) |
if ($result==1) |
| 2914 |
{ |
{ |
| 2915 |
// Query Succesfull |
// Query Succesfull |
| 2916 |
watchdog('user', 'A picture is added to address '.$id.' in addressbook'); |
watchdog('user', 'A picture has been added to address '.$id.' in addressbook'); |
| 2917 |
|
|
| 2918 |
if ($mid=='0') |
if ($mid=='0') |
| 2919 |
{ |
{ |
| 2927 |
else { |
else { |
| 2928 |
// Query Failed |
// Query Failed |
| 2929 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2930 |
$page .= t('Failed to add picture, try again!'); |
$page .= t('Failed to add picture, please try again!'); |
| 2931 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2932 |
} |
} |
| 2933 |
} |
} |
| 2934 |
} |
} |
| 2935 |
else { |
else { |
| 2936 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2937 |
$page.=t('Only JPG image format is supported'); |
$page.=t('Only the jpg image format is supported for pictures'); |
| 2938 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 2939 |
$_FILES['uploadedfile']['name']=''; |
$_FILES['uploadedfile']['name']=''; |
| 2940 |
} |
} |
| 3127 |
} |
} |
| 3128 |
} |
} |
| 3129 |
|
|
| 3130 |
// If family insert/update was succesful continue with member insert/update. |
// If family insert/update was successful, then continue with member insert/update. |
| 3131 |
if ( $line_error==0 ) |
if ( $line_error==0 ) |
| 3132 |
{ |
{ |
| 3133 |
// Check if member already exist |
// Check if member already exist |
| 3214 |
else { |
else { |
| 3215 |
// Query Failed |
// Query Failed |
| 3216 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 3217 |
$page .= t('Failed to save csv file, try again!').'<br/>'; |
$page .= t('Failed to save csv file, please try again!').'<br/>'; |
| 3218 |
$page .= '<br/>'; |
$page .= '<br/>'; |
| 3219 |
|
|
| 3220 |
// Return to family view page |
// Return to family view page |
| 3264 |
} |
} |
| 3265 |
|
|
| 3266 |
/** |
/** |
| 3267 |
* Creat CSV file and start file transfer to web user. |
* Create CSV file and start file transfer to web user. |
| 3268 |
*/ |
*/ |
| 3269 |
function download_csv() { |
function download_csv() { |
| 3270 |
|
|