Exemplo n.º 1
0
function editor_activex($textarea, $cols, $rows, $text)
{
    //style sheet for active-x editor
    printc("<style type=\"text/css\">\n");
    printc("<!--\n");
    printc("  .btn   { BORDER-WIDTH: 1; width: 26px; height: 24px; }\n");
    printc("  .btnDN { BORDER-WIDTH: 1; width: 26px; height: 24px; BORDER-STYLE: inset; BACKGROUND-COLOR: buttonhighlight; }\n");
    printc("  .btnNA { BORDER-WIDTH: 1; width: 26px; height: 24px; filter: alpha(opacity=25); }\n");
    printc("-->\n");
    printc("</style>\n");
    printc("<style type=\"text/css\">\n");
    printc("<!--\n");
    printc("   body, td { font-family: arial; font-size: 12px; }\n");
    printc("  .headline { font-family: arial black, arial; font-size: 28px; letter-spacing: -2px; }\n");
    printc("  .subhead  { font-family: arial, verdana; font-size: 12px; let!ter-spacing: -1px; }\n");
    printc("-->\n");
    printc("</style>\n");
    //	Begin modification 4 - 11.11.02 - afranco
    //	Add explanation of how to get <br />s
    printc("<div class='desc'><b>Note:</b> To get a single line break, hold down SHIFT while pressing enter.");
    //	Begin modification 2 - 10.26.02 - rlange
    //	Added an id tag to the textarea definition
    printc("<textarea name='{$textarea}' id='{$textarea}' cols='{$cols}' rows='{$rows}'>");
    printc(spchars($text));
    printc("</textarea>");
    //	End modification 2 - 10.26.02 - rlange
    //	Begin modification 3 - 10.26.02 - rlange
    //	Create the iView from JavaScript for the above textarea
    printc("<script language=\"javascript1.2\">\n");
    printc("editor_generate('{$textarea}');\n");
    printc("</script>\n");
}
Exemplo n.º 2
0
function countit()
{
    static $count = 0;
    // default value
    $count++;
    printc("Count: {$count}");
}
Exemplo n.º 3
0
function printStoryEditLinks()
{
    global $thisSite, $thisSection, $thisPage, $thisStory, $tagged_page, $site_owner, $o, $story_set, $s, $sid, $site, $section, $page, $cfg;
    printc("<div class='edit_links'>");
    if ($cfg['disable_edit_content'] == TRUE && $_SESSION['ltype'] != 'admin') {
        printc("<div align='right'>editing disabled</div>");
    } else {
        /******************************************************************************
         * edit, delete options 
         ******************************************************************************/
        if ($_REQUEST['tag']) {
            $envvars = "&amp;site=" . $thisSite->name;
            if ($tagged_section) {
                $envvars .= "&amp;section=" . $tagged_section;
            }
            if ($tagged_page) {
                $envvars .= "&amp;page=" . $tagged_page;
            }
        }
        //printpre($story_set);
        $l = array();
        if ($_SESSION[auser] == $site_owner || $_SESSION[auser] != $site_owner && !$o->getField("locked")) {
            if (!$_REQUEST['tag']) {
                if (($thisPage->getField("storyorder") == 'custom' || $thisPage->getField("storyorder") == '') && $thisPage->hasPermission("edit")) {
                    if ($_REQUEST[showorder] == "story") {
                        $l[] = "<a href='{$PHP_SELF}?{$sid}{$envvars}&amp;action=viewsite&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;showorder=0" . ($story_set ? "&amp;story_set=" . ($story_set + 1) : "") . "' class='small' title='Reorder content blocks on this page'>hide order</a>";
                    } else {
                        $l[] = "<a href='{$PHP_SELF}?{$sid}{$envvars}&amp;action=viewsite&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;showorder=story" . ($story_set ? "&amp;story_set=" . ($story_set + 1) : "") . "' class='small' title='Reorder content blocks on this page'>reorder</a>";
                    }
                }
                if (($thisPage->getField("archiveby") == '' || $thisPage->getField("archiveby") == 'none' || !$thisPage->getField("archiveby")) && $thisPage->hasPermission("edit")) {
                    //								if ($i!=0 && ($thisPage->getField("storyorder") == 'custom' || $thisPage->getField("storyorder") == '')) {
                    //									$l[] = "<a href='$PHP_SELF?$sid$envvars&amp;action=viewsite&amp;reorder=story&amp;direction=up&amp;id=$s' class='small' title='Move this Content Block up'><b>&uarr;</b></a>";
                    //								}
                    //								if ($i!=count($thisPage->stories)-1 && ($thisPage->getField("storyorder") == 'custom' || $thisPage->getField("storyorder") == '')) {
                    //									$l[] = "<a href='$PHP_SELF?$sid$envvars&amp;action=viewsite&amp;reorder=story&amp;direction=down&amp;id=$s' class='small' title='Move this Content Block down'><b>&darr;</b></a>";
                    //								}
                }
                if ($thisPage->hasPermission("edit") || $o->hasPermission("edit")) {
                    $l[] = "<a href='copy_parts.php?{$sid}&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;story={$s}&amp;type=story' class='small' title='Move/Copy this Content Block to another page' onclick=\"doWindow('copy_parts','300','250')\" target='copy_parts'>move</a>";
                }
            }
            if ($thisPage->hasPermission("edit") || $o->hasPermission("edit")) {
                $l[] = "<a href='{$PHP_SELF}?{$sid}{$envvars}&amp;action=edit_story&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;edit_story={$s}&amp;comingFrom=viewsite" . ($story_set ? "&amp;story_set=" . ($story_set + 1) : "") . "' class='small' title='Edit this Content Block'>edit</a>";
            }
            if ($thisPage->hasPermission("delete") || $o->hasPermission("delete")) {
                $l[] = "<a href='javascript:doconfirm(\"Are you sure you want to delete this content?\",\"{$PHP_SELF}?{$sid}{$envvars}&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;action=delete_story&amp;delete_story={$s}\")' class='small' title='Delete this Content Block'>delete</a>";
            }
            if ($thisPage->hasPermission("edit") || $o->hasPermission("edit")) {
                $l[] = "<a href='index.php?{$sid}&amp;action=viewsite&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;story=" . $s . "&amp;versioning=" . $s . "' class='small' title='View the history of this content'>versions</a>";
            }
        }
        printc(implode(" | ", $l));
    }
    printc("</div>");
}
Exemplo n.º 4
0
function fexplode(&$arr)
{
    //Task 3
    printf("\n\nTask Explode\n\n");
    if (!isset($arr)) {
        //must throw exception here
        return;
    }
    $target = "I love ZaraLab";
    $index = array_search($target, $arr);
    if ($index !== false) {
        //printf("format");
        $temp = explode(" ", $arr[$index]);
        $arr[$index] = $temp;
    }
    printc($arr);
}
Exemplo n.º 5
0
function _execute_db_update($KG_Path, $KG_Thumb)
{
    global $super_array;
    global $database_table;
    printc("Updating Database ...");
    mysql_query("TRUNCATE TABLE {$database_table}");
    $files = array();
    if (is_dir($KG_Path)) {
        if ($dh = opendir($KG_Path)) {
            while (($file = readdir($dh)) !== false) {
                if ($file != "." and $file != "..") {
                    $type = filetype("{$KG_Path}/" . $file);
                    if ($type == 'dir') {
                        _get_contents_indir($KG_Path, $KG_Thumb, $file);
                    }
                }
            }
            closedir($dh);
        }
    }
    //print_r($super_array);
    _insert_to_sql($super_array);
    printc("Updating Database Complete");
}
Exemplo n.º 6
0
<?php

$search = 'I love ZaraLab';
$search_index = array_search($search, $array);
$new = explode(" ", $search);
$array[$search_index] = $new;
printc($array);
Exemplo n.º 7
0
<?php

/* $Id$ */
include "output_modules/common.inc.php";
$t = makedownloadbar($o);
$st = convertTagsToInteralLinks($site, $t);
if ($o->getField("texttype") == 'text') {
    $st = nl2br($st);
}
$wikiResolver =& WikiResolver::instance();
$st = $wikiResolver->parseText($st, $site, $section, $page);
printc($st);
if ($o->getField("discuss")) {
    include dirname(__FILE__) . "/discussionLink.inc.php";
}
Exemplo n.º 8
0
<?php

require_once './lib/functions.php';
$var = 10;
function addOne()
{
    global $var;
    $var++;
}
addOne();
$message = sprintf('Value of $var is %d', $var);
printc($message);
function addOneAlt()
{
    $GLOBALS['var']++;
}
addOneAlt();
$message = sprintf('Value of $var is %d', $var);
printc($message);
Exemplo n.º 9
0
    printc("</td></tr>\n");
}
/******************************************************************************
 * print out title and options
 ******************************************************************************/
printc("<tr><td align='left'>");
printc("<a href='index.php?action=" . $action . "&amp;" . $getinfo2 . "'>" . spchars($pageObj->getField('title')) . "</a>");
if ($storyObj->getField('title')) {
    printc(" > " . spchars($storyObj->getField('title')));
}
if ($_REQUEST['oldversion'] && $_REQUEST['newversion']) {
    printc(" > <a href='index.php?{$sid}&amp;action=" . $action . "&amp;site=" . $_REQUEST['site'] . "&amp;section=" . $_REQUEST['section'] . "&amp;page=" . $_REQUEST['page'] . "&amp;story=" . $_REQUEST['story'] . "&amp;versioning=" . $_REQUEST['story'] . "'>All Versions</a>");
    printc(" > Selected Versions");
} else {
    if ($_REQUEST['versioning']) {
        printc(" > All Versions");
        /******************************************************************************
         * if particular version then get version details
         ******************************************************************************/
    } else {
        if ($_REQUEST['version']) {
            printc(" > <a href='index.php?{$sid}&amp;action=" . $action . "&amp;site=" . $_REQUEST['site'] . "&amp;section=" . $_REQUEST['section'] . "&amp;page=" . $_REQUEST['page'] . "&amp;story=" . $_REQUEST['story'] . "&amp;versioning=" . $_REQUEST['story'] . "'>All Versions</a>");
            printc(" > Revision " . $version_num);
        } else {
            printc(" > in depth");
        }
    }
}
printc("</td></tr>\n");
printc("</table>\n");
Exemplo n.º 10
0
<?php

$search = "I love ZaraLab";
$key = array_search($search, $array);
$new = explode(' ', $search);
$array[$key] = $new;
printc('Taks Explode', $array);
Exemplo n.º 11
0
/******************************************************************************
 * print out story content
 ******************************************************************************/
printc("<div class='story'>");
printc(stripslashes($st));
printc("</div>");
/******************************************************************************
 * Append link to more and discussion
 ******************************************************************************/
if ($o->getField("discuss") || $o->getField("longertext")) {
    if ($o->getField("longertext") && !ereg("^[\n\r]*<br />\$", $o->getField("longertext"))) {
        if ($action == 'viewsite') {
            $discussAction = 'viewsite';
        } else {
            if (ereg("preview_edit_as|preview_as", $action)) {
                $discussAction = ereg_replace("preview_edit_as", "preview_as", $action);
            } else {
                $discussAction = 'site';
            }
        }
        $link = "index.php?{$sid}&amp;action=" . $discussAction . "&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;story=" . $o->id . "&amp;detail=" . $o->id;
        printc("<a href='" . $link . "'>" . " ...more</a>\n");
    }
    include dirname(__FILE__) . "/discussionLink.inc.php";
}
if ($tagged_section) {
    $section = $source_section;
}
if ($tagged_page) {
    $page = $source_page;
}
function main()
{
    $options = getopt("hdsrp:", array('help', 'debug', 'silent', 'remove', 'path:'));
    // Check if help requested
    if (hasOption($options, 'h', 'help')) {
        printc(HELP);
        die;
    }
    if (!hasOption($options, 'p', 'path')) {
        printc("Error: path required\n");
        printc(HELP);
        die;
    }
    $silent = hasOption($options, 's', 'silent');
    $debug = hasOption($options, 'd', 'debug');
    // Disable silent on debug
    if ($debug) {
        $silent = false;
    }
    $remove = hasOption($options, 'r', 'remove');
    // Process path
    $path = array_key_exists('p', $options) ? $options['p'] : $options['path'];
    printc('Using path: ' . $path, $silent);
    printc('Remove is: ' . ($remove ? 'on' : 'off'), $silent);
    printc('Remove debug is: ' . ($debug ? 'on' : 'off'), $silent);
    $path = realpath($path);
    if ($path === NULL || !is_dir($path)) {
        printc('Error: directory does not exists');
        die;
    }
    // Add directory separator to path
    $ds = DIRECTORY_SEPARATOR;
    $path = rtrim($path, $ds) . $ds;
    // Include Wordpress files
    printc('Loading Wordpress', $silent);
    define('BASE_PATH', $path);
    define('WP_USE_THEMES', false);
    // Require main wp loader
    require_once $path . 'wp-load.php';
    require_once $path . 'wp-admin' . $ds . 'includes' . $ds . 'image.php';
    require_once $path . 'wp-admin' . $ds . 'includes' . $ds . 'file.php';
    $regenerator = new Regenerator($remove, $debug, $silent);
    $regenerator->run();
}
Exemplo n.º 13
0
 function _output($cr, $o)
 {
     global $sid, $error, $showallauthors, $showposts, $uploadurl, $site_owner, $_full_uri;
     $siteOwnerId = db_get_value("user", "user_id", "user_uname='" . addslashes($site_owner) . "'");
     $parentAuthorId = db_get_value("discussion", "FK_author", "discussion_id='" . addslashes($this->parentid) . "'");
     //print $siteOwnerId;
     //printc("author=".$parentAuthorId);
     $siteObj =& $this->storyObj->owningSiteObj;
     $siteLevelEditors = $siteObj->getSiteLevelEditors();
     $isSiteEditor = in_array($_SESSION[auser], $siteLevelEditors);
     if ($showposts == 1 || ($_SESSION[auser] == $this->authoruname || $o == 1 || $isSiteEditor || $site_owner == $this->authoruname && $_SESSION[aid] == $parentAuthorId && $_SESSION[auser] || in_array($this->authoruname, $siteLevelEditors) && $_SESSION[aid] == $parentAuthorId && $_SESSION[auser])) {
         // check to see if we have any info to commit
         $this->_commithttpdata();
         if ($_REQUEST['discuss'] == 'edit' && $_REQUEST['id'] == $this->id) {
             $this->_outputform('edit');
             return true;
         }
         if ($_REQUEST['discuss'] == 'del' && $_REQUEST['id'] == $this->id) {
             $this->_del();
             return true;
         }
         if ($_REQUEST['discuss'] == 'rate' && $_REQUEST['id'] == $this->id) {
             $this->_outputform('rate');
             return true;
         }
         //$script = $_SERVER['SCRIPT_NAME'];
         /******************************************************************************
          * 	Outputs html for displaying posts
          * outputs discussion post info
          ******************************************************************************/
         if (!$this->id) {
             return false;
         }
         printc("\n<tr>");
         $s = "<a href='" . $_full_uri . "/index.php?{$sid}&amp;action=site&amp;" . $this->getinfo . "&amp;expand=" . $this->id . "' name='" . $this->id . "'>" . $this->subject . "</a>\n";
         //	printc ("</form>");
         //		$s = $this->subject;
         //printpre($_SESSION);
         $a = "";
         if ($showallauthors == 1 || $_SESSION[auser] && ($o || $_SESSION[auser] == $this->authoruname || $site_owner == $this->authoruname && $_SESSION[aid] == $parentAuthorId)) {
             if ($this->opt("showauthor")) {
                 $a .= "by <span class='subject'>" . $this->authorfname . "</span>\n";
             }
             if ($this->opt("showauthor") && $this->opt("showtstamp")) {
                 $a .= " on ";
             }
         } else {
             $a .= "posted on ";
         }
         if ($this->opt("showtstamp")) {
             $a .= timestamp2usdate($this->tstamp);
         }
         // Wiki-markup example
         global $storyObj;
         $a .= WikiResolver::getMarkupExample($storyObj->getField("title"), $this->id);
         /******************************************************************************
          * 	 collect possible actions to current post (rely | del | edit | rate)
          ******************************************************************************/
         $b = array();
         if ($cfg['disable_discussion'] != TRUE && ($cfg['disable_discussion'] != TRUE && $_SESSION['ltype'] == 'admin')) {
             if ($cr) {
                 $b[] = "<a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;replyto=" . $this->id . "&amp;action=site&amp;discuss=reply#reply'>reply</a>\n";
             }
             if ($o || $_SESSION[auser] == $this->authoruname && !$this->dbcount()) {
                 $b[] = "| <a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;action=site&amp;discuss=del&amp;id=" . $this->id . "'>delete</a>\n";
             }
             if ($_SESSION[auser] == $this->authoruname && !$this->dbcount()) {
                 $b[] = " | <a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;id=" . $this->id . "&amp;action=site&amp;discuss=edit#" . $this->id . "'>edit</a>\n";
             }
             if ($o) {
                 $ratelink = "<a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;id=" . $this->id . "&amp;action=site&amp;discuss=rate#" . $this->id . "'>rate</a>\n";
             }
         }
         /******************************************************************************
          * if there are dicussion actions (reply | del | edit | rate) then print 
          ******************************************************************************/
         if ($a != "" || count($b)) {
             $c = '';
             if (count($b)) {
                 $c .= implode(" ", $b);
             }
             /******************************************************************************
              * discussion post header info (subject=$s, author and timestamp=$a, options=$c)
              ******************************************************************************/
             //printc ("<table width='100%' cellspacing='0px'>\n");
             printc("\n<td class='dheader3'>\n");
             printc("<table width='100%' cellspacing='0px'>\n");
             printc("<tr><td align='left'>\n");
             printc("<span class='subject'>\n");
             // subject
             printc($s);
             // rating
             if ($this->rating !== NULL) {
                 printc(" (Rating: " . $this->rating . ")");
             }
             printc("</span></td>\n");
             // link for rating
             printc("<td align='right'>{$ratelink}</td>\n");
             printc("</tr><tr>\n");
             printc("<td>{$a}\n");
             printc("</td>\n");
             printc("<td align='right' valign='bottom'>{$c}</td>");
             printc("</tr>\n</table>\n");
             /******************************************************************************
              * if there are no dicussion actions (rely | del | edit | rate) then 
              * print subject only
              ******************************************************************************/
         } else {
             printc($s);
         }
         printc("</td></tr>");
         /******************************************************************************
          * 	print discussion post content
          ******************************************************************************/
         if ($this->opt("showcontent")) {
             printc("<tr><td class='dtext'>");
             if ($this->media_tag) {
                 $media_link = "<a href='" . $uploadurl . "/" . $_REQUEST[site] . "/" . $this->media_tag . "' target='media'>" . $this->media_tag . "</a>\n";
                 $mediaRow[media_tag] = $this->media_tag;
                 $mediaRow[slot_name] = $_REQUEST[site];
                 $mediaRow[media_size] = $this->media_size;
                 $audioplayer = printMediaPlayer($mediaRow);
                 $downloadlink = printDownloadLink($mediaRow);
                 //					$citation = printCitation($mediaRow);
                 // if attached file is an .mp3 print out audio player
                 if ($audioplayer) {
                     printc("<table width='100%' cellpadding='2' border='0'>");
                     printc("<tr><td>");
                     printc($downloadlink . "\n");
                     printc($audioplayer . "\n");
                     //						printc ("<div style='clear: left; font-size: smaller; margin-bottom: 10px; '>");
                     //						printc ($citation."\n");
                     //						printc ("</div>");
                     printc("</td></tr>");
                     printc("</table>");
                     // if attached file not .mp3 print out download link only
                 } else {
                     printc("<table width='100%' cellpadding='2' border='0'>");
                     printc("<tr><td>");
                     printc("<div style='clear: left; float: left; '>{$media_link}</div>\n");
                     printc($downloadlink . "\n");
                     printc("</td></tr>");
                     printc("</table>");
                 }
             }
             $content = convertTagsToInteralLinks($_REQUEST[site], stripslashes($this->content));
             $wikiResolver =& WikiResolver::instance();
             $content = $wikiResolver->parseText($content, $_REQUEST[site], $_REQUEST[section], $_REQUEST[page]);
             printc("<div style='clear: both;'>\n");
             printc($content);
             printc("</div>\n");
             //printc ("- [ $c]</td></tr>\n");
             //printc ("<tr><td align='right'>$c</td></tr>\n");
         }
         // done
         // now check if we're replying to this post
         if ($_REQUEST['discuss'] == 'reply' && $_REQUEST['replyto'] == $this->id) {
             $this->_outputform('reply');
         }
         //if ($_REQUEST['discuss'] == 'rate' && $_REQUEST['replyto'] == $this->id) $this->_outputform('rate');
         printc("</td></tr>");
     }
 }
Exemplo n.º 14
0
<?php

require_once './lib/functions.php';
function multiply10($value)
{
    $value = $value * 10;
    return $value;
}
function multiply10ref(&$byReference)
{
    $byReference = multiply10($byReference);
}
$value = 2;
$multiply = multiply10($value);
$message1 = sprintf('%d * 10 = %d', $value, $multiply);
$message2 = sprintf('$value after multiply is %d', $value);
printc($message1);
printc($message2);
multiply10ref($value);
$message3 = sprintf('$value after multiply by reference is %d', $value);
printc($message3);
Exemplo n.º 15
0
function handlearchive($stories, $pa)
{
    global $startday, $startmonth, $startyear, $endday, $endmonth, $endyear, $usestart, $useend, $months;
    global $usesearch;
    global $site, $section, $page;
    $newstories = array();
    if (!$usesearch) {
        $endyear = date("Y");
        $endmonth = date("n");
        $endday = date("j");
    }
    printc("<div>");
    //	printc("<b>Search:</b> ");
    printc("Display content in date rage: ");
    printc("<form action='{$PHP_SELF}?{$sid}&amp;action=site&amp;site={$site}&amp;section={$section}&amp;page={$page}' method='post'>");
    printc("<input type='hidden' name='usesearch' value='1' />");
    printc("<select name='startday'>");
    for ($i = 1; $i <= 31; $i++) {
        printc("<option" . ($startday == $i ? " selected" : "") . ">{$i}\n");
    }
    printc("</select>\n");
    printc("<select name='startmonth'>");
    for ($i = 0; $i < 12; $i++) {
        printc("<option value=" . ($i + 1) . ($startmonth == $i + 1 ? " selected" : "") . ">{$months[$i]}\n");
    }
    printc("</select>\n<select name='startyear'>");
    $curryear = date("Y");
    for ($i = $curryear - 10; $i <= $curryear; $i++) {
        printc("<option" . ($startyear == $i ? " selected" : "") . ">{$i}\n");
    }
    printc("</select>");
    //	printc("<br />");
    printc(" to <select name='endday'>");
    for ($i = 1; $i <= 31; $i++) {
        printc("<option" . ($endday == $i ? " selected" : "") . ">{$i}\n");
    }
    printc("</select>\n");
    printc("<select name='endmonth'>");
    for ($i = 0; $i < 12; $i++) {
        printc("<option value=" . ($i + 1) . ($endmonth == $i + 1 ? " selected" : "") . ">{$months[$i]}\n");
    }
    printc("</select>\n<select name='endyear'>");
    for ($i = $curryear; $i <= $curryear + 5; $i++) {
        printc("<option" . ($endyear == $i ? " selected" : "") . ">{$i}\n");
    }
    printc("</select>");
    printc(" <input type='submit' class='button' value='go' />");
    printc("</form></div>");
    $start = mktime(1, 1, 1, $startmonth, $startday, $startyear);
    $end = mktime(1, 1, 1, $endmonth, $endday, $endyear);
    if ($pa == 'week') {
        if (!$usesearch) {
            $start = mktime(0, 0, 0, date("n"), date('j') - 7, date('Y'));
            $end = time();
        }
    }
    if ($pa == 'month') {
        if (!$usesearch) {
            $start = mktime(0, 0, 0, date("n") - 1, date('j'), date("Y"));
            $end = time();
        }
    }
    if ($pa == 'year') {
        if (!$usesearch) {
            $start = mktime(0, 0, 0, date("n"), date('j'), date("Y") - 1);
            $end = time();
        }
    }
    $txtstart = date("n/j/y", $start);
    $txtend = date("n/j/y", $end);
    foreach ($stories as $s) {
        $a = db_get_line("stories", "id='" . addslashes($s) . "'");
        $added = $a[addedtimestamp];
        ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $added, $regs);
        $year = (int) $regs[1];
        $month = (int) $regs[2];
        $day = (int) $regs[3];
        $t = mktime(0, 0, 0, $month, $day, $year);
        // 			$week = date("W",$t-(date("w",$t)*86400));
        //
        // 			if ($startyear == $year && $startweek == $week)
        // 				$newstories[] = $s;
        // 		if ((!$usestart || $start < $t) && (!$useend || $t < $end)) {
        if ($start < $t && $t < $end || false) {
            $newstories[$s] = $t;
        }
    }
    // 	print_r($newstories);
    arsort($newstories, SORT_NUMERIC);
    // 	print_r($newstories);
    $newstories = array_keys($newstories);
    printc("<b>Content ranging from {$txtstart} to {$txtend}.</b><br /><br />");
    return $newstories;
}
Exemplo n.º 16
0
    printc("<table border='0' width='100%'>");
    foreach (array_reverse($thisSite->sections, TRUE) as $s => $o) {
        if ($i != $total - 1) {
            $pdfname = $filename = $fileurl = $extra = '';
            $pdfname = createPdfName($o->getField("title"));
            $filename = "{$uploaddir}/" . $thisSite->name . "/{$pdfname}";
            $fileurl = "{$uploadurl}/" . $thisSite->name . "/{$pdfname}";
            if (file_exists($filename)) {
                $extra .= pdflink($filename, $fileurl, 1);
            }
            printc("<b><a href='{$PHP_SELF}?{$sid}&amp;site={$site}&amp;section={$s}&amp;action={$newaction}&amp;supplement=listarticles'>" . $o->getField("title") . "</a></b>");
            if ($isediting) {
                printc("<div align='right' class='smaller'>");
                if ($o->hasPermission("edit")) {
                    printc("<a href='{$PHP_SELF}?{$sid}&amp;action=edit_section&amp;site={$site}&amp;section={$s}&amp;edit_section={$s}&amp;comingFrom=viewsite%26supplement%3Dlistissues'>edit</a>\n");
                }
                if ($o->hasPermission("delete")) {
                    printc("<a href='{$PHP_SELF}?{$sid}&amp;action=delete_section&amp;site={$site}&amp;section={$s}&amp;delete_section={$s}&amp;comingFrom=viewsite%26supplement%3Dlistissues'>delete</a>\n");
                }
                printc("</div>");
            }
            printc("</td>");
            printc("<td>{$extra}</td></tr>");
        }
        $i++;
    }
    printc("</table>");
    if ($isediting && $thisSite->hasPermission("add")) {
        printc("<br /><div align='right'><a href='{$PHP_SELF}?{$sid}&amp;site={$site}&amp;action=add_section&amp;comingFrom=viewsite%26supplement%3Dlistissues'>+ add issue</a>");
    }
}
Exemplo n.º 17
0
function assignvar()
{
    $var = 1;
    $message = sprintf('Value of $var inside the function is %d', $var);
    printc($message);
}
Exemplo n.º 18
0
<?php

printc($array);
printc($array[0]);
printc($array[1]);
if (isset($array[3])) {
    printc($array[3]);
}
$search_index = array_search('First element', $array);
printc($search_index);
if ($search_index !== false) {
    printc($array[$search_index]);
}
$check = array_key_exists(0, $array);
printc($check);
Exemplo n.º 19
0
// make the navbars!
include "output_modules/publication/navbars.inc.php";
if ($thisSection) {
    printc("<div class='title'>Article listing:</div>");
    $newaction = $action;
    foreach ($thisSection->pages as $p => $o) {
        printc("<div class='articleitem'>");
        printc("<b><a href='{$PHP_SELF}?{$sid}&amp;site={$site}&amp;section={$section}&amp;page={$p}&amp;action={$newaction}'>" . $o->getField("title") . "</a></b>");
        list($first, $story) = each($o->stories);
        if ($story) {
            printc("<br />" . $story->getField("title"));
        }
        if (($author = $o->getField("url")) && $author != "http://") {
            printc("<br /><div class='leftmargin'>by {$author}</div>");
        }
        if ($isediting) {
            printc("<div align='right' class='smaller'>");
            if ($o->hasPermission("edit")) {
                printc("<a href='{$PHP_SELF}?{$sid}&amp;action=edit_page&amp;site={$site}&amp;section={$section}&amp;page={$p}&amp;edit_page={$p}&amp;comingFrom=viewsite%26supplement%3Dlistarticles'>edit</a>\n");
            }
            if ($o->hasPermission("delete")) {
                printc("<a href='{$PHP_SELF}?{$sid}&amp;action=delete_page&amp;site={$site}&amp;section={$section}&amp;page={$p}&amp;delete_page={$p}&amp;comingFrom=viewsite%26supplement%3Dlistarticles'>delete</a>\n");
            }
            printc("</div>");
        }
        printc("</div>");
    }
    if ($isediting && $thisSection->hasPermission("add")) {
        printc("<br /><div align='right'><a href='{$PHP_SELF}?{$sid}&amp;site={$site}&amp;section={$section}&amp;action=add_page&amp;comingFrom=viewsite%26supplement%3Dlistarticles'>+ add article</a>");
    }
}
Exemplo n.º 20
0
        }
        $sitename = $_SESSION[siteObj]->getField("name");
        $comingFrom = $_SESSION[settings][comingFrom];
        $add = $_SESSION[settings][add];
        if ($add) {
            header("Location: index.php?{$sid}&action=viewsite&site={$sitename}");
        } else {
            if ($comingFrom) {
                header("Location: index.php?{$sid}&action={$comingFrom}&site={$sitename}");
            } else {
                header("Location: index.php?{$sid}");
            }
        }
        exit;
    } else {
        printc("<br />There was an error");
    }
}
/******************************************************************************
 * Form Stuff
 ******************************************************************************/
if ($_SESSION[settings][edit] && $_SESSION[settings][step] == 3 && $prevbutton) {
    $_SESSION[settings][step] = 2;
} else {
    if ($_SESSION[settings][edit] && $_SESSION[settings][step] == 3) {
        $_SESSION[settings][step] = 4;
    }
}
// ------- print out the add form -------
// --- The Navigation Links for the sidebar ---
$leftlinks = "________________<br /><table>";
Exemplo n.º 21
0
function printStudentSiteLine($className, $siteInfo)
{
    global $studentSitesColor;
    if (!isset($studentSitesColor)) {
        $studentSitesColor = 0;
    }
    printc("\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='td{$studentSitesColor}' width='150'>{$className}</td>");
    if ($siteInfo['site_exists']) {
        if ($siteInfo['site_active']) {
            printc("\n\t\t\t\t\t<td align='left' class='td{$studentSitesColor}'><a href='{$PHP_SELF}?{$sid}&amp;action=site&amp;site=" . $siteInfo['slot_name'] . "'>" . $siteInfo['site_title'] . "</a></td>");
        } else {
            printc("\n\t\t\t\t\t<td style='color: #999' class='td{$studentSitesColor}'>created, not yet available</td>");
        }
        // check for an associated site slot and whether an associated site has been created for the current user
        $assoc_siteinfo = associatedSiteCreated($_SESSION[auser], $className);
        $assoc_site_title = $assoc_siteinfo['site_title'];
        if ($assoc_site_title != "") {
            printSiteLine2($assoc_siteinfo, 0, 1);
            $studentSitesColor = 1 - $studentSitesColor;
        } else {
            if (associatedSiteExists($_SESSION[auser], $className) == "true") {
                $studentSitesColor = 1 - $studentSitesColor;
                printc("\n\t\t\t\t</tr><tr>\n\t\t\t\t\t<td class='td{$studentSitesColor}' width='150'>" . $siteInfo['slot_name'] . "-" . $_SESSION[auser] . "</td>");
                if ($cfg['disable_new_sites'] == TRUE && $_SESSION['ltype'] != 'admin') {
                    printc("Create: Site (disabled)");
                } else {
                    printc("\n\t\t\t\t\t<td align='left' class='td{$studentSitesColor}'>Create: <a href='{$PHP_SELF}?{$sid}&amp;action=add_site&amp;sitename=" . $siteInfo['slot_name'] . "-" . $_SESSION[auser] . "'> Site</a></td>");
                }
            }
        }
        //check webcourses databases to see if course website was created in course folders (instead of Segue)
    } else {
        if ($course_site = coursefoldersite($className)) {
            $course_url = urldecode($course_site['url']);
            $title = urldecode($course_site['title']);
            printc("\n\t\t\t\t\t<td style='color: #999' class='td{$studentSitesColor}'><a href='{$course_url}' target='new_window'>{$title}</td>");
        } else {
            printc("\n\t\t\t\t\t<td style='color: #999' class='td{$studentSitesColor}'>not created</td>");
        }
    }
    printc("\n\t\t\t\t</tr>");
    $studentSitesColor = 1 - $studentSitesColor;
}
Exemplo n.º 22
0
<?php

/* $Id$ */
$pagetitle = "Delete Site";
$s =& new site($_REQUEST['name']);
$s->fetchDown(1);
/* print "<pre>"; print_r($s); print "</pre>"; */
if (sitenamevalid($_REQUEST['name'])) {
    if ($_REQUEST[confirm]) {
        $s->delete();
        log_entry("delete_site", $_SESSION['auser'] . " deleted site " . $_REQUEST['name'], $s->getField("name"), $s->id, "site");
    } else {
        printc("Are you <b>SURE</b> you want to delete the site <i>" . $s->getField("title") . "</i>?? This operation is <b>irreversable</b>. You will <b>never</b> see any of the content of this site again, including all sections, pages, content, and discussions. You better be <b>ABSOLUTELY SURE</b> you want to do this! If so, hit 'Delete'.<br /><br />");
        printc("<form action='{$PHP_SELF}?{$sid}&amp;action=delete_site&amp;name=" . $_REQUEST['name'] . "'><input type='hidden' name='confirm' value='1' />");
        printc("<input type='hidden' name='name' value='" . $_REQUEST['name'] . "' />");
        printc("<input type='hidden' name='action' value='delete_site' />");
        printc("<input type='button' value='&lt;&lt; Back' onclick='history.go(-1)' /> <input type='submit' value='Delete' />");
        printc("</form>");
        /* 		print "<pre>"; print_r($s); print "</pre>"; */
        return;
    }
} else {
    log_entry("delete_site", $_SESSION['auser'] . " deleting site '" . $_REQUEST['name'] . "' failed", $s->getField("name"), $s->id, "site");
}
header("Location: {$PHP_SELF}?{$sid}");
exit;
Exemplo n.º 23
0
function editor_fck($textarea, $text, $context = "story")
{
    ob_start();
    include "fckeditor_create.php";
    $neweditor = ob_get_contents();
    ob_end_clean();
    ob_start();
    printc($neweditor);
}
Exemplo n.º 24
0
<?php

$search_index = array_search('Search me', $array);
printc("Task Array Search: index is {$search_index}");
Exemplo n.º 25
0
<?php

$search_index = array_search('I\'m going to become PHP expert!', $array);
if ($search_index !== false) {
    $rplc = 'software';
    $oldvlu = 'PHP';
    $result = $array[$search_index];
    $new = str_replace($oldvlu, $rplc, $result);
    printc($new);
    //	printc
}
Exemplo n.º 26
0
include "output_modules/common.inc.php";
/*  */
/* if ($a[category]) { */
/* 	printc("<div class='contentinfo' align='right'>"); */
/* 	printc("Category: <b>".spchars($a[category])."</b>"); */
/* 	printc("</div>"); */
/* } */
/* print "<pre>"; */
/* print_r($o->data); */
/* print "</pre>"; */
/* print db_get_value("story","story_text_long","story_id=".$o->id); */
$abbrurl = substr($o->getField("url"), 0, 75);
$url = $o->getField("url");
/******************************************************************************
 * replace general media library urls (i.e. $mediapath/$sitename/filename)
 * replace general with specific
 ******************************************************************************/
$url = convertTagsToInteralLinks($site, $url);
$abbrurl = substr($url, 0, 75);
if ($o->getField("title")) {
    printc("<div class='leftmargin'><b><a href='" . $url . "' target='_blank'>");
    printc(spchars($o->getField("title")) . "</a></b></div>");
}
printc("<div class='desc'><a href='" . $url . "' target='_blank'>" . $abbrurl . "...</a></div>");
//printc("<div><a href='".$o->getField("url")."' target='_blank'>".$o->getField("url")."</a></div>");
if ($o->getField("shorttext")) {
    printc("<div class='desc'>" . stripslashes($o->getField("shorttext")) . "</div>");
}
if ($o->getField("discuss")) {
    include dirname(__FILE__) . "/discussionLink.inc.php";
}
Exemplo n.º 27
0
<?php

/* $Id$ */
// allows users to preview the theme
$pagetitle = "Segue > Theme Preview > " . $possible_themes[$theme];
add_link(topnav, "Section #1", "#", '', "noid");
add_link(topnav, "Section #2", "#", '', "noid");
add_link(topnav, "Section #3", "#", '', 'previewtheme');
add_link(topnav, "Section #4", "#", '', "noid");
add_link(leftnav, "Page #1", "#", '', '1');
add_link(leftnav, "Page #2", "#", '', '1');
printc("This is some sample content. Here you can enter any information you want, including links and pictures (or any HTML).");
printc("<br /><br />");
printc("<input type='button' value='Close This Window' onclick='window.close()' class='button' />");
Exemplo n.º 28
0
<?php

// Print out the discussion link
if ($action == 'viewsite') {
    $discussAction = 'site';
} else {
    if (ereg("preview_edit_as|preview_as", $action)) {
        $discussAction = ereg_replace("preview_edit_as", "preview_as", $action);
    } else {
        $discussAction = 'site';
    }
}
$link = "index.php?{$sid}&amp;action=" . $discussAction . "&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;story=" . $o->id . "&amp;detail=" . $o->id;
printc("<div class='contentinfo'>");
$l = array();
//if ($o->getField("longertext")) $l[] = $link."Full Text</a>";
if ($o->getField("discuss")) {
    $discusslabel = $o->getField("discusslabel");
    // check if discuss label exists for backward compatibility
    if ($discusslabel) {
        printc("<a href='" . $link . "'>" . $discusslabel . "</a>");
    } else {
        printc("<a href='" . $link . "'>Discuss</a>");
    }
    printc(" (" . discussion::generateStatistics($o->id) . ")");
}
printc(implode(" | ", $l));
printc("</div>");
Exemplo n.º 29
0
    if ($ipIsInInstitute) {
        CarpCacheShow($url, '', 1, 'institute');
    } else {
        CarpCacheShow($url);
    }
}
printc("<div class='story'>");
printc(ob_get_contents());
printc("</div>");
ob_clean();
if ($o->getField("title")) {
    printc("\n\n<div class='contentinfo'>" . spchars($o->getField("title")) . "</div>\n");
    // printc("<div><a href='".$o->getField("url")."' target='_blank'>".$o->getField("url")."</a></div>");
    // if ($o->getField("shorttext")) printc("<div class='desc'>".stripslashes($o->getField("shorttext"))."</div>");
}
if ($o->getField("longertext") && !ereg("^[\n\r]*<br />\$", $o->getField("longertext"))) {
    if ($action == 'viewsite') {
        $discussAction = 'viewsite';
    } else {
        if (ereg("preview_edit_as|preview_as", $action)) {
            $discussAction = ereg_replace("preview_edit_as", "preview_as", $action);
        } else {
            $discussAction = 'site';
        }
    }
    $link = "index.php?{$sid}&amp;action=" . $discussAction . "&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;story=" . $o->id . "&amp;detail=" . $o->id;
    printc("<div align='right'><a href='" . $link . "'>" . " More >></a></div>\n");
}
if ($o->getField("discuss")) {
    include dirname(__FILE__) . "/discussionLink.inc.php";
}
Exemplo n.º 30
0
<?php

require_once './lib/functions.php';
$var = 'Value';
$ref1 =& $var;
$ref2 =& $ref1;
$ref2 = 'Changed';
$result = sprintf('$var is %s, $ref1 is %s, $ref2 is %s', $var, $ref1, $ref2);
printc($result);