function showareas()
{
    doAreaEdit();
    global $indexTemplateAreas;
    //execute the nano site in demo to read the content areas
    demoExecuteNanoSite();
    $sett = getDetails('settings');
    $contents = $sett['def-template-areas'];
    $areaInfo = array();
    foreach ($contents as $areaName) {
        $areaFile = areaDataDir("{$areaName}");
        $fileContent = file_exists($areaFile) ? file_get_contents($areaFile) : '';
        $areaInfo[$areaName] = $fileContent;
    }
    $saveAllTxt = lt('Save all Areas');
    $biggerInp = lt('Bigger Input Box');
    $smallerInp = lt('Smaller Input Box');
    echo "<form action='?action=showareas&do=editarea' method='post'>";
    echo "<input type='submit' value='+ {$saveAllTxt} +' class='floatright'>";
    echo "<input type='hidden' name='areaCount' value='" . count($areaInfo) . "'>";
    $cnt = 1;
    foreach ($areaInfo as $areaName => $areaContents) {
        $boxId = "box{$cnt}";
        //md5($areaName);
        echo "<h2>&raquo; {$areaName}</h2>\r\n\t\t\t    <input type='hidden' name='areaName{$cnt}' value='{$areaName}'>\r\n\t\t\t\t<table><tr valign='top'><td>\r\n\t\t\t\t<textarea name='areaContent{$cnt}' rows='2' cols='60' id='{$boxId}' class='areabox'>" . htmlentities($areaContents) . "</textarea>\r\n\t\t\t\t</td><td>\r\n\t\t\t\t<input type='button' onclick='makesmall(\"{$boxId}\")' value='-' title='{$smallerInp}' class='isizeh'>\r\n\t\t\t\t<input type='button' onclick='makebig(\"{$boxId}\")' value='+' title='{$biggerInp}' class='isizeh'>\r\n\t\t\t\t</td></tr></table>\r\n\t\t\t ";
        $cnt++;
    }
    echo "<input type='submit' value='+ {$saveAllTxt} +' class='floatright'>";
    echo "</form>";
    echo "<script language='javascript'>\r\n\t\t\tfunction makebig(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows < 30 ) obj.rows+= 5;\r\n\t\t\t}\r\n\t\t\tfunction makesmall(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows > 5 ) obj.rows-= 5;\r\n\t\t\t}\r\n\t\t  </script>";
}
 /**
  * Recursively quicksorts the slice of the array between
  * the specified left and right positions.
  *
  * @param integer $left The position of the leftmost element to be sorted.
  * @param integer $right The position of the rightmost element to be sorted.
  */
 protected function sortSlice($left, $right)
 {
     if ($right - $left + 1 > self::CUTOFF) {
         $p = $this->selectPivot($left, $right);
         $this->swap($p, $right);
         $pivot = $this->array[$right];
         $i = $left;
         $j = $right - 1;
         for (;;) {
             while ($i < $j && lt($this->array[$i], $pivot)) {
                 ++$i;
             }
             while ($i < $j && gt($this->array[$j], $pivot)) {
                 --$j;
             }
             if ($i >= $j) {
                 break;
             }
             $this->swap($i++, $j--);
         }
         if (gt($this->array[$i], $pivot)) {
             $this->swap($i, $right);
         }
         if ($left < $i) {
             $this->sortSlice($left, $i - 1);
         }
         if ($right > $i) {
             $this->sortSlice($i + 1, $right);
         }
     }
 }
Exemple #3
0
function savepages()
{
    global $nc;
    runTweak('on-save-pages');
    $pagesdata = serialize($nc);
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        MsgBox(lt("file writing error"), 'redbox');
    }
}
Exemple #4
0
function savepages()
{
    global $NANO;
    runTweak('on-save-pages');
    $pagesdata = serialize($NANO);
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        MsgBox(lt("File writing error"), 'redbox');
        return false;
    }
    return true;
}
 /**
  * Tests whether the specified comparable object
  * is in this binary search tree.
  *
  * @param object IComparable $obj The object for which to look.
  * @return boolean True if the specified object
  * is in this binary search tree; false otherwise.
  */
 public function contains(IComparable $obj)
 {
     if ($this->isEmpty()) {
         return false;
     } elseif (eq($obj, $this->getKey())) {
         return true;
     } elseif (lt($obj, $this->getKey())) {
         return $this->getLeft()->contains($obj);
     } else {
         return $this->getRight()->contains($obj);
     }
 }
function savepages()
{
    global $NANO;
    runTweak('on-save-pages');
    $pagesdata = serialize($NANO);
    $pagesdata = '<?php header("Location: ../index.php"); /*    DO NOT EDIT THIS FILE' . "\n{$pagesdata}\n*/?>";
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        MsgBox(lt("File writing error"), 'redbox');
        return false;
    }
    return true;
}
 /**
  * Merges two sorted subsequences of the array into one.
  * @param integer $left The first position of the left subsequence.
  * @param integer $middle The first position of the right subsequence.
  * The last position in the left subsequences is middle-1.
  * @param integer $right The last position of the right subsequence.
  */
 protected function merge($left, $middle, $right)
 {
     $i = $left;
     $j = $left;
     $k = $middle + 1;
     while ($j <= $middle && $k <= $right) {
         if (lt($this->array[$j], $this->array[$k])) {
             $this->tempArray[$i++] = $this->array[$j++];
         } else {
             $this->tempArray[$i++] = $this->array[$k++];
         }
     }
     while ($j <= $middle) {
         $this->tempArray[$i++] = $this->array[$j++];
     }
     for ($i = $left; $i < $k; ++$i) {
         $this->array[$i] = $this->tempArray[$i];
     }
 }
function showpageslist()
{
    global $nc;
    demoExecuteNanoSite();
    $cdt = getDetails('cats');
    $sett = getDetails('settings');
    $slugs = getDetails('slugs');
    $titles = getDetails('titles');
    $templateCats = $sett['def-template-links'];
    $defaultCats = explode(',', NANO_MUSTHAVE_CATS);
    $musthaveCats = array_unique(array_merge($templateCats, $defaultCats));
    $selectedCat = 1;
    $toggStat = 'false';
    if (isset($_GET[addcat])) {
        $newCatName = strtolower(stripslashes($_POST[catname]));
        if (in_array($newCatName, array_keys($cdt))) {
            $msg = sprintf(lt("Cannot add new Links Category : %s already exists", 'cat-add-fail-already-exists'), "<b>{$newCatName}</b>");
            MsgBox($msg);
        } else {
            $cdt[$newCatName] = array();
            $msg = sprintf(lt("Pages Category %s Added Successfully", 'cat-add-success'), "<b>{$newCatName}</b>");
            MsgBox($msg, 'greenbox');
            setDetails('cats', $cdt);
            savepages();
        }
    }
    if (isset($_GET[removecat])) {
        $catN = $_GET[removecat];
        if (!in_array($catN, array_keys($cdt))) {
            MsgBox(lt("Category to be deleted does not exist", 'cat-to-del-not-exists'), 'redbox');
        } else {
            if (in_array($catN, $musthaveCats)) {
                MsgBox("<b>{$catN}</b> : " . lt('Cannot be deleted'), 'redbox');
            } else {
                unset($cdt[$catN]);
                $msg = sprintf(lt("Pages Category %s was removed Successfully", 'cat-remove-success'), "<b>{$catN}</b>");
                MsgBox($msg, 'greenbox');
                setDetails('cats', $cdt);
                savepages();
            }
        }
    }
    if (isset($_GET[addtocat])) {
        $slug2add = $_POST[page];
        $cat2add = $_POST[cat];
        if (in_array($slug2add, $cdt[$cat2add])) {
            $msg = sprintf(lt("The page %s is already listed in %s", 'page-already-listed'), "<b>{$titles[$slug2add]}</b>", "<b>{$cat2add}</b>");
            MsgBox($msg);
        } else {
            array_push($cdt[$cat2add], $slug2add);
            $msg = sprintf(lt("The page %s was added successfully under %s", 'page-to-cat-add-success'), "<b>{$titles[$slug2add]}</b>", "<b>{$cat2add}</b>");
            MsgBox($msg);
            setDetails('cats', $cdt);
            savepages();
            $selectedCat = $cat2add;
            $toggStat = 'true';
        }
    }
    $catSelectList = array();
    foreach ($cdt as $cN => $cSC) {
        $catSelectList[$cN] = $cN;
    }
    $pagesAndOpt = lt('Pages & Category Options', 'page-and-cat-opt');
    $pagesListing = lt('Pages & Category Listing', 'page-and-cat-list');
    $addNewCat = lt('Add new Category');
    $addToAnotherCat = lt('Add page to another category', 'add-page-to-another-cat');
    $addLabel = lt('Add');
    $useUrlLabel = lt('Url you can use');
    $moveLabel = lt('Move');
    $optLabel = lt('Options');
    $pageLabel = lt('Page');
    echo "<a href='#nogo' class='nodeco'><h2 id='cat_anchor' class='cattitle'><span id='toggCon'></span>{$pagesAndOpt}</h2></a>\r\n\t\t\t<table id='cat_options'>\r\n\t\t\t <tr>\r\n\t\t\t \t<form action='?action=showpages&addcat=true' method='post'>\r\n\t\t\t\t<td>{$addNewCat} : </td><td><input type='text' name='catname'> <input type='submit' value='{$addLabel}'></td>\r\n\t\t\t\t</form>\r\n\t\t\t </tr>\r\n\t\t\t <tr>\r\n\t\t\t\t<form action='?action=showpages&addtocat=true' method='post'>\r\n\t\t\t\t<td>{$addToAnotherCat}</td><td>" . pagesList('page', $titles, 0) . " to " . pagesList('cat', $catSelectList, $selectedCat) . "\r\n\t\t\t\t\t <input type='submit' value='{$addLabel}'>\r\n\t\t\t\t</td>\r\n\t\t\t\t</form>\r\n\t\t\t </tr>\r\n\t\t\t</table>";
    $js = "catopt = new Toggle('cat_options',{$toggStat},'cat_anchor');catopt.setToggleContent( 'toggCon', '+', '-' );";
    $v = 0;
    echo "<h2>&raquo; {$pagesListing}</h2>";
    echo "<div class='linkcats-div'>";
    foreach ($cdt as $catname => $catslugs) {
        $v++;
        $slugids = array_values($catslugs);
        $n = count($slugids) - 1;
        if (!in_array($catname, $musthaveCats)) {
            $removeOpt = "( <a href='?action=showpages&removecat={$catname}'>remove</a> )";
        } else {
            $removeOpt = '';
        }
        //just user interface stuff
        $toggStat = $catname == $_SESSION[opencat] ? 'true' : 'false';
        if (!isset($_SESSION[opencat]) and $catname == 'sidebar') {
            $toggStat = true;
        }
        if ($catname == $_SESSION[opencat]) {
            $toggStat = 'true';
            unset($_SESSION[opencat]);
        } else {
            $toggStat == 'false';
        }
        $js .= "catopt{$v} = new Toggle('t{$v}',{$toggStat},'h2{$v}'); catopt{$v}.setToggleContent( 'co{$v}', '+', '-' );";
        echo "<a href='#nogo'><h2 class='cattitle noborder' id='h2{$v}'><span id='co{$v}' class='togg'>&raquo;</span> {$catname} {$removeOpt}</h2></a>";
        echo "<div class='borderWrap'>";
        echo "<table cellpadding='5px' cellspacing='2px'  width='100%' id='t{$v}' class='pageListTable'>";
        echo "<tr class='th'><th>{$pageLabel}</th><th>{$optLabel}</th><th colspan=2>{$moveLabel}</th><th>{$useUrlLabel}</th></tr>";
        if (count($slugids) == 0) {
            echo "<tr><td colspan='10' class='center'>" . lt('No pages are added under this category', 'no-pages-added') . "</td></tr></table>";
            continue;
        }
        foreach ($slugids as $pos => $ids) {
            $delTxt = lt('Delete');
            $editTxt = lt('Edit');
            $upTxt = lt('Up');
            $downTxt = lt('Down');
            $ul = makeLink("?action=reorder&cat={$catname}&param=" . $pos . ',' . ($pos - 1), '<img src="stuff/icons/arrow_up.png" alt="up" title="Move up"/>');
            $dl = makeLink("?action=reorder&cat={$catname}&param=" . $pos . ',' . ($pos + 1), '<img src="stuff/icons/arrow_down.png" alt="down" title="Move Down" />');
            if ($pos == 0) {
                $ul = '<img src="stuff/icons/arrow_up_d.png" alt="$upTxt" />';
            }
            if ($pos == $n) {
                $dl = '<img src="stuff/icons/arrow_down_d.png" alt="$downTxt" />';
            }
            $deleteConfirmMsg = lt("Are you sure you want to delete this page!! Remember Once you delete you cannot retreive again!! Proceed???", 'page-delete-confirm-msg');
            $s = "<tr>\r\n\t\t\t\t\t<td><b>" . $titles[$ids] . "</b></td>\r\n\t\t\t\t\t<td class='center'>\r\n\t\t\t\t\t\t<a href='?action=edit&slug=" . $slugs[$ids] . "'><img src='stuff/icons/page_edit.png' alt='{$editTxt}' title='{$editTxt}' /></a> |\r\n\t\t\t\t\t\t<a href='?action=delete&slug=" . $slugs[$ids] . "' onclick='return confirm(\"{$deleteConfirmMsg}\");'><img src='stuff/icons/cross.png' alt='{$delTxt}' title='{$delTxt}' /></a>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td>{$ul}</td>\r\n\t\t\t\t\t<td>{$dl}</td>\r\n\t\t\t\t\t<td>" . makeLink((NANO_SEFURL ? '../' : '') . slugUrl($slugs[$ids]), slugUrl($slugs[$ids])) . "</td>\r\n\t\t\t\t  </tr>";
            echo $s;
        }
        echo "</table>";
        echo "</div>";
    }
    echo "</div>";
    echo "\t<script language='javascript'>\r\n\t\t\t\t{$js}\r\n\t\t\t</script>";
}
Exemple #9
0
lt(array(), 'Array');
lt(array('a', 'b'), 'Array');
echo "\n";
gt('Array', array(1, 2));
gt('Array', array());
gt(array(), 'Array');
gt(array('a', 'b'), 'Array');
echo "======\n";
eq('', null);
eq(null, null);
eq(null, '');
eq('', '');
echo "\n";
lt('', null);
lt(null, null);
lt(null, '');
lt('', '');
echo "\n";
gt('', null);
gt(null, null);
gt(null, '');
gt('', '');
echo "======\n";
eq(-1.0, null);
eq(null, -1.0);
echo "\n";
lt(-1.0, null);
lt(null, -1.0);
echo "\n";
gt(-1.0, null);
gt(null, -1.0);
Exemple #10
0
function dt()
{
    global $T, $V;
    // go through all the pending ticks
    foreach ($T as $e => $f) {
        if ($f[0] <= lt()) {
            // if this entry needs to be done
            if ($f[1][0] == '$') {
                $V[substr($f[1], 1)]($f[3], 1, $f[2]);
            } else {
                $f[1]($f[2]);
            }
            // do it
            unset($T[$e]);
            // and call it done
        }
    }
}
Exemple #11
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("BoxedFloat main program.\n");
     $status = 0;
     $d1 = new BoxedFloat(1.0);
     printf("d1 = %s\n", str($d1));
     $d2 = new BoxedFloat(0.5);
     printf("d2 = %s\n", str($d2));
     printf("d1 < d2 = %s\n", str(lt($d1, $d2)));
     printf("hash(d1) = %d\n", hash($d1));
     printf("hash(d2) = %d\n", hash($d2));
     printf("hash(57.0) = 0%o\n", hash(new BoxedFloat(57.0)));
     printf("hash(23.0) = 0%o\n", hash(new BoxedFloat(23.0)));
     printf("hash(0.75) = 0%o\n", hash(new BoxedFloat(0.75)));
     printf("hash(-123.0e6) = 0%o\n", hash(new BoxedFloat(-123000000.0)));
     printf("hash(-123.0e7) = 0%o\n", hash(new BoxedFloat(-1230000000.0)));
     printf("hash(0.875) = 0%o\n", hash(new BoxedFloat(0.875)));
     printf("hash(14.0) = 0%o\n", hash(new BoxedFloat(14.0)));
     return $status;
 }
                    <a href="../" title="<?php 
echo lt('View Site');
?>
" target="_blank"><img class='updown' src='theme/images/window.gif' alt="<?php 
echo lt('View Site');
?>
" /></a> 
                    <a href="?logout" title="<?php 
echo lt('Logout');
?>
"><img class='delete' src='theme/images/trash.gif' alt="<?php 
echo lt('Logout');
?>
" <?php 
if (isset($razorArray['settings']['maintenance']) && $razorArray['settings']['maintenance'] == true) {
    echo "onclick='return confirm(\"" . lt("You are in maintenance mode, are you sure you want to log out in maintenance mode") . "\");'";
}
?>
 /></a>
                </div>
            </div>
        <div id="midbrace">
            <div id="midbox">
                <div id="leftbar">
                    <div id="leftnav">
                        <?php 
loadAdminSubLinks();
?>
                        <?php 
BsocketB('admin-xhtml-leftnav');
?>
Exemple #13
0
 function commitChanges()
 {
     $catList = getDetails('cats');
     $sd = getDetails('slugs');
     $tt = getDetails('titles');
     $tt[$this->slugId] = $this->title;
     $sd[$this->slugId] = $this->slug;
     foreach ($catList as $catName => $catSlugs) {
         //the cat is there in our list and our page is not there in master list then just add/push it
         $isCategoryInOurList = in_array($catName, $this->cats);
         $isSlugInMasterCategory = in_array($this->slugId, $catSlugs);
         if ($isCategoryInOurList and !$isSlugInMasterCategory) {
             array_push($catList[$catName], $this->slugId);
             echo '<br>' . lt('Added');
         }
         if (!$isCategoryInOurList and $isSlugInMasterCategory) {
             $catSlugsIndexes = array_flip($catList[$catName]);
             array_splice($catList[$catName], $catSlugsIndexes[$this->slugId], 1);
             echo "<br>" . lt('Deleted from list') . " - {$catName}";
         }
     }
     setDetails('cats', $catList);
     setDetails('slugs', $sd);
     setDetails('titles', $tt);
 }
function nanoadmin_showsettings()
{
    $home = getDetails('homepage');
    $pages = getDetails('titles');
    $slugs = getDetails('slugs');
    $username = getDetails('username');
    $seourl_stat = (bool) getDetails('seourl');
    $seourl = array(lt('Disabled'), lt('Enabled'));
    $is_modrewrite_available = true;
    if (isset($_POST['save'])) {
        runTweak('save-settings');
        $_POST = array_map('stripslashes', $_POST);
        $home = $_POST['homepage'];
        $seourl_stat = $_POST['seourls'];
        $seourl_stat = $is_modrewrite_available ? $seourl_stat : 0;
        if ($seourl_stat == 1) {
            file_put_contents(NANO_INDEX_LOCATION . '.htaccess', NANO_HTACCESS_FORMAT);
        } else {
            unlink(NANO_INDEX_LOCATION . '.htaccess');
        }
        $username = $_POST['username'];
        $password = $_POST['password'];
        setDetails('homepage', $home);
        setDetails('seourl', $seourl_stat);
        if (!empty($username)) {
            setDetails('username', $username);
        }
        if (!empty($password)) {
            setDetails('password', md5($password));
            //reset the logged session variable
            $_SESSION[NANO_CMS_ADMIN_LOGGED] = md5(md5($password) . $_SESSION[LOGIN_TIME_STAMP]);
        }
        if (savepages()) {
            MsgBox(lt('Settings were saved successfully'), 'greenbox');
        }
    }
    $word_homepage = lt('Home Page');
    $word_sefurl = lt('Search Engine Friendly URL\'s');
    $word_new = lt('New');
    $word_username = lt('Username');
    $word_password = lt('Password');
    $word_leaveitemtpy = lt("Leave empty if you don't want to change", 'leave-empty-for-no-change');
    $word_loginsettings = lt("Login Settings");
    $word_save = lt("Save Changes");
    $word_settings = lt("NanoCMS Settings");
    if ($is_modrewrite_available) {
        $select_seourl = html_select('seourls', $seourl, $seourl_stat);
        $word_modrewrite = lt("mod_rewrite is required and is available");
    } else {
        $select_seourl = html_select('seourls', $seourl, $seourl_stat, ' disabled="disabled"');
        $word_modrewrite = lt("mod_rewrite is <b>not available</b>, please contact your host or enable it via httpd.conf", 'modrewrite-not-available');
    }
    $select_homepage = html_select('homepage', $pages, $home);
    echo $output = <<<NANO_SETTINGS
\t<h2>{$word_settings}</h2>
\t<form action="#" method="POST" accept-charset="utf-8">
\t\t<table width="100%" cellpadding="5">
\t\t\t<tr>
\t\t\t\t<td>{$word_homepage}</td><td>{$select_homepage}</td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>{$word_sefurl} <br /><small>[ {$word_modrewrite} ]</small></td><td>{$select_seourl}</td>
\t\t\t</tr>
\t\t\t<tr><td>&nbsp;</td></tr>
\t\t\t<tr>
\t\t\t\t<td colspan="2"><h2>{$word_loginsettings}</h2></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td colspan="2">{$word_leaveitemtpy}</td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>{$word_new} {$word_username}</td><td><input type="text" value="{$username}" name="username" /></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>{$word_new} {$word_password}</td><td><input type="text" name="password" value="" /></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td><br /><input type="submit" value="{$word_save}" name="save" /></td>
\t\t\t</tr>
NANO_SETTINGS;
    runTweak('admin-settings');
    echo "\r\n\t\t</table>\r\n\t</form>";
}
Exemple #15
0
 /**
  * Returns the binomial tree in this binomial queue
  * that has the "smallest" root.
  * The smallest root is the root which is less than or
  * equal to all other roots.
  *
  * @return object BinomialTree The binomial tree in this binomial queue
  * that has the "smallest" root.
  */
 protected function findMinTree()
 {
     $minTree = NULL;
     for ($ptr = $this->treeList->getHead(); $ptr !== NULL; $ptr = $ptr->getNext()) {
         $tree = $ptr->getDatum();
         if ($minTree === NULL || lt($tree->getKey(), $minTree->getKey())) {
             $minTree = $tree;
         }
     }
     return $minTree;
 }
Exemple #16
0
 public function lt($other)
 {
     return lt($this, $other);
 }
Exemple #17
0
function _lt($defaultText, $text_type = '')
{
    echo lt($defaultText, $text_type);
}
Exemple #18
0
    message_die(GENERAL_MESSAGE, 'PLUGIN_DISABLED');
}
if ($config['cash_adminnavbar']) {
    $navbar = 1;
    include 'admin_cash.' . PHP_EXT;
}
$current_time = time();
$ar_time = array('all' => '', 'day' => '(log_time > ' . ($current_time - 86400) . ')', 'week' => '(log_time > ' . ($current_time - 604800) . ')', 'month' => '(log_time > ' . ($current_time - 2592000) . ')', 'year' => '(log_time > ' . ($current_time - 31536000) . ')');
function lt($const)
{
    return "log_type = {$const}";
}
$action_types = array(CASH_LOG_DONATE => 'user', CASH_LOG_ADMIN_MODEDIT => 'admin', CASH_LOG_ADMIN_CREATE_CURRENCY => 'admin', CASH_LOG_ADMIN_DELETE_CURRENCY => 'admin', CASH_LOG_ADMIN_RENAME_CURRENCY => 'admin', CASH_LOG_ADMIN_COPY_CURRENCY => 'admin');
$action_users = array('user' => array(), 'admin' => array());
while (list($type, $user) = each($action_types)) {
    $action_users[$user][] = lt($type);
}
$ar_action = array('all' => '', 'user' => '(' . implode(' OR ', $action_users['user']) . ')', 'admin' => '(' . implode(' OR ', $action_users['admin']) . ')');
$ar_count = array('a' => 10, 'b' => 25, 'c' => 50, 'd' => 100);
if (isset($_GET['delete']) && ($_GET['delete'] == 'all' || $_GET['delete'] == 'admin' || $_GET['delete'] == 'user')) {
    $deleteclause = $ar_action[$_GET['delete']];
    if ($deleteclause != '') {
        $deleteclause = " WHERE " . $deleteclause;
    }
    $sql = "DELETE FROM " . CASH_LOGS_TABLE . $deleteclause;
    $db->sql_query($sql);
}
//
// most of this is just stupid sorting stuff
// -- but then, that's mostly all the functionality that this page has :P
//
function bladepackInstall()
{
    if ($_SESSION['adminType'] == 'user') {
        return;
    }
    $startInstall = false;
    if (isset($_GET['startinstall']) && $_GET['startinstall']) {
        $startInstall = true;
    }
    if ($startInstall) {
        $filename = basename($_FILES['file-upload']['name']);
        $stripFileName = explode('.', $filename);
        if (end($stripFileName) == 'zip') {
            $bladepacksDir = getSystemRoot(RAZOR_ADMIN_FILENAME) . RAZOR_BLADEPACK_DIR;
            $bladepackFiles = readDirContents($bladepacksDir);
            $fileExists = false;
            foreach ($bladepackFiles as $fileCheck) {
                $fileCheckT = explode('.', $fileCheck);
                $filenameT = explode('.', $filename);
                if (reset($fileCheckT) == reset($filenameT)) {
                    $fileExists = true;
                }
            }
            if (!$fileExists) {
                uploadFile(RAZOR_BLADEPACK_DIR . $filename, $_FILES['file-upload']['tmp_name']);
                $bpInstall = new BPCONTROL();
                $bpInstall->extractContents(RAZOR_BLADEPACK_DIR . $filename);
                if ($bpInstall->checkContents(RAZOR_BLADEPACK_DIR)) {
                    if ($bpInstall->extractXmlData()) {
                        $bpInstall->saveContents(RAZOR_BLADEPACK_DIR);
                        MsgBox(lt('Bladepack installed successfully'), 'greenbox');
                        if ($bpInstall->searchXmlArray($bpInstall->xmlContents, 'note')) {
                            MsgBox(lt('PLEASE READ SPECIAL NOTES FOR BLADE PACK'), 'yellowbox');
                            $sentance = '';
                            $noteArray = array();
                            $noteArray = $bpInstall->searchXmlArray($bpInstall->xmlContents, 'note');
                            foreach ($noteArray['child'] as $paras) {
                                $sentance .= '<' . $paras['tag'] . '>' . $paras['value'] . '</' . $paras['tag'] . '>';
                            }
                            MsgBox($sentance, 'yellowbox');
                        }
                        deleteFile(RAZOR_BLADEPACK_DIR . $filename, false);
                    } else {
                        MsgBox(lt('Error installing bladepack, cannot parse xml, attempting to clean up install file'), 'redbox');
                        deleteFile(RAZOR_BLADEPACK_DIR . $filename);
                    }
                } else {
                    MsgBox(lt('Error installing bladepack, unpack error, attempting to clean up install file'), 'redbox');
                    deleteFile(RAZOR_BLADEPACK_DIR . $filename);
                }
            } else {
                MsgBox(lt('Error installing bladepack, bladepack already present'), 'redbox');
            }
        } else {
            MsgBox(lt("Error installing bladepack, only bladepack parcels allowed"), 'redbox');
        }
    }
    echo "<h1>" . lt('Install Blade Packs') . "</h1>";
    echo "<div class='contentwh'>";
    echo "<h3>" . lt('Upload blade pack parcel') . "</h3>";
    echo '<p>' . lt('Please only upload verified blade pack parcel files downloaded from the official razorCMS website. All blade pack parcels are distributed in zip archive format') . '.</p>';
    echo '<form enctype="multipart/form-data" action="?action=bladeinstall&startinstall=true" method="POST">';
    echo "<table class='tableViewBlades'>";
    echo "<tr class='tableFooter'><th class='auto'></th><th class='ten'></th></tr>";
    echo '<tr><td><input name="file-upload" type="file" /></td><td><input id="button" type="submit" value="' . lt('upload file') . '" name="upload"/></td></tr>';
    echo "<tr class='tableFooter'><th class='twentyFive'></th><th class='auto'></th></tr></table></form></div>";
}
function demoExecuteNanoSite()
{
    global $indexTemplateAreas, $indexTemplateLL;
    $sett = getDetails('settings');
    $catt = getDetails('cats');
    $indexLastModified = filemtime(NANO_CMS_PAGE);
    if ($sett['index-last-modified'] >= $indexLastModified) {
        return;
    }
    $removeFunctionList = array('show_sidebar', 'show_content_slug', 'show_title', 'require_once');
    $replaceFunction = 'dummyFunction';
    $demoContentToRun = file_get_contents(NANO_CMS_PAGE);
    $demoContentToRun = str_replace('show_content_area', 'readIntoAreaList', $demoContentToRun);
    $demoContentToRun = str_replace('show_links', 'readIntoLinksList', $demoContentToRun);
    $demoContentToRun = str_replace($removeFunctionList, $replaceFunction, $demoContentToRun);
    ob_start();
    eval(" ?> " . $demoContentToRun . " <?php ");
    $cont = ob_get_contents();
    ob_end_clean();
    MsgBox(lt("Template Changes Detected! Config & Settings updated!", 'template-changes-detected'));
    $newcatt = array_diff($indexTemplateLL, array_keys($catt));
    foreach ($newcatt as $newcatname) {
        $catt[$newcatname] = array();
    }
    foreach ($indexTemplateAreas as $k => $v) {
        $indexTemplateAreas[$k] = strtolower($v);
    }
    $sett['index-last-modified'] = $indexLastModified;
    $sett['def-template-areas'] = array_unique($indexTemplateAreas);
    $sett['def-template-links'] = array_unique($indexTemplateLL);
    setDetails('settings', $sett);
    setDetails('cats', $catt);
    savepages();
}
Exemple #21
0
 /**
  * Dequeues and returns the "smallest" object in this deap.
  * The smallest object in this deap is the object
  * which is less than or equal to all other objects in this deap.
  *
  * @return object IComparable The "smallest" object in this deap.
  */
 public function dequeueMin()
 {
     if ($this->count == 0) {
         throw new ContainerEmptyException();
     }
     $result = $this->array[2];
     $last = $this->array[$this->count + 1];
     --$this->count;
     if ($this->count <= 1) {
         $this->array[2] = $last;
     } else {
         $i = 2;
         while (2 * $i < $this->count + 2) {
             $child = 2 * $i;
             if ($child + 1 < $this->count + 2 && lt($this->array[$child + 1], $this->array[$child])) {
                 $child += 1;
             }
             $this->array[$i] = $this->array[$child];
             $i = $child;
         }
         $j = $this->dual($i);
         if (le($last, $this->array[$j])) {
             $this->insertMin($i, $last);
         } else {
             $this->array[$i] = $this->array[$j];
             $this->insertMax($j, $last);
         }
     }
     return $result;
 }
Exemple #22
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("BoxedInteger main program.\n");
     $status = 0;
     $i1 = new BoxedInteger(57);
     printf("i1 = %s\n", str($i1));
     $i2 = new BoxedInteger(123);
     printf("i2 = %s\n", str($i2));
     printf("i1 < i2 = %s\n", str(lt($i1, $i2)));
     printf("hash(i1) = %d\n", hash($i1));
     printf("hash(i2) = %d\n", hash($i2));
     return $status;
 }
Exemple #23
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("BoxedBoolean main program.\n");
     $status = 0;
     $b1 = new BoxedBoolean(false);
     printf("b1 = %s\n", str($b1));
     $b2 = new BoxedBoolean(true);
     printf("b2 = %s\n", str($b2));
     printf("b1 < b2 = %s\n", str(lt($b1, $b2)));
     printf("hash(b1) = %d\n", hash($b1));
     printf("hash(b2) = %d\n", hash($b2));
     return $status;
 }
Exemple #24
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("BoxedString main program.\n");
     $status = 0;
     $s1 = new BoxedString('s1');
     printf("s1 = %s\n", str($s1));
     $s2 = new BoxedString('s2');
     printf("s2 = %s\n", str($s2));
     printf("s1 < s2 = %s\n", str(lt($s1, $s2)));
     printf("hash(s1) = %d\n", hash($s1));
     printf("hash(s2) = %d\n", hash($s2));
     BoxedString::testHash();
     return $status;
 }
function lang_parse_word($word)
{
    $word = $word[1];
    return lt($word);
}
Exemple #26
0
function div($x, $y)
{
    return lt($x, $y) ? 0 : add(1, div(sub($x, $y), $y));
}
Exemple #27
0
 /**
  * Finds the position of the specified object
  * in the array of keys contained in this M-way tree node.
  * Uses binary search.
  *
  * @param object IComparable $obj The object for which to look.
  * @return integer The position of the object in the array of keys.
  * If the object is not present,
  * the result is the position of the largest key
  * less than the specified one.
  */
 protected function findIndex(IComparable $obj)
 {
     if ($this->isEmpty() || lt($obj, $this->key[1])) {
         return 0;
     }
     $left = 1;
     $right = $this->count;
     while ($left < $right) {
         $middle = intval(($left + $right + 1) / 2);
         if (lt($obj, $this->key[$middle])) {
             $right = $middle - 1;
         } else {
             $left = $middle;
         }
     }
     return $left;
 }
loadSettings('siteslogan');
?>
</h2>
        </div>
        </div>
        </div>
        <div id="midbrace">
            <div id="midbox">
                <div id="content">
                        <img src="theme/images/warning.png" title="warning" alt="warning" />
                        <h1><?php 
echo lt('UNDER MAINTENANCE');
?>
</h1>
                        <p><?php 
echo lt('This site is currently under going routine maintenance, sorry for any inconvenience this has cause, we hope to be up and running shortly');
?>
</p>
                </div>
            </div>
            <div id="copyw">
                <div id="copynav">
                </div>
            </div>  
        </div>
        <div id="footer">
        <div id="footerr">
        <div id="footerl">
        <div id="footnav">
            <div id="footerLeft">
                <a href="http://www.razorcms.co.uk">www.razorcms.co.uk</a>
<?php

//login
runTweak('before-login-check');
if (!isset($_SESSION[NANO_CMS_ADMIN_LOGGED])) {
    if (isset($_POST[user])) {
        if ($_POST[user] == NANO_CMS_ADMIN_USER and $_POST[pass] == NANO_CMS_ADMIN_PASS) {
            $_SESSION[LOGIN_TIME_STAMP] = $ts = time();
            $_SESSION[NANO_CMS_ADMIN_LOGGED] = md5(NANO_CMS_ADMIN_PASS . $ts);
            //die('done');
            runTweak('after-logged-in');
        } else {
            $loginbox_msg = lt("Error : wrong Username or Password");
        }
    }
}
//logout
if (isset($_GET[logout])) {
    $loginbox_msg = lt("You were successfully logged out");
    unset($_SESSION[NANO_CMS_ADMIN_LOGGED]);
}
//the login form
if ($_SESSION[NANO_CMS_ADMIN_LOGGED] != md5(NANO_CMS_ADMIN_PASS . $_SESSION[LOGIN_TIME_STAMP]) or !isset($_SESSION[NANO_CMS_ADMIN_LOGGED])) {
    session_destroy();
    runTweak('before-login-form');
    $form = "\r\n\t\t<html>\r\n\t\t<head>\r\n\t\t<title>NanoCMS Admin login</title>\r\n\t\t<style type='text/css'>\r\n\t\tbody{ font:12px verdana; background:#FFFFEA; text-align:center; }\r\n\t\ttable { border-collapse:collapse; background:#FFFFEA; }\r\n\t\t.cinfo { font-size:9px; }\r\n\t\t.cinfo a { color:#FF9933; }\r\n\t\t.cinfo a:hover { text-decoration:none; }\r\n\t\t</style>\r\n\t\t</head>\r\n\t\t<body>\r\n\t\t\t<br />\t<br />\t<br />\t<br />\t<br />\t<br />\t<br />\r\n\t\t\t<p align='center'>{$loginbox_msg}</p>\r\n\t\t\t<table align='center' border='1' cellpadding='5px' bordercolor='#FF9933'>\r\n\t\t\t<form action='?' method='post'>\r\n\t\t\t<tr class='th'><td colspan=2 align='center'>NanoCMS Login</td></tr>\r\n\t\t\t<tr><td>Username</td><td><input type='text' name='user'></td></tr>\r\n\t\t\t<tr><td>Password</td><td><input type='password' name='pass'></td></tr>\r\n\t\t\t<tr><td colspan='2' align='right'><input type='submit' value='Login'></td></tr>\r\n\t\t\t</form>\r\n\t\t\t</table>\r\n\t\t\t<p class='cinfo'>&copy; <a href='http://KalyanChakravarthy.net/'>Kalyan Chakravarthy</a></p>\r\n\t\t</body>\r\n\t\t</html>\r\n";
    runTweak('login-form', array(&$form));
    echo $form;
    exit;
}
 /**
  * Finds the offset in this sorted list of the object
  * that matches the given object.
  *
  * @param object IComparable $obj An object.
  * @return integer The offset of the matching object;
  * -1 if no match is found.
  */
 public function findOffset(IComparable $obj)
 {
     $left = 0;
     $right = $this->count - 1;
     while ($left <= $right) {
         $middle = intval(($left + $right) / 2);
         if (gt($obj, $this->array[$middle])) {
             $left = $middle + 1;
         } elseif (lt($obj, $this->array[$middle])) {
             $right = $middle - 1;
         } else {
             return $middle;
         }
     }
     return -1;
 }