예제 #1
0
                $VideosInDB = Video::Filter($Videos, $ModelID, $Set->getID(), $matches['Name'] . $matches['Number'] . $matches['Suffix']);
                if ($VideosInDB) {
                    $VideoInDB = $VideosInDB[0];
                    $cis = CacheImage::Filter($CacheImages, NULL, NULL, NULL, NULL, NULL, $VideoInDB->getID());
                    CacheImage::DeleteMulti($cis, $CurrentUser);
                } else {
                    $VideoInDB = new Video();
                    $VideoInDB->setSet($Set);
                }
                $VideoInDB->setFileName($matches['Prefix'] . $matches['Name'] . $matches['Number'] . $matches['Suffix']);
                $VideoInDB->setFileExtension($matches['Extension']);
                $VideoInDB->setFileSize($FileInfo->getSize());
                $VideoInDB->setFileCheckSum(Utils::CalculateMD5($FileInfo->getRealPath()));
                $VideoInDB->setFileCRC32(Utils::CalculateCRC32($FileInfo->getRealPath()));
                if (!$VideoInDB->getID() && $CurrentUser->hasPermission(RIGHT_VIDEO_ADD)) {
                    Video::Insert($VideoInDB, $CurrentUser);
                } else {
                    if ($CurrentUser->hasPermission(RIGHT_VIDEO_EDIT)) {
                        Video::Update($VideoInDB, $CurrentUser);
                    }
                }
            }
        }
    }
    $infoSuccess = new Info($lang->g('MessageVideosImported'));
    Info::AddInfo($infoSuccess);
    if (isset($argv) && $argc > 0) {
        $bi->Finish();
    }
}
HTMLstuff::RefererRedirect();
예제 #2
0
    $SmtpUsername = isset($_POST['txtSmtpUsername']) && strlen($_POST['txtSmtpUsername']) > 0 ? (string) $_POST['txtSmtpUsername'] : NULL;
    $SmtpPassword = isset($_POST['txtSmtpPassword']) && strlen($_POST['txtSmtpPassword']) > 0 ? (string) $_POST['txtSmtpPassword'] : NULL;
    $SmtpPort = isset($_POST['txtSmtpPort']) && intval($_POST['txtSmtpPort']) > 0 ? intval($_POST['txtSmtpPort']) : 0;
    $SmtpAuth = array_key_exists('chkSmtpAuth', $_POST);
    // Checks
    // TODO
    // Read-write config.php
    if (($configfile = file_get_contents('config.php')) !== FALSE) {
        $configfile = preg_replace(array("/define\\('CANDYPATH'           [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('CANDYVIDEOTHUMBPATH' [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('DBHOSTNAME'          [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('DBUSERNAME'          [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('DBPASSWORD'          [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('DBNAME'              [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('SMTP_FROM_ADDRESS'   [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('SMTP_FROM_NAME'      [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('SMTP_HOST'           [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('SMTP_USERNAME'       [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('SMTP_PASSWORD'       [ \t]*,[ \t]*'[^']+?'[ \t]*\\);/ix", "/define\\('SMTP_PORT'           [ \t]*,[ \t]*\\d+[ \t]*\\);/ix", "/define\\('SMTP_AUTH'           [ \t]*,[ \t]*(true|false)[ \t]*\\);/ix", "/define\\('CMDLINE_USERID'      [ \t]*,[ \t]*\\d+[ \t]*\\);/ix"), array(sprintf("define('CANDYPATH', '%1\$s');", $CandyPath), sprintf("define('CANDYVIDEOTHUMBPATH', '%1\$s');", $CandyVideoThumbPath), sprintf("define('DBHOSTNAME', '%1\$s');", $DBHostName), sprintf("define('DBUSERNAME', '%1\$s');", $DBUserName), sprintf("define('DBPASSWORD', '%1\$s');", $DBPassword), sprintf("define('DBNAME', '%1\$s');", $DBName), sprintf("define('SMTP_FROM_ADDRESS', '%1\$s');", $SmtpFromAddress), sprintf("define('SMTP_FROM_NAME', '%1\$s');", $SmtpFromName), sprintf("define('SMTP_HOST', '%1\$s');", $SmtpHostname), sprintf("define('SMTP_USERNAME', '%1\$s');", $SmtpUsername), sprintf("define('SMTP_PASSWORD', '%1\$s');", $SmtpPassword), sprintf("define('SMTP_PORT', %1\$d);", $SmtpPort), sprintf("define('SMTP_AUTH', %1\$s);", $SmtpAuth ? 'TRUE' : 'FALSE'), sprintf("define('CMDLINE_USERID', %1\$d);", $CommandlineUserID)), $configfile);
        if ($CurrentUser->hasPermission(RIGHT_CONFIG_REWRITE)) {
            if (@file_put_contents('config.php', $configfile) === FALSE) {
                $e = new Error(NULL, $lang->g('ErrorSetupWritingConfig'));
                Error::AddError($e);
            } else {
                $i = new Info($lang->g('MessageConfigWritten'));
                Info::AddInfo($i);
            }
        } else {
            $e = new Error(RIGHTS_ERR_USERNOTALLOWED);
            Error::AddError($e);
        }
    } else {
        $e = new Error(NULL, $lang->g('ErrorSetupWritingConfig'));
        Error::AddError($e);
    }
}
$UsersOptions = '';
$Users = User::GetUsers();
/* @var $User User */
foreach ($Users as $User) {
    $UsersOptions .= sprintf("<option value=\"%1\$d\"%3\$s>%2\$s</option>", $User->getID(), htmlentities($User->GetFullName()), HTMLstuff::SelectedStr($User->getID() == $CommandlineUserID));