GithubHelp home page GithubHelp logo

ikkez / fabulog Goto Github PK

View Code? Open in Web Editor NEW
63.0 63.0 22.0 2.63 MB

the new F3-powered awesome fabulous blog-ware

License: GNU General Public License v3.0

PHP 15.61% CSS 47.31% JavaScript 17.34% HTML 19.74%
blog fat-free-framework

fabulog's People

Contributors

ikkez avatar onionstand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fabulog's Issues

Trying to redirect to another controller...

In order to learn Fat-Free-Framework, I decided to start tweaking Fabulog to add support for Pages (I can share my code when I am done)

Here is what I did:

1 ) Created a new model "Page", new Admin views "page-list.html", "page_edit.html", "page_layout.html", and a new controller "Page". Obviously, these are tweaked copies of your Post versions.

2 ) I added the Page section in the admin menu

3 ) I changed the routing at follows:

             // view list
           $f3->route(array(
              'GET /',
               'GET /page/@page'
              ),'Controller\Post->getList');

        // view single

        // pages have priority: if the slug isn't found in page, we will call Post->getsingle
         $f3->route(array(
             'GET /@slug',
            'GET /p/@slug',
           ), 'Controller\Page->getSingle');


$f3->route(array(
    'GET /post/@id'
   ), 'Controller\Post->getSingle');

4 ) In my page not found handling, I added this:

			if ($this->resource->dry()){
				if (!isset($params['id'])) {

					$postcontroller= new Post();
					$postcontroller->getSingle($f3, $params);

/*
					$f3->route(array(
    			'GET /'. $params['slug'],
       ), 'Controller\Page->getSingle');
*/
				}
				else{
					$f3->error(404, 'Page not found');
				}
			}

But neither methods work...

I instead get a page without the post loaded.

I can simply redirect to /post/@slug

But I was hoping to avoid doing that...

Do you have any ideas?

Here are my thoughts:

1 ) I do not yet fully understand the resource, so it's quite possible that the resource is still trying to work with pages.

2 ) Perhaps it's not possible to route or call a new controller from within a controller without extra initialization?

postgres

From your demo , when changing to postgres DB and then going 'home' it throws a query issue, missing group thingy. I will dl the blog and play with it, and might find a fix if you don't etc. but just thought I'd mention:

Internal Server Error
PDOStatement: ERROR: subquery uses ungrouped column "fblg_posts.id" from outer query LINE 1: ...ved" = $1 ) and ( "fblg_comments__count"."post" = "fblg_post... ^
[fabulog/vendor/bcosca/fatfree-core/base.php:2261] Base->error()
[fabulog/vendor/bcosca/fatfree-core/db/sql.php:235] user_error()
[fabulog/vendor/bcosca/fatfree-core/db/sql/mapper.php:376] DB\SQL->exec()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:892] DB\SQL\Mapper->count()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:1311] DB\Cortex->filteredFind()
[fabulog/vendor/bcosca/fatfree-core/db/cursor.php:150] DB\Cortex->count()
[fabulog/app/controller/post.php:53] DB\Cursor->paginate()
[fabulog/vendor/bcosca/fatfree-core/base.php:1873] Controller\Post->getList()
[fabulog/vendor/bcosca/fatfree-core/base.php:1673] Base->call()
[fabulog/index.php:71] Base->run()
(1.3ms) SELECT "id","username","name","password","mail" FROM "fblg_user" WHERE "id" = 1
(16.8ms) SELECT C.COLUMN_NAME AS field,C.DATA_TYPE AS type,C.COLUMN_DEFAULT AS defval,C.IS_NULLABLE AS nullable,T.CONSTRAINT_TYPE AS pkey FROM INFORMATION_SCHEMA.COLUMNS AS C LEFT OUTER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS K ON C.TABLE_NAME=K.TABLE_NAME AND C.COLUMN_NAME=K.COLUMN_NAME AND C.TABLE_SCHEMA=K.TABLE_SCHEMA AND C.TABLE_CATALOG=K.TABLE_CATALOG LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS T ON K.TABLE_NAME=T.TABLE_NAME AND K.CONSTRAINT_NAME=T.CONSTRAINT_NAME AND K.TABLE_SCHEMA=T.TABLE_SCHEMA AND K.TABLE_CATALOG=T.TABLE_CATALOG WHERE C.TABLE_NAME='fblg_tags' AND C.TABLE_CATALOG='fatfree'
(1.7ms) SELECT "id","title","slug",((select count("fblg_posts__tags_mm_fblg_tags__post"."tags") from "fblg_posts__tags_mm_fblg_tags__post" LEFT JOIN "fblg_posts" ON "fblg_posts__tags_mm_fblg_tags__post"."post" = "fblg_posts"."id" where ("fblg_posts__tags_mm_fblg_tags__post"."tags" = "fblg_tags"."id") AND ("fblg_posts"."published" = true and "fblg_posts"."publish_date" <= '2022-08-19') group by "fblg_posts__tags_mm_fblg_tags__post"."tags")) AS "count_post" FROM "fblg_tags" WHERE 1=1 ORDER BY "count_post" DESC NULLS LAST
(0.6ms) SELECT ((select count("fblg_comments__count"."id") from "fblg_comments" AS "fblg_comments__count" where ( "fblg_comments__count"."approved" = 1 ) and ( "fblg_comments__count"."post" = "fblg_posts"."id" ) group by "fblg_comments__count"."post")) AS "count_comments",COUNT(*) AS "_rows" FROM "fblg_posts" WHERE "publish_date" <= '2022-08-19' and "published" = true

Should check csrf in forms?

Someone told me that forms should add token to avoid csrf attack. Then I read the fatfree documentation, the Session class has a csrf method to get the token.
But how to get the token?
`
$s = new Session();

echo $s->csrf(); //false returned
`
Then I look into fabulog to get help, I find that it doesn't check this.
Is csrf check needed?
Thanks.

Admin user can be deleted

I accidentally deleted admin user and now unable to log in admin panel. You should not allow to delete admin user.

empty Text causes error

nabend ikkez,
bin durch zufall auf dein fabulog gekommen, echt schick, gute arbeit (:
hab leider beim testen folgendes gefunden:

  • leerer treaser text beim (add, edit) verursacht fehler
  • leerer body text beim (add, edit) verursacht fehler

mfg stefano

Demo is throwing error

http://ikkez.de/fabulog/
Internal Server Error
Invalid query: unbalanced brackets found
Then in a black box in red writing (almost unreadable)
[fabulog/vendor/bcosca/fatfree-core/base.php:2178] Base->error()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:2481] trigger_error()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:2250] DB\CortexQueryParser->_mongo_parse_logical_op()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:751] DB\CortexQueryParser->prepareFilter()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:609] DB\Cortex->filteredFind()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:1718] DB\Cortex->find()
[fabulog/vendor/ikkez/f3-cortex/lib/db/cortex.php:619] DB\Cortex->get()
[fabulog/app/controller/tag.php:39] DB\Cortex->find()
[fabulog/app/controller/post.php:47] Controller\Tag->tagCloud()
[fabulog/vendor/bcosca/fatfree-core/base.php:1791] call_user_func_array()
[fabulog/vendor/bcosca/fatfree-core/base.php:1612] Base->call()
[fabulog/index.php:70] Base->run()

What's wrong in repeat loop?

When I tried to make page selected it show me error Object of class Model\Page could not be converted to int

This is code in page_edit.htm

         <select name="parent_id" class="form-control">
                    <F3:repeat group="{{ @parents }}" value="{{ @item }}">
                         <option value="{{@item.id}}" {{(@item.id == @content.parent_id)?'selected':''}}>{{@item.title}}</option>
                    </F3:repeat>
               </select>

and here is controller code

  $this->response->data['content'] = $this->resource;
  $this->response->data['parents'] =   array(
                        array( "id"=>1, "title" => "About Us"),
                        array( "id"=>2, "title" => "Contact Us"),
                    );

How to run custom query like db->exec() in a controller?

Hi,

I'm trying to develop a dropdown list of published pages when creating a new page. I just want to assign a parent page for each page. How can I show a list of all published pages excluding the current page and assign it to the current page(like an about us, contact us page under about page)?

When I write this code it show error in page_edit.htm
Internal Server Error
Object of class Model\Page could not be converted to string

        $parent = new \Model\Page();
        $parent->filter('page',array('published = ? and publish_date <= ?', true, date('Y-m-d')));
        $parent->countRel('page');
        $this->response->data['parents'] = $parent->find(null,array('order'=>'title asc'));;
        $f3->set('parents',$this->resource->exec("SELECT title FROM fblg_pages where id!='".$params['id']."' and published=1 order by title asc"));

When I tried this code

   $f3->set('parents',$this->resource->exec("SELECT title FROM fblg_pages where id!='".$params['id']."' and published=1 order by title asc"));

It show me error- Fatal error: Call to undefined method Model\Page::exec()

How can I call exec in a controller?

db using

why for comments u use
$comment = new \Model\Comment();
if ($comment->addToPost($this->resource->_id)) {
and after in model use cortex foreach.

but in resource script u use cortex foreach from controller. what is the right way of editing db? with set_ in model or with side function in model that used by controller?
sorry for my english :)

Logical Error in User Model

When you update user information and don't put anything in the Password field maybe coz you want it to remain the same it blanks out the user's password. Developed a custom fix to circumvent this, it can be found here. The affected file is user.php

about comment

from admin/comment/edit/ID can't render the database

related content

I offer to add this functionality similar/related content by tags/keywords.

echo in both controller->afterroute and view->render

Hello,

it's not really a problem as everything works wonder, but I wonder why there is an echo in both the controllers->afterroute (which invokes view->render) and the views->render themselves (which return nothing, so the echo in the controller doesn't look useful).

The code does this:

in Controller->afterroute:
echo $this->response->render();

in View->render()
echo \Template::instance()->render($this->template);
(returns nothing)

Is this a safeguard for custom Views?
Best whishes.

does not work with MySQL

I switched database type in admin area to MySQL, but only half of post is visible. What I shoud to config yet?
23 01 17 03-39-00

Dynamic meta info in header section

The title and description in the header area are currently all identical, how do I make it to load from the variable value I set in each controller? I've tried to set the variable in each controller but the layout.html always loads first than the other page.

Fatal error when page does not exits

When I tried to open an url which does not exists(e.g. http://localhost/fabulog-master/admin/page), it shows me following error

Fatal error: Call to a member function setView() on a non-object
[C:/xampp/htdocs/fabulog-master/app/controller/backend.php:19]

while it should show the user that page does not exists. Why you are showing programming error?

Update?

The project is not up to date, are you going to make a new update?

In php7.2 bug

PHP 7.2: session_cache_limiter(): Cannot change cache limiter when session is active

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.