variables.version = "3.3"; variables.svnBuild = "268"; application.ptSocialMedia.version = variables.version; application.ptSocialMedia.svnBuild = variables.svnBuild; // Setup Errors variable in the App variable scope if ( StructKeyExists(application,"ptSocialMedia") AND !StructKeyExists(application.ptSocialMedia,"appErrors") ) application.ptSocialMedia.appErrors = []; var appConfig = getAppConfig(); // Get the UI theme from the config element if ( structKeyExists(appConfig,"ui_theme") AND LEN(TRIM(appConfig['ui_theme'])) ) return appConfig['ui_theme']; else return "redmond"; var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"socialMediaServiceTypes") AND LEN(TRIM(appConfig['socialMediaServiceTypes'])) ) return appConfig['socialMediaServiceTypes']; else return "facebook,instagram,twitter,youtube,wordpress"; var appConfig = getAppConfig(); // Get the cache dashboard url from the config element if ( structKeyExists(appConfig,"dashboardURL") AND LEN(TRIM(appConfig.dashboardURL)) ) return application.ptSocialMedia.csData.parseCSURL(str=appConfig['dashboardURL']); else return "#request.site.CP_URL#webadmin/socialmedia/Social-Media-Dashboard.cfm"; var appConfig = getAppConfig(); // Get the cache dashboard url from the config element if ( structKeyExists(appConfig,"serviceManagerURL") AND LEN(TRIM(appConfig.serviceManagerURL)) ) return application.ptSocialMedia.csData.parseCSURL(str=appConfig['serviceManagerURL']); else return "#request.site.CP_URL#webadmin/socialmedia/Manage-Services.cfm"; var appConfig = getAppConfig(); // Get the configuration manager page url from the config element if ( structKeyExists(appConfig,"configManagerURL") AND LEN(TRIM(appConfig.configManagerURL)) ) return application.ptSocialMedia.csData.parseCSURL(str=appConfig['configManagerURL']); else return "#request.site.CP_URL#webadmin/socialmedia/Manage-Configuration.cfm"; var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"enableFeedCache") AND LEN(TRIM(appConfig['enableFeedCache'])) ) return appConfig['enableFeedCache']; else return 0; var appConfig = getAppConfig(); // Get the Rebuild Feed Cache Interval from the config element if ( structKeyExists(appConfig,"rebuildFeedCacheInterval") AND IsNumeric(appConfig['rebuildFeedCacheInterval']) ) return appConfig['rebuildFeedCacheInterval']; else return 15; var appConfig = getAppConfig(); // Get the Rebuild Feed Cache Interval from the config element if ( structKeyExists(appConfig,"rebuildFeedCacheDailyStartTime") AND LEN(TRIM(appConfig['rebuildFeedCacheDailyStartTime'])) ) return appConfig['rebuildFeedCacheDailyStartTime']; else return '12:01 AM'; var appConfig = getAppConfig(); // Get the Rebuild Feed Cache Interval from the config element if ( structKeyExists(appConfig,"rebuildFeedCacheDailyEndTime") AND LEN(TRIM(appConfig['rebuildFeedCacheDailyEndTime'])) ) return appConfig['rebuildFeedCacheDailyEndTime']; else return ''; var appConfig = getAppConfig(); // Get the Rebuild Feed Cache Interval from the config element if ( structKeyExists(appConfig,"maxPostsPerService") AND IsNumeric(appConfig['maxPostsPerService']) ) return appConfig['maxPostsPerService']; else return 25; var appConfig = getAppConfig(); // Get the Rebuild Feed Cache Interval from the config element if ( structKeyExists(appConfig,"ServiceTypeFeedCacheFileEnabled") AND IsBoolean(appConfig['ServiceTypeFeedCacheFileEnabled']) ) return appConfig['ServiceTypeFeedCacheFileEnabled']; else return 1; // On by default var appConfig = getAppConfig(); // Get the Facebook AppID from the config element if ( StructKeyExists(appConfig,"apiFacebookAppID") AND LEN(TRIM(appConfig.apiFacebookAppID)) ) return appConfig.apiFacebookAppID; else return ""; var appConfig = getAppConfig(); // Get the Facebook AppID from the config element if ( StructKeyExists(appConfig,"apiTwitterConsumerKey") AND LEN(TRIM(appConfig.apiTwitterConsumerKey)) ) return TRIM(appConfig.apiTwitterConsumerKey); else if ( StructKeyExists(appConfig,"apiTwitterCustomerKey") AND LEN(TRIM(appConfig.apiTwitterCustomerKey)) ) return TRIM(appConfig.apiTwitterCustomerKey); else return ""; var appConfig = getAppConfig(); // Get the Facebook AppID from the config element if ( StructKeyExists(appConfig,"apiTwitterConsumerSecret") AND LEN(TRIM(appConfig.apiTwitterConsumerSecret)) ) return TRIM(appConfig.apiTwitterConsumerSecret); else if ( StructKeyExists(appConfig,"apiTwitterCustomerSecret") AND LEN(TRIM(appConfig.apiTwitterCustomerSecret)) ) return TRIM(appConfig.apiTwitterCustomerSecret); else return ""; var consumerKey = getTwitterConsumerKey(); var consumerSecret = getTwitterConsumerSecret(); // RFC 1738 encoded consumer key (does not change) consumerKey = URLEncodedFormat(consumerKey); // TODO: verify that CF's URLEncodedFormat does RFC 1738 encoding // RFC 1738 encoded consumer secret (does not change) consumerSecret = URLEncodedFormat(consumerSecret); // TODO: verify that CF's URLEncodedFormat does RFC 1738 encoding // Get the Facebook AppID from the config element if ( LEN(TRIM(consumerKey)) AND LEN(TRIM(consumerSecret)) ) return consumerKey & ":" & consumerSecret; else return ""; var bearerToken = getTwitterBearerToken(); // Convert the bearer token to base64 if ( LEN(TRIM(bearerToken)) ) return ToBase64(bearerToken,"utf-8"); else return ""; var errorDump = ""; var logFileName = errorLogFileName(arguments.serviceName); //var logFileName = dateFormat(now(), "yyyymmdd") & "." & request.site.name & ".ptSocialMedia_" & arguments.serviceName & "_Errors.htm"; var errorStruct = StructNew(); // Add the errorDetails to the errorStruct errorStruct.Details = arguments.errorDetails; // Add the serviceName to the errorStruct if ( LEN(TRIM(arguments.serviceName)) ) errorStruct.ServiceName = arguments.serviceName; // Add the methodName to the errorStruct data if ( LEN(TRIM(arguments.methodName)) ) errorStruct.methodName = arguments.methodName; var logFileName = dateFormat(now(), "yyyymmdd") & "." & request.site.name & ".ptSocialMedia_" & arguments.serviceName & "_Errors.htm"; return logFileName;