1

Looking for a campaign

Code

Edit the action search in the file actions/search.php to protect the access to a campaign:

  1. require_once 'userprofile.php';

Loads the function user_profile.

  1.         if ($thread_type == 'campaign') {
  2.             if (!(user_has_role('administrator') or (user_has_role('client') and $thread_user_id == user_profile('id')))) {
  3.                 return run('error/notfound', $lang);
  4.             }
  5.             $cloud_name=$cloud_id;
  6.         }

If the thread is a campaign and if the user is not an administrator or not the client who owns the thread, returns a protocol error.

Edit the model cloud to forbid accessing the keywords of a campaign like for the RSS thread or the thread of the newsletters:

Modify the code of the functions cloud_list_tags, cloud_search and cloud_match in the file models/cloud.inc to forbid accessing the keywords of a campaign:

  1.         $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
  1.         $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
  1.         $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";

To forbid global searching, i.e. calling the action search without a thread in parameter, set the configuration parameter $search_all to false in config.inc:

  1. global $search_all, $search_distance, $search_closest, $search_pertinence;
  1. $search_all=true;       // true, false, 'cloud'
Git
  1. /izendsms.com
    1. actions
      1. search.php
    2. includes
      1. includes.inc
    3. models
      1. cloud.inc

Commit this version:

$ git status
$ git add actions/search.php includes/config.inc models/cloud.inc
$ git commit -m'Adds searching campaigns'

IMPORTANT: Edit the DB connector in the file includes/db.inc.

Comments

To add a comment, click here.