public static final function init($reset = false) { $GLOBALS['ApplicationUrl'] = SENDSTUDIO_APPLICATION_URL; if (defined('SENDSTUDIO_IS_SETUP') && SENDSTUDIO_IS_SETUP && !InterspireEvent::eventExists('IEM_MARKER_20090701')) { IEM_Installer::RegisterEventListeners(); require_once IEM_ADDONS_PATH . '/interspire_addons.php'; $addons = new Interspire_Addons(); $addons->FixEnabledEventListeners(); InterspireEvent::eventCreate('IEM_MARKER_20090701'); } if (!self::configInit($reset)) { return false; } if (!self::sessionInit($reset)) { return false; } if (!self::userInit($reset)) { return false; } $tempUser = IEM::getCurrentUser(); $tempUserLanguage = 'default'; if (!empty($tempUser->user_language) && is_dir(IEM_PATH . "/language/{$tempUser->user_language}")) { $tempUserLanguage = $tempUser->user_language; } require_once IEM_PATH . "/language/{$tempUserLanguage}/whitelabel.php"; require_once IEM_PATH . "/language/{$tempUserLanguage}/language.php"; self::$_enableInfoTips = false; if (isset($tempUser->infotips) && $tempUser->infotips) { self::$_enableInfoTips = true; } unset($tempUserLanguage); unset($tempUser); }
/** * RunUpgrade * Runs the reregister_listeners * * @return Boolean Returns TRUE if successful, FALSE otherwise */ function RunUpgrade() { try { // Restore default listeners IEM_Installer::RegisterEventListeners(); // Restore Addons listeners require_once IEM_ADDONS_PATH . '/interspire_addons.php'; $addons = new Interspire_Addons(); $addons->FixEnabledEventListeners(); } catch (Exception $e) { return true; } return true; }
public function Disable() { //$job_check = "SELECT COUNT(jobid) AS jobcount FROM [|PREFIX|]jobs WHERE jobtype='splittest' AND jobstatus NOT IN ('c')"; try { $status = parent::Disable(); } catch (Interspire_Addons_Exception $e) { throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode()); } return true; }
/** * Install * This addon has no settings to it can automatically be configured and enabled when it's installed * * @uses enabled * @uses configured * @uses Interspire_Addons::Install * @uses Interspire_Addons_Exception * * @throws Throws an Interspire_Addons_Exception if something in the install process fails. * @return True Returns true if everything works ok. */ public function Install() { $this->enabled = true; $this->configured = true; try { $status = parent::Install(); } catch (Interspire_Addons_Exception $e) { throw new Exception("Unable to install addon {$this->GetId()} " . $e->getMessage()); } return true; }
/** * Initialize the framework * @param Boolean $reset Whether or not to re-initialize the framework again * @return Boolean Returns TRUE the application initializes without encountering any errors, FALSE otherwise */ public static final function init($reset = false) { $GLOBALS['ApplicationUrl'] = SENDSTUDIO_APPLICATION_URL; // Defining IEM_MARKER in the event is part of the installation procedure // If it is not there, we can assume that the stash file has been overwritten // So we will need to restore it. // TODO change reference to SENSTUDIO_IS_SETUP if (defined('SENDSTUDIO_IS_SETUP') && SENDSTUDIO_IS_SETUP && !InterspireEvent::eventExists('IEM_MARKER_20090701')) { IEM_Installer::RegisterEventListeners(); // Restore Addons listeners require_once IEM_ADDONS_PATH . '/interspire_addons.php'; $addons = new Interspire_Addons(); $addons->FixEnabledEventListeners(); InterspireEvent::eventCreate('IEM_MARKER_20090701'); } if (!self::configInit($reset)) { return false; } if (!self::sessionInit($reset)) { return false; } if (!self::userInit($reset)) { return false; } // ----- Include common language variables $tempUser = IEM::getCurrentUser(); $tempUserLanguage = 'default'; if (!empty($tempUser->user_language) && is_dir(IEM_PATH . "/language/{$tempUser->user_language}")) { $tempUserLanguage = $tempUser->user_language; } require_once IEM_PATH . "/language/{$tempUserLanguage}/whitelabel.php"; require_once IEM_PATH . "/language/{$tempUserLanguage}/language.php"; self::$_enableInfoTips = false; if (isset($tempUser->infotips) && $tempUser->infotips) { self::$_enableInfoTips = true; } unset($tempUserLanguage); unset($tempUser); // ----- }
$format = strtolower(substr($sent_format, 0, 1)); $GLOBALS['recipient_' . $format]++; } else { $this->Stats_API->UpdateRecipient($this->statid, $sent_format, 'n'); } #END_BLOCK_6A# #START_BLOCK_6B# if (isset($GLOBALS['addon_multithread_class'])) { $addon_multithread = $GLOBALS['addon_multithread_class']; if ($mail_result['success'] > 0) { $GLOBALS['multithread_sent']++; } else { $GLOBALS['multithread_failed']++; } } #END_BLOCK_6B# #START_BLOCK_7A# $addon_system = new Interspire_Addons(); $multithread_enabled = $addon_system->isEnabled("multithread"); if ($multithread_enabled && $jobtype == 'send') { return true; } #END_BLOCK_7A# ?> #START_BLOCK_1A# %%GLOBAL_THREAD_SEND_SELECT_THREAD%% #END_BLOCK_1A# #START_BLOCK_3A# %%GLOBAL_THREAD_SEND_SELECT_THREAD_CONFIRM%% #END_BLOCK_3A#
/** * PrintAddonsList * Prints a list of all addons that the system can use. * It works out what step an addon is up to (whether it is configured, enabled, installed or not) and prints an appropriate action * * @uses Interspire_Addons * @uses Interspire_Addons::GetAllAddons * @uses Interspire_Addons::GetAvailableAddons * @uses FlashMessage * @uses GetFlashMessages * * @return String Returns a formatted (table design) list of addons and what they are up to (whether they need to be configured, installed, enabled etc). */ function PrintAddonsList() { require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php'); $addon_system = new Interspire_Addons(); $addons = $addon_system->GetAllAddons(); if (empty($addons)) { FlashMessage(GetLang('Addon_NoAddonsAvailable'), SS_FLASH_MSG_ERROR); $GLOBALS['Message'] .= GetFlashMessages(); return $this->ParseTemplate('Settings_Addons_Empty', true, false); } else { $GLOBALS['Message'] .= GetFlashMessages(); } $addons_status = $addon_system->GetAvailableAddons(); $addons_list = ''; $page = array( 'message' => $GLOBALS['Message'] ); foreach ($addons as $addon_name => $details) { $addons[$addon_name]['name'] = htmlspecialchars($details['name'], ENT_QUOTES, SENDSTUDIO_CHARSET); $addons[$addon_name]['short_name'] = htmlspecialchars($this->TruncateName($details['name']), ENT_QUOTES, SENDSTUDIO_CHARSET); $addons[$addon_name]['description'] = htmlspecialchars($details['description'], ENT_QUOTES, SENDSTUDIO_CHARSET); $addons[$addon_name]['short_description'] = htmlspecialchars($this->TruncateName($details['description']), ENT_QUOTES, SENDSTUDIO_CHARSET); if (isset($addons_status[$addon_name])) { $addons[$addon_name]['install_details'] = $addons_status[$addon_name]; $addons[$addon_name]['need_upgrade'] = (version_compare($details['addon_version'], $addons_status[$addon_name]['addon_version']) == 1); } else { $addons[$addon_name]['install_details'] = false; } } $tpl = GetTemplateSystem(); $tpl->Assign('PAGE', $page); $tpl->Assign('records', $addons); return $tpl->ParseTemplate('Settings_Addons_Display', true); }
$mta_enabled = $addon_system->isEnabled("mta"); if ($mta_enabled) { $addon_mta = $addon_system->Process("mta", "GetApi", "mta"); $addon_mta->iem_log_send_pre($this, $send_results); } #END_BLOCK_5A# #START_BLOCK_5B# $addon_system = new Interspire_Addons(); $mta_enabled = $addon_system->isEnabled("mta"); if ($mta_enabled) { $addon_mta = $addon_system->Process("mta", "GetApi", "mta"); $addon_mta->iem_log_send($this, $send_results); } #END_BLOCK_5B# #START_BLOCK_6A# $addon_system = new Interspire_Addons(); $mta_enabled = $addon_system->isEnabled("mta"); if ($mta_enabled) { $addon_mta = $addon_system->Process("mta", "GetApi", "mta"); $addon_mta->iem_mta_schedule_details($details); } #END_BLOCK_6A# ?> #START_BLOCK_1A# %%GLOBAL_MTA_SEND_SELECT_MTA%% #END_BLOCK_1A# #START_BLOCK_4A# %%GLOBAL_MTA_SEND_SELECT_MTA_CONFIRM%% #END_BLOCK_4A# #START_BLOCK_6B# %%GLOBAL_MTA_SCHEDULE_INFO_TITLE%%
#END_BLOCK_A4_G# #START_BLOCK_A5# $addon_system = new Interspire_Addons(); $spins_enabled = $addon_system->isEnabled("spins"); if ($spins_enabled) { $this->_AssembledEmail['Body']['t'] = null; $this->_AssembledEmail['Body']['h'] = null; } #END_BLOCK_A5# #START_BLOCK_A6# $addon_system = new Interspire_Addons(); $spins_enabled = $addon_system->isEnabled("spins"); if ($spins_enabled) { } else { $extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>'; } #END_BLOCK_A6# #START_BLOCK_3A# if (isset($GLOBALS['addon_spins_class'])) { $addon_spins = $GLOBALS['addon_spins_class']; $addon_system = new Interspire_Addons(); $spins_enabled = $addon_system->isEnabled("spins"); if ($spins_enabled) { $sp = $addon_system->Process("spins", "GetApi", "spins"); $mid = $sp->rotate_url($this->message_id_server); $message_id = 'Message-ID: <' . $semi_rand . '@' . $mid . '>' . $this->_newline; } else { $message_id = 'Message-ID: <' . $semi_rand . '@' . $this->message_id_server . '>' . $this->_newline; } } #END_BLOCK_3A#
/** * Uninstall * This is called when the addon is uninstalled in the main application. * * @uses default_settings * @uses Interspire_Addons::Install * @uses Interspire_Addons_Exception * * @throws Throws an Interspire_Addons_Exception if something goes wrong with the install process. * @return True Returns true if all goes ok with the install. */ public function Uninstall() { // $prefix = $this->db->TablePrefix; // $query[] = "DROP TABLE {$prefix}surveys"; // $query[] = "DROP TABLE {$prefix}survey_questions"; // $query[] = "DROP TABLE {$prefix}survey_templates"; $this->db->StartTransaction(); require_once dirname(__FILE__) . '/schema.' . SENDSTUDIO_DATABASE_TYPE . '.php'; foreach ($tables as $tablename) { $query = 'DROP TABLE [|PREFIX|]' . $tablename . ' CASCADE'; $result = $this->db->Query($query); if (!$result) { $this->db->RollbackTransaction(); throw new Interspire_Addons_Exception("Unable to install addon, query failed: " . $query); } } try { $status = parent::Uninstall(); } catch (Interspire_Addons_Exception $e) { $this->db->RollbackTransaction(); throw new Exception("Unable to uninstall addon {$this->GetId}();" . $e->getMessage()); } $this->db->CommitTransaction(); return true; }
/** * RegisterAddons * Installs a set of add-ons to be enabled after application installation. * * @return Void Does not return anything. */ public function RegisterAddons() { require_once IEM_PATH . '/../addons/interspire_addons.php'; $all_addons = array_keys(Interspire_Addons::GetAllAddons()); // the add-ons we want to be enabled after installation $addons_to_install = array('checkpermissions', 'dbcheck', 'emaileventlog', 'splittest', 'systemlog', 'updatecheck', 'dynamiccontenttags', 'surveys'); $addons_to_install = array_intersect($all_addons, $addons_to_install); foreach ($addons_to_install as $addon) { $this->InstallAddOn($addon); } }
/** * RegisterAddonPermission * This adds the permission details passed in to the static userPermissions array. * This array is then used by GetAddonPermissions to return the permissions it needs based on whether an addon is available/enabled. * Regardless of the addon or permissions you try to set, a super-administrator always has access to it - they cannot be blocked or locked out. * If an addon does not set any permissions, then only a super-administrator will be able to access it through the menu item it creates. * The permissions can be used in conjunction with the menu items to only appear for certain users who have a permission set. * * <code> * $permissions = array ( * 'addon_id' => array ( * 'addon_description' => 'This is the short description for the addon. It comes from the description.xml file.', * 'permission_1' => array ( * 'name' => 'This is the name of the permission. The name is a short description (eg "Create Options")', * 'help' => 'This is the help tip description if it needs one. If one is not supplied, a help tip icon is not shown next to the permission' * ), * 'permission_2' => array ( * 'name' => 'This is another permission (eg "Edit Options"). It does not have a helptip' * ), * 'permission_3' => array ( * 'name' => 'This is a 3rd permission (eg "Delete Options"). It does have a helptip', * 'help' => 'This is the helptip for the 3rd permission' * ), * ) * ); * </code> * * The permissions are checked like: * * <code> * $access_ok = $user->HasAccess('addon_id', 'permission_1'); * if (!$access_ok) { * echo "Permission denied"; * } else { * echo "Permission granted"; * } * </code> * * @param Array $permissions The new permissions to include for the addon. * * @uses userPermissions * @see GetEventListeners * @see User_API::GrantAccess * @see User_API::RevokeAccess * @see User_API::HasAccess * @see GetMenuItems * @see RegisterMenuItems */ static function RegisterAddonPermission($permissions = array()) { self::$userPermissions = array_merge(self::$userPermissions, $permissions); }
/** * Disable * This disables the split test addon from the control panel. * Before it does it, it checks for any non-complete split test sending jobs * If any are found, the addon cannot be disabled. * * If that's ok, it deletes itself from the settings_cron_schedule table and any other settings it created (config_settings table). * * @uses Interspire_Addons::Disable * @uses Interspire_Addons_Exception * * @return Returns true if the addon was disabled successfully and there are no pending/in progress split test sends. * @throws If the parent::Disable method throws an exception, this will just re-throw that error. */ public function Disable() { $job_check = "SELECT COUNT(jobid) AS jobcount FROM [|PREFIX|]jobs WHERE jobtype='splittest' AND jobstatus NOT IN ('c')"; $count = $this->db->FetchOne($job_check); if ($count > 0) { throw new Interspire_Addons_Exception(GetLang('Addon_splittest_DisableFailed_SendsInProgress')); } $this->db->StartTransaction(); $result = $this->db->Query("DELETE FROM [|PREFIX|]settings_cron_schedule WHERE jobtype='" . $this->db->Quote($this->addon_id) . "'"); if (!$result) { $this->db->RollbackTransaction(); } $result = $this->db->Query("DELETE FROM [|PREFIX|]config_settings WHERE area='" . $this->db->Quote(strtoupper('CRON_' . $this->addon_id)) . "'"); if (!$result) { $this->db->RollbackTransaction(); } $this->db->CommitTransaction(); try { $status = parent::Disable(); } catch (Interspire_Addons_Exception $e) { throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode()); } return true; }
/** * Save * This function saves the current class vars to the settings file. * It checks to make sure the file is writable, then places the appropriate values in there and saves it. It uses a temporary name then copies that over the top of the old one, then removes the temporary file. * * @return Boolean Returns true if it worked, false if it fails. */ function Save() { require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php'); if (!is_writable($this->ConfigFile)) { return false; } $tmpfname = tempnam(TEMP_DIRECTORY, 'SS_'); if (!$handle = fopen($tmpfname, 'w')) { return false; } $copy = true; if (is_file(TEMP_DIRECTORY . '/config.prev.php')) { if (!@unlink(TEMP_DIRECTORY . '/config.prev.php')) { $copy = false; } } if ($copy) { @copy($this->ConfigFile, TEMP_DIRECTORY . '/config.prev.php'); } // the old config backups were in the includes folder so try to clean them up as part of this process. $config_prev = SENDSTUDIO_INCLUDES_DIRECTORY . '/config.prev.php'; if (is_file($config_prev)) { @unlink($config_prev); } $contents = "<?php\n\n"; gmt($this); $areas = $this->Areas; foreach ($areas['config'] as $area) { // See self::LoadSettings() on UTF8PATCH settings if ($area == 'DATABASE_UTF8PATCH') { if (!defined('SENDSTUDIO_DATABASE_UTF8PATCH')) { define('SENDSTUDIO_DATABASE_UTF8PATCH', 1); } $contents .= "define('SENDSTUDIO_DATABASE_UTF8PATCH', '" . SENDSTUDIO_DATABASE_UTF8PATCH . "');\n"; continue; } $string = 'define(\'SENDSTUDIO_' . $area . '\', \'' . addslashes($this->Settings[$area]) . '\');' . "\n"; $contents .= $string; } $contents .= "define('SENDSTUDIO_IS_SETUP', 1);\n"; if (!defined('SENDSTUDIO_DEFAULTCHARSET')) { define('SENDSTUDIO_DEFAULTCHARSET', 'UTF-8'); } $contents .= "define('SENDSTUDIO_DEFAULTCHARSET', '" . SENDSTUDIO_DEFAULTCHARSET . "');\n"; $contents .= "\n\n"; fputs($handle, $contents, strlen($contents)); fclose($handle); chmod($tmpfname, 0644); if (!copy($tmpfname, $this->ConfigFile)) { return false; } unlink($tmpfname); $copy = true; if (is_file(TEMP_DIRECTORY . '/config.bkp.php')) { if (!@unlink(TEMP_DIRECTORY . '/config.bkp.php')) { $copy = false; } } if ($copy) { @copy($this->ConfigFile, TEMP_DIRECTORY . '/config.bkp.php'); } // the old config backups were in the includes folder so try to clean them up as part of this process. $config_bkp = SENDSTUDIO_INCLUDES_DIRECTORY . '/config.bkp.php'; if (is_file($config_bkp)) { @unlink($config_bkp); } unset($areas['config']); if (defined('APPLICATION_SHOW_WHITELABEL_MENU') && constant('APPLICATION_SHOW_WHITELABEL_MENU')) { $query = "DELETE FROM " . SENDSTUDIO_TABLEPREFIX . "whitelabel_settings"; $result = $this->Db->Query($query); foreach ($areas['whitelabel'] as $area) { // If settings are not set, do not continue if (!isset($this->Settings[$area])) { continue; } $value = $this->Settings[$area]; if (strtolower($area) == 'update_check_enabled') { $subAction = 'uninstall'; if ($value == '1') { $subAction = 'install'; } $result = Interspire_Addons::Process('updatecheck', $subAction, array()); continue; } elseif (strtolower($area) == 'lng_accountupgrademessage') { $agencyId = get_agency_license_variables(); if(empty($agencyId['agencyid'])) { continue; } } if (is_bool($value)) { $value = (int)$value; } $query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "whitelabel_settings(name, value) VALUES ('" . $this->Db->Quote($area) . "', '" . $this->Db->Quote($value) . "')"; $result = $this->Db->Query($query); } if ($this->WhiteLabelCache->exists('IEM_SETTINGS_WHITELABEL')) { $this->WhiteLabelCache->remove('IEM_SETTINGS_WHITELABEL'); } } if (isset($areas['whitelabel'])) { unset($areas['whitelabel']); } $stash = IEM_InterspireStash::getInstance(); if ($stash->exists('IEM_SYSTEM_SETTINGS')) { $stash->remove('IEM_SYSTEM_SETTINGS'); } $query = "DELETE FROM " . SENDSTUDIO_TABLEPREFIX . "config_settings"; $result = $this->Db->Query($query); foreach ($areas as $area) { $value = isset($this->Settings[$area]) ? $this->Settings[$area] : ''; if ($area == 'SYSTEM_DATABASE_VERSION') { $value = $this->Db->FetchOne("SELECT version() AS version"); } if (is_bool($value)) { $value = (int)$value; } $query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "config_settings(area, areavalue) VALUES ('" . $this->Db->Quote($area) . "', '" . $this->Db->Quote($value) . "')"; $result = $this->Db->Query($query); } return true; }
define('SENDSTUDIO_APPLICATION_URL', false); define('SENDSTUDIO_LICENSEKEY', false); define('SENDSTUDIO_DEFAULTCHARSET', 'UTF-8'); } /** * If the app is set up, we can include the addons and also the storage interfaces. * Once we have included those, we need to include the event system. * * We need to include the addon system first so the storage/event systems have the class/objects they need to work with. * * Then, include the database files and set up the db connection. * This is done before including the user object so the database object is 'complete' and not invalid. */ if (SENDSTUDIO_IS_SETUP) { require_once SENDSTUDIO_BASE_DIRECTORY . '/addons/interspire_addons.php'; Interspire_Addons::SetUrl(SENDSTUDIO_APPLICATION_URL . '/admin'); require_once SENDSTUDIO_API_DIRECTORY . '/settings.php'; $settings_api = new Settings_API(); } // SENDSTUDIO_SERVERTIMEZONE is no longer stored in database, rather it will be defined here pending deprecation // TODO depracate in favour of IEM framework if (!defined('SENDSTUDIO_SERVERTIMEZONE')) { $tempTimeZone = preg_replace('/^([+-])0?(\\d{1,2})(\\d\\d)/', '$1$2:$3', date('O')); if ($tempTimeZone == '+0:00') { $tempTimeZone = ''; } define('SENDSTUDIO_SERVERTIMEZONE', "GMT{$tempTimeZone}"); } if (SENDSTUDIO_IS_SETUP) { require_once IEM_PATH . '/ext/interspire_log/interspire_log.php'; if (!IEM::isUpgrading()) {
public function Disable() { try { $status = parent::Disable(); } catch (Interspire_Addons_Exception $e) { throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode()); } return true; }
/** * Process * Process does the basic work to figure out: * - which addon you're trying to access (and whether it exists & is active/enabled) * - whether you have access to perform that action * - whether to print a header/footer or not * * Then hands control over to the addon itself to do the rest. * * @uses HasAccess * @uses Interspire_Addons * @uses Interspire_Addons::GetAvailableAddons * @uses Interspire_Addons::Process * * @return Void Doesn't return anything. */ function Process() { // if we're not viewing an addon, then show an "access denied" message // there's no way to view a list of addons to run // they all have to appear in a menu somewhere. if (!isset($_GET['Addon'])) { $this->DenyAccess(); return; } /** * print_header tells us whether to print the header/footer at all. */ $print_header = true; /** * popup_header tells us whether it's a popup window or not. * If it's a full window, that includes the nav menus etc. * If it's a popup window, then none of that is shown. */ $popup_header = false; $get_keywords = array_map('strtolower', array_keys($_GET)); /** * See if the 'ajax' keyword is used in the get string anywhere as a key. * If it is, don't show the header/footer. */ if (in_array('ajax', $get_keywords)) { $print_header = false; } /** * See if the 'popup' keyword is used in the get string anywhere as a key. * If it is, show the popup header/footer. */ if (in_array('popup', $get_keywords)) { $popup_header = true; } if ($print_header) { $this->PrintHeader($popup_header); } $addon = strtolower($_GET['Addon']); require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php'); $addon_system = new Interspire_Addons(); $addons = $addon_system->GetAvailableAddons(); if (!isset($addons[$addon])) { $this->DenyAccess(); if ($print_header) { $this->PrintFooter($popup_header); } return; } $action = 'Default'; if (isset($_GET['Action']) && $_GET['Action'] !== '') { $action = $_GET['Action']; } /** * Check the user has access to this addon and what you are trying to do. * The first argument is always the addon id (eg 'surveys'). * * The second argument is the action you are trying to perform. * eg 'create', 'edit', 'delete', 'stats' * This must match up to the methods in the addon itself * eg if you're trying to get the addon to create something, the permission is 'create' and the addon method must be 'Admin_Create_Action' * */ $user = IEM::GetCurrentUser(); $admin_action = $action; if ($admin_action == 'Default') { $admin_action = null; } if(!is_null($admin_action)){$admin_action = strtolower($admin_action);} // Survey permission addon... added in the group now foreach ($user->group->permissions as $perm_key => &$perm ) { if ($perm_key == 'surveys') { $perm[] = "submit"; $perm[] = "tinymcesurveylist"; foreach ($perm as $perm_action) { switch ($perm_action): case 'create': $perm[] = "build"; $perm[] = "save"; break; case 'viewresponsesdefault': $perm[] = "viewresponses"; $perm[] = "downloadattach"; break; case 'editresponse': $perm[] = "saveresponse"; $perm[] = "downloadattach"; case 'exportdefault': $perm[] = "export"; case 'resultdefault': $perm[] = "result"; $perm[] = "result_responseslist"; break; endswitch; } } } // Check if addon is enabled or disabled if (!$addon_system->isEnabled($addon)) { $this->DenyAccess(); } if (!is_null($admin_action)) { $access = $user->HasAccess($addon, $admin_action); if(!$access){ $this->DenyAccess(); if ($print_header) {$this->PrintFooter($popup_header);} return; } } else { $access = $user->HasAccess($addon); if(!$access){ $this->DenyAccess(); if ($print_header) {$this->PrintFooter($popup_header);} return; } } try { if(is_null($action)){$action = "Default";} $result = Interspire_Addons::Process($addon, 'Admin_Action_'.$action); echo $result; } catch (Exception $e) { echo "Error!: " . $e->getMessage(); } if ($print_header) { $this->PrintFooter($popup_header); } }
/** * UnInstall * Drop tables the addon created. * It includes the schema files (based on the database type) and drops the bits it created. * Once that's done, it calls the parent UnInstall method to do its work. * * @uses Interspire_Addons::UnInstall * @uses Interspire_Addons_Exception * * @return Returns true if the addon was uninstalled successfully. * @throws Throws an Interspire_Addons_Exception::DatabaseError if one of the tables it created couldn't be removed. If the parent::UnInstall method throws an exception, this will * just re-throw that error. */ public function UnInstall() { $tables = $sequences = array(); $this->db->StartTransaction(); try { $this->Disable(); } catch (Interspire_Addons_Exception $e) { $this->db->RollbackTransaction(); throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode()); } require dirname(__FILE__) . '/schema.' . SENDSTUDIO_DATABASE_TYPE . '.php'; foreach ($tables as $tablename) { $query = 'DROP TABLE [|PREFIX|]' . $tablename . ' CASCADE'; $result = $this->db->Query($query); if (!$result) { $this->db->RollbackTransaction(); throw new Interspire_Addons_Exception("There was a problem running query " . $query . ": " . $this->db->GetErrorMsg(), Interspire_Addons_Exception::DatabaseError); } } foreach ($sequences as $sequencename) { $query = 'DROP SEQUENCE [|PREFIX|]' . $sequencename; $result = $this->db->Query($query); if (!$result) { $this->db->RollbackTransaction(); throw new Interspire_Addons_Exception("There was a problem running query " . $query . ": " . $this->db->GetErrorMsg(), Interspire_Addons_Exception::DatabaseError); } } try { $status = parent::UnInstall(); } catch (Interspire_Addons_Exception $e) { $this->db->RollbackTransaction(); throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode()); } $this->db->CommitTransaction(); return true; }
$social_enabled = $addon_system->isEnabled("social"); if ($social_enabled) { $addon_social = $addon_system->Process("social", "GetApi", "social"); $GLOBALS['NetworksPage'] = $addon_social->stats($statid, $summary); } #END_BLOCK_2# #START_BLOCK_4A# $addon_system = new Interspire_Addons(); $social_enabled = $addon_system->isEnabled("social"); if ($social_enabled) { $addon_social = $addon_system->Process("social", "GetApi", "social"); $addon_social->replace_in_mail($text, $web_version_link, $this->SentBy, $this->Subject); } #END_BLOCK_4A# #START_BLOCK_4B# $addon_system = new Interspire_Addons(); $social_enabled = $addon_system->isEnabled("social"); if ($social_enabled) { $addon_social = $addon_system->Process("social", "GetApi", "social"); if ($addon_social->ignore_patterns($url)) { continue; } } #END_BLOCK_4B# #START_BLOCK_EMAIL2# if (preg_match('/%%sendfriend_(.*)%%/i', $url)) { continue; } if (preg_match("/(%%SURVEY.*?%%)/isx", $url)) { continue; }