Example #1
0
function make_content($docParams)
{
    /**
    * creates the editable content and returns it as a html string
    *
    * @since 1.0
    *
    * @caller make_doc
    * @calls get_published_content,
    *				 combine_sources
    *
    * @ingroup make doc
    *
    * @param object $docParams
    * @return object $result w. info on the new content 
    */
    $firstSrc = $docParams['firstSource'];
    $firstType = $docParams['firstSourceType'];
    $secondSrc = $docParams['secondSource'];
    $secondType = $docParams['secondSourceType'];
    $content;
    $path = 'sources/';
    $maxCharCnt = 2200;
    $id = time();
    $result = array('content' => '', 'numOfSrcs' => '0', 'date_time' => $id);
    if ($firstSrc === '' && $secondSrc === '') {
        $result['content'] = '<span class="author-user-' . $id . '" style="font-size: 18px;"><span style="font-family: serif;">type here...</span></span>';
        return $result;
    }
    $do_mix = true;
    if ($firstSrc === '' || $secondSrc === '' || $firstSrc === $secondSrc) {
        $do_mix = false;
    }
    if (!$do_mix) {
        $source = $firstSrc !== '' ? $firstSrc : $secondSrc;
        $type = $firstSrc !== '' ? $firstType : $secondType;
        $result['numOfSrcs'] = '1';
        if ($type === 'published') {
            $content = get_published_content($path . $source, $maxCharCnt);
            $result['content'] = '<span class="author-firstSrc-' . $id . '" style="font-size: 18px;">' . '<span style="font-family: serif;">' . $content . '</span>' . '</span>';
        } else {
            $result['content'] = '<span class="author-user-' . $id . '" style="font-size: 18px;">' . '<span style="font-family: serif;">' . $source . '</span>' . '</span>';
        }
        return $result;
    }
    if ($firstType === 'published' && $secondType === 'published') {
        $firstSrc = get_published_content($path . $firstSrc, $maxCharCnt / 2);
        $secondSrc = get_published_content($path . $secondSrc, $maxCharCnt / 2);
    } else {
        if ($firstType === 'input' && $secondType === 'input') {
            $firstSrc = $firstSrc . ' ';
            $secondSrc = $secondSrc . ' ';
        } else {
            $inputSrc = ($firstType === 'input' ? $firstSrc : $secondSrc) . ' ';
            $publishedSrc = $firstType === 'published' ? $firstSrc : $secondSrc;
            $publishedSrc = get_published_content($path . $publishedSrc, strlen($inputSrc)) . ' ';
            $firstSrc = $firstType === 'published' ? $publishedSrc : $inputSrc;
            $secondSrc = $secondType === 'published' ? $publishedSrc : $inputSrc;
        }
    }
    $result['numOfSrcs'] = '2';
    $result['content'] = combine_sources($firstSrc, $secondSrc, $id);
    return $result;
}
Example #2
0
    include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/process_login.php';
}
if (!isset($_SESSION)) {
    session_start();
    //sec_session_start();
}
$tweets = null;
if (login_check($mysqli) == true) {
    $logged_in = true;
    //load user permissions and data
    include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/user_profile.php';
    //prepare tweets
    include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/twitterAPI.php';
    $tweets = getTweets("crabs");
    //prepare user content
    $user_content = get_published_content($mysqli);
} else {
    $logged_in = false;
}
?>

<!DOCTYPE html>
<html>
  <head>
    <title>Crab News, Forums & Games - Crabtown: The Official World of Crabs</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
    <link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/login.css"/> 
    <link rel="stylesheet" type="text/css" href="/css/Crabtown v1.0.css">