[ABD] Advertisement Management

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
Locked
Badhon_raj
Registered User
Posts: 142
Joined: Wed Jan 04, 2012 6:33 pm

[ABD] Advertisement Management

Post by Badhon_raj » Wed Oct 12, 2016 8:59 pm

This is my first attempt at developing an extension for phpBB.
I built this according to my client requirements since other extensions out there doesn't work as he needed.

I don't have much prior knowledge on phpBB extension or MOD development.
so there might errors or I may have done things wrong way.

So please take a look at your spare times and provide feedback.
Some review will really help :).
I've original built this for metro theme. But it should work just as fine with prosilve (Except the sidebar event)
If you want to add a new position for ad or any code, then you'll need to know the template event name for that position. And then upload event_name.html file to /ext/orthohin/adman/styles/prosilver/template/event directory.
The file must contain {EVENT_NAME} in it.

I initially wanted not to use the html files for triggering template events. But it seems phpBB has no way other than that.
Let me know if there's any workaround.

Thanks all.

Extension Name: Advertisement Management
Author: badhon_raj

Extension Description: Manage Advertise code or other tracking codes
Extension Version: 1.0.0

Screenshots: Screenshots for the extension

Image
Image
Image

Extension Download: https://github.com/orthohincom/phpbb-adman

User avatar
Ger
Recognised Extension Developer
Posts: 1593
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: [DEV] Advertisement Management

Post by Ger » Thu Oct 13, 2016 1:57 pm

Nice extension. I actually was thinking of creating something like this when my cmBB extension would be in RC phase. :)

Unfortunately, I get an error when I try to add or edit an adertisement:

Code: Select all

General Error
SQL ERROR [ mysqli ]

Incorrect integer value: 'LOG_ADMAN_EDIT' for column 'user_id' at row 1 [1366]

SQL

INSERT INTO phpbb_log (user_id, log_ip, log_time, log_operation, log_type, log_data) VALUES ('LOG_ADMAN_EDIT', 'overall_header_body_before', 1476366892, NULL, 0, '')

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 999
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/log/log.php
LINE: 317
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/ext/orthohin/adman/acp/main_module.php
LINE: 244
CALL: phpbb\log\log->add()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: orthohin\adman\acp\main_module->main()

FILE: [ROOT]/adm/index.php
LINE: 81
CALL: p_master->load_active()
The advertisement is stored correctly, it's just the logging that throws an error. Could this be 3.2 related?

Also: I'm having trouble getting this to work on template events that I have defined in my cmBB extention. For instance, i have this event:

Code: Select all

<!-- EVENT ger_cmbb_main_menu_prepend -->
What is the correct way to add an advertisement here?
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
RomaamoR
Registered User
Posts: 119
Joined: Tue Feb 24, 2015 4:45 pm
Contact:

Re: [DEV] Advertisement Management

Post by RomaamoR » Thu Oct 13, 2016 2:51 pm

Unfortunately, I get an error when I try to add or edit an adertisement:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/log/log.php on line 219: Missing argument 4 for phpbb/log/log::add(), called in [ROOT]/ext/orthohin/adman/acp/main_module.php on line 244 and defined

Code: Select all

Общая ошибка
SQL ERROR [ mysqli ]

Incorrect integer value: 'LOG_ADMAN_EDIT' for column 'user_id' at row 1 [1366]

SQL

INSERT INTO phpbbga_log (user_id, log_ip, log_time, log_operation, log_type, log_data) VALUES ('LOG_ADMAN_EDIT', 'sidebar_top', 1476370038, NULL, 0, '')

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 855
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/log/log.php
LINE: 314
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/ext/orthohin/adman/acp/main_module.php
LINE: 244
CALL: phpbb\log\log->add()

FILE: [ROOT]/includes/functions_module.php
LINE: 674
CALL: orthohin\adman\acp\main_module->main()

FILE: [ROOT]/adm/index.php
LINE: 81
CALL: p_master->load_active()

Badhon_raj
Registered User
Posts: 142
Joined: Wed Jan 04, 2012 6:33 pm

Re: [DEV] Advertisement Management

Post by Badhon_raj » Thu Oct 13, 2016 4:08 pm

Ger wrote:Nice extension. I actually was thinking of creating something like this when my cmBB extension would be in RC phase. :)
Thanks :)
I actually studied your cmbb extension along with the acme-demo to learn things.
Ger wrote:Unfortunately, I get an error when I try to add or edit an adertisement:

The advertisement is stored correctly, it's just the logging that throws an error. Could this be 3.2 related?
RomaamoR wrote:Unfortunately, I get an error when I try to add or edit an adertisement:
This is due to a last minute change of add_log() to $phpbb_log->add()
I originally used add_log() but it showed a warning and suggested to use $phpbb_log>add() instead when I tested the code in EVP tester.
I didn't test the plugin after changing it. I can't seem to find documentation of $phpb_log class at the moment.
So reverted back to add_log();
Now it shouldn't show the error.
can you please show me the link where I can get documentation on $phpbb_log?

Also: I'm having trouble getting this to work on template events that I have defined in my cmBB extention. For instance, i have this event:

Code: Select all

<!-- EVENT ger_cmbb_main_menu_prepend -->
What is the correct way to add an advertisement here?
this is where I failed. I wanted to make everything controllable from ACP.
I couldn't find a way to dynamically add a new add section.
Now the only way to add one is th upload a file
ger_cmbb_main_menu_prepend.html to /ext/orthohin/adman/styles/prosilver/template/event directory.
the html file should contain {GER_CMBB_MAIN_MENU_PREPEND} in it. (all CAPS)
I opened a topic in the mod writers discussion forum asking about this, but didn't get any solution.
Here's the link:

I'm really hoping someone can help me around it.

User avatar
Ger
Recognised Extension Developer
Posts: 1593
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: [DEV] Advertisement Management

Post by Ger » Fri Oct 14, 2016 7:30 am

Badhon_raj wrote:can you please show me the link where I can get documentation on $phpbb_log
I'm not sure about the documentation, but there is ./phpbb/log/log_interface which has some useful comments:

Code: Select all

    /**
    * Adds a log entry to the database
    *
    * @param    string        $mode                The mode defines which log_type is used and from which log the entry is retrieved
    * @param    int            $user_id            User ID of the user
    * @param    string        $log_ip                IP address of the user
    * @param    string        $log_operation        Name of the operation
    * @param    int|bool    $log_time            Timestamp when the log entry was added. If false, time() will be used
    * @param    array        $additional_data    More arguments can be added, depending on the log_type
    *
    * @return    int|bool        Returns the log_id, if the entry was added to the database, false otherwise.
    */
    public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array());

In my cmBB extension I use this in ./controller/save.php:

Code: Select all

                $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'LOG_ARTICLE_VISIBILLITY', time(), array('article_id' => $article_id, 'visible' => $article_data['visible']));
So I guess hat you should do this:

Code: Select all

$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($event_name));
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
Ger
Recognised Extension Developer
Posts: 1593
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: [DEV] Advertisement Management

Post by Ger » Fri Oct 14, 2016 7:55 am

Badhon_raj wrote: this is where I failed. I wanted to make everything controllable from ACP.
I couldn't find a way to dynamically add a new add section.
Now the only way to add one is th upload a file
ger_cmbb_main_menu_prepend.html to /ext/orthohin/adman/styles/prosilver/template/event directory.
the html file should contain {GER_CMBB_MAIN_MENU_PREPEND} in it. (all CAPS)
I opened a topic in the mod writers discussion forum asking about this, but didn't get any solution.
Here's the link:

I'm really hoping someone can help me around it.
Using PHP in templates is considered bad practice and besides that: you can't be sure everyone has PHP enabled in templates (default is set to NO in security settings). But perhaps you can do something like this in your acp/main_module.php

Code: Select all

    /**
     * Create a template event file for new events
     * @param string $event_name
     * @return int | bool the number of bytes that were written to the file, or FALSE on failure
     */
    private function create_template_file($event_name)
    {
        global $phpbb_root_path;
        
        $file_content = '{' . strtoupper($event_name) . '}';
        $file_name = strtolower($event_name) . '.html';
        $full_path = $phpbb_root_path . 'ext/orthohin/adman/styles/all/template/event/' . $file_name;
        return file_put_contents($full_path, $file_content);
    }
When you call this function upon creating a new advertisement event in your ACP module, there should be a template file created. Totally untested though. :)
I'm not sure if extension policies allow to create files on the fly and wether or not the CHMOD allows for this.

Perhaps you can even put something like this in a migration file for the case you'll update this extension, allowing to recreate all template events stored in you DB table. But that's just a longshot (or call it a brainfart, whatever you like :) )
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Badhon_raj
Registered User
Posts: 142
Joined: Wed Jan 04, 2012 6:33 pm

Re: [DEV] Advertisement Management

Post by Badhon_raj » Fri Oct 14, 2016 10:03 am

Ger wrote:I'm not sure about the documentation, but there is ./phpbb/log/log_interface which has some useful comments:
Thanks. didn't think of that.
Ger wrote: Using PHP in templates is considered bad practice and besides that: you can't be sure everyone has PHP enabled in templates (default is set to NO in security settings). But perhaps you can do something like this in your acp/main_module.php
...
...
When you call this function upon creating a new advertisement event in your ACP module, there should be a template file created. Totally untested though. :)
I'm not sure if extension policies allow to create files on the fly and wether or not the CHMOD allows for this.
hmm, good idea, but it'll definitely need write permission on that directory.
This policy says that you must store uploaded or downloaded files in /store directory.
Not sure if it is applicable for files created on-the-fly.
Perhaps you can even put something like this in a migration file for the case you'll update this extension, allowing to recreate all template events stored in you DB table. But that's just a longshot (or call it a brainfart, whatever you like :) )
hmm, will see what I can do.

Thanks so much for your suggestions. :)

sakkiotto
Registered User
Posts: 224
Joined: Mon Jun 13, 2005 9:45 pm

Re: [DEV] Advertisement Management

Post by sakkiotto » Sat Dec 10, 2016 11:57 am

edit : resolv

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 24493
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [ABD] Advertisement Management

Post by Paul » Mon Jul 16, 2018 9:27 am

This topic has been marked as [ABD] - Abandoned as the extension author has not been active recently. If the extension author wishes to continue development, please PM anyone on the Extension Customisations Team to request this topic be unlocked.

Notice!
We do not recommend that a user of the phpBB software install this extension, or any other extension that is marked as "abandoned" or "in development", on a live forum. Doing so may cause your forum to not perform in the manner it should.


Thank you,
The phpBB Extension Customisations Team
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Locked

Return to “Abandoned Extensions”

Who is online

Users browsing this forum: Gubkin and 7 guests