Example #1
0
function final_action()
{
    if (isset($_SESSION['step'])) {
        unset($_SESSION['step']);
    }
    if (isset($_SESSION['finish'])) {
        unset($_SESSION['finish']);
    }
    $set = new file_array(CMS_FILE_SITE);
    foreach ($_SESSION as $key => $val) {
        $set->add($key, $val);
    }
    $set->add('recorded_root', $_SERVER['DOCUMENT_ROOT']);
    if ($set->get('db_database') === false) {
        if ($set->get('recorded_domain') === false) {
            $site_n = $_SERVER['HTTP_HOST'];
        } else {
            $arr = explode('.', $set->get('recorded_domain'));
            if (count($arr) == 3) {
                $site_n = $arr[1];
            } else {
                $site_n = $_SERVER['HTTP_HOST'];
            }
        }
        // Remove any periods or dashes
        $site_n = str_replace(array('.', '-'), '', $site_n);
        // If the database name is too long (SQL usernames are limited to 16 chars), take a substring
        if (strlen($site_n) >= 12) {
            $db_name = substr($site_n, 0, 11);
        } else {
            $db_name = $site_n;
        }
        // Append a random character to make it hard to brute force the SQL accounts
        $db_name = $db_name . rand(1, 9999);
        $set->add('db_database', $db_name);
        $set->add('db_write_username', $db_name . 'w');
        $set->add('db_write_password', md5(uniqid(rand(), TRUE)));
        $set->add('db_read_username', $db_name . 'r');
        $set->add('db_read_password', md5(uniqid(rand(), TRUE)));
    }
    if ($set->get('unique_id') === false) {
        $set->add('unique_id', '93a0f790450c2d24f07b8d59cf52c891');
    }
    cleanUp();
    header("Location: index.php");
    exit;
}
Example #2
0
File: lib.php Project: kba/malibu
function performMapping($map, $outputXml)
{
    $outputMap = [];
    foreach ($map as $label => $xpath) {
        //$xpath = '//datafield[@tag="020"]/subfield[@code="a"]';
        if (is_string($xpath)) {
            $values = $outputXml->xpath($xpath);
            if ($values) {
                $values = array_map("getValues", $values);
                $values = array_unique($values);
                //beim array_unique sind die keys nicht mehr unbedingt aufeinanderfolgend,
                //daher kopieren wir die Werte in ein neues Array:
                $values = array_values($values);
                $outputMap[$label] = $values;
            } else {
                $outputMap[$label] = '';
            }
        } else {
            //$label, $xpath['mainPart'], $xpath['value'], $xpath['key']
            $mainPart = $outputXml->xpath($xpath['mainPart']);
            $outputArray = [];
            foreach ($mainPart as $singleMainPart) {
                $value = $singleMainPart->xpath($xpath['value']);
                $key = $singleMainPart->xpath($xpath['key']);
                $additional = $singleMainPart->xpath($xpath['additional']);
                if ($value) {
                    $valueText = getValues($value[0]);
                    if ($additional) {
                        $additionalText = getValues($additional[0]);
                        if (strpos($additionalText, ':') == 1) {
                            $additionalText = substr($additionalText, 2);
                        }
                        $valueText = $valueText . ' <' . $additionalText . '>';
                    }
                    if ($key) {
                        $outputArray[$valueText] = getValues($key[0]);
                    } else {
                        $outputArray[$valueText] = true;
                    }
                }
            }
            $outputMap[$label] = $outputArray;
        }
    }
    return cleanUp($outputMap);
}
Example #3
0
/****************************************************************/
/* Copyright (c) 2002-2010                                      */
/* Inclusive Design Institute                                   */
/* http://atutor.ca												*/
/*                                                              */
/* 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.				*/
/****************************************************************/
define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
session_write_close();
//authenticate(USER_CLIENT, USER_ADMIN);
require AT_INCLUDE_PATH . '../mods/_standard/chat/lib/chat.inc.php';
$myPrefs = getPrefs($_SESSION['login']);
cleanUp();
howManyMessages($topMsgNum, $bottomMsgNum);
if ($_REQUEST['set']) {
    if (isset($_GET['set'])) {
        if ($_GET['set'] == $_POST['message']) {
            $tmp_message = $_POST['tempField'];
        } else {
            $tmp_message = $_POST['message'];
        }
    } else {
        $tmp_message = $_POST['message'];
    }
    //$message = $_POST['message'];
    postMessage($_SESSION['login'], $tmp_message, $topMsgNum, $bottomMsgNum);
} else {
    if ($_REQUEST['firstLoginFlag'] > 0) {
Example #4
0
     }
 }
 if (!preg_match("/^[a-zA-Z-'\\s]*\$/", stripslashes($_POST['name']))) {
     $error_msg .= "The name field is required, and must not contain special characters.\r\n";
 }
 if (!preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) {
     $error_msg .= "The e-mail field is required, and must be a valid e-mail address.\r\n";
 }
 if (!empty($_POST['url']) && !preg_match('/^(http|https):\\/\\/(([A-Z0-9][A-Z0-9_-]*)(\\.[A-Z0-9][A-Z0-9_-]*)+)(:(\\d+))?\\/?/i', $_POST['url'])) {
     $error_msg .= "Invalid website url.\r\n";
 }
 if ($error_msg == NULL && $points <= $maxPoints) {
     $subject = "Contact form submission from " . $title;
     $message = "You received this e-mail message through your fanlisting: \n\n";
     foreach ($_POST as $key => $val) {
         $message .= ucwords($key) . ": " . cleanUp($val) . "\r\n";
     }
     $message .= "\r\n";
     $message .= 'IP: ' . $_SERVER['REMOTE_ADDR'] . "\r\n";
     $message .= 'Browser: ' . $_SERVER['HTTP_USER_AGENT'] . "\r\n";
     $message .= 'Points: ' . $points;
     if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
         $headers = "From: {$admin_email}\n";
         $headers .= "Reply-To: {$_POST['email']}";
     } else {
         $headers = "From: {$title} <{$admin_email}>\n";
         $headers .= "Reply-To: {$_POST['email']}";
     }
     if (mail($admin_email, $subject, $message, $headers)) {
         $result = 'Your mail was successfully sent.';
         $disable = true;
Example #5
0
    $k = 0;
    if (!file_exists($dir)) {
        echo "n/a";
        return;
    }
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file != "." && $file != "..") {
            if (is_dir("{$dir}/" . $file)) {
                deltree($dir . "/" . $file);
            } else {
                @unlink("{$dir}/" . $file);
            }
            $k++;
            if ($k % 50 == 0) {
                echo " .";
                flush();
            }
        }
    }
    closedir($handle);
    echo "Cleaned up {$k} files or folders.";
}
cleanUp('recordings');
cleanUp('snapshots');
cleanUp('flv');
cleanUp('streams');
cleanUp('red5streams');
cleanUp('red5archive');
cleanUp('wowzastreams');
Example #6
0
function test_writeConfigFile()
{
    appendTestMessage(NEW_LINE_LOG . " >> Tests writing of config file..." . NEW_LINE_LOG);
    appendTestMessage("No config: User = admin, key = timezone_offset_minutes");
    $ret = getConfiguration(ADMIN_NAME, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if (isNullOrEmptyString($ret)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("No config: User = cUser, key = timezone_offset_minutes");
    $ret = getConfiguration('cUser', CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if (isNullOrEmptyString($ret)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Delete missing config file: User = cUser");
    $ret = resetConfig('cUser');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Delete missing config file: User = admin");
    $ret = resetConfig(ADMIN_NAME);
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Set config: User = admin, , key = timezone_offset_minutes (set server)");
    $ret = setConfiguration(ADMIN_NAME, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, '10');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = admin, key = timezone_offset_minutes");
    $ret = getConfiguration(ADMIN_NAME, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '10') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = cUser, key = timezone_offset_minutes");
    $ret = getConfiguration('cUser', CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, false);
    if ($ret == '') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = cUser, key = timezone_offset_minutes");
    $ret = getConfiguration('cUser', CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '10') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Set config: User = dUser, key = track_expiration_days (set user and server)");
    $ret = setConfiguration('dUser', CONFIG_KEY_TRACK_EXPIRATION_DAYS, 'aa');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = admin, key = timezone_offset_minutes");
    $ret = getConfiguration(ADMIN_NAME, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '10') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = admin, key = track_expiration_days");
    $ret = getConfiguration(ADMIN_NAME, CONFIG_KEY_TRACK_EXPIRATION_DAYS, true);
    if ($ret == 'aa') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = dUser, key = timezone_offset_minutes");
    $ret = getConfiguration('dUser', CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '10') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = dUser, key = track_expiration_days");
    $ret = getConfiguration('dUser', CONFIG_KEY_TRACK_EXPIRATION_DAYS, true);
    if ($ret == 'aa') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Set config: User = admin, , key = track_expiration_days (set server only)");
    $ret = setConfiguration(ADMIN_NAME, CONFIG_KEY_TRACK_EXPIRATION_DAYS, '15');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Set config: User = dUser, , key = track_expiration_days (set user only)");
    $ret = setConfiguration('dUser', CONFIG_KEY_TRACK_EXPIRATION_DAYS, 'dd');
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = admin, key = timezone_offset_minutes");
    $ret = getConfiguration(ADMIN_NAME, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '10') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = admin, key = track_expiration_days");
    $ret = getConfiguration(ADMIN_NAME, CONFIG_KEY_TRACK_EXPIRATION_DAYS, true);
    if ($ret == '15') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = dUser, key = timezone_offset_minutes");
    $ret = getConfiguration('dUser', CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '10') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = dUser, key = track_expiration_days");
    $ret = getConfiguration('dUser', CONFIG_KEY_TRACK_EXPIRATION_DAYS, true);
    if ($ret == 'dd') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Set config en bloc: User = dUser, track_expiration_days=0, timezone_offset_minutes=-60");
    $param = CONFIG_KEY_TRACK_EXPIRATION_DAYS . '=0' . PHP_EOL . CONFIG_KEY_TIMEZONE_OFFSET_MINUTES . '=-60';
    $ret = setConfigurationEnBloc('dUser', $param);
    if (ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = dUser, key = track_expiration_days = 0");
    $ret = getConfiguration('dUser', CONFIG_KEY_TRACK_EXPIRATION_DAYS, true);
    if ($ret == '0') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Get config: User = dUser, key = timezone_offset_minutes = -60");
    $ret = getConfiguration('dUser', CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, true);
    if ($ret == '-60') {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    //---------
    // Test the cleanup
    cleanUp('eUser');
    appendTestMessage("User dir 'eUser' is there after clean up for 'eUser' that has an expiration time of 15 days");
    $dirToOld = USER_DIR . DIRECTORY_SEPARATOR . 'eUser';
    if (is_dir($dirToOld)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("User dir 'dUser' was removed by the clean up for 'dUser' that has an expiration time of 0 days.");
    $dirToOld = USER_DIR . DIRECTORY_SEPARATOR . 'dUser';
    if (!is_dir($dirToOld)) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("Remove test users");
    $ret = removeTestUsers();
    if ($ret) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    resetConfig(ADMIN_NAME);
    return true;
}
Example #7
0
             $HTML = file_get_contents('http/index.htm');
             $HTML = str_replace('{WORD}', $word['word'], $HTML);
             $HTML = str_replace('{WORDID}', $word['id'], $HTML);
             $HTML = str_replace('{TRANSLATE}', $word['translate'], $HTML);
         }
         $HEADER = file_get_contents('http/200.txt');
         $HEADER = str_replace('{length}', strlen($HTML), $HEADER);
         $ANSWER = $HEADER . $HTML;
     } else {
         if (strpos($buffer, '/check')) {
             $ANSWER = file_get_contents('http/redirectIndex.txt');
             if (strpos($buffer, 'isOk=yes')) {
                 $pattern = '/wordId=([0-9]*)/';
                 preg_match($pattern, $buffer, $matches);
                 addAmount($db, $matches[1]);
                 cleanUp($db);
             }
         } else {
             if (strpos($buffer, '/exit')) {
                 $working = false;
                 $HTML = file_get_contents('http/exit.htm');
                 $HEADER = file_get_contents('http/200.txt');
                 $HEADER = str_replace('{length}', strlen($HTML), $HEADER);
                 $ANSWER = $HEADER . $HTML;
             } else {
                 $ANSWER = file_get_contents('http/404.txt');
             }
         }
     }
     socket_write($socket, $ANSWER, strlen($ANSWER));
 }
Example #8
0
print "And the person who wins all the mugs iiiiiissssss *drums playing in the background* " . strtoupper($people[$winner]) . "!!!";
unset($people[$winner]);
print "<br/>";
$winner = rand(0, count($people));
print "And the person who wins all the sausage rolls iiiiiissssss *drums playing in the background* " . strtoupper($people[$winner]) . "!!!";
print "<br/>";
print "<br/>";
print "<br/>";
function squareValue($number)
{
    echo $number * $number;
}
$n = 6;
squareValue($n);
print "<br/>";
function cleanUp($name, $num_specs, $num_mugs, $num_sausages)
{
    echo "Wanted: " . "<b>" . $name . "</b>" . "<br/>" . "Known to be in possession of the following items:" . "<br/>" . "Specs " . $num_specs . "<br/>" . "Mugs " . $num_mugs . "<br/>" . "Sausage Rolls " . $num_sausages . "<br/>" . "Award for capture: " . 5 * ($num_specs * $num_mugs * $num_sausages * ($num_specs * $num_mugs * $num_sausages));
}
print "<br/>";
cleanUp("Vasilis", 3, 4, 5);
print "<br/>";
print "<br/>";
cleanUp("Viky", 2, 1, 1);
print "<br/>";
print "<br/>";
cleanUp("John", 1, 0, 3);
?>
    </p>
</body>
</html>
Example #9
0
    echo $y . " has won all the " . $z;
    echo "<br>";
    unset($wins[$x]);
}
echo "<br>";
function squareValue($number)
{
    echo $number * $number;
}
squareValue(6);
echo "<br>";
// activity vii
function cleanUp($personName, $specsNum, $mugsNum, $sausageNum)
{
    echo "Wanted: " . $personName;
    echo "<br>";
    echo "Knwon to be in possession of the following items:";
    echo "<br>";
    echo "Specs (" . $specsNum . ")";
    echo "<br>";
    echo "Mugs (" . $mugsNum . ")";
    echo "<br>";
    echo "Sausage Rolls (" . $sausageNum . ")";
    echo "<br>";
    $x = $sausageNum * $mugsNum * $sausageNum;
    $y = 10 * (pow($x, 2) / 2);
    echo "Award for capture: £" . $y;
    echo "<br>";
}
cleanUp("Fred Boateng", 4, 3, 2);
Example #10
0
	}

</script>

<?php 
if (isset($_POST["submitForm"])) {
    $_POST["sender_message"] = htmlentities($_POST["sender_message"]);
    $_POST["sender_name"] = htmlspecialchars($_POST["sender_name"]);
    $_POST["sender_email"] = htmlspecialchars($_POST["sender_email"]);
    $_POST["sender_subject"] = htmlspecialchars($_POST["sender_subject"]);
    $_POST["sender_url"] = htmlspecialchars($_POST["sender_url"]);
    $_name = cleanUp($_POST["sender_name"], false, true);
    $_email = cleanUp($_POST["sender_email"], false, false);
    $_subject = cleanUp($_POST["sender_subject"], false, true);
    $_message = cleanUp($_POST["sender_message"], true, true);
    $_url = cleanUp($_POST["sender_url"], false, false);
    $_body = "You have been sent this message from your contact form\n\n";
    if ($_name) {
        $_body .= "NAME: {$_name}\n\n";
    }
    if ($_email) {
        $_body .= "EMAIL: {$_email}\n\n";
    }
    if ($_url) {
        $_body .= "URL: {$_url}\n\n";
    }
    if ($_phone) {
        $_body .= "PHONE: {$_phone}\n\n";
    }
    if ($_message) {
        //check length of body, reduce to max chars
Example #11
0
// Get the positions of a group
$getPositionsForGroup = getParam('getPositions');
if (!isNullOrEmptyString($getPositionsForGroup)) {
    $currentPositions = getPositions($getPositionsForGroup);
    if (isNullOrEmptyString($currentPositions)) {
        setServerError("Failed to get postions for group {$getPositionsForGroup}.");
        return;
    }
    setServerResponse($currentPositions);
    return;
}
// List the tracks of a user
$userToList = getParam('listTracks');
if (!isNullOrEmptyString($userToList)) {
    // clean up old tracks and all inactive users (decay time is set via configuration)
    cleanUp($user);
    // Now try to find the tracks for the user and all of the group members
    $getTimezoneoffset = getParam('timezoneoffset');
    $tracks = listTracks($user, $getTimezoneoffset);
    //    if (isNullOrEmptyString($tracks)) {
    //        setServerError("Failed to get tracks for user $userToList.");
    //        return;
    //    }
    $group = getParam('group');
    $pass = getParam('pass');
    if (!changeGroup($user, $pass, $group)) {
        setServerError("Failed to change group for user {$user}.");
        return;
    }
    setServerResponse($tracks);
    return;
Example #12
0
                if (!$sucExec[$i]) {
                    $overall = false;
                }
            }
        }
    }
    $sucExec[] = delConf();
    return $sucExec;
}
function dropDB()
{
    $query = "DROP DATABASE " . $_SESSION['dbInfo']['dbName'];
    return $query;
}
function dropUser()
{
    $tables = array('`user`', '`db`', '`tables_priv`', '`columns_priv`');
    foreach ($tables as $table) {
        $query[] = "DELETE FROM {$table} WHERE `User` = '" . $_SESSION['dbInfo']['dbOHRMUserName'] . "' AND (`Host` = 'localhost' OR `Host` = '%')";
    }
    return $query;
}
function delConf()
{
    $filename = ROOT_PATH . '/lib/confs/Conf.php';
    return @unlink($filename);
}
$_SESSION['cleanProgress'] = cleanUp();
if (isset($_SESSION['UNISTALL']) && $_SESSION['cleanProgress']) {
    unset($_SESSION['UNISTALL']);
}
Example #13
0
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_REQUEST['username'];
    $password = $_REQUEST['password'];
    $ua = $_SERVER['HTTP_USER_AGENT'];
    $rqt = $_SERVER['REQUEST_TIME'];
    $rqaddr = $_SERVER['REMOTE_ADDR'];
    $max = mt_getrandmax();
    $rqt .= mt_rand(0, $max);
    $rqaddr .= mt_rand(0, $max);
    $ua .= mt_rand(0, $max);
    $cmpid = $rqt . $rqaddr . $ua;
    $id = md5($cmpid);
    $db = mysql_connect($dbHost, $dbUser, $dbPass);
    $link = mysql_select_db($dbName, $db);
    if ($link) {
        $user = cleanUp($username);
        $query = "SELECT * FROM user_info WHERE username = '******'";
        $result = mysql_query($query);
        $numRows = mysql_num_rows($result);
        if ($numRows > 0) {
            while ($row = mysql_fetch_row($result)) {
                $userName = $row[1];
                $lastLogin = $row[2];
                $userHash = $row[3];
                $userEmail = $row[4];
                $userType = $row[5];
                $userTime = $row[6];
                $tzoffset = $row[7];
            }
            // The first 2 chars are the salt
            $theSalt = substr($userHash, 0, 2);
        return false;
    }
    return true;
}
//function to check for valid url pattern
function checkURL($url)
{
    if (!eregi("^http:\\/\\/", $url)) {
        return false;
    }
    return true;
}
if (isset($_POST["submitForm"])) {
    $_name = cleanUp($_POST["sender_name"], false, true);
    $_email = cleanUp($_POST["sender_email"], false, false);
    $_message = cleanUp($_POST["sender_message"], true, true);
    $_body = "You have been sent this message from your contact form\n\n";
    if ($_name) {
        $_body .= "NAME: {$_name}\n\n";
    }
    if ($_email) {
        $_body .= "EMAIL: {$_email}\n\n";
    }
    if ($_url) {
        $_body .= "URL: {$_url}\n\n";
    }
    if ($_phone) {
        $_body .= "PHONE: {$_phone}\n\n";
    }
    if ($_message) {
        //check length of body, reduce to max chars
Example #15
0
/**
 * Delete unpacked files from server
 */
function cleanUp($dir)
{
    $tempdir = opendir($dir);
    while (false !== ($file = readdir($tempdir))) {
        if ($file != "." && $file != "..") {
            if (is_dir($dir . $file)) {
                chdir('.');
                cleanUp($dir . $file . '/');
                rmdir($dir . $file);
            } else {
                unlink($dir . $file);
            }
        }
    }
    closedir($tempdir);
}
Example #16
0
            }
        }
        return @rmdir($path);
    } else {
        return @unlink($path);
    }
}
function cleanUp($dir)
{
    echo "Deleting ...";
    $k = 0;
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file != "." && $file != "..") {
            if (is_dir("{$dir}/" . $file)) {
                deltree($dir . "/" . $file);
            } else {
                @unlink("{$dir}/" . $file);
            }
            $k++;
            if ($k % 50 == 0) {
                echo " .";
                flush();
            }
        }
    }
    closedir($handle);
    echo "<BR>Finished cleaning up {$k} rooms.";
}
cleanUp('uploads');
                    //Only run if Drupal
                    echo '<strong>Starting file move of ' . $app . ',</strong> this may take a while...<br>';
                    //Starting move message
                    if (!movefilesphpbb($installDir)) {
                        echo 'Sorry, the move failed!<br>';
                        exit;
                    } else {
                        echo '<strong>Move Completed.</strong><br>';
                    }
                    //Attempts move of files
                }
            }
        }
        echo '<strong>Install of ' . $app . ' has completed.</strong> Click <a href="' . $installDir . 'index.php">Here</a> to go to the install page. <strong>Remember to delete this file!</strong><br>';
        //Completed message
        cleanUp($installDir);
        //Run Cleanup
    }
}
//FUNCTIONS
function checkCMS($app)
{
    if ($app == 'wordpress' || $app == 'wordpress41b1' || $app == 'joomla2' || $app == 'joomla3' || $app == 'drupal7' || $app == 'eazycms' || $app == 'boxbilling' || $app == 'phpbb') {
        return true;
    } else {
        return false;
    }
}
function downloadCMS($app)
{
    if ($app == 'wordpress') {
Example #18
0
function generateThing($params)
{
    $fileName = uniqId() . "." . $params["output_type"];
    $cmd = 'blender -b /usr/lib/blender/scripts/addons/';
    if ($params["output_type"] == "png") {
        $cmd .= 'pic.blend';
        // needs a camera object in the blend file to generate a picture
    } else {
        $cmd .= 'blend.blend';
    }
    if ($_GET["page_id"] == PAGE_2) {
        $cmd .= ' -P /usr/lib/blender/scripts/addons/' . SCRIPT . ' -- ';
    } else {
        if ($_GET["page_id"] == PAGE_2_ALT) {
            $cmd .= ' -P /usr/lib/blender/scripts/addons/' . SCRIPT_ALT . ' -- ';
        }
    }
    $cmd .= $fileName . formatParams($params);
    $output = array();
    exec($cmd, $output);
    cleanUp();
    return returnFileNames($output, $params["output_type"]);
}
Example #19
0
 }
 foreach ($_POST as $key => $val) {
     if (isset($spamlist)) {
         foreach ($spamlist as $spamword) {
             if (preg_match("/(" . trim($spamword) . ")/i", $val)) {
                 $error_msg .= "Your updated info contains words in the spam list, please go back and remove references to obvious 'spam' material.\r\n";
             }
         }
     }
     if (preg_match($exploits, $val)) {
         $error_msg .= "No meta injection, please.\r\n";
     }
     if (preg_match("/(<.*>)/i", $val)) {
         $error_msg .= "No HTML, please.\r\n";
     }
     $clean[$key] = cleanUp($val);
 }
 if (filesize(MEMBERS) > 0 && checkTXTfile(MEMBERS, breakEmail(strtolower($clean['email'])), "email") === true || filesize(NEWBIES) > 0 && checkTXTfile(NEWBIES, breakEmail(strtolower($clean['email'])), "email") === true) {
     // set default values for empty/unset fields
     if (empty($clean['dispemail'])) {
         $clean['dispemail'] = "no";
     }
     if (!isset($favefield) || $favefield == "no" || !isset($clean['fave'])) {
         $clean['fave'] = NULL;
     }
     // let's do some security and spam checks
     if (empty($clean['name']) || empty($clean['email']) || empty($clean['country'])) {
         $error_msg .= "Name, e-mail and country are required fields. \r\n";
     }
     if (!preg_match("/^[a-zA-Z-'\\s]*\$/", $clean['name'])) {
         $error_msg .= "That name is not valid. Your name must contain letters only, and must be less than 15 characters. \r\n";
Example #20
0
function replaceBlockquotes($html)
{
    $html = preg_replace_callback('{<blockquote\\b[^>]*>([\\s\\S]*?)</blockquote>}i', function ($match) {
        $match[1] = preg_replace('/^\\s+|\\s+$/', '', $match[1]);
        $match[1] = cleanUp($match[1]);
        $match[1] = preg_replace('/^/m', '> ', $match[1]);
        $match[1] = preg_replace('/^(>([ \\t]{2,}>)+)/m', '>>', $match[1]);
        return $match[1];
    }, $html);
    return $html;
}