mirror of
https://github.com/jimeh/zynapse.git
synced 2026-02-19 07:06:39 +00:00
Initial import of old legacy Zynapse Framework,
untouched since early 2008.
This commit is contained in:
16
app/controllers/admin/admin_controller.php
Normal file
16
app/controllers/admin/admin_controller.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
|
||||
class AdminController extends ApplicationController {
|
||||
|
||||
function index () {
|
||||
echo ' controller called ';
|
||||
}
|
||||
|
||||
function view () {
|
||||
$this->render_layout = false;
|
||||
echo ' controller called ';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
8
app/controllers/application.php
Normal file
8
app/controllers/application.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ApplicationController extends ActionController {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
65
app/controllers/page_controller.php
Normal file
65
app/controllers/page_controller.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
|
||||
class PageController extends ApplicationController {
|
||||
|
||||
|
||||
|
||||
function index ($vars) {
|
||||
// page view count
|
||||
if ( isset($_REQUEST['kill']) ) {
|
||||
unset($_SESSION['views']);
|
||||
$this->redirect_to('back');
|
||||
}
|
||||
|
||||
@$_SESSION['views']++;
|
||||
$this->views = $_SESSION['views'];
|
||||
|
||||
// new Page object experiments
|
||||
// $newpage = new Page();
|
||||
// $newpage->id = 8;
|
||||
// $newpage->title = 'anything else';
|
||||
// $newpage->body = '...maybe not...';
|
||||
// $newpage->get_association('person');
|
||||
// $newpage->error_title = 'error message'; // define errors
|
||||
// print_r($newpage);
|
||||
// $newpage->save();
|
||||
// echo $newpage->build_update_query($newpage)."\n<br />";
|
||||
|
||||
// $newpage->delete_all('`id` > 11');
|
||||
|
||||
|
||||
// get page list
|
||||
$page = new Page();
|
||||
$this->columns = $page->_columns;
|
||||
$this->pages = $page->find_all();
|
||||
|
||||
|
||||
// App::$prefs->yay = 'hello';
|
||||
// unset(App::$prefs->yay);
|
||||
// App::$prefs->save();
|
||||
// print_r(Znap::$prefs);
|
||||
|
||||
// print_r($this->page);
|
||||
// print_r(Page::$table_info);
|
||||
// print_r($this->page->_columns);
|
||||
}
|
||||
|
||||
|
||||
function view () {
|
||||
if ( isset($_REQUEST['id']) ) {
|
||||
$page = new Page();
|
||||
$this->columns = $page->_columns;
|
||||
$this->page = $page->find($_REQUEST['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function edit () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
11
app/controllers/snippet_testing_controller.php
Normal file
11
app/controllers/snippet_testing_controller.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
class SnippetTestingController extends ApplicationController {
|
||||
|
||||
function index () {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
5
app/helpers/application_helper.php
Normal file
5
app/helpers/application_helper.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
?>
|
||||
5
app/helpers/snippet_helpers/snippets_helper.php
Normal file
5
app/helpers/snippet_helpers/snippets_helper.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
?>
|
||||
4
app/helpers/snippet_helpers/test_helper.php
Normal file
4
app/helpers/snippet_helpers/test_helper.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
# Anything added to this helper will be available to all views in the TestSnippet.
|
||||
|
||||
?>
|
||||
4
app/helpers/snippet_testing_helper.php
Normal file
4
app/helpers/snippet_testing_helper.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
# Anything added to this helper will be available to all views in the SnippetTestingController.
|
||||
|
||||
?>
|
||||
9
app/models/category.php
Normal file
9
app/models/category.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
class Category extends ActiveRecord {
|
||||
|
||||
public $has_and_belongs_to_many = 'pages';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
10
app/models/comment.php
Normal file
10
app/models/comment.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Comment extends ActiveRecord {
|
||||
|
||||
public $belongs_to = 'page';
|
||||
public $counter_cache = true;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
41
app/models/page.php
Normal file
41
app/models/page.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class Page extends ActiveRecord {
|
||||
|
||||
public $has_many = 'comments';
|
||||
public $has_and_belongs_to_many = 'categories';
|
||||
|
||||
|
||||
|
||||
// public $has_many = array(
|
||||
// 'comments' => array(
|
||||
// 'class_name' => 'Comment',
|
||||
// 'foreign_key' => 'page_id',
|
||||
// 'conditions' => array('is_public' => 1),
|
||||
// ),
|
||||
// );
|
||||
|
||||
|
||||
// public $table_name = 'whatever';
|
||||
// public $primary_key = 'id';
|
||||
|
||||
|
||||
// public $type = 'mysql';
|
||||
// public $host = 'db.domain.com';
|
||||
// public $database = 'librarious_db';
|
||||
// public $username = 'root';
|
||||
// public $password = '';
|
||||
// public $persistent = false;
|
||||
// public $table_prefix = 'znap_';
|
||||
// public $table_name = 'collection';
|
||||
|
||||
|
||||
function validate_title () {
|
||||
if ( $this->title == '' ) {
|
||||
$this->error_title = 'Title can not be empty.';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
31
app/preferences/_internals.prefs.php
Normal file
31
app/preferences/_internals.prefs.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Zynapse Preference Class
|
||||
|
||||
This class is used to store preferences, it is humanly editable
|
||||
and requires no overhead processing to be loaded.
|
||||
|
||||
*/
|
||||
|
||||
class _internals_preferences extends PreferenceContainer {
|
||||
|
||||
public $js_url;
|
||||
public $js_libs_url;
|
||||
public $js_libs;
|
||||
public $js_charset;
|
||||
|
||||
function __construct () {
|
||||
parent::__construct();
|
||||
|
||||
$this->js_url = "/javascripts";
|
||||
$this->js_libs_url = "/javascripts/libs";
|
||||
$this->js_libs = array(
|
||||
'jquery' => "jquery-1.2.1.pack.js",
|
||||
);
|
||||
$this->js_charset = "utf-8";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
23
app/preferences/application.prefs.php
Normal file
23
app/preferences/application.prefs.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Zynapse Preference Class
|
||||
|
||||
This class is used to store preferences, it is humanly editable
|
||||
and requires no overhead processing to be loaded.
|
||||
|
||||
*/
|
||||
|
||||
class application_preferences extends PreferenceContainer {
|
||||
|
||||
public $language;
|
||||
|
||||
function __construct () {
|
||||
parent::__construct();
|
||||
|
||||
$this->language = "english";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
8
app/snippets/snippets.php
Normal file
8
app/snippets/snippets.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Snippets extends SnippetController {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
16
app/snippets/test_snippet.php
Normal file
16
app/snippets/test_snippet.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class TestSnippet extends Snippets {
|
||||
|
||||
function index () {
|
||||
$this->message = 'hello world';
|
||||
}
|
||||
|
||||
function wiiee () {
|
||||
$this->message = 'helppppp';
|
||||
$this->render_action = 'index';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
0
app/views-wap/__layouts/.emptydir
Normal file
0
app/views-wap/__layouts/.emptydir
Normal file
0
app/views-wap/__snippets/.emptydir
Normal file
0
app/views-wap/__snippets/.emptydir
Normal file
3
app/views/__layouts/_navpane.phtml
Normal file
3
app/views/__layouts/_navpane.phtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<div id="navpane" style="border: 1px solid">
|
||||
navpane here
|
||||
</div>
|
||||
31
app/views/__layouts/application.phtml
Normal file
31
app/views/__layouts/application.phtml
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo App::$strings['_ZNAP_LANG']; ?>" lang="<?php echo App::$strings['_ZNAP_LANG']; ?>">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo App::$strings['_ZNAP_ENCODING']; ?>"/>
|
||||
|
||||
<title>application</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php render_partial('navpane'); ?>
|
||||
|
||||
<?php if(Session::isset_flash('error')): ?>
|
||||
<div style="color: red;"><?php echo Session::flash('error') ?></div>
|
||||
<?php elseif(Session::isset_flash('notice')): ?>
|
||||
<div style="color: green;"><?php echo Session::flash('notice') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $content_for_layout; ?>
|
||||
|
||||
<?php if (Timer::$started): ?>
|
||||
<div id="timer">
|
||||
<?php echo Timer::end(5);?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
34
app/views/__layouts/page.phtml
Normal file
34
app/views/__layouts/page.phtml
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo App::$strings['_ZNAP_LANG']; ?>" lang="<?php echo App::$strings['_ZNAP_LANG']; ?>">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo App::$strings['_ZNAP_ENCODING']; ?>"/>
|
||||
|
||||
<title>page</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php render_partial('navpane'); ?>
|
||||
|
||||
<?php if(Session::isset_flash('error')): ?>
|
||||
<div style="color: red;"><?php echo Session::flash('error') ?></div>
|
||||
<?php elseif(Session::isset_flash('notice')): ?>
|
||||
<div style="color: green;"><?php echo Session::flash('notice') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $content_for_layout; ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<?php if (Timer::$started): ?>
|
||||
<?php echo Timer::end(5); ?>
|
||||
<?php endif; ?>
|
||||
<pre>
|
||||
<?php print_r(ActiveRecord::$query_log); ?>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1
app/views/__snippets/__layouts/snippets.phtml
Normal file
1
app/views/__snippets/__layouts/snippets.phtml
Normal file
@@ -0,0 +1 @@
|
||||
<?php echo $content_for_layout; ?>
|
||||
1
app/views/__snippets/test/index.phtml
Normal file
1
app/views/__snippets/test/index.phtml
Normal file
@@ -0,0 +1 @@
|
||||
<?php echo $message ?> :)
|
||||
0
app/views/_admin/admin/index.phtml
Normal file
0
app/views/_admin/admin/index.phtml
Normal file
0
app/views/_admin/admin/view.phtml
Normal file
0
app/views/_admin/admin/view.phtml
Normal file
5
app/views/page/_comment.phtml
Normal file
5
app/views/page/_comment.phtml
Normal file
@@ -0,0 +1,5 @@
|
||||
<div style="comment">
|
||||
<?php echo $comment['body']; ?><br />
|
||||
<h6 style="margin: 0px;"> — <?php echo $comment['name']?> <?php if (!empty($comment['email'])) echo '('.$comment['email'].')'; ?></h6>
|
||||
</div>
|
||||
<hr />
|
||||
9
app/views/page/_page_list_item.phtml
Normal file
9
app/views/page/_page_list_item.phtml
Normal file
@@ -0,0 +1,9 @@
|
||||
<tr>
|
||||
<?php foreach ($page_list_item as $key => $value): ?>
|
||||
<?php if ($key == 'title'): ?>
|
||||
<td><a href="/page/<?php echo $page_list_item['id']?>"><?php echo $value; ?></td>
|
||||
<?php else: ?>
|
||||
<td><?php echo $value; ?></td>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
16
app/views/page/index.phtml
Normal file
16
app/views/page/index.phtml
Normal file
@@ -0,0 +1,16 @@
|
||||
hello world!<br />
|
||||
<br />
|
||||
you've seen this page <?php echo $views ?> time<?php if ($views > 1) echo 's'; ?>. <a href="?kill=yes">reset</a>
|
||||
|
||||
|
||||
<?php if ( isset($pages) && count($pages) ): ?>
|
||||
<table border="1" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<?php foreach ($columns as $column => $col_info): ?>
|
||||
<th><?php echo $col_info['HumanName']; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php render_partial('page_list_item', $pages); ?>
|
||||
</table>
|
||||
|
||||
<?php endif; ?>
|
||||
28
app/views/page/view.phtml
Normal file
28
app/views/page/view.phtml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php if (isset($page)): ?>
|
||||
<?php foreach ($page as $key => $value): if (array_key_exists($key, $columns)): ?>
|
||||
<b><?php echo $key; ?>:</b> <?php echo $value; ?><br />
|
||||
<?php endif; endforeach; ?>
|
||||
<?php if ( $page->categories ): ?>
|
||||
<b>Categories:</b> <?php
|
||||
$cats = array();
|
||||
foreach ($page->categories as $category) {
|
||||
$cats[] = $category['name'];
|
||||
}
|
||||
echo implode(', ', $cats);
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<b>Comments:</b><br />
|
||||
<hr />
|
||||
<?php if ( $page->comments ): ?>
|
||||
<?php render_partial('comment', $page->comments); ?>
|
||||
<?php else: ?>
|
||||
- No Comments -<br />
|
||||
<hr />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else: ?>
|
||||
The page you're trying to view doesn't exist.
|
||||
<?php endif; ?>
|
||||
4
app/views/snippet_testing/index.phtml
Normal file
4
app/views/snippet_testing/index.phtml
Normal file
@@ -0,0 +1,4 @@
|
||||
testing a snippet here:
|
||||
<div id="snippet">
|
||||
<?php render_snippet('test') ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user