function add_image_to_album($file, $folder_path) { global $site; $folder_path = trim($folder_path); // only public folders if (strpos($folder_path, 'public/') === 0) { $folder_id = create_folder_from_path($folder_path); if (is_int($folder_id)) { // upload the file $upload_result = upload_to_folder($file, $folder_id); if (is_int($upload_result)) { global $site, $class_path; $folder = new Objekt(array('objekt_id' => $folder_id)); $conf = new CONFIG($folder->all['ttyyp_params']); include_once $class_path . 'picture.inc.php'; generate_images($site->absolute_path . $conf->get('path'), $conf->get('tn_size'), $conf->get('pic_size')); } return $upload_result; } else { // error message return $folder_id; } } else { return 'no_such_folder'; } }
} else { $response = array('error' => 1, 'error_message' => $synchro); } echo $json_encoder->encode($response); exit; } // upload file if ($site->user->user_id && $site->fdat['op'] == 'file_upload' && (int) $site->fdat['folder_id']) { verify_form_token(); include_once $class_path . 'adminpage.inc.php'; include_once $class_path . 'custom.inc.php'; //include_once($class_path.'lgpl/Services_JSON.class.php'); //$json_encoder = new Services_JSON(); $folder_id = (int) $site->fdat['folder_id']; //echo $json_encoder->encode($response); $file_id = upload_to_folder($_FILES['Filedata'], $folder_id); if (is_int($file_id)) { echo '{"file_id": ' . $file_id . '}'; } else { echo '{"error": "' . $file_id . '"}'; } exit; } // toggle favorite if ($site->user->user_id && $site->fdat['op'] == 'toggle_favorite' && (int) $site->fdat['objekt_id']) { verify_form_token(); include_once $class_path . 'adminpage.inc.php'; include_once $class_path . 'custom.inc.php'; include_once $class_path . 'lgpl/Services_JSON.class.php'; $json_encoder = new Services_JSON(); $objekt_id = (int) $site->fdat['objekt_id'];