Changeset 730 for trunk/phpbms/modules/mailchimp/adminsettings.php
- Timestamp:
- 01/07/10 18:13:51 (2 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/modules/mailchimp/adminsettings.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/mailchimp/adminsettings.php
r686 r730 1 1 <?php 2 /* 3 $Rev: 267 $ | $LastChangedBy: brieb $ 4 $LastChangedDate: 2007-08-14 13:08:27 -0600 (Tue, 14 Aug 2007) $ 5 +-------------------------------------------------------------------------+ 6 | Copyright (c) 2004 - 2010, Kreotek LLC | 7 | All rights reserved. | 8 +-------------------------------------------------------------------------+ 9 | | 10 | Redistribution and use in source and binary forms, with or without | 11 | modification, are permitted provided that the following conditions are | 12 | met: | 13 | | 14 | - Redistributions of source code must retain the above copyright | 15 | notice, this list of conditions and the following disclaimer. | 16 | | 17 | - Redistributions in binary form must reproduce the above copyright | 18 | notice, this list of conditions and the following disclaimer in the | 19 | documentation and/or other materials provided with the distribution. | 20 | | 21 | - Neither the name of Kreotek LLC nor the names of its contributore may | 22 | be used to endorse or promote products derived from this software | 23 | without specific prior written permission. | 24 | | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | 28 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 36 | | 37 +-------------------------------------------------------------------------+ 38 */ 2 39 class mailchimpUpdate{ 3 40 4 41 function updateSettings($variables){ 5 42 6 43 if(!isset($variables["mailchimp_secure"])) 7 44 $variables["mailchimp_secure"] = 0; 8 45 9 46 /** 10 47 * Check for a valid api key. … … 12 49 if($variables["apikey_changed"] == "1" && $variables["mailchimp_apikey"] != ""){ 13 50 include_once("include/MCAPI.class.php"); 14 51 15 52 $api = new MCAPI($variables["mailchimp_apikey"]); 16 53 $api->ping(); … … 20 57 return $variables; 21 58 }//end if 22 59 23 60 }//end if 24 25 61 62 26 63 /** 27 * Check for valid list id 64 * Check for valid list id 28 65 */ 29 66 if($variables["apilist_changed"] == "1" && $variables["mailchimp_list_id"] != ""){ 30 67 include_once("include/MCAPI.class.php"); 31 68 32 69 /** 33 70 * Check to see if api is already defined (from a possible api key check) … … 43 80 }//end if 44 81 }//end if 45 82 46 83 /** 47 84 * Look up the lists … … 53 90 return $variables; 54 91 }else{ 55 92 56 93 /** 57 * Check to see if list id is valid 94 * Check to see if list id is valid 58 95 */ 59 96 $validId = false; … … 63 100 break; 64 101 }//endif 65 102 66 103 if(!$validId){ 67 104 unset($variables["mailchimp_list_id"]); … … 69 106 return $variables; 70 107 }else{ 71 72 /** 73 * Check to see if the list has a uuid. 108 109 /** 110 * Check to see if the list has a uuid. 74 111 */ 75 112 $hasUuid = false; … … 82 119 return $variables; 83 120 }//end if 84 121 85 122 $req = array(); 86 123 foreach($mergeVars as $mergeVar){ 87 124 88 125 switch($mergeVar["tag"]){ 89 126 90 127 case "UUID": 91 128 $hasUuid = true; 92 129 break; 93 130 94 131 case "COMPANY": 95 132 $hasCompany = true; 96 133 break; 97 134 98 135 case "TYPE": 99 136 $hasType = true; 100 137 break; 101 138 102 139 }//end switch 103 140 104 141 }//end foreach 105 106 /** 107 * If it doesn't have a uuid field, create it. 142 143 /** 144 * If it doesn't have a uuid field, create it. 108 145 */ 109 146 if(!$hasUuid){ … … 119 156 return $variables; 120 157 }//end if 121 122 }//end if 123 124 /** 125 * If it doesn't have a company field, create it. 158 159 }//end if 160 161 /** 162 * If it doesn't have a company field, create it. 126 163 */ 127 164 if(!$hasCompany){ … … 137 174 return $variables; 138 175 }//end if 139 140 }//end if 141 142 /** 143 * If it doesn't have a type field, create it. 176 177 }//end if 178 179 /** 180 * If it doesn't have a type field, create it. 144 181 */ 145 182 if(!$hasType){ … … 155 192 return $variables; 156 193 }//end if 157 158 }//end if 159 160 161 /** 162 * If the date list id has changed, the last sync date must be reset: 194 195 }//end if 196 197 198 /** 199 * If the date list id has changed, the last sync date must be reset: 163 200 */ 164 201 $variables["mailchimp_last_sync_date"] = ""; 165 202 166 203 }//end if 167 204 168 205 }//end if 169 206 170 207 }//end if 171 208 172 209 return $variables; 173 210 174 211 }//end function 175 176 212 213 177 214 }//end class 178 215 … … 186 223 $theinput = new inputField("mailchimp_apikey",$therecord["mailchimp_apikey"],"mailchimp apikey", false, NULL, 48); 187 224 $fields[] = $theinput; 188 225 189 226 $theinput = new inputCheckbox("mailchimp_secure", $therecord["mailchimp_secure"], "use ssl connection"); 190 227 $fields[] = $theinput; 191 228 192 229 $theinput = new inputField("mailchimp_list_id", $therecord["mailchimp_list_id"], "list id"); 193 230 $fields[] = $theinput; 194 231 195 232 $theinput = new inputField("mailchimp_last_sync_date", $therecord["mailchimp_last_sync_date"], "last sync date"); 196 233 $theinput->setAttribute("class", "uneditable"); … … 207 244 <legend>Main</legend> 208 245 209 246 210 247 <input type="hidden" id="apikey_changed" name="apikey_changed" value="0" /> 211 248 212 249 <p> 213 250 <span class="notes"> … … 216 253 </span> 217 254 </p> 218 255 219 256 <p> 220 257 <?php echo $theform->showField("mailchimp_apikey");?>