コード例 #1
0
ファイル: global.php プロジェクト: hackingman/TubeX
function tbxAboutShow()
{
    Privileges::CheckSuper();
    $output = array();
    $link_removal = LIC_POWEREDBY == 'true' ? 'Not Purchased' : 'Purchased';
    $product = LIC_PRODUCT;
    $licensee = LIC_LICENSEE;
    $domain = LIC_DOMAIN;
    $output['html'] = <<<STUFF
    <div id="dialog-header" class="ui-widget-header ui-corner-all">
      <div id="dialog-close"></div>
      About {$product}
    </div>

    <div id="dialog-panel">
      <div style="padding: 8px;">
        <span style="font-size: 130%; font-weight: bold;">
          This is {$product} version 1.0.1 released on August 4th, 2013
        </span>

        <div class="field">
          <label>Licensee:</label>
          <span class="text-container">All</span>
        </div>

        <div class="field">
          <label>Licensed Domain:</label>
          <span class="text-container">{$domain}</span>
        </div>

        <div class="field">
          <label>Link Removal:</label>
          <span class="text-container">Yes</span>
        </div>

      </div>
    </div>

    <div id="dialog-buttons">
      <input type="button" id="dialog-button-cancel" value="Close" style="margin-left: 10px;" />
    </div>
STUFF;
    JSON::Success($output);
}
コード例 #2
0
ファイル: ajax.php プロジェクト: hackingman/TubeX
function tbxGlobalSettingsSave()
{
    Privileges::CheckSuper();
    $si = ServerInfo::GetCached();
    $required = array('site_name' => 'Site Name', 'meta_description' => 'Meta Description', 'meta_keywords' => 'Meta Keywords', 'document_root' => 'Document Root', 'base_url' => 'TubeX URL', 'cookie_domain' => 'Cookie Domain', 'cookie_path' => 'Cookie Path', 'email_address' => 'E-mail Address', 'email_name' => 'E-mail Name', 'date_format' => 'Date Format', 'time_format' => 'Time Format', 'dec_point' => 'Decimal Point', 'thousands_sep' => 'Thousands Separator', 'video_extensions' => 'File Extensions');
    switch (Request::Get('mailer')) {
        case Mailer::SMTP:
            $required['smtp_hostname'] = 'SMTP Hostname';
            $required['smtp_port'] = 'SMTP Port';
            break;
        case Mailer::SENDMAIL:
            $required['sendmail_path'] = 'Sendmail Path';
            break;
    }
    $v = Validator::Get();
    foreach ($required as $field => $label) {
        $v->Register(Request::Get($field), Validator_Type::NOT_EMPTY, 'The ' . $label . ' field is required');
    }
    if (!$v->Validate()) {
        $output['message'] = 'Settings could not be saved; please fix the following items';
        $output['errors'] = $v->GetErrors();
        return JSON::Failure($output);
    }
    unset($_REQUEST['r']);
    // Setup mcf file for VP6 encoding
    if ($_REQUEST['video_format'] == Video_Converter::FORMAT_VP6 && preg_match('~^[0-9]+$~', $_REQUEST['video_bitrate'])) {
        $fp = fopen(INCLUDES_DIR . '/vp6.mcf', 'r+');
        fseek($fp, 0x14);
        fwrite($fp, pack('s', $_REQUEST['video_bitrate']));
        fclose($fp);
    }
    $_REQUEST['max_upload_size'] = Format::BytesToString(min(Format::StringToBytes($si->php_settings[ServerInfo::PHP_UPLOAD_MAX_FILESIZE]), Format::StringToBytes($_REQUEST['max_upload_size'])));
    $_REQUEST['document_root'] = Dir::StripTrailingSlash($_REQUEST['document_root']);
    $_REQUEST['base_url'] = Dir::StripTrailingSlash($_REQUEST['base_url']);
    $_REQUEST['base_uri'] = parse_url($_REQUEST['base_url'], PHP_URL_PATH);
    $_REQUEST['template_uri'] = $_REQUEST['base_uri'] . '/templates/' . $_REQUEST['template'];
    if (Config::Get('template') != $_REQUEST['template']) {
        tbxTemplateCacheFlush(true);
        TemplateRecompileAll(BASE_DIR . '/templates/' . $_REQUEST['template']);
    }
    ServerInfo::Get(true);
    Config::Save($_REQUEST);
    JSON::Success('Global software settings have been saved');
}