function vidtrial_send_confirm($email_address, $name, $url, $expires, $extra_query_params) { require_once(plugin_dir_path(__FILE__) . "crypto.php"); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $template = stripslashes(get_option("vidtrial_template_confirm")); $template = str_replace("{{USER}}", stripslashes($name), $template); $link = generate_signature($email_address, $expires, AUTH_KEY); foreach(array_keys($extra_query_params) as $key){ $link[$key] = $extra_query_params[$key]; } $que = (strpos($url, "?") === false) ? '?' : '&'; $mail = str_replace("{{LINK}}", $url.$que.http_build_query($link), $template); if(!wp_mail($email_address, __("Confirm your Vidyo Trial", VIDTRIAL_TD), $mail, $headers)){ throw new MailError("Failed to send email"); } }
// run swift to generate wave file system("/opt/swift/bin/swift -o " . TEMP_WAVE . " -f " . EMERG_TEXT); // run lame to convert to mp3 system("lame -b 128 " . TEMP_WAVE . " " . MP3_PATH); // remove text file unlink(EMERG_TEXT); // remove temp wave file unlink(TEMP_WAVE); // remove lock file unlink(LOCK_FILE); $url = MP3_URL; } else { if (!file_exists(MP3_PATH) && file_exists(LOCK_FILE)) { $url = "none"; // wait until other process finishes } else { // audio file exists # check the timestamp on the MP3_PATH and make sure it # isn't too stale $stat = stat(MP3_PATH); if (time() - $stat['mtime'] > TIMEOUT) { $url = "none"; } else { $url = MP3_URL; } } } } $resp = generate_signature($chal . $url); print "{$resp}\n"; print "{$url}\n";
public function add_file($filename, $target_path) { $id = $this->id; # get the md5 hash of the file and sign it $path = BASE_DIR . "/flash/" . $filename; $md5 = md5_file($path); #$tmp = split('= ', exec("openssl md5 $path")); #$md5 = trim($tmp[1]); print "-->" . $md5 . "<--"; $sig = generate_signature($md5); $filename = basename($filename); if (!file_exists(BASE_DIR . "/flash/{$filename}")) { die("File does not exist!"); } $url = BASE_URL . "/flash/{$filename}"; $filename = mysql_escape_string($filename); $url = mysql_escape_string($url); $target_path = mysql_escape_string($target_path); $md5 = mysql_escape_string($md5); $sig = mysql_escape_string($sig); mysql_query("insert into file_map (class_id, filename, url, output_path, md5, sig) " . "values({$id}, \"{$filename}\", \"{$url}\", \"{$target_path}\", \"{$md5}\", \"{$sig}\")") or die("failure to add file to class: " . mysql_error()); }
check_area_status($eb_area, $fyr_voting_area); //Check the contact method exists $success = msg_recipient_test($fyr_values['who']); if (rabx_is_error($success)) { list($error_type, $error_msg) = recipient_test_error($success, $eb_area, $fyr_voting_area, $fyr_representative); $values = array('error_message' => $error_msg); if ($error_type == 'shame') { $values['title'] = 'Oh no! What a shame!'; } template_draw("error-general", $values); exit(1); } //Assemble the name string $stash['rep_text'] = $fyr_voting_area['rep_prefix'] . " " . $fyr_representative['name'] . " " . $fyr_voting_area['rep_suffix']; } generate_signature($fyr_values); // Work out which page we are on, using which submit button was pushed // to get here $on_page = on_page($fyr_values); if ($on_page == 'preview' || $on_page == 'write') { $options = cobrand_write_form_options($cobrand); $writeForm = buildWriteForm($options); } // Error in form when trying to submit for preview if ($on_page == 'preview' && !$writeForm->validate()) { $on_page = "write"; } // Display it if ($on_page == "write") { $writeForm->setDefaults(array('body' => default_body_text())); $writeForm->setConstants($fyr_values);
<?php $endpoint = 'sandbox'; require_once './mturk.php'; // Calculate the request authentication parameters $operation = "CreateHIT"; $title = "How's the weather?"; $description = 'Write a paragraph about the weather in your area.'; $keywords = "weather, fun, writing, vtcs5774"; $url = 'http://contextslices.kurtluther.com/weather.php'; $frame_height = 400; // height of window, in pixels $timestamp = generate_timestamp(time()); $signature = generate_signature($SERVICE_NAME, $operation, $timestamp, $AWS_SECRET_ACCESS_KEY); // Construct the request $url2 = $SERVICE_ENDPOINT . "?Service=" . urlencode($SERVICE_NAME) . "&Operation=" . urlencode($operation) . "&Title=" . urlencode($title) . "&Description=" . urlencode($description) . "&Keywords=" . urlencode($keywords) . "&Reward.1.Amount=0.25" . "&Reward.1.CurrencyCode=USD" . "&Question=" . urlencode(constructQuestion($url, $frame_height)) . "&AssignmentDurationInSeconds=3600" . "&LifetimeInSeconds=3600" . "&AutoApprovalDelayInSeconds=86400" . "&MaxAssignments=10" . "&Version=" . urlencode($SERVICE_VERSION) . "&Timestamp=" . urlencode($timestamp) . "&AWSAccessKeyId=" . urlencode($AWS_ACCESS_KEY_ID) . "&ResponseGroup.0=Minimal" . "&ResponseGroup.1=HITDetail" . "&QualificationRequirement.1.QualificationTypeId=00000000000000000071" . "&QualificationRequirement.1.Comparator=EqualTo" . "&QualificationRequirement.1.LocaleValue.Country=US" . "&QualificationRequirement.2.QualificationTypeId=000000000000000000L0" . "&QualificationRequirement.2.Comparator=GreaterThan" . "&QualificationRequirement.2.IntegerValue=90" . "&QualificationRequirement.3.QualificationTypeId=00000000000000000040" . "&QualificationRequirement.3.Comparator=GreaterThan" . "&QualificationRequirement.3.IntegerValue=50" . "&Signature=" . urlencode($signature); // Make the request $xml = simplexml_load_file($url2); // Print any errors if ($xml->OperationRequest->Errors) { print_errors($xml->OperationRequest->Errors->Error); } $hitID = strval($xml->HIT->HITId); if ($hitID != '') { print "Created HIT " . $hitID . " on Amazon Mechanical Turk (" . $endpoint . ")...<br/>\n"; } print "====================<br/>\n";
<?php /** * This file was developed as part of the Concerto digital signage project * at RPI. * * Copyright (C) 2009 Rensselaer Polytechnic Institute * (Student Senate Web Technologies Group) * * 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. * * @package Concerto * @author Web Technologies Group, $Author$ * @copyright Rensselaer Polytechnic Institute * @license GPLv2, see www.gnu.org/licenses/gpl-2.0.html * @version $Revision$ */ require ROOT_DIR . '/hardware/config.php'; require ROOT_DIR . '/hardware/signature.php'; $resp = generate_signature($this->challenge); print "{$resp}\n"; print $this->status ? "on\n" : "off\n";