'../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace'));
$group_document = true;
$noPHP_SELF = true;
}
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
if (!$is_certificate_mode)
$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
else
$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
} else {
foreach($document_data['parents'] as $document_sub_data) {
if ($document_data['title'] == $document_sub_data['title']) {
continue;
}
$interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
}
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
if (!$is_allowedToEdit) {
api_not_allowed(true);
}
event_access_tool(TOOL_DOCUMENT);
Display :: display_header($nameTools, 'Doc');
echo '
';
///pixlr
$title=$file;//disk name. No sql name because pixlr return this when save
$pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
$langpixlr = api_get_language_isocode();
$langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser
$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
$_SESSION['exit_pixlr']= Security::remove_XSS($parent_id);
$referrer="Chamilo";
$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
$target=$target_path;
$locktarget="true";
$locktitle="false";
if ($_SERVER['HTTP_HOST']=="localhost") {
$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
if (!file_exists($path_and_file)) {
$crossdomain='
';//more open domain="*"
@file_put_contents($path_and_file, $crossdomain);
}
$credentials="true";
}
else {
$credentials="false";
}
//make temp images
$temp_folder=api_get_path(SYS_ARCHIVE_PATH).'temp/images';
if (!file_exists($temp_folder)) {
@mkdir($temp_folder, api_get_permissions_for_new_directories(), true);//TODO:check $permissions value, now empty;
}
//make htaccess with allow from all, and file index.html into temp/images
$htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
if (!file_exists($htaccess)) {
$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
if ($fp) {
fwrite($fp, $htaccess_content);
fclose($fp);
}
}
$html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
if (!file_exists($html_index)) {
$html_index_content="";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
if ($fp) {
fwrite($fp, $html_index_content);
fclose($fp);
}
}
//encript temp name file
$name_crip=sha1(uniqid());//encript
$findext= explode(".", $file);
$extension= $findext[count($findext)-1];
$file_crip=$name_crip.'.'.$extension;
//copy file to temp/images directory
$from=$filepath.$file;
$to=api_get_path(SYS_ARCHIVE_PATH).'temp/images/'.$file_crip;
copy($from, $to);
$_SESSION['temp_realpath_image']=$to;
//load image to url
$to_url=api_get_path(WEB_ARCHIVE_PATH).'temp/images/'.$file_crip;
$image=urlencode($to_url);
$pixlr_url = api_get_protocol().'://pixlr.com/editor/?title='.$title.'&image='.$image.'&loc='.$loc.'&referrer='.$referrer.'&target='.$target.'&exit='.$exit_path.'&locktarget='.$locktarget.'&locktitle='.$locktitle.'&credentials='.$credentials;
//make frame an send image
?>
';
echo '';
echo '';
Display::display_footer();