Looking for a campaign
Code
Edit the action search
in the file actions/search.php to protect the access to a campaign:
- require_once 'userprofile.php';
Loads the function user_profile
.
- if ($thread_type == 'campaign') {
- if (!(user_has_role('administrator') or (user_has_role('client') and $thread_user_id == user_profile('id')))) {
- return run('error/notfound', $lang);
- }
- $cloud_name=$cloud_id;
- }
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:
- $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
- $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
- $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:
- global $search_all, $search_distance, $search_closest, $search_pertinence;
- $search_all=false; // true, false, 'cloud'
Git
- /izendsms.com
- actions
- search.php
- includes
- includes.inc
- models
- cloud.inc
- actions
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