Ejemplo n.º 1
0
/**
 * @ignore
 */
function doImport(&$config)
{
    $installerPath = __AMBER_BASE__ . '/install/';
    $amber =& Amber::getInstance($config);
    // Create tx_amber_sys_objects
    $sysDb =& Amber::sysDb();
    $sql = file_get_contents($installerPath . '/tx_amber_sys_objects.sql');
    if ($sql == false) {
        echo formatMessage('Unable to open tx_amber_sys_objects.sql');
        return false;
    }
    $sysDb->Execute($sql);
    if ($sysDb->ErrorNo() != 0) {
        echo formatMessage('Importing tx_amber_sys_objects.sql failed:<p />' . $sysDb->ErrorMsg());
    }
    // Create table which hold sample data
    $db =& Amber::currentDb();
    $sql = @file_get_contents($installerPath . '/sample_data.sql');
    if ($sql == false) {
        echo formatMessage('Unable to open sample_data.sql');
        return false;
    }
    $db->Execute($sql);
    if ($db->ErrorNo() != 0) {
        echo formatMessage('Importing sample_data.sql failed:<p />' . $db->ErrorMsg());
    }
}
Ejemplo n.º 2
0
function printMessage($violation)
{
    $str = formatMessage($violation);
    if (!class_exists('ColorCLI')) {
        return $str;
    }
    $priority = $violation['priority'];
    if (isHighPriority($priority)) {
        return ColorCLI::red($str);
    } elseif (isNormatPriority($priority)) {
        return ColorCLI::yellow($str);
    }
    return ColorCLI::cyan($str);
}
Ejemplo n.º 3
0
    $datain = fread($handle, filesize($filename));
    fclose($handle);
    $out = explode("<!-- E -->", $datain);
    $outCount = count($out) - 1;
    $j = 0;
    for ($i = 0; $i <= $outCount; $i++) {
        if (unserialize($out[$i]) != FALSE) {
            $lines[$j] = unserialize($out[$i]);
            $j++;
        }
    }
    // Make user input safe, insert emoticons, and encode UBB code -------------------------------------
    function formatMessage($mess)
    {
        $mess = stripcslashes($mess);
        $mess = html_entity_decode($mess, ENT_NOQUOTES, 'UTF-8');
        $mess = utf8_encode($mess);
        return $mess;
    }
    for ($i = 0; $i < count($lines); $i++) {
        $gbXML = new gbXML('messages', 'message', 'data.xml');
        $id = $gbXML->get_max_value_for_tag('id');
        ++$id;
        $myUBB = new UBBCodeN();
        $tmpArray = array('id' => $id, 'date' => $lines[$i]->showDate(), 'name' => formatMessage($lines[$i]->showFrom()), 'email' => $lines[$i]->showEmail(), 'msg' => formatMessage($lines[$i]->showMessage()));
        if ($gbXML->append_record_to_file($tmpArray) === TRUE) {
            // Add code to display progress
        }
    }
    echo "Conversion is complete.";
}
Ejemplo n.º 4
0
/**
 * Package everything up
 *
 * @param  string name of the current application
 * @param  string version of the application
 * @return boolean
 */
function package($appName, $version)
{
    echo formatMessage('-- creating archive', ' ');
    $exclusions = preg_split('/\\s+/', file_get_contents('.exclude'));
    foreach ($exclusions as $exclusion) {
        $exclusion = trim($exclusion);
        $exclusionFlags[] = "--exclude={$appName}/{$exclusion}";
    }
    $exclusionFlags = implode(' ', $exclusionFlags);
    $filename = "";
    // Include COPY_EXTENDED_ATTRIBUTES_DISABLE=true for packaging on Mac OS X
    $command = 'COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true ' . "tar {$exclusionFlags} -cjvf {$appName}{$version}.tar.bz2 {$appName}";
    chdir('tmp');
    exec($command, $output, $return);
    chdir('..');
    $return = 0;
    return $return === 0;
}
Ejemplo n.º 5
0
function error($message)
{
    formatMessage(PF_STATUS_ERROR, $message);
}