Synopsis

This module creates and manages advertisements blocks, which can be added to any region.

Installation

For installing the module:

1. Copy the entire manage_advertisements directory the Drupal sites/all/modules/custom directory.

2. Login as an administrator. Enable the module in the "Administer" -> "Modules".

For removing the module:

  • Disable the Manage Advertisements module.
  • Uninstall the Manage Advertisements module.
  • Clear Caches.

Configuration

1. Add new advertisement at "Administer" -> "Configuration" -> "Content authoring" -> "Manage Advertisements" -> "Create Advertisement".

2. Find list of created advertisements at "Administer" -> "Configuration" -> "Content authoring" -> "Manage Advertisements".

3. Add advertisements to any existing regions and also control as where should these advertisements should appear.

Maintainer

This project is originally written and maintained by Shashwat Purav along with co-maintainer Sandeep Kumbhatil

Similar Projects

Following are the similar projects,
Ad manager
SimpleAds

Manage Advertisements does not depend on any frameworks or other modules.

Project Page

This is the project page link for Manage Advertisements

Clone Repository

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/shashwatpurav/2412501.git manage_advertisements

The Project Application Review Link

https://www.drupal.org/node/2441453#comment-9716443
https://www.drupal.org/node/2451563#comment-9716617
https://www.drupal.org/node/2445625#comment-9716819

Automated Review Link

http://pareview.sh/pareview/httpgitdrupalorgsandboxshashwatpurav2412501

CommentFileSizeAuthor
#23 manage-ad-notice.png18.57 KBsandeep.kumbhatil

Comments

shashwat purav’s picture

Issue summary: View changes
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

sandeep.kumbhatil’s picture

Automated Review

OK

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
No: Does not follow the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
  1. Suggestion : You can add multiple images fields option for advertisement type.
  2. (*)Remove admin theme selection because if user select the admin theme and content region then content will display on admin section

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

hemangi.gokhale’s picture

Status: Needs review » Needs work

Automated Review

Issues identified by pareview.sh seems to be clean.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication or fragmentation but please clearly justify the difference between these modules:
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
No: Does not follow the guidelines for in-project documentation or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
  1. (+) You should use manage_advertisements.admin.inc instead of manage_advertisements.inc
  2. (+) There should be Implements hook_settings() instead of Implements manage_advertisements_settings() in manage_advertisements.module file at line no 78.
  3. (+) As of Drupal 7, a call to drupal_uninstall_schema() is no longer necessary. See "A module no longer should explicitly install or uninstall its database schema in hook_install() or hook_uninstall()."

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

shashwat purav’s picture

Hi @Sandeep Kumbhatil,

Thanks for reviewing the project, I have resolved issues you have mentioned.

1. For this version I have kept only one image for advertisement. I will surely consider your suggestion for adding multiple images fields option in the next version.

2. I have removed admin theme selection.

3. Also module follows the guidelines for master branch.

sandeep.kumbhatil’s picture

Status: Needs work » Needs review

OK then changing status to Need Review.

shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Hi @Hemangi Gokhale,

Thanks for reviewing the project, Following are my views on your suggestions,

1. Project file "manage_advertisements.inc" does not contain any administrator settings but custom functions so, I have kept the name of the file as "manage_advertisements.inc".

2. "manage_advertisements_settings" is not implementation of hook but a simple menu callback so, I am changing comments to "Callback for menu item manage_advertisements_settings" in the manage_advertisements.module file.

3. Module creates instances in Drupal core tables. While getting un-installed those instances get deleted. The code is in the hook_uninstall in "manage_advertisements.install" file.

4. Also module now follows the guidelines for the README Template.

shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Issue summary: View changes
novitsh’s picture

Automated tests passed successfully.

Manual review:

  • Clearly formatted README file with good explanation. This passes for me.
  • If I choose 'text' as a format, I am unable to choose my text format filters. Say for example if I want to attach a WYSIWYG editor.

Baseline: good and efficient small module to quickly create ads. Looking forward to see this become more extended in the future.

shashwat purav’s picture

Hi @Novitsh,

Thank you for reviewing the project, Following are my views on your suggestions,

1. For Advertisement type "text" I wanted to build functionality where technical as well as non-technical users can create text-type Ads. I thought "Text format filters" functionality may confuse non-technical users. So I did not add "Text format filters" option.

2. Kindly please suggest how can I allow to choose text formats to non-technical users also.

naveenvalecha’s picture

Removing PAReview: Single project promote because module has enough code.
As all reviewers are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

novitsh’s picture

@Shashwat Purav, I'm just mentioning that if I want to add a WYSIWYG editor to that body field on the ad for only a certain role, I can't.
On the other hand, it's your design. You can pick up my mention as a feature request.

shashwat purav’s picture

Hi @Novitsh,

Thanks for the review. Following are my views on your suggestions,

1. For Advertisement type "text" users can now choose "Text format filters" role-wise.

2. Also you can add a WYSIWYG editor to the body field on the advertisement for only a certain role.

nashkrammer’s picture

Status: Needs review » Needs work

Automated Review

[Best practice issues identified by pareview.sh / drupalcs / coder. Please don't copy/paste all of the results unless they are short. If there are a lot, then post a link to the automated review and mention that problems should be addressed.]

Manual Review

Individual user account
[Yes: Follows / No: Does not follow] the guidelines for individual user accounts.
No duplication
[Yes: Does not cause / No: Causes] module duplication and/or fragmentation.
Master Branch
[Yes: Follows / No: Does not follow] the guidelines for master branch.
Licensing
[Yes: Follows / No: Does not follow] the licensing requirements.
3rd party assets/code
[Yes: Follows / No: Does not follow] the guidelines for 3rd party assets/code.
README.txt/README.md
[Yes: Follows / No: Does not follow] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
[Yes: Follows / No: Does not follow] the guidelines for project length and complexity.
Secure code
[Yes: Meets the security requirements. / No: List of security issues identified.]
Coding style & Drupal API usage
[List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
  1. Just a recommendation
  2. For Text advertisement You can mention as TEXT/HTML as it works with html as well.
  3. If advertisement content like image tag has width more than the block region it breaks the ui. Maybe you can keep a wrapper and set overflow hidden.
  4. (+)When Manage Advertisements module is disabled the ads created are not removed.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

shashwat purav’s picture

Hi @nashkrammer,

Thank you for reviewing the module. Following are my views on your suggestions,

1. For the "Text Advertisement" I have added "TEXT/HTML" in the description of the "textarea" field.

2. I want user to examine where is he/ she is going to add the Advertisement so that he/ she can think of the size of the image and the Advertisement will not break the ui. Also I do not want to restrict user from adding any size of image he/ she wants to add.

3. I have added functionality so that when Manage Advertisements module is disabled the ads created will be removed.

shashwat purav’s picture

Status: Needs work » Needs review
shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Issue tags: +PAreview: review bonus
sandeep.kumbhatil’s picture

Status: Needs review » Needs work
StatusFileSize
new18.57 KB

Automated Review

Looks Fine

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
  1. (*) I am able to see Text format section even if i select Advertisement type as image or video.
  2. (+) While adding a advertisement notice was generated after submited. I have attached the notice image.
  3. Just a recommendation : If adding an image advertisement and i provide specific images dimension it just resize through html width and height,thus image look shrink. Why dont you resize the image in given dimension.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walk through are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

shashwat purav’s picture

Status: Needs work » Needs review

Hi sandeep.kumbhatil,

Thank you for reviewing the module. Following are my views on your suggestions,

  1. I have fixed the bug: I am able to see Text format section even if i select Advertisement type as image or video.
  2. I designed the module to show videos only from Youtube. Also I have added e.g. as how you can add video advertisements in description.
  3. I want user to examine where is he/ she is going to add the Advertisement so that he/ she can think of the size of the image and the Advertisement will not break the ui.
webcodin’s picture

Hi,

Manual review:

manage_advertisements.module

  • Why do you use $form seems it should be a $form_state (148-149, 164-165, 194, 210-211)
  • On advertisements edit form you are use hidden textarea field for image and video block this is strange solution.
  • In your table 'manage_advertisements' the column 'updated' is empty for text blocks
    On manage_advertisements.js file you are use .on() on line 9. But default drupal 7 installation use jquery 1.4 and .on() wouldn't work because it is available since jquery > 1.7

Wishes

  • Added image is always wrapped in

    element. It can be not good for displaying.

  • I can't add image without a link.
webcodin’s picture

Status: Needs review » Needs work

Change status

shashwat purav’s picture

Hi @sandeep.kumbhatil,

  1. I have fixed the bug: Why don't you resize the image in given dimension.
shashwat purav’s picture

Hi webcodin,

Thank you for reviewing the module. I have fixed the bugs you mentioned.

shashwat purav’s picture

Issue summary: View changes
PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

shashwat purav’s picture

Status: Closed (won't fix) » Needs review
klausi’s picture

Assigned: Unassigned » joachim
Status: Needs review » Needs work
Issue tags: -PAreview: review bonus +PAreview: security

manual review:

  1. manage_advertisements_settings(): don't call theme() here, just return a nested render array. Drupal core will render it later for you. See https://www.drupal.org/node/930760
  2. manage_advertisements_settings(): "'#value' => 'Execute',": all user facing text must run through t() for translation. Make sure to check all your strings.
  3. manage_advertisements_settings_submit(): if you delete from the block table you must also make sure that you don't delete block from other modules, right? Why is there no condition for the "module" column in the block table? Please add a comment.
  4. There is a security vulnerability in this module and as part of our git admin training I'm assigning this to joachim so that he can take a look. If he does not find anything I'm going to post the vulnerability details in one week. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Issue summary: View changes
shashwat purav’s picture

Thank you @klausi for the review.

I have worked on your suggestions. Please find my comments below to your suggestions.

  1. manage_advertisements_settings(): I have uncalled the theme().
  2. manage_advertisements_settings(): Added t() for translation.
  3. manage_advertisements_settings_submit(): Added condition for the "module" column in the block table.

Please review it and let me know in case any more suggestions.

joachim’s picture

/**
 * Implements custom function manage_advertisements_enabled_themes().
 */
function manage_advertisements_enabled_themes() {

It looks like you've labelled every function as 'Implements...'. Only functions which are a hook implementation are implementations ;)

joachim’s picture

  $form['manage_advertisement_create_advertisement'] = array(
    '#markup' => l(t('New Advertisement'), 'admin/config/content/manage_advertisements/settings/create_advertisement', array('attributes' => array('class' => array('button')))),
  );

Use the local tasks system to create the link rather than hardcoding it into the form.

    $form['page_region_settings']['create_advertisement_region_' . $enabled_theme] = array(
      '#type' => 'select',
      '#title' => $enabled_theme,
      '#options' => $regions,
    );

Use the theme's label, not its machine name.

  $form['cancel'] = array(
    '#markup' => l(t('Back'), 'admin/config/content/manage_advertisements/settings', array('attributes' => array('class' => array('button')))),
  );

This shouldn't be styled as a button -- it doesn't submit the form. Also, people can go back with their browser controls, or with the breadcrumbs. AFAIK we only provide buttons to get out of destructive operation forms (such as delete).

When I submit the edit form, I get a crash:

> PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'bartik-manage_advertisements-1' for key 'tmd': UPDATE {block} SET module=:db_update_placeholder_0,

  $form['operations'] = array(
    '#type' => 'select',
    '#options' => array(
      0 => t('- Choose an operation -'),
      'delete_advertisements' => t('Delete Advertisements'),
    ),
  );

This is overkill if there is only one operation.

    $options[$block->advertisement_bid] = array(
      'advertisements_name' => $block->advertisement_description,
      'advertisements_type' => $block->advertisement_type,
      'edit' => l(t('Edit'), 'admin/manage_advertisements/' . $block->advertisement_bid . '/edit', array('query' => array('destination' => 'admin/config/content/manage_advertisements/settings'))),
      'delete' => l(t('Delete'), 'admin/manage_advertisements/' . $block->advertisement_bid . '/delete', array('query' => array('destination' => 'admin/config/content/manage_advertisements/settings'))),
    );

Here's the security issue I found. You are not sanitizing the ad description, which is user-entered text. A malicious user with access to create advertisements could enter JS code here, for instance.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

shashwat purav’s picture

Project: Drupal.org security advisory coverage applications »
Component: module » Code

Project: » Lost & found issues

This issue’s project has disappeared. Most likely, it was a sandbox project, which can be deleted by its maintainer. See the Lost & found issues project page for more details. (The missing project ID was 2412501)