public final function load($f_szId)
 {
     try {
         return AROImplementation::loadImplementationByID($f_szId);
     } catch (PageNotFoundException $ex) {
         throw new TemplateErrorException();
     }
 }
 public static function loadImplementationByID($f_szID, $f_arrDetails = array())
 {
     try {
         $objImpLoader = AROImplementation::finder()->byPK($f_szID);
         $objImplementation = $objImpLoader->loadImplementation($f_arrDetails);
         $objImplementation->id = $objImpLoader->id;
         $objImplementation->title = $objImpLoader->title;
         return $objImplementation;
     } catch (AROException $ex) {
         throw new PageNotFoundException();
     }
 }
Example #3
0
<?php

require_once 'cfg_admin.php';
logincheck();
$objGuestbook = AROImplementation::loadImplementationByID($_GET['id']);
if (isset($_POST['id'], $_POST['title'], $_POST['content_1'], $_POST['title_2'], $_POST['content_2'])) {
    header('Location: edit.php?id=' . $_POST['id']);
    exit;
} else {
    if (isset($_POST['sortorder'])) {
        $arrOrder = explode(',', $_POST['sortorder']);
        foreach ($arrOrder as $o => $id) {
            $db->update('guestbook_entries', 'o = ' . (int) $o, 'guestbook_implementation_id = ' . $objGuestbook->implementation_id . ' AND id = ' . (int) $id);
        }
        header('Location: ?id=' . $_GET['id']);
        exit;
    } else {
        if (isset($_GET['del'])) {
            $db->update('guestbook_entries', "deleted = '1'", 'id = ' . (int) $_GET['del']);
            header('Location: ?id=' . $_GET['id']);
            exit;
        }
    }
}
tpl_header();
echo '<h1>Editing guestbook: ' . $objGuestbook->title . '</h1>';
?>
<script type="text/javascript" src="/admin/_resources/mootools_1_11.js"></script>

<p><a href="properties.php?id=<?php 
echo $_GET['id'];
Example #4
0
<?php

require_once 'cfg_admin.php';
require_once 'cfg_complete.php';
logincheck();
$objShop = AROImplementation::loadImplementationByID($_GET['id']);
if (isset($_GET['del'])) {
    $db->delete('shop_products', 'shop_implementation_id = ' . $objShop->implementation_id . ' AND id = ' . $_GET['del']);
    header('Location: ?id=' . $objShop->id);
    exit;
}
echo '<h1>Editing shop: ' . $objShop->title . ' | Products</h1>';
$arrProducts = AROShopProduct::finder()->findMany('shop_implementation_id = ?', $objShop->implementation_id);
?>
<p><a href="properties.php?id=<?php 
echo $objShop->id;
?>
">Properties</a> | <a href="categories.php?id=<?php 
echo $objShop->id;
?>
">Categories</a> | <a href="edit.php?id=<?php 
echo $objShop->id;
?>
">Products</a></p>
<?php 
echo '<table border="0" cellpadding="5" cellspacing="0">';
echo '<tr><td colspan="2" align="center"><a href="new_product.php?id=' . $objShop->id . '">New product</a></td></tr>';
foreach ($arrProducts as $prod) {
    $prod->init($objShop);
    echo '<tr><td><a href="' . $prod->image_1 . '"><img src="' . $prod->image_1 . '" width="30" height="30" /></a></td><td><a href="edit_product.php?id=' . $objShop->id . '&prod=' . $prod->id . '">' . $prod->title . '</a></td><td><a href="?id=' . $objShop->id . '&del=' . $prod->id . '">x</a></td></tr>';
}
Example #5
0
<?php

require_once 'cfg_admin.php';
logincheck();
$objMenu = AROImplementation::loadImplementationByID($_GET['id']);
if (isset($_POST['id'], $_POST['title'], $_POST['content_1'], $_POST['max_depth'])) {
    // Update implementation
    $db->update('implementations', "id = '" . addslashes($_POST['id']) . "', title = '" . addslashes($_POST['title']) . "'", "id = '" . addslashes($objMenu->id) . "'");
    // Update menu
    $db->update('menu_implementations', array('max_depth' => (int) $_POST['max_depth'], 'content_1' => $_POST['content_1']), 'implementation_id = ' . $objMenu->implementation_id);
    foreach (array('special_1', 'special_2', 'special_3') as $name) {
        $objMenu->setConfig($name, empty($_POST[$name]) ? null : $_POST[$name]);
    }
    header('Location: edit.php?id=' . $objMenu->id);
    exit;
}
tpl_header();
echo '<h1>Editing menu: ' . $objMenu->title . '</h1>';
?>
<p><a href="properties.php?id=<?php 
echo $objMenu->id;
?>
">Properties</a> | <a href="items.php?id=<?php 
echo $objMenu->id;
?>
">Items</a></p>

<script type="text/javascript" src="/admin/_resources/ckeditor/ckeditor.js"></script>

<form method="post" action="">
Example #6
0
<?php

require_once 'cfg_admin.php';
logincheck();
if (isset($_POST['id'], $_POST['title'], $_POST['content_1'])) {
    $arrInsert = array('content_1' => $_POST['content_1']);
    foreach (array('title_2', 'content_2', 'datetime_1', 'datetime_2') as $k) {
        if (isset($_POST[$k])) {
            $arrInsert[$k] = $_POST[$k];
        }
    }
    $db->insert('news_implementations', $arrInsert);
    $iNewsId = $db->insert_id();
    // Update implementation
    $db->insert('implementations', array('id' => $_POST['id'], 'type' => 'news', 'implementation_id' => $iNewsId, 'title' => $_POST['title']));
    $objNews = AROImplementation::loadImplementationByID($_POST['id']);
    $objNews->setConfig('ni_label_for_title_1', 'Title');
    $objNews->setConfig('ni_label_for_content_1', 'Content');
    $objNews->setConfig('ni_label_for_datetime_1', 'DateTime 1');
    $objNews->setConfig('ni_label_for_title_2', 'Title 2');
    $objNews->setConfig('ni_label_for_content_2', 'Content 2');
    $objNews->setConfig('ni_label_for_datetime_2', 'DateTime 2');
    header('Location: edit.php?id=' . $_POST['id']);
    exit;
}
tpl_header();
echo '<h1>New news collection</h1>';
include 'inc.properties_form.php';
Example #7
0
<?php

require_once 'cfg_admin.php';
logincheck();
$objForm = AROImplementation::loadImplementationByID($_GET['id']);
if (isset($_POST['id'], $_POST['title'], $_POST['content_1'], $_POST['send_to_email'], $_POST['send_from_email'], $_POST['send_from_name'])) {
    // Update implementation
    $db->update('implementations', array('id' => $_POST['id'], 'title' => $_POST['title']), "id = '" . addslashes($objForm->id) . "'");
    // Update form
    $db->update('form_implementations', array('content_1' => $_POST['content_1'], 'send_to_mail' => $_POST['send_to_mail'], 'send_from_mail' => $_POST['send_from_mail'], 'send_from_name' => $_POST['send_from_name']), 'implementation_id = ' . $objForm->implementation_id);
    foreach (array('special_1', 'special_2', 'special_3') as $name) {
        $objForm->setConfig($name, empty($_POST[$name]) ? null : $_POST[$name]);
    }
    foreach ($_POST['specviewtype'] as $vt => $v) {
        $db->delete('specific_view_selections', "object_id = '" . $_GET['id'] . "' AND view_type = '" . $vt . "'");
        if ($v) {
            $db->insert('specific_view_selections', array('object_id' => $_GET['id'], 'view_type' => $vt, 'view_id' => $v));
        }
    }
    header('Location: edit.php?id=' . $_POST['id']);
    exit;
}
tpl_header();
echo '<h1>Editing form: ' . $objForm->title . '</h1>';
?>
<p><a href="properties.php?id=<?php 
echo $_GET['id'];
?>
">Properties</a> | <a href="fields.php?id=<?php 
echo $_GET['id'];
?>
Example #8
0
<?php

require_once 'cfg_admin.php';
logincheck();
$objPage = AROImplementation::loadImplementationByID($_GET['id']);
if (isset($_POST['id'], $_POST['title'], $_POST['content_1'], $_POST['title_2'], $_POST['content_2'])) {
    //exit(print_r($_POST, true));
    // Update implementation
    $db->update('implementations', array('id' => strtolower(strtr($_POST['id'], array(' ' => '-'))), 'title' => $_POST['title']), "id = '" . $objPage->id . "'");
    // Update page
    $db->update('page_implementations', array('content_1' => $_POST['content_1'], 'title_2' => $_POST['title_2'], 'content_2' => $_POST['content_2']), 'implementation_id = ' . $objPage->implementation_id);
    $g_objAdmin->addLog('update', 'page_implementations', $objPage->implementation_id);
    foreach ($_POST['specviewtype'] as $vt => $v) {
        $db->delete('specific_view_selections', "object_id = '" . $_GET['id'] . "' AND view_type = '" . $vt . "'");
        if ($v) {
            $db->insert('specific_view_selections', array('object_id' => $_GET['id'], 'view_type' => $vt, 'view_id' => $v));
        }
    }
    header('Location: ?id=' . $_POST['id']);
    exit;
}
tpl_header();
echo '<h1>Editing web page: ' . $objPage->title . '</h1>';
?>
<p><a href="properties.php?id=<?php 
echo $objPage->id;
?>
">Properties</a> | <a href="pages.php?id=<?php 
echo $objPage->id;
?>
">Child pages</a></p>
Example #9
0
<?php

require_once 'cfg_admin.php';
logincheck();
$g_objAdmin->checkEditSnippetAccess();
$objSnippet = AROImplementation::loadImplementationByID($_GET['id']);
$szSnippetFile = PROJECT_SNIPPETS . '/' . $objSnippet->implementation_id . '.php';
if (isset($_POST['id'], $_POST['title'], $_POST['content'], $_POST['content_type'])) {
    // Update implementation
    $db->update('implementations', "id = '" . addslashes($_POST['id']) . "', title = '" . addslashes($_POST['title']) . "'", "id = '" . addslashes($objSnippet->id) . "'");
    // Update snippet
    $db->update('snippet_implementations', 'modified_time = ' . time() . ', content_type = \'' . addslashes($_POST['content_type']) . '\'', 'implementation_id = ' . $objSnippet->implementation_id);
    // Update content
    file_put_contents($szSnippetFile, $_POST['content']);
    header('Location: edit.php?id=' . $objSnippet->id);
    exit;
}
tpl_header();
echo '<h1>Editing snippet: ' . $objSnippet->title . '</h1>';
include 'inc.tpl.form.php';
Example #10
0
	<div id="leftcol">
		<table border="0" width="100%" cellspacing="0">
<?php 
echo '<tr><th>Pages</th></tr>';
$arrImplementations = AROImplementation::finder()->findMany("type <> 'snippet' AND id NOT LIKE '%/%' ORDER BY id ASC");
foreach ($arrImplementations as $imp) {
    echo '<tr><td><a href="/admin/' . $imp->type . '/edit.php?id=' . $imp->id . '">' . $imp->id . '</a></td></tr>';
}
echo '<tr><th>(<a href="/admin/_view/sort.php">&gt;</a>) Templates (<a href="/admin/_view/add.php">+</a>)</th></tr>';
$arrViews = AROView::finder()->findMany('1 ORDER BY o ASC');
foreach ($arrViews as $view) {
    echo '<tr><td><a' . ($g_objAdmin->allowEditView() ? ' href="/admin/_view/edit.php?id=' . $view->id . '"' : '') . '>' . $view->title . '</a></td></tr>';
}
echo '<tr><th>Snippets (<a href="/admin/snippet/add.php">+</a>)</th></tr>';
$arrSnippets = AROImplementation::finder()->findMany("type = 'snippet' ORDER BY title ASC");
foreach ($arrSnippets as $snippet) {
    echo '<tr><td><a' . ($g_objAdmin->allowEditSnippet() ? ' href="/admin/snippet/edit.php?id=' . $snippet->id . '"' : '') . '>' . $snippet->id . '</a></td></tr>';
}
echo '<tr><th>File folders (<a href="/admin/filefolder/add.php">+</a>)</th></tr>';
foreach ($g_arrFileFolders as $f) {
    echo '<tr><td><a href="/admin/filefolder/edit.php?id=' . basename($f) . '">' . basename($f) . '</a></td></tr>';
}
?>
		</table>
	</div>

	<div id="rightcol">

		<div id="messages">
			<div class="successes"><div>This is not a success</div></div>
Example #11
0
        $args[0] = preg_replace('/\\$(\\d+)/', '%$1$s', $szTo);
        $g_szUseRequestUri = call_user_func_array('sprintf', $args);
        //echo $g_szUseRequestUri;
        if ($route->forward) {
            header('Location: ' . $g_szUseRequestUri);
            exit;
        } else {
            if ($route->use_new_path) {
                $g_szRequestUri = $g_szUseRequestUri;
            }
        }
        break;
    }
}
//echo '[['.$g_szUseRequestUri.']]';
$arrLoad = explode('/', trim($g_szUseRequestUri, '/'));
$szModuleID = array_shift($arrLoad);
/** dispatcher --> **/
try {
    $objImplementation = AROImplementation::loadImplementationByID($szModuleID, $arrLoad);
    $page = $objImplementation;
    $objImplementation->parse();
} catch (PageNotFoundException $ex) {
    exit('Page not found');
} catch (NoTemplateFoundException $ex) {
    exit('No template found for type(s) `' . implode('` or `', $ex->m_arrViewTypes) . '`.');
} catch (TemplateErrorException $ex) {
    exit('No template found.');
} catch (Exception $ex) {
    exit('Unknown error');
}
 public function getPage($f_id)
 {
     $p = AROImplementation::loadImplementationByID($this->id . '/' . $f_id);
     $p->init($this);
     return $p;
 }