Adds nsconddefine function to make it easier to put things in LocalConfig, a=chris

Chris Pollett [2015-12-25 00:Dec:th]
Adds nsconddefine function to make it easier to put things in LocalConfig, a=chris
Filename
src/configs/Config.php
diff --git a/src/configs/Config.php b/src/configs/Config.php
index 15c6a8b79..e56c442ca 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -22,8 +22,15 @@
  *
  * END LICENSE
  *
- * Used to set the configuration settings of the SeekQuarry project.
+ * Used to set the configuration settings of the Yioop/SeekQuarry project.
  *
+ * Some settings can be set in the Page Options and Server Settings
+ * and Appearance activities. Other settings can be overriden by making
+ * a LocalConfig.php file in the same folder as this file and using the
+ * same namespace.  If a setting in this file is created using nsdefine
+ * it is unlikely that it is safe to override. If it is created using
+ * nsconddefine it should be fair game for tweaking in the LocalConfig.php
+ * file
  * @author Chris Pollett chris@pollett.org
  * @license http://www.gnu.org/licenses/ GPL3
  * @link http://www.seekquarry.com/
@@ -89,6 +96,18 @@ function nsdefined($constant)
 {
     return defined("seekquarry\\yioop\\configs\\" . $constant);
 }
+/**
+ * Define a constant in the Yioop configs namespace (seekquarry\yioop)
+ * if it hasn't been defined yet, otherwise do nothing.
+ * @param string $constant the name of the constant to define
+ * @param $value the value to give it
+ */
+function nsconddefine($constant, $value)
+{
+    if (!defined("seekquarry\\yioop\\configs\\" . $constant)) {
+        define("seekquarry\\yioop\\configs\\" . $constant, $value);
+    }
+}
 /**
  * Version number for upgrade function
  * @var int
@@ -136,10 +155,8 @@ ini_set('pcre.backtrack_limit', 1000000);
     /** Calculate base directory of script
      * @ignore
      */
-if (!nsdefined("BASE_DIR")) {
-    nsdefine("BASE_DIR", str_replace("\\", "/", realpath(__DIR__ ."/../")));
-    nsdefine("PARENT_DIR",  substr(BASE_DIR, 0, -strlen("/src")));
-}
+nsconddefine("BASE_DIR", str_replace("\\", "/", realpath(__DIR__ ."/../")));
+nsconddefine("PARENT_DIR",  substr(BASE_DIR, 0, -strlen("/src")));
 computeBaseUrl();
 /** Yioop Namespace*/
 nsdefine('NS', "seekquarry\\yioop\\");
@@ -211,15 +228,11 @@ if (file_exists(BASE_DIR."/configs/LocalConfig.php")) {
  *  different configuration settings. This might be useful if one was production
  *  and one was more dev.
  */
-if (!nsdefined('PROFILE_FILE_NAME')) {
-    nsdefine('PROFILE_FILE_NAME', "/Profile.php");
-}
-if (!nsdefined('MAINTENANCE_MESSAGE')) {
-    nsdefine('MAINTENANCE_MESSAGE', <<<EOD
+nsconddefine('PROFILE_FILE_NAME', "/Profile.php");
+nsconddefine('MAINTENANCE_MESSAGE', <<<EOD
 This Yioop! installation is undergoing maintenance, please come back later!
 EOD
 );
-}
 if (MAINTENANCE_MODE && $_SERVER["SERVER_ADDR"] != $_SERVER["REMOTE_ADDR"]) {
     echo MAINTENANCE_MESSAGE;
     exit();
@@ -260,7 +273,7 @@ nsdefine('ZKP_AUTHENTICATION', 2);
 /** If ZKP Authentication via Fiat Shamir Protocol used how many iterations
  * to do
  */
-nsdefine('FIAT_SHAMIR_ITERATIONS', 20);
+nsconddefine('FIAT_SHAMIR_ITERATIONS', 20);
 if (file_exists(WORK_DIRECTORY . PROFILE_FILE_NAME)) {
     if((file_exists(WORK_DIRECTORY . "/locale/en-US") &&
         !file_exists(WORK_DIRECTORY . "/locale/en_US"))
@@ -367,27 +380,23 @@ if (file_exists(WORK_DIRECTORY . PROFILE_FILE_NAME)) {
     nsdefine('TOPBAR_COLOR', "#EEEEFF");
     nsdefine('AD_LOCATION','none');
 }
-if (!nsdefined("BASE_URL")) {
-    nsdefine('BASE_URL', NAME_SERVER);
-}
-if (!nsdefined('LOGO')) {
-    /*  these defines were added to the profile at same time. So we add them
-        all in  one go to both the case where we have no profile and in the
-        older  profile case where they were not defined.
-     */
-    nsdefine('LOGO', "resources/yioop.png");
-    nsdefine('M_LOGO', "resources/m-yioop.png");
-    nsdefine('FAVICON', BASE_URL."favicon.ico");
-    nsdefine('TIMEZONE', 'America/Los_Angeles');
-    /* name of the cookie used to manage the session
-       (store language and perpage settings), define CSRF token
-     */
-    nsdefine('SESSION_NAME', "yioopbiscuit");
-    nsdefine('CSRF_TOKEN', "YIOOP_TOKEN");
-}
-if (!nsdefined("AD_LOCATION")) {
-    nsdefine('AD_LOCATION', "none");
-}
+/** URL that all url paths will be constructed from */
+nsconddefine('BASE_URL', NAME_SERVER);
+/** Relative url to website logo */
+nsconddefine('LOGO', "resources/yioop.png");
+/** Relative url to mobile website logo */
+nsconddefine('M_LOGO', "resources/m-yioop.png");
+/** Url for website favicon */
+nsconddefine('FAVICON', BASE_URL . "favicon.ico");
+/** Timezone for website */
+nsconddefine('TIMEZONE', 'America/Los_Angeles');
+/* name of the cookie used to manage the session
+   (store language and perpage settings), define CSRF token
+ */
+nsconddefine('SESSION_NAME', "yioopbiscuit");
+nsconddefine('CSRF_TOKEN', "YIOOP_TOKEN");
+/** locations that ads can be placed in search result pages */
+nsconddefine('AD_LOCATION', "none");
 date_default_timezone_set(TIMEZONE);
 if ((DEBUG_LEVEL & ERROR_INFO) == ERROR_INFO) {
     error_reporting(-1);
@@ -397,9 +406,7 @@ if ((DEBUG_LEVEL & ERROR_INFO) == ERROR_INFO) {
 /** if true tests are diplayable*/
 nsdefine('DISPLAY_TESTS', ((DEBUG_LEVEL & TEST_INFO) == TEST_INFO));
 /** if true query statistics are diplayed */
-if (!nsdefined('QUERY_STATISTICS')) {
-    nsdefine('QUERY_STATISTICS', ((DEBUG_LEVEL & QUERY_INFO) == QUERY_INFO));
-}
+nsconddefine('QUERY_STATISTICS', ((DEBUG_LEVEL & QUERY_INFO) == QUERY_INFO));
 //check if mobile css and formatting should be used or not
 if (isset($_SERVER['HTTP_USER_AGENT'])) {
     $agent = $_SERVER['HTTP_USER_AGENT'];
@@ -437,58 +444,49 @@ if (!PROFILE) {
 /** this is the User-Agent names the crawler provides
  * a web-server it is crawling
  */
-nsdefine('USER_AGENT',
+nsconddefine('USER_AGENT',
     'Mozilla/5.0 (compatible; '.USER_AGENT_SHORT.'; +'.NAME_SERVER.'bot.php)');
 /**
  * To change the Open Search Tool bar name overrride the following variable
  * in your local_config.php file
  */
-if (!nsdefined('SEARCHBAR_PATH')) {
-    nsdefine('SEARCHBAR_PATH', NAME_SERVER . "yioopbar.xml");
-}
+nsconddefine('SEARCHBAR_PATH', NAME_SERVER . "yioopbar.xml");
 /**
  * Phantom JS is used by some optional Javascript tests of the Yioop interface.
  * The constant PHANTOM_JS should point to the path to phantomjs
  */
-if (!nsdefined("PHANTOM_JS")) {
-    nsdefine("PHANTOM_JS", "phantomjs");
-}
+nsconddefine("PHANTOM_JS", "phantomjs");
 /** maximum size of a log file before it is rotated */
-nsdefine("MAX_LOG_FILE_SIZE", 5000000);
+nsconddefine("MAX_LOG_FILE_SIZE", 5000000);
 /** number of log files to rotate amongst */
-nsdefine("NUMBER_OF_LOG_FILES", 5);
+nsconddefine("NUMBER_OF_LOG_FILES", 5);
 /**
  * how long in seconds to keep a cache of a robot.txt
  * file before re-requesting it
  */
-nsdefine('CACHE_ROBOT_TXT_TIME', ONE_DAY);
+nsconddefine('CACHE_ROBOT_TXT_TIME', ONE_DAY);
 /**
  * Whether the scheduler should track ETag and Expires headers.
  * If you want to turn this off set the variable to false in
  * local_config.php
  */
-if (!nsdefined('USE_ETAG_EXPIRES')) {
-    nsdefine('USE_ETAG_EXPIRES', true);
-}
+nsconddefine('USE_ETAG_EXPIRES', true);
 /**
  * if the robots.txt has a Crawl-delay larger than this
  * value don't crawl the site.
  * maximum value for this is 255
  */
-nsdefine('MAXIMUM_CRAWL_DELAY', 64);
+nsconddefine('MAXIMUM_CRAWL_DELAY', 64);
 /** maximum number of active crawl-delayed hosts */
-nsdefine('MAX_WAITING_HOSTS', 250);
+nsconddefine('MAX_WAITING_HOSTS', 250);
 /** Minimum weight in priority queue before rebuilt */
-nsdefine('MIN_QUEUE_WEIGHT', 1/100000);
+nsconddefine('MIN_QUEUE_WEIGHT', 1/100000);
 /**  largest sized object allowed in a web archive (used to sanity check
  *  reading data out of a web archive)
  */
-nsdefine('MAX_ARCHIVE_OBJECT_SIZE', 100000000);
+nsconddefine('MAX_ARCHIVE_OBJECT_SIZE', 100000000);
 /** Treat earlier timestamps as being indexes of format version 0 */
-if (!nsdefined('VERSION_0_TIMESTAMP')) {
-    nsdefine('VERSION_0_TIMESTAMP', 1369754208);
-}
-
+nsconddefine('VERSION_0_TIMESTAMP', 1369754208);
 defineMemoryProfile();
 /**
  * Code to determine how much memory current machine has
@@ -535,33 +533,33 @@ function defineMemoryProfile()
  * urls will be stored in a single filter. Additional filters are
  * read to and from disk.
  */
-nsdefine('URL_FILTER_SIZE', MEMORY_PROFILE * 5000000);
+nsconddefine('URL_FILTER_SIZE', MEMORY_PROFILE * 5000000);
 /**
  * maximum number of urls that will be held in ram
  * (as opposed to in files) in the priority queue
  */
-nsdefine('NUM_URLS_QUEUE_RAM', MEMORY_PROFILE * 80000);
+nsconddefine('NUM_URLS_QUEUE_RAM', MEMORY_PROFILE * 80000);
 /** number of documents before next gen */
-nsdefine('NUM_DOCS_PER_GENERATION', MEMORY_PROFILE * 10000);
+nsconddefine('NUM_DOCS_PER_GENERATION', MEMORY_PROFILE * 10000);
 /** precision to round floating points document scores */
-nsdefine('PRECISION', 10);
+nsconddefine('PRECISION', 10);
 /** maximum number of links to extract from a page on an initial pass*/
-nsdefine('MAX_LINKS_TO_EXTRACT', MEMORY_PROFILE * 80);
+nsconddefine('MAX_LINKS_TO_EXTRACT', MEMORY_PROFILE * 80);
 /** maximum number of links to keep after initial extraction*/
-nsdefine('MAX_LINKS_PER_PAGE', 50);
+nsconddefine('MAX_LINKS_PER_PAGE', 50);
 /** Estimate of the average number of links per page a document has*/
-nsdefine('AVG_LINKS_PER_PAGE', 24);
+nsconddefine('AVG_LINKS_PER_PAGE', 24);
 /** maximum number of links to consider from a sitemap page */
-nsdefine('MAX_LINKS_PER_SITEMAP', MEMORY_PROFILE * 80);
+nsconddefine('MAX_LINKS_PER_SITEMAP', MEMORY_PROFILE * 80);
 /**  maximum number of words from links to consider on any given page */
-nsdefine('MAX_LINKS_WORD_TEXT', 100);
+nsconddefine('MAX_LINKS_WORD_TEXT', 100);
 /**  maximum length of urls to try to queue, this is important for
  *  memory when creating schedule, since the amount of memory is
  *  going to be greater than the product MAX_URL_LEN*MAX_FETCH_SIZE
  *  text_processors need to promise to implement this check or rely
  *  on the base class which does implement it in extractHttpHttpsUrls
  */
-nsdefine('MAX_URL_LEN', 512);
+nsconddefine('MAX_URL_LEN', 512);
 /** request this many bytes out of a page -- this is the default value to
  * use if the user doesn't set this value in the page options GUI
  */
@@ -570,10 +568,11 @@ nsdefine('PAGE_RANGE_REQUEST', 50000);
  * When getting information from an index dictionary in word iterator
  * how many distinct generations to read in in one go
  */
-nsdefine('NUM_DISTINCT_GENERATIONS', 20);
+nsconddefine('NUM_DISTINCT_GENERATIONS', 20);
 /**
  * Max number of chars to extract for description from a page to index.
- * Only words in the description are indexed.
+ * Only words in the description are indexed. -- this is the default value
+ * can be set in Page Options
  */
 nsdefine('MAX_DESCRIPTION_LEN', 2000);
 /**
@@ -584,42 +583,38 @@ nsdefine('MAX_DESCRIPTION_LEN', 2000);
  */
 nsdefine('PAGE_RECRAWL_FREQUENCY', -1);
 /** number of multi curl page requests in one go */
-nsdefine('NUM_MULTI_CURL_PAGES', 100);
+nsconddefine('NUM_MULTI_CURL_PAGES', 100);
 /** number of pages to extract from an archive in one go */
-nsdefine('ARCHIVE_BATCH_SIZE', 100);
+nsconddefine('ARCHIVE_BATCH_SIZE', 100);
 /** time in seconds before we give up on multi page requests*/
-if (!nsdefined('PAGE_TIMEOUT')) {
-    nsdefine('PAGE_TIMEOUT', 30);
-}
+nsconddefine('PAGE_TIMEOUT', 30);
 /** time in seconds before we give up on a single page request*/
-nsdefine('SINGLE_PAGE_TIMEOUT', ONE_MINUTE);
+nsconddefine('SINGLE_PAGE_TIMEOUT', ONE_MINUTE);
 /** max time in seconds in a process before write a log message if
  *  crawlTimeoutLog is called repeatedly from a loop
  */
-nsdefine('LOG_TIMEOUT', 30);
+nsconddefine('LOG_TIMEOUT', 30);
 /** Number of lines of QueueServer log file to check to make sure both
  *  Indexer and Scheduler are running. 6000 should be roughly 20-30 minutes
  */
-nsdefine('LOG_LINES_TO_RESTART', 6000);
+nsconddefine('LOG_LINES_TO_RESTART', 6000);
 /**
  * Maximum time a crawl daemon process can go before calling
  * @see CrawlDaemon::processHandler
  */
-nsdefine('PROCESS_TIMEOUT', 15 * ONE_MINUTE);
+nsconddefine('PROCESS_TIMEOUT', 15 * ONE_MINUTE);
 /**
  * Number of error page 400 or greater seen from a host before crawl-delay
  * host and dump remainder from current schedule
  */
-nsdefine('DOWNLOAD_ERROR_THRESHOLD', 50);
+nsconddefine('DOWNLOAD_ERROR_THRESHOLD', 50);
 /** Crawl-delay to set in the event that DOWNLOAD_ERROR_THRESHOLD exceeded*/
-nsdefine('ERROR_CRAWL_DELAY', 20);
+nsconddefine('ERROR_CRAWL_DELAY', 20);
 /**
  * if FFMPEG defined, the maximum size of a uploaded video file which will
  * be automatically transcode by Yioop to mp4 and webm
  */
-if (!nsdefined("MAX_VIDEO_CONVERT_SIZE")) {
-    nsdefine("MAX_VIDEO_CONVERT_SIZE", 2000000000);
-}
+nsconddefine("MAX_VIDEO_CONVERT_SIZE", 2000000000);
 /**
  * The maximum time limit in seconds where if a file is not converted by the
  * time it will be picked up again by the client media updater
@@ -628,99 +623,91 @@ if (!nsdefined("MAX_VIDEO_CONVERT_SIZE")) {
  * This value should be kept more than the sleeping time of media updater
  * loop to avoid conversion of same file multiple times.
  */
-if(!nsdefined("MAX_FILE_TIMESTAMP_LIMIT")) {
-    nsdefine('MAX_FILE_TIMESTAMP_LIMIT', 600);
-}
+nsconddefine('MAX_FILE_TIMESTAMP_LIMIT', 600);
 /**
  * This mail timestamp limit allows mail server to create a new file
  * and write next mailer batch in the new file. Otherwise, new mailer
  * batch will be written in old file. For eg. new file will be created every
  * 5 minutes as per below value.
  */
-if(!nsdefined("MAX_MAIL_TIMESTAMP_LIMIT")) {
-    nsdefine('MAX_MAIL_TIMESTAMP_LIMIT', 300);
-}
+nsconddefine('MAX_MAIL_TIMESTAMP_LIMIT', 300);
 /**
  * Default edge size of square image thumbnails in pixels
  */
-nsdefine('THUMB_DIM', 128);
+nsconddefine('THUMB_DIM', 128);
 /**
  * Maximum size of a user thumb file that can be uploaded
  */
-nsdefine('THUMB_SIZE', 1000000);
+nsconddefine('THUMB_SIZE', 1000000);
 /** Characters we view as not part of words, not same as POSIX [:punct:]*/
-nsdefine ('PUNCT', "\.|\,|\:|\;|\"|\'|\[|\/|\%|\?|-|" .
+nsconddefine ('PUNCT', "\.|\,|\:|\;|\"|\'|\[|\/|\%|\?|-|" .
     "\]|\{|\}|\(|\)|\!|\||\&|\`|" .
     "\’|\‘|©|®|™|℠|…|\/|\>|,|\=|。|)|:|、|" .
     "”|“|《|》|(|「|」|★|【|】|·|\+|\*|;".
         "|!|—|―|?|!|،|؛|؞|؟|٪|٬|٭");
 /** Number of total description deemed title */
-nsdefine ('AD_HOC_TITLE_LENGTH', 50);
+nsconddefine ('AD_HOC_TITLE_LENGTH', 50);
 /** Used to say number of bytes in histogram bar (stats page) for file
     download sizes
  */
-nsdefine('DOWNLOAD_SIZE_INTERVAL', 5000);
+nsconddefine('DOWNLOAD_SIZE_INTERVAL', 5000);
 /** Used to say number of secs in histogram bar for file download times*/
-nsdefine('DOWNLOAD_TIME_INTERVAL', 0.5);
+nsconddefine('DOWNLOAD_TIME_INTERVAL', 0.5);
 /**
  * How many non robot urls the fetcher successfully downloads before
  * between times data sent back to queue server
  */
-nsdefine ('SEEN_URLS_BEFORE_UPDATE_SCHEDULER', MEMORY_PROFILE * 95);
+nsconddefine('SEEN_URLS_BEFORE_UPDATE_SCHEDULER', MEMORY_PROFILE * 95);
 /** maximum number of urls to schedule to a given fetcher in one go */
-nsdefine ('MAX_FETCH_SIZE', MEMORY_PROFILE * 1000);
+nsconddefine('MAX_FETCH_SIZE', MEMORY_PROFILE * 1000);
 /** fetcher must wait at least this long between multi-curl requests */
-nsdefine ('MINIMUM_FETCH_LOOP_TIME', 5);
+nsconddefine('MINIMUM_FETCH_LOOP_TIME', 5);
 /** an idling fetcher sleeps this long between queue_server pings*/
-nsdefine ('FETCH_SLEEP_TIME', 10);
+nsconddefine('FETCH_SLEEP_TIME', 10);
 /** an a queue_server minimum loop idle time*/
-nsdefine ('QUEUE_SLEEP_TIME', 5);
+nsconddefine('QUEUE_SLEEP_TIME', 5);
 /** How often mirror script tries to synchronize with machine it is mirroring*/
-nsdefine ('MIRROR_SYNC_FREQUENCY', ONE_HOUR);
+nsconddefine('MIRROR_SYNC_FREQUENCY', ONE_HOUR);
 /** How often mirror script tries to notify machine it is mirroring that it
 is still alive*/
-nsdefine ('MIRROR_NOTIFY_FREQUENCY', ONE_MINUTE);
+nsconddefine('MIRROR_NOTIFY_FREQUENCY', ONE_MINUTE);
 /** Max time before dirty index (queue_server) and
     filters (fetcher) will be force saved in seconds*/
-nsdefine('FORCE_SAVE_TIME', ONE_HOUR);
+nsconddefine('FORCE_SAVE_TIME', ONE_HOUR);
 /** Number of seconds of no fetcher contact before crawl is deemed dead*/
 nsdefine("CRAWL_TIME_OUT", 1800);
 /** maximum number of terms allowed in a conjunctive search query */
-nsdefine ('MAX_QUERY_TERMS', 10);
+nsconddefine('MAX_QUERY_TERMS', 10);
 /** When to switch to using suffice tree approach */
-nsdefine ('SUFFIX_TREE_THRESHOLD', 3);
+nsconddefine('SUFFIX_TREE_THRESHOLD', 3);
 /** default number of search results to display per page */
-nsdefine ('NUM_RESULTS_PER_PAGE', 10);
+nsconddefine('NUM_RESULTS_PER_PAGE', 10);
 /** Number of recently crawled urls to display on admin screen */
-nsdefine ('NUM_RECENT_URLS_TO_DISPLAY', 10);
+nsconddefine('NUM_RECENT_URLS_TO_DISPLAY', 10);
 /** Maximum time a set of results can stay in query cache before it is
     invalidated. If negative, then never use time to kick something out of
     cache. */
-if(!nsdefined("MAX_QUERY_CACHE_TIME")) {
-    nsdefine ('MAX_QUERY_CACHE_TIME', 2 * ONE_DAY); //two days
-}
+nsconddefine('MAX_QUERY_CACHE_TIME', 2 * ONE_DAY); //two days
 /** Minimum time a set of results can stay in query cache before it is
     invalidated (used for active crawl or feed results) */
-if(!nsdefined("MIN_QUERY_CACHE_TIME")) {
-    nsdefine ('MIN_QUERY_CACHE_TIME', ONE_HOUR); //one hour
-}
+nsconddefine('MIN_QUERY_CACHE_TIME', ONE_HOUR); //one hour
 /**
  * Default number of items to page through for users,roles, mixes, etc
  * on the admin screens
  */
-nsdefine ('DEFAULT_ADMIN_PAGING_NUM', 50);
+nsconddefine ('DEFAULT_ADMIN_PAGING_NUM', 50);
 /** Maximum number of bytes that the file that the suggest-a-url form
  * send data to can be.
  */
-nsdefine ('MAX_SUGGEST_URL_FILE_SIZE', 100000);
+nsconddefine ('MAX_SUGGEST_URL_FILE_SIZE', 100000);
 /** Maximum number of a user can suggest to the suggest-a-url form in one day
  */
-nsdefine ('MAX_SUGGEST_URLS_ONE_DAY', 10);
+nsconddefine ('MAX_SUGGEST_URLS_ONE_DAY', 10);
 /**
  * Length after which to truncate names for users/groups/roles when
  * they are displayed (not in DB)
  */
-nsdefine ('NAME_TRUNCATE_LEN', 7);
+nsconddefine ('NAME_TRUNCATE_LEN', 7);
 /** USER STATUS value used for someone who is not in a group by can browse*/
 nsdefine('NOT_MEMBER_STATUS', -1);
 /** USER STATUS value used for a user who can log in and perform activities */
@@ -809,9 +796,7 @@ nsdefine('STANDARD_GROUP_ITEM', 0);
  *  set to true if Multiple news updaters are running
  *  otherwise set to false if name server is running the news updater
  */
-if(!nsdefined("SEND_MAIL_MEDIA_UPDATER")) {
-    nsdefine('SEND_MAIL_MEDIA_UPDATER', false);
-}
+nsconddefine('SEND_MAIL_MEDIA_UPDATER', false);
 /**
  *  Indicates the thread was created to go alongside the creation of a wiki
  *  page so that people can discuss the pages contents
@@ -856,21 +841,23 @@ nsdefine('ADVERTISEMENT_KEYWORD_LEN', 60);
 nsdefine('ADVERTISEMENT_DATE_LEN', 20);
 /** Length of advertisement destination */
 nsdefine('ADVERTISEMENT_DESTINATION_LEN', 60);
-/** value used for the created advertisement*/
+/** value used to create advertisement*/
 nsdefine('ADVERTISEMENT_ACTIVE_STATUS', 1);
 /** value used to stop advertisement campaign */
 nsdefine('ADVERTISEMENT_DEACTIVATED_STATUS',2);
 /** value used to admin suspend advertisement campaign */
 nsdefine('ADVERTISEMENT_SUSPENDED_STATUS',3);
-/** value used to indicate campaign completed succesfulle */
+/** value used to indicate campaign completed successfully */
 nsdefine('ADVERTISEMENT_COMPLETED_STATUS',4);
-/** Truncate length for ad description and keywords*/
+/*
+ * Adjustable AD RELATED defines
+ *
+ /** Truncate length for ad description and keywords*/
 nsdefine ('ADVERTISEMENT_TRUNCATE_LEN', 8);
+
 /** Initial bid amount for advertisement keyword */
-nsdefine ('AD_KEYWORD_INIT_BID',1);
+nsconddefine ('AD_KEYWORD_INIT_BID',1);
 /** advertisement date format for start date and end date*/
-nsdefine ('AD_DATE_FORMAT','Y-m-d');
-/** advertisement save click action */
-nsdefine('AD_SAVE_CLICK','recordClick');
+nsconddefine ('AD_DATE_FORMAT','Y-m-d');
 /** advertisement logo*/
-nsdefine('AD_LOGO','resources/adv-logo.png');
+nsconddefine('AD_LOGO','resources/adv-logo.png');
ViewGit