public function toJS()
 {
     $generatedJS = ' $("#_orongo_ajax_comment_form").submit(function(event) {';
     $generatedJS .= " event.preventDefault(); ";
     $generatedJS .= " postComment('" . Settings::getWebsiteURL() . "ajax/postComment.php', " . $this->articleID . ", \$('textarea[name=_orongo_ajax_new_comment]').val(),'" . Settings::getWebsiteName() . "');";
     $generatedJS .= " \$('textarea[name=_orongo_ajax_new_comment]').val('');";
     $generatedJS .= " return false; ";
     $generatedJS .= ' });';
     return $generatedJS;
 }
/**
 * Shortcut for Settings::getWebsite() . *STRING*
 * @param String $paramFile string to add before Settings::getWebsite();
 * @return String
 */
function orongoURL($paramFile)
{
    $website_url = Settings::getWebsiteURL();
    $url = $website_url . $paramFile;
    if (substr($website_url, 0, 1) == '/') {
        if (substr($paramFile, 0, 1) == '/') {
            $url = $website_url . substr($paramFile, 1);
        }
    }
    return $url;
}
 public function toJS()
 {
     $generatedJS = " offset = " . $this->offset . "; ";
     $generatedJS .= " lastCommentID = " . $this->lastCommentID . "; ";
     $generatedJS .= " window.setInterval(function() {";
     //$generatedJS .= " try{";
     $generatedJS .= "   var returned = loadComments('" . Settings::getWebsiteURL() . "ajax/loadComments.php', " . $this->articleID . ", lastCommentID, offset);";
     $generatedJS .= "   offset = returned[0]; ";
     $generatedJS .= "   lastCommentID = returned[1]; ";
     //$generatedJS .= "}catch(err){ alert(err); }";
     $generatedJS .= " }, " . $this->refreshInterval . "); ";
     return $generatedJS;
 }
Example #4
0
 public function getArticlesHTML($paramArticles)
 {
     $generatedHTML = "";
     $curPage = getCurrentPage();
     if (is_array($paramArticles) == false) {
         return null;
     }
     //Sup, Orongo? U nooo pass me an array :(
     $count = count($paramArticles);
     if ($count < 1) {
         return "<p>No articles we're found</p>";
     }
     $generatedCount = 0;
     foreach ($paramArticles as $article) {
         $last = false;
         if ($article instanceof Article == false) {
             continue;
         }
         $generatedCount++;
         if ($generatedCount == 4 && $curPage == 'index') {
             $last = true;
         }
         if (is_int($generatedCount / 4) && $curPage == 'archive') {
             $last = true;
         }
         if ($curPage == 'archive' && $last == false && $generatedCount == count($paramArticles)) {
             $last = true;
         }
         $generatedHTML .= '<div class="one_fourth ';
         if ($last) {
             $generatedHTML .= 'column-last';
         }
         $generatedHTML .= ' ">';
         $generatedHTML .= '<a href="' . Settings::getWebsiteURL() . 'article.php?id=' . $article->getID() . '"><h3>' . $article->getTitle() . '</h3></a>';
         $generatedHTML .= '<p>' . substr(strip_tags($article->getContent()), 0, 500) . '</p>';
         $generatedHTML .= '</div>';
         if ($last && $curPage == 'index') {
             break;
         }
     }
     return $generatedHTML;
 }
/**
 * @author Jaco Ruit
 */
require '../startOrongo.php';
startOrongo();
setCurrentPage('admin_orongo-settings');
Security::promptAuth();
if (getUser()->getRank() != RANK_ADMIN) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
    exit;
}
if (!isset($_POST['website_url']) || !isset($_POST['website_style']) || !isset($_POST['website_name']) || !isset($_POST['website_lang']) || !isset($_POST['show_archive'])) {
    header("Location: " . orongoURL("orongo-admin/orongo-settings.php"));
    exit;
}
if (Settings::getWebsiteURL() != $_POST['website_url'] && !empty($_POST['website_url'])) {
    Settings::setWebsiteURL($_POST['website_url']);
}
if (Settings::getWebsiteName() != $_POST['website_name'] && !empty($_POST['website_name'])) {
    Settings::setWebsiteName($_POST['website_name']);
}
if (Settings::getLanguageName() != $_POST['website_lang'] && !empty($_POST['website_lang'])) {
    Settings::setLanguageName($_POST['website_lang']);
}
if (strval(Settings::showArchive()) != $_POST['show_archive'] && !empty($_POST['show_archive'])) {
    Settings::setShowArchive($_POST['show_archive']);
}
if (getStyle()->getStyleFolder() != $_POST['website_style'] && file_exists(ROOT . "/themes/" . $_POST['website_style']) . "/info.xml") {
    try {
        Settings::setStyle($_POST['website_style']);
    } catch (Exception $e) {
Example #6
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <title>OrongoTerminal</title>
        <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script src="<?php 
echo Settings::getWebsiteURL();
?>
js/jquery.mousewheel-min.js"></script>
        <script src="<?php 
echo Settings::getWebsiteURL();
?>
js/jquery.terminal-0.4.6.min.js"></script>
        <link href="<?php 
echo Settings::getWebsiteURL();
?>
orongo-admin/theme/css/jquery.terminal.css" rel="stylesheet"/>
        <script>
            jQuery(document).ready(function($) {
                $(document.documentElement).terminal("<?php 
echo Settings::getWebsiteURL();
?>
ajax/terminalRPC.php", { greetings: "Welcome to the OrongoTerminal\n*****************************\n\nTo show commands enter 'cmd'\n\n"});
                $('body').css('display', 'none');
            });
        </script>
    </head>
    <body><noscript>Activate JavaScript</noscript>
    </body>
</html>
Example #7
0
 /**
  * Generates activation URL
  * @param String $paramID ID of User
  * @return String activation URL
  */
 public static function generateActivationURL($paramID)
 {
     $websiteURL = Settings::getWebsiteURL();
     $activationCode = self::getRandomString();
     getDatabase()->insert("user_activations", array("userID" => $paramID, "code" => $activationCode));
     return $websiteURL . 'orongo-activation.php?code=' . $activationCode;
 }
Example #8
0
 /**
  * Installs database for the style
  * @param String $paramInfoXML path where info.xml of style is located
  */
 public static function install($paramInfoXML)
 {
     if (file_exists($paramInfoXML) == false) {
         throw new Exception("The style's info.xml doesn't exist!");
     }
     $xml = @simplexml_load_file($paramInfoXML);
     $json = @json_encode($xml);
     $info = @json_decode($json, true);
     $setting = '';
     $typeSetting = '';
     if ($info['style']['use_php'] != 'true') {
         throw new Exception("Cannot install settings because the style is not using PHP.");
     }
     foreach ($info['style']['settings'] as $key => $value) {
         $setting = $key;
         foreach ($info['style']['settings'][$key] as $key => $value) {
             if ($key == 'type') {
                 $typeSetting = $value;
                 self::installSetting($info['style']['main_class'], $setting, $typeSetting);
             } else {
                 if ($key == 'default') {
                     $default = str_replace('{$website_url}', Settings::getWebsiteURL(), $value);
                     getDatabase()->update("style_data", array("setting_value" => $default), "`style_main_class`=%s AND `setting`=%s", $info['style']['main_class'], $setting);
                 }
             }
         }
     }
 }
 public function render()
 {
     getDisplay()->setTitle(Settings::getWebsiteName() . " - " . $this->pageTitle);
     getDisplay()->setTemplateVariable("body", $this->body);
     if (count($this->msgs) > 0) {
         $msgstring = "";
         foreach ($this->msgs as $msg) {
             if (!is_array($msg)) {
                 continue;
             }
             $msgstring .= '<h4 class="alert_' . $msg['msgtype'] . '">' . $msg['msg'] . "</h4>";
         }
         getDisplay()->setTemplateVariable("msgs", $msgstring);
     }
     $objectshtml = "";
     foreach ($this->objects as $object) {
         if ($object instanceof AdminFrontendObject == false) {
             continue;
         }
         $objectshtml .= $object->toHTML();
     }
     getDisplay()->setTemplateVariable("objects", $objectshtml);
     getDisplay()->setTemplateVariable("current_page", $this->pageTitle);
     getDisplay()->setTemplateVariable("style_url", Settings::getWebsiteURL() . "orongo-admin/theme/");
     getStyle()->run();
     getDisplay()->add("header");
     getDisplay()->add($this->pageTemplate);
     getDisplay()->render();
 }
Example #10
0
 /**
  * Renders the Display
  */
 public function render()
 {
     if ($this->rendered) {
         return;
     }
     $this->setTemplateVariable("website_name", Settings::getWebsiteName());
     $this->setTemplateVariable("website_url", Settings::getWebsiteURL());
     $this->setTemplateVariable("version", "r" . REVISION);
     $this->setTemplateVariable("menu", getMenu()->toHTML());
     if (getUser() != null) {
         $this->setTemplateVariable("user", getUser());
         $on = new OrongoNotifier();
         $on->start();
     }
     if (!$this->isImported(orongoURL('orongo-admin/theme/smoothness/jquery-ui-1.8.16.custom.css'))) {
         $this->import(orongoURL('orongo-admin/theme/smoothness/jquery-ui-1.8.16.custom.css'));
     }
     if (!$this->isImported('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js')) {
         $this->import('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js');
     }
     foreach ($this->objects as $object) {
         if ($object == null) {
             continue;
         }
         if ($object instanceof OrongoDisplayableObject == false) {
             continue;
         }
         $this->addToTemplateVariable("body", $object->toHTML());
     }
     foreach ($this->imports as $import) {
         $type = strrev($import);
         $type = explode(".", $type);
         $type = strrev($type[0]);
         if (stristr($type, "?")) {
             $type = explode("?", $type);
             $type = $type[0];
         }
         switch ($type) {
             case "css":
                 $this->addHTML('<link rel="stylesheet" href="' . $import . '" type="text/css" media="screen" />', "head");
                 break;
             case "js":
                 $this->addHTML('<script type="text/javascript" src="' . $import . '"></script>', "head");
                 break;
             default:
                 break;
         }
     }
     $this->addToTemplateVariable("head", $this->head);
     $this->addToTemplateVariable("body", $this->generalhtml);
     foreach ($this->pluginhtml as $field => $html) {
         $this->setTemplateVariable($field, $html);
     }
     $this->addToTemplateVariable("body", '<script type="text/javascript">' . $this->js . '</script>');
     foreach ($this->tpls as $tpl) {
         if (empty($tpl)) {
             continue;
         }
         if (function_exists("getCurrentPage") && !stristr(getCurrentPage(), "admin") && !file_exists(raintpl::$tpl_dir . $tpl . ".html")) {
             $msgbox = new MessageBox("Style was missing a file: " . $tpl . ".html");
             die($msgbox->getImports() . $msgbox->toHTML());
         }
         $this->raintpl->draw($tpl);
     }
     $this->rendered = true;
 }
Example #11
0
 /**
  * Gets the imports needed to show the messagebox.
  * @return String HTML Code for imports
  */
 public function getImports()
 {
     $websiteURL = Settings::getWebsiteURL();
     $generatedHTML = "<script src=\"http://code.jquery.com/jquery-latest.js\" type=\"text/javascript\"></script><script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js\" type=\"text/javascript\"></script><link rel=\"stylesheet\" href=\"" . $websiteURL . "orongo-admin/theme/smoothness/jquery-ui-1.8.16.custom.css\" type=\"text/css\"/>";
     return $generatedHTML;
 }
Example #12
0
Each resource type name must be unique.

When loading CKFinder, the "type" querystring parameter can be used to display
a specific type only. If "type" is omitted in the URL, the
"DefaultResourceTypes" settings is used (may contain the resource type names
separated by a comma). If left empty, all types are loaded.

maxSize is defined in bytes, but shorthand notation may be also used.
Available options are: G, M, K (case insensitive).
1M equals 1048576 bytes (one Megabyte), 1K equals 1024 bytes (one Kilobyte), 1G equals one Gigabyte.
Example: 'maxSize' => "8M",
*/
$config['DefaultResourceTypes'] = '';
$config['ResourceType'][] = array('name' => 'Files', 'url' => Settings::getWebsiteURL() . 'orongo-media/files', 'directory' => ROOT . '/orongo-media/files', 'maxSize' => 0, 'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip', 'deniedExtensions' => '');
$config['ResourceType'][] = array('name' => 'Images', 'url' => Settings::getWebsiteURL() . 'orongo-media/images', 'directory' => ROOT . '/orongo-media/images', 'maxSize' => 0, 'allowedExtensions' => 'bmp,gif,jpeg,jpg,png', 'deniedExtensions' => '');
$config['ResourceType'][] = array('name' => 'Flash', 'url' => Settings::getWebsiteURL() . 'orongo-media/flash', 'directory' => ROOT . '/orongo-media/flash', 'maxSize' => 0, 'allowedExtensions' => 'swf,flv', 'deniedExtensions' => '');
/*
 Due to security issues with Apache modules, it is recommended to leave the
 following setting enabled.

 How does it work? Suppose the following:

	- If "php" is on the denied extensions list, a file named foo.php cannot be
	  uploaded.
	- If "rar" (or any other) extension is allowed, one can upload a file named
	  foo.rar.
	- The file foo.php.rar has "rar" extension so, in theory, it can be also
	  uploaded.

In some conditions Apache can treat the foo.php.rar file just like any PHP
script and execute it.
Example #13
0
    header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
    exit;
}
$settings = new AdminFrontend();
if (isset($_GET['msg'])) {
    switch ($_GET['msg']) {
        case 0:
            $settings->addMessage(l("Settings saved"), "success");
        default:
            break;
    }
}
$settings->main(array('time' => time(), 'page_title' => 'Orongo Settings', 'page_template' => 'dashboard'));
$settingForm = new AdminFrontendForm(100, "Orongo Settings", "POST", orongoURL("actions/action_SaveOrongoSettings.php"));
$settingForm->addInput("Website Name", "website_name", "text", Settings::getWebsiteName());
$settingForm->addInput("Website URL", "website_url", "text", Settings::getWebsiteURL());
$settingForm->addInput("Admin Email", "admin_email", "text", Settings::getEmail());
$currentShowArchiveString = Settings::showArchive() ? l("Yes") : l("No");
$settingForm->addRadios("Show archive", "show_archive", array(l("Yes") => "true", l("No") => "false"), $currentShowArchiveString);
$languages = array(Settings::getLanguageName() => "nl_NL");
$files = @scandir(ADMIN . '/lang/');
if (is_array($files)) {
    foreach ($files as $file) {
        if ($file == Settings::getLanguageName() || stristr($file, ".")) {
            continue;
        }
        $languages[$file] = $file;
    }
}
$styles = array(getStyle()->getStyleName() => getStyle()->getStyleFolder());
$files = @scandir(ROOT . '/themes');