function email_collection($colrefs, $collectionname, $fromusername, $userlist, $message, $feedback, $access = -1, $expires = "", $useremail = "", $from_name = "", $cc = "", $themeshare = false, $themename = "", $themeurlsuffix = "", $list_recipients = false, $add_internal_access = false, $group = "") { # Attempt to resolve all users in the string $userlist to user references. # Add $collection to these user's 'My Collections' page # Send them an e-mail linking to this collection # handle multiple collections (comma seperated list) global $baseurl, $email_from, $applicationname, $lang, $userref, $email_multi_collections, $usergroup, $attach_user_smart_groups; if ($useremail == "") { $useremail = $email_from; } if ($group == "") { $group = $usergroup; } if (trim($userlist) == "") { return $lang["mustspecifyoneusername"]; } $userlist = resolve_userlist_groups($userlist); if ($attach_user_smart_groups && strpos($userlist, $lang["groupsmart"] . ": ") !== false) { $groups_users = resolve_userlist_groups_smart($userlist, true); if ($groups_users != '') { if ($userlist != "") { $userlist = remove_groups_smart_from_userlist($userlist); if ($userlist != "") { $userlist .= ","; } } $userlist .= $groups_users; } } $ulist = trim_array(explode(",", $userlist)); $emails = array(); $key_required = array(); if ($feedback) { $feedback = 1; } else { $feedback = 0; } $reflist = trim_array(explode(",", $colrefs)); $emails_keys = resolve_user_emails($ulist); $emails = $emails_keys['emails']; $key_required = $emails_keys['key_required']; # Add the collection(s) to the user's My Collections page $urefs = sql_array("select ref value from user where username in ('" . join("','", $ulist) . "')"); if (count($urefs) > 0) { # Delete any existing collection entries sql_query("delete from user_collection where collection in ('" . join("','", $reflist) . "') and user in ('" . join("','", $urefs) . "')"); # Insert new user_collection row(s) #loop through the collections for ($nx1 = 0; $nx1 < count($reflist); $nx1++) { #loop through the users for ($nx2 = 0; $nx2 < count($urefs); $nx2++) { sql_query("insert into user_collection(collection,user,request_feedback) values ({$reflist[$nx1]}, {$urefs[$nx2]}, {$feedback} )"); if ($add_internal_access) { foreach (get_collection_resources($reflist[$nx1]) as $resource) { if (get_edit_access($resource)) { open_access_to_user($urefs[$nx2], $resource, $expires); } } } #log this collection_log($reflist[$nx1], "S", 0, sql_value("select username as value from user where ref = {$urefs[$nx2]}", "")); } } } # Send an e-mail to each resolved user # htmlbreak is for composing list $htmlbreak = "\r\n"; global $use_phpmailer; if ($use_phpmailer) { $htmlbreak = "<br><br>"; $htmlbreaksingle = "<br>"; } if ($fromusername == "") { $fromusername = $applicationname; } // fromusername is used for describing the sender's name inside the email if ($from_name == "") { $from_name = $applicationname; } // from_name is for the email headers, and needs to match the email address (app name or user name) $templatevars['message'] = str_replace(array("\\n", "\\r", "\\"), array("\n", "\r", ""), $message); if (trim($templatevars['message']) == "") { $templatevars['message'] = $lang['nomessage']; } $templatevars['fromusername'] = $fromusername; $templatevars['from_name'] = $from_name; if (count($reflist) > 1) { $subject = $applicationname . ": " . $lang['mycollections']; } else { $subject = $applicationname . ": " . $collectionname; } if ($fromusername == "") { $fromusername = $applicationname; } $externalmessage = $lang["emailcollectionmessageexternal"]; $internalmessage = $lang["emailcollectionmessage"]; $viewlinktext = $lang["clicklinkviewcollection"]; if ($themeshare) { $externalmessage = $lang["emailthemecollectionmessageexternal"]; $internalmessage = $lang["emailthememessage"]; $viewlinktext = $lang["clicklinkviewcollections"]; } ## loop through recipients for ($nx1 = 0; $nx1 < count($emails); $nx1++) { ## loop through collections $list = ""; $list2 = ""; $origviewlinktext = $viewlinktext; // Save this text as we may change it for internal theme shares for this user if ($themeshare && !$key_required[$nx1]) { $url = ""; $subject = $applicationname . ": " . $themename; $url = $baseurl . "/pages/themes.php" . $themeurlsuffix; $viewlinktext = $lang["clicklinkviewthemes"]; $emailcollectionmessageexternal = false; if ($use_phpmailer) { $link = "<a href=\"{$url}\">" . $themename . "</a>"; $list .= $htmlbreak . $link; // alternate list style $list2 .= $htmlbreak . $themename . ' -' . $htmlbreaksingle . $url; $templatevars['list2'] = $list2; } else { $list .= $htmlbreak . $url; } for ($nx2 = 0; $nx2 < count($reflist); $nx2++) { #log this collection_log($reflist[$nx2], "E", 0, $emails[$nx1]); } } else { for ($nx2 = 0; $nx2 < count($reflist); $nx2++) { $url = ""; $key = ""; $emailcollectionmessageexternal = false; # Do we need to add an external access key for this user (e-mail specified rather than username)? if ($key_required[$nx1]) { $k = generate_collection_access_key($reflist[$nx2], $feedback, $emails[$nx1], $access, $expires, $group); $key = "&k=" . $k; $emailcollectionmessageexternal = true; } $url = $baseurl . "/?c=" . $reflist[$nx2] . $key; $collection = array(); $collection = sql_query("select name,savedsearch from collection where ref='{$reflist[$nx2]}'"); if ($collection[0]["name"] != "") { $collection_name = i18n_get_collection_name($collection[0]); } else { $collection_name = $reflist[$nx2]; } if ($use_phpmailer) { $link = "<a href=\"{$url}\">{$collection_name}</a>"; $list .= $htmlbreak . $link; // alternate list style $list2 .= $htmlbreak . $collection_name . ' -' . $htmlbreaksingle . $url; $templatevars['list2'] = $list2; } else { $list .= $htmlbreak . $collection_name . $htmlbreak . $url . $htmlbreak; } #log this collection_log($reflist[$nx2], "E", 0, $emails[$nx1]); } } //$list.=$htmlbreak; $templatevars['list'] = $list; $templatevars['from_name'] = $from_name; if (isset($k)) { if ($expires == "") { $templatevars['expires_date'] = $lang["email_link_expires_never"]; $templatevars['expires_days'] = $lang["email_link_expires_never"]; } else { $day_count = round((strtotime($expires) - strtotime('now')) / (60 * 60 * 24)); $templatevars['expires_date'] = $lang['email_link_expires_date'] . nicedate($expires); $templatevars['expires_days'] = $lang['email_link_expires_days'] . $day_count; if ($day_count > 1) { $templatevars['expires_days'] .= " " . $lang['expire_days'] . "."; } else { $templatevars['expires_days'] .= " " . $lang['expire_day'] . "."; } } } else { # Set empty expiration tempaltevars $templatevars['expires_date'] = ''; $templatevars['expires_days'] = ''; } if ($emailcollectionmessageexternal) { $template = $themeshare ? "emailthemeexternal" : "emailcollectionexternal"; } else { $template = $themeshare ? "emailtheme" : "emailcollection"; } if (count($emails > 1) && $list_recipients === true) { $body = $lang["list-recipients"] . "\n" . implode("\n", $emails) . "\n\n"; $templatevars['list-recipients'] = $lang["list-recipients"] . "\n" . implode("\n", $emails) . "\n\n"; } else { $body = ""; } $body .= $templatevars['fromusername'] . " " . ($emailcollectionmessageexternal ? $externalmessage : $internalmessage) . "\n\n" . $templatevars['message'] . "\n\n" . $viewlinktext . "\n\n" . $templatevars['list']; #exit ($body . "<br>" . $viewlinktext); send_mail($emails[$nx1], $subject, $body, $fromusername, $useremail, $template, $templatevars, $from_name, $cc); $viewlinktext = $origviewlinktext; } hook("additional_email_collection", "", array($colrefs, $collectionname, $fromusername, $userlist, $message, $feedback, $access, $expires, $useremail, $from_name, $cc, $themeshare, $themename, $themeurlsuffix, $template, $templatevars)); # Return an empty string (all OK). return ""; }
function email_collection($colrefs,$collectionname,$fromusername,$userlist,$message,$feedback,$access=-1,$expires="",$useremail="",$from_name="",$cc="",$themeshare=false,$themename="",$themeurlsuffix="") { # Attempt to resolve all users in the string $userlist to user references. # Add $collection to these user's 'My Collections' page # Send them an e-mail linking to this collection # handle multiple collections (comma seperated list) global $baseurl,$email_from,$applicationname,$lang,$userref, $email_multi_collections ; if ($useremail==""){$useremail=$email_from;} if (trim($userlist)=="") {return ($lang["mustspecifyoneusername"]);} $userlist=resolve_userlist_groups($userlist); $ulist=trim_array(explode(",",$userlist)); $emails=array(); $key_required=array(); if ($feedback) {$feedback=1;} else {$feedback=0;} $reflist=trim_array(explode(",",$colrefs)); $emails_keys=resolve_user_emails($ulist); $emails=$emails_keys['emails']; $key_required=$emails_keys['key_required']; # Add the collection(s) to the user's My Collections page $urefs=sql_array("select ref value from user where username in ('" . join("','",$ulist) . "')"); if (count($urefs)>0) { # Delete any existing collection entries sql_query("delete from user_collection where collection in ('" .join("','", $reflist) . "') and user in ('" . join("','",$urefs) . "')"); # Insert new user_collection row(s) #loop through the collections for ($nx1=0;$nx1<count($reflist);$nx1++) { #loop through the users for ($nx2=0;$nx2<count($urefs);$nx2++) { sql_query("insert into user_collection(collection,user,request_feedback) values ($reflist[$nx1], $urefs[$nx2], $feedback )"); if ($access == 0) { foreach (get_collection_resources($reflist[$nx1]) as $resource) { open_access_to_user($urefs[$nx2],$resource,$expires); } } #log this collection_log($reflist[$nx1],"S",0, sql_value ("select username as value from user where ref = $urefs[$nx2]","")); } } } # Send an e-mail to each resolved user # htmlbreak is for composing list $htmlbreak="\r\n"; global $use_phpmailer; if ($use_phpmailer){$htmlbreak="<br><br>";$htmlbreaksingle="<br>";} if ($fromusername==""){$fromusername=$applicationname;} // fromusername is used for describing the sender's name inside the email if ($from_name==""){$from_name=$applicationname;} // from_name is for the email headers, and needs to match the email address (app name or user name) $templatevars['message']=str_replace(array("\\n","\\r","\\"),array("\n","\r",""),$message); if (trim($templatevars['message'])==""){$templatevars['message']=$lang['nomessage'];} $templatevars['fromusername']=$fromusername; $templatevars['from_name']=$from_name; if(count($reflist)>1){$subject=$applicationname.": ".$lang['mycollections'];} else { $subject=$applicationname.": ".$collectionname;} if ($fromusername==""){$fromusername=$applicationname;} $externalmessage=$lang["emailcollectionmessageexternal"]; $internalmessage=$lang["emailcollectionmessage"]; $viewlinktext=$lang["clicklinkviewcollection"]; if ($themeshare) // Change the text if sharing a theme category { $externalmessage=$lang["emailthemecollectionmessageexternal"]; $internalmessage=$lang["emailthememessage"]; $viewlinktext=$lang["clicklinkviewcollections"]; } ## loop through recipients for ($nx1=0;$nx1<count($emails);$nx1++) { ## loop through collections $list=""; $list2=""; $origviewlinktext=$viewlinktext; // Save this text as we may change it for internal theme shares for this user if ($themeshare && !$key_required[$nx1]) # don't send a whole list of collections if internal, just send the theme category URL { $url=""; $subject=$applicationname.": " . $themename; $url=$baseurl . "/pages/themes.php" . $themeurlsuffix; $viewlinktext=$lang["clicklinkviewthemes"]; $emailcollectionmessageexternal=false; if ($use_phpmailer){ $link="<a href=\"$url\">" . $themename . "</a>"; $list.= $htmlbreak.$link; // alternate list style $list2.=$htmlbreak.$themename.' -'.$htmlbreaksingle.$url; $templatevars['list2']=$list2; } else { $list.= $htmlbreak.$url; } for ($nx2=0;$nx2<count($reflist);$nx2++) { #log this collection_log($reflist[$nx2],"E",0, $emails[$nx1]); } } else { for ($nx2=0;$nx2<count($reflist);$nx2++) { $url=""; $key=""; $emailcollectionmessageexternal=false; # Do we need to add an external access key for this user (e-mail specified rather than username)? if ($key_required[$nx1]) { $k=generate_collection_access_key($reflist[$nx2],$feedback,$emails[$nx1],$access,$expires); $key="&k=". $k; $emailcollectionmessageexternal=true; } $url=$baseurl . "/?c=" . $reflist[$nx2] . $key; $collection = array(); $collection = sql_query("select name,savedsearch from collection where ref='$reflist[$nx2]'"); if ($collection[0]["name"]!="") {$collection_name = i18n_get_collection_name($collection[0]);} else {$collection_name = $reflist[$nx2];} if ($use_phpmailer){ $link="<a href=\"$url\">$collection_name</a>"; $list.= $htmlbreak.$link; // alternate list style $list2.=$htmlbreak.$collection_name.' -'.$htmlbreaksingle.$url; $templatevars['list2']=$list2; } else { $list.= $htmlbreak . $collection_name . $htmlbreak . $url . $htmlbreak; } #log this collection_log($reflist[$nx2],"E",0, $emails[$nx1]); } } //$list.=$htmlbreak; $templatevars['list']=$list; $templatevars['from_name']=$from_name; if ($emailcollectionmessageexternal ){ $template=($themeshare)?"emailthemeexternal":"emailcollectionexternal"; } else { $template=($themeshare)?"emailtheme":"emailcollection"; } $body=$templatevars['fromusername']." " . (($emailcollectionmessageexternal)?$externalmessage:$internalmessage) . "\n\n" . $templatevars['message']."\n\n" . $viewlinktext ."\n\n".$templatevars['list']; #exit ($body . "<br>" . $viewlinktext); send_mail($emails[$nx1],$subject,$body,$fromusername,$useremail,$template,$templatevars,$from_name,$cc); $viewlinktext=$origviewlinktext; } # Return an empty string (all OK). return ""; }
{ # Access has been selected. Generate a URL. ?> <p><?php echo $lang["generatethemeurlsexternal"]?></p> <p> <textarea class="URLDisplay" cols="100" rows="<?php echo count($collectionstoshare)*4+1; ?>" ><?php $unapproved_collection=false; foreach($collectionstoshare as $collection){ $ref=$collection["ref"]; #Check if any resources are not approved if (!is_collection_approved($ref) && !$collection_allow_not_approved_share) { echo str_replace("%collectionname%", i18n_get_collection_name($collection), $lang["collection-name"]) . "\r\n" . $lang["notapprovedsharecollection"] . "\r\n\r\n"; $unapproved_collection=true; } else { echo str_replace("%collectionname%", i18n_get_collection_name($collection), $lang["collection-name"]) . "\r\n" . $baseurl?>/?c=<?php echo urlencode($ref)?>&k=<?php echo generate_collection_access_key($ref,0,"URL",$access,$expires) . "\r\n" . ($expires!="" ? str_replace("%date%", $expires, $lang["expires-date"]) : str_replace("%date%", $lang["never"], $lang["expires-date"])) . "\r\n\r\n"; } } ?> </textarea> <?php if ($unapproved_collection){?><script>alert('<?php echo $lang['notapprovedsharetheme']?>');</script><?php } ?> </p> <?php } } //Display existing shares for collections in theme if ($access=="") { foreach($collectionstoshare as $collection) {
<div class="clearerleft"> </div> </div> <div class="QuestionSubmit" style="padding-top:0;margin-top:0;"> <label for="buttons"> </label> <input name="generateurl" type="submit" value=" <?php echo $lang["generateexternalurl"]?> " /> </div> <?php } else { # Access has been selected. Generate a URL. ?> <p><?php echo $lang["generateurlexternal"]?></p> <p><input class="URLDisplay" type="text" value="<?php echo $baseurl?>/?c=<?php echo urlencode($ref) ?>&k=<?php echo generate_collection_access_key($ref,0,"URL",$access,$expires)?>"> <?php } } ?> <?php hook("collectionshareoptions") ?> </ul> </div> <?php if (collection_writeable($ref)|| (isset($collection['savedsearch']) && $collection['savedsearch']!=null && ($userref==$collection["user"] || checkperm("h")))) { if (!($hide_internal_sharing_url)) { ?> <h2><?php echo $lang["internalusersharing"]?></h2>
} else { # Access has been selected. Generate a URL. ?> <p><?php echo $lang["generateurlexternal"]; ?> </p> <p><input class="URLDisplay" type="text" value="<?php echo $baseurl; ?> /?c=<?php echo $ref; ?> &k=<?php echo generate_collection_access_key($ref, 0, "URL", $access, $expires); ?> "> <?php } } hook("collectionshareoptions"); ?> </ul> </div> <?php if (collection_writeable($ref) || isset($collection['savedsearch']) && $collection['savedsearch'] != null && ($userref == $collection["user"] || checkperm("h"))) { if (!$hide_internal_sharing_url) { ?> <h2><?php
function HookEmbedslideshowCollection_shareExtra_share_options() { global $ref, $lang, $baseurl, $embedslideshow_min_size, $embedslideshow_max_size; ?> <li><a onClick="return CentralSpaceLoad(this,true);" href="collection_share.php?ref=<?php echo $ref; ?> &embedslideshow=true"><?php echo $lang["embedslideshow"]; ?> </a></li> <?php if (getval("embedslideshow", "") != "") { ?> <p><?php echo $lang["embedslideshow_action_description"]; ?> </p> <div class="Question"> <label><?php echo $lang["embedslideshow_size"]; ?> </label> <select name="size" class="stdwidth"> <?php $sizes = get_all_image_sizes(true); foreach ($sizes as $size) { if ($size["width"] <= $embedslideshow_max_size && $size["width"] >= $embedslideshow_min_size) { # Slideshow size is max of height/width so that all images will fit within the slideshow area (for default installs height/width is the same anyway though) ?> <option value="<?php echo $size["id"]; ?> " <?php if ($size["id"] == getval("size", "pre")) { ?> selected<?php } ?> ><?php echo str_replace(array("%name", "%pixels"), array($size["name"], max($size["width"], $size["height"])), $lang["sizename_pixels"]); ?> </option> <?php } } ?> </select> <div class="clearerleft"></div> </div> <div class="Question"> <label><?php echo $lang["embedslideshow_transitiontime"]; ?> </label> <select name="transition" class="stdwidth"> <option value="0"><?php echo $lang["embedslideshow_notransition"]; ?> </option> <?php for ($n = 1; $n < 20; $n++) { ?> <option value="<?php echo $n; ?> " <?php if ($n == getval("transition", "4")) { ?> selected<?php } ?> ><?php echo str_replace("?", $n, $lang["embedslideshow_seconds"]); ?> </option> <?php } ?> </select> <div class="clearerleft"></div> </div> <div class="Question"> <label><?php echo $lang["embedslideshow_maximise_option"]; ?> </label> <input type="checkbox" value="1" name="maximise" <?php if (isset($_POST["maximise"]) && $_POST["maximise"] == "1") { ?> checked<?php } ?> > <div class="clearerleft"></div> </div> <div class="QuestionSubmit" style="padding-top:0;margin-top:0;"> <label for="buttons"> </label> <input name="generateslideshow" type="submit" value=" <?php echo $lang["generateslideshowhtml"]; ?> " /> </div> <?php } if (getval("generateslideshow", "") != "") { # Create a new external access key $key = generate_collection_access_key($ref, 0, $lang["slideshow"], 1, ''); # Find image size $sizes = get_all_image_sizes(true); foreach ($sizes as $size) { if ($size["id"] == getval("size", "")) { break; } } # Slideshow size is max of height/width so that all images will fit within the slideshow area (for default installs height/width is the same anyway though) $width = max($size["width"], $size["height"]); $height = $width; $width_w_border = $width + 8; //expands width to display border $height += 48; // Enough space for controls # Create embed code $embed = ""; if ($width < 850 && getval("maximise", "") == 1) { # Maxmimise function only necessary for < screen size slideshows $embed .= "\n\t\t\t<div id=\"embedslideshow_back_" . $ref . "\" style=\"display:none;position:absolute;top:0;left:0;width:100%;height:100%;min-height: 100%;background-color:#000;opacity: .5;filter: alpha(opacity=50);\"></div>\n\t\t\t<div id=\"embedslideshow_minimise_" . $ref . "\" style=\"position:absolute;top:5px;left:20px;background-color:white;border:1px solid black;display:none;color:black\"><a style=\"color:#000\" href=\"#\" onClick=\"\n\t\t\tvar ed=document.getElementById('embedslideshow_" . $ref . "');\n\t\t\ted.width='" . $width_w_border . "';\n\t\t\ted.height='" . $height . "';\t\t\n\t\t\ted.style.position='relative';\n\t\t\ted.style.top='0';\n\t\t\ted.style.left='0';\n\t\t\ted.src='" . $baseurl . "/plugins/embedslideshow/pages/viewer.php?ref={$ref}&key={$key}&size=" . getval("size", "") . "&transition=" . getval("transition", "") . "&width=" . $width . "&height=" . $height . "';\n\t\t\tdocument.getElementById('embedslideshow_minimise_" . $ref . "').style.display='none';\n\t\t\tdocument.getElementById('embedslideshow_maximise_" . $ref . "').style.display='block';\t\n\t\t\tdocument.getElementById('embedslideshow_back_" . $ref . "').style.display='none';\n\t\t\t\">" . $lang["embedslideshow_minimise"] . "</a></div>\n\t\t\t<div id=\"embedslideshow_maximise_" . $ref . "\" class=\"embedslideshow_maximise\"><a href=\"#\" onClick=\"\n\t\t\tvar ed=document.getElementById('embedslideshow_" . $ref . "');\n\t\t\ted.width='858';\n\t\t\ted.height='898';\n\t\t\ted.style.position='absolute';\n\t\t\ted.style.top='20px';\n\t\t\ted.style.left='20px';\n\t\t\ted.src='" . $baseurl . "/plugins/embedslideshow/pages/viewer.php?ref={$ref}&key={$key}&size=scr&width=850&transition=" . getval("transition", "") . "';\n\t\t\ted.style.zIndex=999;\n\t\t\tdocument.getElementById('embedslideshow_minimise_" . $ref . "').style.display='block';\n\t\t\tdocument.getElementById('embedslideshow_maximise_" . $ref . "').style.display='none';\t\n\t\t\tdocument.getElementById('embedslideshow_back_" . $ref . "').style.display='block';\t\n\t\t\t\">" . $lang["embedslideshow_maximise"] . "</a></div>"; } $embed .= "<iframe id=\"embedslideshow_" . $ref . "\" Style=\"background-color:#fff;cursor: pointer;\" width=\"{$width_w_border}\" height=\"{$height}\" src=\"" . $baseurl . "/plugins/embedslideshow/pages/viewer.php?ref={$ref}&key={$key}&size=" . getval("size", "") . "&transition=" . getval("transition", "") . "&width={$width}&height={$height}\" frameborder=0 scrolling=no>Your browser does not support frames.</iframe>"; # Compress embed HTML. $embed = str_replace("\n", " ", $embed); $embed = str_replace("\t", " ", $embed); while (strpos($embed, " ") !== false) { $embed = str_replace(" ", " ", $embed); } ?> <div class="Question"> <label><?php echo $lang["slideshowhtml"]; ?> </label> <textarea style="width:535px;height:120px;"><?php echo htmlspecialchars($embed); ?> </textarea> <div class="clearerleft"></div> </div> <div class="Question"> <label><?php echo $lang["embedslideshow_directlink"]; ?> </label> <div class="Fixed"><a href="<?php echo $baseurl; ?> /plugins/embedslideshow/pages/viewer.php?ref=<?php echo $ref; ?> &key=<?php echo $key; ?> &size=<?php echo getval("size", ""); ?> &transition=<?php echo getval("transition", ""); ?> &width=<?php echo $width; ?> &height=<?php echo $height; ?> " target="_blank"><?php echo $lang["embedslideshow_directlinkopen"]; ?> </a></div> <div class="clearerleft"></div> </div> <div class="Question"> <label><?php echo $lang["slideshowpreview"]; ?> </label> <div class="Fixed"> <?php echo $embed; ?> </div> <div class="clearerleft"></div> </div> <?php } return true; }
function email_collection($colrefs, $collectionname, $fromusername, $userlist, $message, $feedback, $access = -1, $expires = "", $useremail = "", $from_name = "", $cc = "") { # Attempt to resolve all users in the string $userlist to user references. # Add $collection to these user's 'My Collections' page # Send them an e-mail linking to this collection # handle multiple collections (comma seperated list) global $baseurl, $email_from, $applicationname, $lang, $userref, $email_multi_collections; if ($useremail == "") { $useremail = $email_from; } if (trim($userlist) == "") { return $lang["mustspecifyoneusername"]; } $userlist = resolve_userlist_groups($userlist); $ulist = trim_array(explode(",", $userlist)); $emails = array(); $key_required = array(); if ($feedback) { $feedback = 1; } else { $feedback = 0; } $reflist = trim_array(explode(",", $colrefs)); $emails_keys = resolve_user_emails($ulist); $emails = $emails_keys['emails']; $key_required = $emails_keys['key_required']; # Add the collection(s) to the user's My Collections page $urefs = sql_array("select ref value from user where username in ('" . join("','", $ulist) . "')"); if (count($urefs) > 0) { #�Delete any existing collection entries sql_query("delete from user_collection where collection in ('" . join("','", $reflist) . "') and user in ('" . join("','", $urefs) . "')"); # Insert new user_collection row(s) #loop through the collections for ($nx1 = 0; $nx1 < count($reflist); $nx1++) { #loop through the users for ($nx2 = 0; $nx2 < count($urefs); $nx2++) { sql_query("insert into user_collection(collection,user,request_feedback) values ({$reflist[$nx1]}, {$urefs[$nx2]}, {$feedback} )"); #log this collection_log($reflist[$nx1], "S", 0, sql_value("select username as value from user where ref = {$urefs[$nx2]}", "")); } } } # Send an e-mail to each resolved user # htmlbreak is for composing list $htmlbreak = ""; global $use_phpmailer; if ($use_phpmailer) { $htmlbreak = "<br><br>"; $htmlbreaksingle = "<br>"; } if ($fromusername == "") { $fromusername = $applicationname; } // fromusername is used for describing the sender's name inside the email if ($from_name == "") { $from_name = $applicationname; } // from_name is for the email headers, and needs to match the email address (app name or user name) $templatevars['message'] = str_replace(array("\\n", "\\r", "\\"), array("\n", "\r", ""), $message); if (trim($templatevars['message']) == "") { $templatevars['message'] = $lang['nomessage']; } $templatevars['fromusername'] = $fromusername; $templatevars['from_name'] = $from_name; if (count($reflist) > 1) { $subject = $applicationname . ": " . $lang['mycollections']; } else { $subject = $applicationname . ": " . $collectionname; } if ($fromusername == "") { $fromusername = $applicationname; } ## loop through recipients for ($nx1 = 0; $nx1 < count($emails); $nx1++) { ## loop through collections $list = ""; $list2 = ""; for ($nx2 = 0; $nx2 < count($reflist); $nx2++) { $url = ""; $key = ""; $emailcollectionmessageexternal = false; # Do we need to add an external access key for this user (e-mail specified rather than username)? if ($key_required[$nx1]) { $k = generate_collection_access_key($reflist[$nx2], $feedback, $emails[$nx1], $access, $expires); $key = "&k=" . $k; $emailcollectionmessageexternal = true; } $url = $baseurl . "/?c=" . $reflist[$nx2] . $key; $collection_name = ""; $collection_name = sql_value("select name value from collection where ref='{$reflist[$nx2]}'", "{$reflist[$nx2]}"); if ($use_phpmailer) { $link = "<a href=\"{$url}\">{$collection_name}</a>"; $list .= $htmlbreak . $link; // alternate list style $list2 .= $htmlbreak . $collection_name . ' -' . $htmlbreaksingle . $url; $templatevars['list2'] = $list2; } else { $list .= $htmlbreak . $url; } #log this collection_log($reflist[$nx2], "E", 0, $emails[$nx1]); } //$list.=$htmlbreak; $templatevars['list'] = $list; $templatevars['from_name'] = $from_name; if ($emailcollectionmessageexternal) { $template = "emailcollectionexternal"; } else { $template = "emailcollection"; } $body = $templatevars['fromusername'] . " " . ($emailcollectionmessageexternal ? $lang["emailcollectionmessageexternal"] : $lang["emailcollectionmessage"]) . "\n\n" . $templatevars['message'] . "\n\n" . $lang["clicklinkviewcollection"] . "\n\n" . $templatevars['list']; send_mail($emails[$nx1], $subject, $body, $fromusername, $useremail, $template, $templatevars, $from_name, $cc); } # Return an empty string (all OK). return ""; }
if (getvalescaped("editaccess", "") == "") { # Access has been selected. Generate a new URL. ?> <p><?php echo $lang["generateurlexternal"]; ?> </p> <p><input class="URLDisplay" type="text" value="<?php echo $baseurl; ?> /?c=<?php echo urlencode($ref); ?> &k=<?php echo generate_collection_access_key($ref, 0, "URL", $access, $expires, getval("usergroup", "")); ?> "> <?php } } # Process editing of external share if ($editexternalurl) { $editsuccess = edit_collection_external_access($editaccess, $access, $expires, getvalescaped("usergroup", "")); if ($editsuccess) { echo "<span style='font-weight:bold;'>" . $lang['changessaved'] . " - <em>" . $editaccess . "</em>"; } } } hook("collectionshareoptions"); ?>
" ><?php $unapproved_collection = false; foreach ($collectionstoshare as $collection) { $ref = $collection["ref"]; #Check if any resources are not approved if (!is_collection_approved($ref) && !$collection_allow_not_approved_share) { echo str_replace("%collectionname%", i18n_get_collection_name($collection), $lang["collection-name"]) . "\r\n" . $lang["notapprovedsharecollection"] . "\r\n\r\n"; $unapproved_collection = true; } else { echo str_replace("%collectionname%", i18n_get_collection_name($collection), $lang["collection-name"]) . "\r\n" . $baseurl; ?> /?c=<?php echo urlencode($ref); ?> &k=<?php echo generate_collection_access_key($ref, 0, "URL", $access, $expires) . "\r\n" . ($expires != "" ? str_replace("%date%", $expires, $lang["expires-date"]) : str_replace("%date%", $lang["never"], $lang["expires-date"])) . "\r\n\r\n"; } } ?> </textarea> <?php if ($unapproved_collection) { ?> <script>alert('<?php echo $lang['notapprovedsharetheme']; ?> ');</script><?php } ?> </p> <?php
?> <p><?php echo $lang["generatethemeurlsexternal"]; ?> </p> <p> <textarea cols="200" rows="100" ><?php foreach ($collectionstoshare as $collection) { $ref = $collection["ref"]; echo $lang["collectionname"] . ": " . $collection["name"] . "\r\n" . $baseurl; ?> /?c=<?php echo $ref; ?> &k=<?php echo generate_collection_access_key($ref, 0, "URL", $access, $expires) . "\r\n" . $lang["expires"] . ": " . $expires . "\r\n\r\n"; } ?> </textarea> </p> <?php } ?> </div> <?php } if (isset($show_error)) { ?> <script type="text/javascript"> alert('<?php echo $error;