function convert($currency_value, $your_currencies)
{
    global $exchangeRates, $currencies;
    if (isset($your_currencies)) {
        $list_currencies = $your_currencies;
    } elseif (isset($currencies)) {
        $list_currencies = $currencies;
    } else {
        $list_currencies = (array) $exchangeRates->rates;
    }
    foreach ($list_currencies as $key => $value) {
        if (is_assoc($list_currencies)) {
            $return_list[$key] = convert_to($currency_value, $key);
        } else {
            $return_list[$value] = convert_to($currency_value, $value);
        }
    }
    return $return_list;
}
Example #2
0
    print "got new connection\n";
    $pid = pcntl_fork();
    if ($pid != 0) {
        // In the main process
        socket_close($spawn);
    } else {
        // We are in the forked child process
        socket_write($spawn, "eZ Publish document conversion daemon\n");
        // Parse input
        $input = socket_read($spawn, 1024);
        $inputParts = explode(" ", $input);
        $command = trim($inputParts[0]);
        $fileName = trim($inputParts[1]);
        $destName = trim($inputParts[2]);
        if (file_exists($fileName)) {
            $result = convert_to($fileName, $command, $destName);
            if (!($result === true)) {
                echo "Error: {$result}";
                socket_write($spawn, "Error: {$result}");
            } else {
                echo "Conversion ok. FilePath: {$destName}";
                socket_write($spawn, "FilePath: {$destName}");
            }
        } else {
            echo "Error: (2)-File not found";
            socket_write($spawn, "Error: (2)-File not found");
        }
        socket_close($spawn);
        die('Data Recieved on child ' . posix_getpid() . "\n");
    }
}
     $errors[] = 'Publication submission start date must be entered';
 }
 if (!empty($_POST['psdue'])) {
     $tempdate = trim($_POST['psdue']);
     if (vardate($tempdate)) {
         $AuthorPublicationSubmissionDueDate = convert_to($tempdate);
     } else {
         $errors[] = 'The publication submission due date provided was in the wrong format.';
     }
 } else {
     $errors[] = 'Publication submission due date must be entered';
 }
 if (!empty($_POST['pdate'])) {
     $tempdate = trim($_POST['pdate']);
     if (vardate($tempdate)) {
         $PublicationDate = convert_to($tempdate);
     } else {
         $errors[] = 'The publication date provided was in the wrong format.';
     }
 } else {
     $errors[] = 'Publication date must be entered';
 }
 // create query and send the data.
 if (empty($errors)) {
     // no errors
     $q_dates = "CALL spUpdateArticleDates ('{$Year}', '{$AuthorFirstSubmissionStartDate}', '{$AuthorFirstSubmissionDueDate}', \n\t\t'{$FirstReviewStartDate}', '{$FirstReviewDueDate}', '{$AuthorSecondSubmissionStartDate}', '{$AuthorSecondSubmissionDueDate}', \n\t\t'{$SecondReviewStartDate}', '{$SecondReviewDueDate}', '{$AuthorPublicationSubmissionStartDate}', '{$AuthorPublicationSubmissionDueDate}',\n\t\t'{$PublicationDate}')";
     if (mysqli_query($dbc, $q_dates)) {
         echo '<p>You have successfully updated the submission dates.</p><p><br /></p>';
     } else {
         echo '<p>There was an error updating the submission dates. Please try again.</p><br />,/p>';
     }
Example #4
0
 require './include_utils/date_conversion.php';
 $role = $_POST['role'];
 if (!empty($_POST['title'])) {
     $title = $_POST['title'];
 } else {
     $errors[] = 'Please provide a title for the announcement';
 }
 if (!empty($_POST['announcement'])) {
     $announcement = $_POST['announcement'];
 } else {
     $errors[] = 'Please provide an announcement';
 }
 if (!empty($_POST['expiration'])) {
     $tempdate = $_POST['expiration'];
     if (vardate($tempdate)) {
         $expiration = convert_to($tempdate);
     } else {
         $errors[] = 'The expiration date provided was in the wrong format.';
     }
 } else {
     $errors[] = 'Please provide an expiration date';
 }
 if (empty($errors) && ($success = 'no')) {
     //if everything ran ok
     $q_announce = "CALL spCreateAnnouncement('{$title}', '{$announcement}', '{$expiration}')";
     $announcementID = mysqli_query($dbc, $q_announce);
     complete_procedure($dbc);
     $success = 'yes';
     // make sure the announcement is not created again if the user forgets to select a role
     $announcementID = mysqli_fetch_array($announcementID, MYSQLI_ASSOC);
     $announcementID = $announcementID["AnnouncementID"];