Just like Fortron said smile

Here's a short example that will allow your plugin to set an error:

// Set error for Wolf CMS backend to use when calling a view using display()
Flash::setNow('error', __('My cute error'));

// Set the error when not using display() but redirect() for example
Flash::set('error', __('My cute error'));

// Set a success message when not using display() but redirect() for example
Flash::set('success', __('You are soooo cute... you were successful.'));

Wolf backend will handle the rest. smile

2

(42 replies, posted in Wolf Core Plugins)

kirk wrote:

Thank you Martijn,
I will be exploring your idea as it's a better solution than mine :-)

You're welcome. There are probably better ways too. smile

kirk wrote:

The problem is: the URI solution will work when the user select a language or switch between languages.  How do I handle the automatic "redirect"?
I'm thinking to use cookies to do this, basically when an user access the website check if cookie are set up, in case no cookie is found the user is redirected to the language based on the HTTP of his browser and set the cookie.

What are your thought on this? Would you go down the cookie path or there are better way to achieve this?

If you want users to be able to dynamically select their language based on the flag they click for example (which sounds like your plan), then the cookie way is just about the only way.

When no cookie is set, you'll have to either assume the default language of the site or determine the desired language some other way like you said.

Once the user makes a selection (or you did it for them), a cookie should be set that's checked and acted upon every time the user wants to view a page. This last part can be achieves by using the Observer system and watching for the page_found event.

kirk wrote:

On another note, as if this was not complicated enough.
How would you handle different domains ie mysite.com, mysite.nl, mysite.it etc etc
Let's say, ideally situation would be to be able to use all domains from a single installation.

I would probably change config.php to dynamically determine the URL_PUBLIC:

// The full URL of your Wolf CMS install
define('URL_PUBLIC', 'http://'.substr(dirname($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']), 0, strrpos(dirname($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']), '/wolf')).'/');

HOWEVER, its important that only domain names belonging to your site resolve to that site. In this sort of setup Wolf CMS would accept just about any domain name for its site.

3

(4 replies, posted in Wolf Core)

Welcome to the forum Alessio. smile

alessiograziani wrote:

I try to pose the question in another way. Is there a way to use the model Page outside the WolfCMS container? I'd like to use it in a php page that is running outside WolfCMS container?

No. The Page model depends on the Record class which is available in Framework.php... In essence you'd be loading a big part of Wolf CMS anyway.

You might get it to work, but you'll get no support with regards to bugs, etc. in that configuration. For obvious reasons. (I hope they're obvious anyway) smile

Anyway, in response to your original post...

Wolf CMS tries its best to let you do whatever you want in terms of design, html, css, etc... I've seen your site (very nice design smile ) and I believe its not very difficult to convert to Wolf CMS. As for your custom DB for your images... A model is very easily made in Wolf CMS and a plugin is also very easy (and low-effort) to make.

I'd probably write a simplistic plugin that provides a new model accessing the custom DB.

In any case, using Wolf CMS to host your site and include the custom DB is a lot less work than adapting or extracting parts of the functionality of Wolf CMS and insert them into an existing site. (which is what you're trying to do I believe?)

See the wiki and phpdocs for more details on Wolf's innards:

www.wolfcms.org/wiki/
www.wolfcms.org/phpdoc/

4

(42 replies, posted in Wolf Core Plugins)

@kirk,

If you're using the setup where the language is part of the URI ("uri" option in the plugin) , you can do it in a similar way as the Multiple Languages plugin itself does it. The plugin fist calls replaceUri() and then replaceContentByUri() based on events.

The first function determines what the requested language is based on the keys of the SettingController::$iso_639_1 array. It stores that in a GLOBAL variable called $urilang. That variable is used by the second function to actually replace the content.

You could use a similar tactic and reuse the $urilang variable which I believe should be available already by the time your menu code is executed. Translated page names could be stored in page parts called "fr_title", "nl_title" etc... your code can then replace the title by $urilang.'_title'...

If you, for example, want to use the browser preferences ("header" option in the plugin) to determine the language, you can just call:

        use_helper('I18n');
        $found = false;

        foreach (I18n::getPreferredLanguages() as $lang) {
            if ( Setting::get('language') == $lang) { break; }

            if ( your language specific part exists based on $lang ) {
                // do your thing
                $found = true;
            }

            if ($found) break;
        }

5

(2 replies, posted in General)

Undefined index means you made a coding mistake... most likely you are trying to use a field of an array that does not exist because it wasn't added or POSTed for example.

If you want to query an existing table like for example the "user" table, you can either use the model class itself (in this case "User") or the more generic Record class.

Example when using User:

$user = User::findById(1);
$user->name = "Some new name";
$user->save();

Example when using Record:

$user = Record::findByIdFrom('User', 1);
$user->name = "Some new name";
$user->save();

// Or even more directly...

$data = array(
    'name' => 'some name',
    'email' => 'some@some.com',
    'username' => 'someone',
    'language' => 'en',
    'created_on' => '2012-01-30 15:15:01',
    'updated_on' => '2012-01-30 15:15:01',
    'created_by_id' => '1',
    'updated_by_id' => '1'
);

Record::insert('User', $data);

When dealing with Wolf CMS core tables, its best to use their model classes (like "User"). When you have custom tables, its best to create a model class for them first. When you have one-off interactions with random tables, its probably best to use straight PDO at the moment.

Also see:

http://www.wolfcms.org/phpdoc/latest/
http://www.wolfcms.org/phpdoc/latest/Fr … tml#insert
http://www.wolfcms.org/phpdoc/latest/Fr … tml#update
http://www.wolfcms.org/phpdoc/latest/Fr … tml#delete

6

(2 replies, posted in The Pub)

djgprv wrote:

I suggest to remove security.php file and change default admin url.

Good advice, but I would also read the advices given by the security.php file first... The advice on removing write permissions for example... (assuming you're done with development of the site)

Good looking site though smile

Thanks for the remarks concerning the issues. I'll make sure those work. I'm reworking the plugin anyway since its not very stable in its current form.

8

(42 replies, posted in Wolf Core Plugins)

kirk wrote:
mvdkleijn wrote:

4) The multiple languages plugin does not affect the menu in any way.

Hi Martijn,
is there an easy way to have the menu also translated?

Through the plugin? Currently no... since the menu systems on sites are built by the designer themselves and not by Wolf CMS, I've not provided for any functionality for that.

Why? Got an idea on how to do it?

9

(12 replies, posted in General)

So in effect you're adding four lines for touch events using the new library? And modding the library to make it work?

10

(3 replies, posted in General)

tepad.no wrote:

I am just wondering what causes the problem? Is it Wolf or hosting provider?

That's definitely the hosting provider... they're trying to "protect" their clients by resetting various files automatically to 644. Unfortunately they're doing that with "chmod 644 file.php" instead of (for example) "chmod o-w file.php"

You have three options in order or best choice (in my opinion):

- Talk to your hosting provider to see if they would consider using o-w (for example) instead of hard forcing it to 644

- comment our the security check in index.php (easy enough to find)

- turn on DEBUG like fortron said.

The reason I put DEBUG in the last place is because it could potentially display sensitive information or even just errors in your frontend if something goes wrong. It's "DEBUG" after all.

11

(8 replies, posted in The Pub)

djgprv wrote:

Thanks guys,

zielperson wrote:

I also had a nice chuckle about the name. Great marketing.

unfortunately not my idea

Can't have everything I guess. tongue Good looking site though.

One remark though: I was half expecting to be able to click on the round icons since they have a hover effect. Not sure if you should do something with that, but you could direct people to a page with some info on that subject for example.

12

(2 replies, posted in The Pub)

Welcome indeed. smile We hope to improve Wolf CMS even further in the future while sticking to its core ideals that led us so far.

Not a bad idea in my opinion. smile

As for "is it possible?":

Yes. The theme switcher is very easy to do in a plugin. The most basic version would be something like: you just use the Observer system to listen for the page_found event. Then you'd use the given $page object to replace the page's normally set Layout by the seasonal one.

One thing that might become difficult with the above is when some pages don't inherit the parent's Layout but use a custom Layout geared towards the page's content. Though I'm sure there are ways to handle that cleanly too... perhaps allow the user to setup a mapping of some sort... Normal Layout A belongs to Seasonal A1, A2, A3 and A4. Then when Normal Layout A is detected at page_found event, you'd select one of the seasonal's that was mapped to it.

The seasonal article picker could be as simple as writing a function that retrieves all articles tagged with a particular tag and randomly selecting one using PHP's random functions. Quite easy I believe.

14

(12 replies, posted in General)

David wrote:
mvdkleijn wrote:

Apple stuff I can't test at all since I don't have iPad, iPhone and the like. smile

Although accepting donations of test rigs, I assume? big_smile

Lol... I won't say no. smile (I am a gadget lover after all...)

15

(12 replies, posted in General)

I doubt upgrading Wolf CMS will help with your problem (though its never a bad idea to upgrade), the interface is based on HTML + JQuery + nestedSortable. The most likely culprit here is nestedSortable and/or JQuery since those are the generic components that handle user input in this case. It could also be in the bits of JS that was written specifically for Wolf CMS. We've not really tested the backend on mobile platforms like smartphones though.

Apple stuff I can't test at all since I don't have iPad, iPhone and the like. smile

16

(7 replies, posted in Showcase)

zielperson wrote:

WolfCMS saved the day.

Woohoo! wink

17

(7 replies, posted in Showcase)

zielperson wrote:

Backup / restore - moving to a new server

The plugin "backup/restore" is great, but e I ran into a few problems.

--> Thank god I still had my wolfCMS download. I needed 0.75, using 0.75-SP1 killed the site. Maybe an archive is needed?

Can you specify this a little more? SP1 is the same as 0.7.5 except for its adding some CSRF checks. How exactly did SP1 "kill your site"? I don't think it should...

An archive is actually available, we've just not linked to it. Oversight on our part, sorry.

zielperson wrote:

Here is what happened
- A few pages were set to "Archived"
- All pages got the field "valid until" filled out with "00-00-00 and 00:00" which made the pages invalid and they would not show up.

I'll have to take a look at that...

18

(12 replies, posted in General)

Definitely advisable to upgrade to the latest version. What kind of browser is on an iPad? The drag-n-drop interface of the Pages tab is JS based, so if it doesn't work, its most likely a browser (version) issue.

Check if there's a space at the beginning of your file or something.

In any case, I've been contracted to fix and improve the Newsletter plugin and will be releasing it shortly.

20

(2 replies, posted in The Pub)

creativemeans wrote:

Then again, I may be going at this the wrong way - is there a multiple user extension in the works which would basically allow for the same notion?

Depends on what you need it for exactly? I guess you want some sort of "profile" page?

The Account plugin is something that is intended to provide a "My Account" like page that can be expanded by developers of other plugins. I'm planning to expand it with a "public profile" page in the near future. (just waiting on the completion of the new design for my private site)

21

(6 replies, posted in General)

tikky wrote:

Did you have other users in the Wolf CMS system apart from "admin"?

Yes, but only admin password was hacked.

I've changed passwords, admin users name, etc.

BTW: Is there any way to disable user (without deleting)?

I would not say your admin password was hacked. It was changed yes, but anyone that is able to add a htaccess file to your site can add any file, including PHP files (and later delete them) to allow them to run commands, change DB stuff etc...

I'm always interested in getting as much information about the avenues of attack that are used so I can try and close them. Either by improving Wolf CMS source code or by adding (for example) security advice to the security.php checker.

There is no way to disable a user as such. However, you could remove all roles from the user which will cause the user to lose backend access and change the user's password so they can't login anymore.

22

(6 replies, posted in General)

A very important precaution comes to mind:

Do not use FileZilla (or other similar ftp tool) to transfer your files to your machine because it stores your password clear text on your system.

A well known vector of attack that is used is for a trojan / keylogger virus to hit your PC which then reports your ftp password to the attacker.

Also: if you do not use a plugin, uninstall it from your system.

Good security consists of minimizing risks and adding layers of security.

Question: are you on a shared hosting platform? Did you manage to see the content of the htaccess file? What effect did the changes have on your site? Did you have other users in the Wolf CMS system apart from "admin"?

You really should've created a separate topic for this... so I split it off from the old topic.

To get to your question, what does the plugin do?

A: It automatically detects the language that is preferred by the user, using standard methods, and then automatically replaces a page's content with the content in the user's desired language if a translation was found.

So it does not... translate page names when translations are stored as parts, translate slugs or change the UI you built using a Layout.

If you choose to store translations using the "translations as page copy" option, it DOES allow translating page names. (only slugs remain untranslated)

So if you store translations as copies, it can also translate your menu if you built your menu in the correct manner.

24

(2 replies, posted in General)

We all bang our heads at nothing occasionally. smile

25

(6 replies, posted in Showcase)

craig wrote:

Hehe yes, I did mean the responsive layout type, in that it scales to the device being viewed on. I'm using a framework grid, but I think it could do with additional tweaks that make more sense on a handset - such as stacking the main nav items vertically, for example.

Ah yes, right... smile sorry, my head tends to focus towards development terminology instead of design terminology.