| 1 |
<?php
|
| 2 |
// $Id: pageear.install,v 1.13 2009/10/29 19:37:43 manfer Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install file.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_install().
|
| 11 |
*/
|
| 12 |
function pageear_install() {
|
| 13 |
|
| 14 |
$result = drupal_install_schema('pageear');
|
| 15 |
|
| 16 |
if ($result[0]['success']) {
|
| 17 |
// Insert an example pageear
|
| 18 |
$sql = "INSERT INTO {pageears} (status, name, peelPosition, smallURL, bigURL, mirror, inTransition, transitionDuration, peelColor, redValue, greenValue, blueValue, linkTarget, link, loadSoundURL, openSoundURL, closeSoundURL, flagSpeed, peelSpeed, automaticOpen, automaticClose, close_button_enable, text_on_close_button, close_redValue, close_greenValue, close_blueValue, languages, roles, visibility, pages, flagWidth, flagHeight, peelWidth, peelHeight, flagStyle, peelStyle, peelColorStyle, weight, linkEnabled, peelPositionModel, waitEnable, waitURL, waitWidth, waitHeight)";
|
| 19 |
$sql .= " VALUES ('%d', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%s', '%d', '%d')";
|
| 20 |
$result = db_query($sql,
|
| 21 |
array(
|
| 22 |
':status' => 0,
|
| 23 |
':name' => 'drupal',
|
| 24 |
':peelPosition' => 'topright',
|
| 25 |
':smallURL' => drupal_get_path('module', 'pageear') .'/pageturn/small.jpg',
|
| 26 |
':bigURL' => drupal_get_path('module', 'pageear') .'/pageturn/big.jpg',
|
| 27 |
':mirror' => 1,
|
| 28 |
':inTransition' => 'Squeeze',
|
| 29 |
':transitionDuration' => 4,
|
| 30 |
':peelColor' => 'custom',
|
| 31 |
':redValue' => 255,
|
| 32 |
':greenValue' => 255,
|
| 33 |
':blueValue' => 255,
|
| 34 |
':linkTarget' => '_blank',
|
| 35 |
':link' => 'http://www.drupal.org/',
|
| 36 |
':loadSoundURL' => '',
|
| 37 |
':openSoundURL' => '',
|
| 38 |
':closeSoundURL' => '',
|
| 39 |
':flagSpeed' => 4,
|
| 40 |
':peelSpeed' => 4,
|
| 41 |
':automaticOpen' => 0,
|
| 42 |
':automaticClose' => 0,
|
| 43 |
':close_button_enable' => 0,
|
| 44 |
':text_on_close_button' => 'close',
|
| 45 |
':close_redValue' => 100,
|
| 46 |
':close_greenValue' => 100,
|
| 47 |
':close_blueValue' => 100,
|
| 48 |
':languages' => '',
|
| 49 |
':roles' => '',
|
| 50 |
':visibility' => 0,
|
| 51 |
':pages' => '',
|
| 52 |
':flagWidth' => 100,
|
| 53 |
':flagHeight' => 100,
|
| 54 |
':peelWidth' => 500,
|
| 55 |
':peelHeight' => 500,
|
| 56 |
':flagStyle' => 'style1',
|
| 57 |
':peelStyle' => 'style1',
|
| 58 |
':peelColorStyle' => 'gradient',
|
| 59 |
':weight' => 0,
|
| 60 |
':linkEnabled' => 1,
|
| 61 |
':peelPositionModel' => 'absolute',
|
| 62 |
':waitEnable' => 0,
|
| 63 |
':waitURL' => drupal_get_path('module', 'pageear') .'/pageturn/wait.gif',
|
| 64 |
':waitWidth' => 42,
|
| 65 |
':waitHeight' => 42
|
| 66 |
));
|
| 67 |
|
| 68 |
}
|
| 69 |
}
|
| 70 |
|
| 71 |
|
| 72 |
/**
|
| 73 |
* Implementation of hook_enable().
|
| 74 |
*/
|
| 75 |
function pageear_enable() {
|
| 76 |
// Update the persistent variable numEnabledPageears that tracks number of pageears enabled
|
| 77 |
variable_set('numEnabledPageears', 0);
|
| 78 |
}
|
| 79 |
|
| 80 |
/**
|
| 81 |
* Implementation of hook_disable().
|
| 82 |
*/
|
| 83 |
function pageear_disable() {
|
| 84 |
// Disable all enabled pageears if the module is disabled.
|
| 85 |
db_query("UPDATE {pageears} SET status = 0 WHERE status = 1");
|
| 86 |
|
| 87 |
// Update the persistent variable numEnabledPageears that tracks number of pageears enabled
|
| 88 |
variable_set('numEnabledPageears', 0);
|
| 89 |
}
|
| 90 |
|
| 91 |
/**
|
| 92 |
* Deletes images and sounds used by pageears.
|
| 93 |
*/
|
| 94 |
function delete_all_images_sounds() {
|
| 95 |
|
| 96 |
$directory_path = file_directory_path() .'/'. PAGEEAR_PATH_IMAGES;
|
| 97 |
// if the directory where files reside does not exists nothing to do
|
| 98 |
if (!file_check_directory($directory_path)) {
|
| 99 |
return;
|
| 100 |
}
|
| 101 |
|
| 102 |
$result = db_query("SELECT p.peid FROM {pageears} p");
|
| 103 |
while ($row = db_fetch_object($result)) {
|
| 104 |
|
| 105 |
foreach (array('waitURL', 'smallURL', 'bigURL', 'loadSoundURL', 'openSoundURL', 'closeSoundURL') as $image_sound) {
|
| 106 |
|
| 107 |
if ($image_sound == 'waitURL' || $image_sound == 'smallURL' || $image_sound == 'bigURL') {
|
| 108 |
$extensions = array('.jpg', '.jpeg', '.gif', '.png', '.swf');
|
| 109 |
}
|
| 110 |
else {
|
| 111 |
$extensions = array('.mp3');
|
| 112 |
}
|
| 113 |
|
| 114 |
foreach ($extensions as $extension) {
|
| 115 |
|
| 116 |
$filename = $directory_path .'/'. $image_sound .'_'. $row->peid;
|
| 117 |
$filepath = $filename . $extension;
|
| 118 |
file_delete($filepath);
|
| 119 |
|
| 120 |
$i = 0;
|
| 121 |
$filepath = $filename .'_'. $i . $extension;
|
| 122 |
while (file_delete($filepath)) {
|
| 123 |
$i += 1;
|
| 124 |
$filepath = $filename .'_'. $i . $extension;
|
| 125 |
}
|
| 126 |
|
| 127 |
}
|
| 128 |
|
| 129 |
}
|
| 130 |
|
| 131 |
}
|
| 132 |
|
| 133 |
}
|
| 134 |
|
| 135 |
/**
|
| 136 |
* Implementation of hook_uninstall().
|
| 137 |
*/
|
| 138 |
function pageear_uninstall() {
|
| 139 |
// Delete all images and sounds used by pageear
|
| 140 |
delete_all_images_sounds();
|
| 141 |
// Delete persistent variables.
|
| 142 |
variable_del('numEnabledPageears');
|
| 143 |
variable_del('current_topleft_pageear');
|
| 144 |
variable_del('current_topright_pageear');
|
| 145 |
// Drop the associated schema(s).
|
| 146 |
drupal_uninstall_schema('pageear');
|
| 147 |
}
|
| 148 |
|
| 149 |
/**
|
| 150 |
* Implementation of hook_schema().
|
| 151 |
*/
|
| 152 |
function pageear_schema() {
|
| 153 |
$schema['pageears'] = array(
|
| 154 |
'description' => 'Stores pageear settings.',
|
| 155 |
'fields' => array(
|
| 156 |
'peid' => array(
|
| 157 |
'type' => 'serial',
|
| 158 |
'not null' => TRUE,
|
| 159 |
'description' => 'Primary Key: Unique pageear ID.',
|
| 160 |
),
|
| 161 |
'weight' => array(
|
| 162 |
'type' => 'int',
|
| 163 |
'not null' => TRUE,
|
| 164 |
'default' => 0,
|
| 165 |
'size' => 'tiny',
|
| 166 |
),
|
| 167 |
'status' => array(
|
| 168 |
'type' => 'int',
|
| 169 |
'not null' => TRUE,
|
| 170 |
'default' => 0,
|
| 171 |
'size' => 'tiny',
|
| 172 |
'description' => 'Pageear enabled status. (1 = enabled, 0 = disabled).',
|
| 173 |
),
|
| 174 |
'name' => array(
|
| 175 |
'type' => 'varchar',
|
| 176 |
'length' => 64,
|
| 177 |
'not null' => TRUE,
|
| 178 |
'default' => 'Sample Pageear',
|
| 179 |
'description' => 'Name of the pageear. The name will be added to the pageear class to enable custom theming.',
|
| 180 |
),
|
| 181 |
'flagStyle' => array(
|
| 182 |
'type' => 'varchar',
|
| 183 |
'length' => 7,
|
| 184 |
'not null' => TRUE,
|
| 185 |
'default' => 'style1',
|
| 186 |
'description' => 'Style of flag.',
|
| 187 |
),
|
| 188 |
'peelStyle' => array(
|
| 189 |
'type' => 'varchar',
|
| 190 |
'length' => 7,
|
| 191 |
'not null' => TRUE,
|
| 192 |
'default' => 'style1',
|
| 193 |
'description' => 'Style of peel.',
|
| 194 |
),
|
| 195 |
'peelPosition' => array(
|
| 196 |
'type' => 'varchar',
|
| 197 |
'length' => 9,
|
| 198 |
'not null' => TRUE,
|
| 199 |
'default' => 'topright',
|
| 200 |
'description' => 'Position of pageear. In left or right top browser corner (topleft: left, topright: right).',
|
| 201 |
),
|
| 202 |
'peelPositionModel' => array(
|
| 203 |
'type' => 'varchar',
|
| 204 |
'length' => 9,
|
| 205 |
'not null' => TRUE,
|
| 206 |
'default' => 'absolute',
|
| 207 |
'description' => 'Position Model of pageear. (absolute or fixed).',
|
| 208 |
),
|
| 209 |
'waitEnable' => array(
|
| 210 |
'type' => 'int',
|
| 211 |
'not null' => TRUE,
|
| 212 |
'default' => 0,
|
| 213 |
'size' => 'tiny',
|
| 214 |
'description' => 'Wait icon enabled status. (1 = enabled, 0 = disabled).',
|
| 215 |
),
|
| 216 |
'waitURL' => array(
|
| 217 |
'type' => 'varchar',
|
| 218 |
'length' => 255,
|
| 219 |
'not null' => TRUE,
|
| 220 |
'default' => '',
|
| 221 |
'description' => 'URL of the image to show while the ad is loading.',
|
| 222 |
),
|
| 223 |
'waitWidth' => array(
|
| 224 |
'type' => 'int',
|
| 225 |
'unsigned' => TRUE,
|
| 226 |
'not null' => TRUE,
|
| 227 |
'default' => 42,
|
| 228 |
'size' => 'normal',
|
| 229 |
'description' => 'Width of wait icon.',
|
| 230 |
),
|
| 231 |
'waitHeight' => array(
|
| 232 |
'type' => 'int',
|
| 233 |
'unsigned' => TRUE,
|
| 234 |
'not null' => TRUE,
|
| 235 |
'default' => 42,
|
| 236 |
'size' => 'normal',
|
| 237 |
'description' => 'Height of wait icon.',
|
| 238 |
),
|
| 239 |
'flagWidth' => array(
|
| 240 |
'type' => 'int',
|
| 241 |
'unsigned' => TRUE,
|
| 242 |
'not null' => TRUE,
|
| 243 |
'default' => 100,
|
| 244 |
'size' => 'normal',
|
| 245 |
'description' => 'Width of flag.',
|
| 246 |
),
|
| 247 |
'flagHeight' => array(
|
| 248 |
'type' => 'int',
|
| 249 |
'unsigned' => TRUE,
|
| 250 |
'not null' => TRUE,
|
| 251 |
'default' => 100,
|
| 252 |
'size' => 'normal',
|
| 253 |
'description' => 'Height of flag.',
|
| 254 |
),
|
| 255 |
'peelWidth' => array(
|
| 256 |
'type' => 'int',
|
| 257 |
'unsigned' => TRUE,
|
| 258 |
'not null' => TRUE,
|
| 259 |
'default' => 500,
|
| 260 |
'size' => 'normal',
|
| 261 |
'description' => 'Width of peel.',
|
| 262 |
),
|
| 263 |
'peelHeight' => array(
|
| 264 |
'type' => 'int',
|
| 265 |
'unsigned' => TRUE,
|
| 266 |
'not null' => TRUE,
|
| 267 |
'default' => 500,
|
| 268 |
'size' => 'normal',
|
| 269 |
'description' => 'Height of peel.',
|
| 270 |
),
|
| 271 |
'smallURL' => array(
|
| 272 |
'type' => 'varchar',
|
| 273 |
'length' => 255,
|
| 274 |
'not null' => TRUE,
|
| 275 |
'default' => '',
|
| 276 |
'description' => 'URL of the image to show when the ad is not peeled.',
|
| 277 |
),
|
| 278 |
'bigURL' => array(
|
| 279 |
'type' => 'varchar',
|
| 280 |
'length' => 255,
|
| 281 |
'not null' => TRUE,
|
| 282 |
'default' => '',
|
| 283 |
'description' => 'URL of the image to show when the ad is peeled.',
|
| 284 |
),
|
| 285 |
'mirror' => array(
|
| 286 |
'type' => 'int',
|
| 287 |
'not null' => TRUE,
|
| 288 |
'default' => 1,
|
| 289 |
'size' => 'tiny',
|
| 290 |
'description' => 'Mirror the ad on the back of the peeled page. (1 = enabled, 0 = disabled).',
|
| 291 |
),
|
| 292 |
'inTransition' => array(
|
| 293 |
'type' => 'varchar',
|
| 294 |
'length' => 15,
|
| 295 |
'not null' => TRUE,
|
| 296 |
'default' => 'none',
|
| 297 |
'description' => 'In Transition when pageear is loaded.',
|
| 298 |
),
|
| 299 |
'transitionDuration' => array(
|
| 300 |
'type' => 'int',
|
| 301 |
'unsigned' => TRUE,
|
| 302 |
'not null' => TRUE,
|
| 303 |
'default' => 4,
|
| 304 |
'size' => 'tiny',
|
| 305 |
'description' => 'Duration of in transition.',
|
| 306 |
),
|
| 307 |
'peelColorStyle' => array(
|
| 308 |
'type' => 'varchar',
|
| 309 |
'length' => 9,
|
| 310 |
'not null' => TRUE,
|
| 311 |
'default' => 'gradient',
|
| 312 |
'description' => 'The color on peel can be a flat color or a gradient.',
|
| 313 |
),
|
| 314 |
'peelColor' => array(
|
| 315 |
'type' => 'varchar',
|
| 316 |
'length' => 7,
|
| 317 |
'not null' => TRUE,
|
| 318 |
'default' => 'custom',
|
| 319 |
'description' => 'If the mirror effect is disabled, this color will be used on the back.',
|
| 320 |
),
|
| 321 |
'redValue' => array(
|
| 322 |
'type' => 'int',
|
| 323 |
'unsigned' => TRUE,
|
| 324 |
'not null' => TRUE,
|
| 325 |
'default' => 255,
|
| 326 |
'size' => 'tiny',
|
| 327 |
'description' => 'Red value of Custom Color for the Peel (0 - 255).',
|
| 328 |
),
|
| 329 |
'greenValue' => array(
|
| 330 |
'type' => 'int',
|
| 331 |
'unsigned' => TRUE,
|
| 332 |
'not null' => TRUE,
|
| 333 |
'default' => 255,
|
| 334 |
'size' => 'tiny',
|
| 335 |
'description' => 'Green value of Custom Color for the Peel (0 - 255).',
|
| 336 |
),
|
| 337 |
'blueValue' => array(
|
| 338 |
'type' => 'int',
|
| 339 |
'unsigned' => TRUE,
|
| 340 |
'not null' => TRUE,
|
| 341 |
'default' => 255,
|
| 342 |
'size' => 'tiny',
|
| 343 |
'description' => 'Blue value of Custom Color for the Peel (0 - 255).',
|
| 344 |
),
|
| 345 |
'linkEnabled' => array(
|
| 346 |
'type' => 'int',
|
| 347 |
'not null' => TRUE,
|
| 348 |
'default' => 1,
|
| 349 |
'size' => 'tiny',
|
| 350 |
'description' => 'Enabled or disabled link. (1 = enabled, 0 = disabled).',
|
| 351 |
),
|
| 352 |
'linkTarget' => array(
|
| 353 |
'type' => 'varchar',
|
| 354 |
'length' => 7,
|
| 355 |
'not null' => TRUE,
|
| 356 |
'default' => '_blank',
|
| 357 |
'description' => 'Where to open the URL.',
|
| 358 |
),
|
| 359 |
'link' => array(
|
| 360 |
'type' => 'varchar',
|
| 361 |
'length' => 255,
|
| 362 |
'not null' => TRUE,
|
| 363 |
'default' => 'http://www.drupal.org/',
|
| 364 |
'description' => 'URL to go when user click on the ad.',
|
| 365 |
),
|
| 366 |
'loadSoundURL' => array(
|
| 367 |
'type' => 'varchar',
|
| 368 |
'length' => 255,
|
| 369 |
'not null' => TRUE,
|
| 370 |
'default' => '',
|
| 371 |
'description' => 'URL of mp3 file to play when the ad is loaded.',
|
| 372 |
),
|
| 373 |
'openSoundURL' => array(
|
| 374 |
'type' => 'varchar',
|
| 375 |
'length' => 255,
|
| 376 |
'not null' => TRUE,
|
| 377 |
'default' => '',
|
| 378 |
'description' => 'URL of mp3 file to play when the peel is opened.',
|
| 379 |
),
|
| 380 |
'closeSoundURL' => array(
|
| 381 |
'type' => 'varchar',
|
| 382 |
'length' => 255,
|
| 383 |
'not null' => TRUE,
|
| 384 |
'default' => '',
|
| 385 |
'description' => 'URL of mp3 file to play when the peel is closed.',
|
| 386 |
),
|
| 387 |
'flagSpeed' => array(
|
| 388 |
'type' => 'int',
|
| 389 |
'unsigned' => TRUE,
|
| 390 |
'not null' => TRUE,
|
| 391 |
'default' => 4,
|
| 392 |
'size' => 'tiny',
|
| 393 |
'description' => 'Speed for the motion in the unpeeled state.',
|
| 394 |
),
|
| 395 |
'peelSpeed' => array(
|
| 396 |
'type' => 'int',
|
| 397 |
'unsigned' => TRUE,
|
| 398 |
'not null' => TRUE,
|
| 399 |
'default' => 4,
|
| 400 |
'size' => 'tiny',
|
| 401 |
'description' => 'Speed for the motion in the peeled state.',
|
| 402 |
),
|
| 403 |
'automaticOpen' => array(
|
| 404 |
'type' => 'int',
|
| 405 |
'unsigned' => TRUE,
|
| 406 |
'not null' => TRUE,
|
| 407 |
'default' => 0,
|
| 408 |
'size' => 'normal',
|
| 409 |
'description' => 'Millisecons to unpeel automatically after the pageear loads.',
|
| 410 |
),
|
| 411 |
'automaticClose' => array(
|
| 412 |
'type' => 'int',
|
| 413 |
'unsigned' => TRUE,
|
| 414 |
'not null' => TRUE,
|
| 415 |
'default' => 0,
|
| 416 |
'size' => 'normal',
|
| 417 |
'description' => 'Millisecons to automatically close after unpeeling.',
|
| 418 |
),
|
| 419 |
'close_button_enable' => array(
|
| 420 |
'type' => 'int',
|
| 421 |
'not null' => TRUE,
|
| 422 |
'default' => 0,
|
| 423 |
'size' => 'tiny',
|
| 424 |
'description' => 'Show a close button on open peel.',
|
| 425 |
),
|
| 426 |
'text_on_close_button' => array(
|
| 427 |
'type' => 'varchar',
|
| 428 |
'length' => 20,
|
| 429 |
'not null' => TRUE,
|
| 430 |
'default' => 'close',
|
| 431 |
'description' => 'Text on clickable close button.',
|
| 432 |
),
|
| 433 |
'close_redValue' => array(
|
| 434 |
'type' => 'int',
|
| 435 |
'unsigned' => TRUE,
|
| 436 |
'not null' => TRUE,
|
| 437 |
'default' => 255,
|
| 438 |
'size' => 'tiny',
|
| 439 |
'description' => 'Color red value of close button (0 - 255).',
|
| 440 |
),
|
| 441 |
'close_greenValue' => array(
|
| 442 |
'type' => 'int',
|
| 443 |
'unsigned' => TRUE,
|
| 444 |
'not null' => TRUE,
|
| 445 |
'default' => 255,
|
| 446 |
'size' => 'tiny',
|
| 447 |
'description' => 'Color green value of close button (0 - 255).',
|
| 448 |
),
|
| 449 |
'close_blueValue' => array(
|
| 450 |
'type' => 'int',
|
| 451 |
'unsigned' => TRUE,
|
| 452 |
'not null' => TRUE,
|
| 453 |
'default' => 255,
|
| 454 |
'size' => 'tiny',
|
| 455 |
'description' => 'Color blue value of close button (0 - 255).',
|
| 456 |
),
|
| 457 |
'languages' => array(
|
| 458 |
'type' => 'varchar',
|
| 459 |
'length' => 255,
|
| 460 |
'not null' => TRUE,
|
| 461 |
'default' => '',
|
| 462 |
'description' => 'The language visibility of the pageear. Comma separated string of language names.',
|
| 463 |
),
|
| 464 |
'roles' => array(
|
| 465 |
'type' => 'varchar',
|
| 466 |
'length' => 255,
|
| 467 |
'not null' => TRUE,
|
| 468 |
'default' => '',
|
| 469 |
'description' => 'The role visibility of the pageear. Comma separated string of role ids (rid).',
|
| 470 |
),
|
| 471 |
'visibility' => array(
|
| 472 |
'type' => 'int',
|
| 473 |
'not null' => TRUE,
|
| 474 |
'default' => 0,
|
| 475 |
'size' => 'tiny',
|
| 476 |
'description' => 'Flag to indicate how to show pageears on pages. (0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)',
|
| 477 |
),
|
| 478 |
'pages' => array(
|
| 479 |
'type' => 'text',
|
| 480 |
'not null' => TRUE,
|
| 481 |
'description' => 'Contents of the "Pages" textarea; contains either a list of paths on which to include/exclude the pageear or PHP code, depending on "visibility" setting.',
|
| 482 |
),
|
| 483 |
),
|
| 484 |
'primary key' => array('peid'),
|
| 485 |
'indexes' => array(
|
| 486 |
'list' => array('status'),
|
| 487 |
),
|
| 488 |
);
|
| 489 |
|
| 490 |
return $schema;
|
| 491 |
}
|
| 492 |
|
| 493 |
/**
|
| 494 |
* Creates pageears table and inserts sample pageear.
|
| 495 |
*/
|
| 496 |
function pageear_update_6200() {
|
| 497 |
|
| 498 |
if (!db_table_exists('pageears')) {
|
| 499 |
$result = drupal_install_schema('pageear');
|
| 500 |
|
| 501 |
if ($result[0]['success']) {
|
| 502 |
// Insert an example pageear
|
| 503 |
$sql = "INSERT INTO {pageears} (status, name, peelPosition, smallURL, bigURL, mirror, inTransition, transitionDuration, peelColor, redValue, greenValue, blueValue, linkTarget, link, loadSoundURL, openSoundURL, closeSoundURL, flagSpeed, peelSpeed, automaticOpen, automaticClose, close_button_enable, text_on_close_button, close_redValue, close_greenValue, close_blueValue, languages, roles, visibility, pages, flagWidth, flagHeight, peelWidth, peelHeight, flagStyle, peelStyle, peelColorStyle, weight, linkEnabled, peelPositionModel, waitEnable, waitURL, waitWidth, waitHeight)";
|
| 504 |
$sql .= " VALUES ('%d', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%s', '%d', '%d')";
|
| 505 |
$insert_result = db_query($sql,
|
| 506 |
array(
|
| 507 |
':status' => 0,
|
| 508 |
':name' => 'drupal',
|
| 509 |
':peelPosition' => 'topright',
|
| 510 |
':smallURL' => drupal_get_path('module', 'pageear') .'/pageturn/small.jpg',
|
| 511 |
':bigURL' => drupal_get_path('module', 'pageear') .'/pageturn/big.jpg',
|
| 512 |
':mirror' => 1,
|
| 513 |
':inTransition' => 'Squeeze',
|
| 514 |
':transitionDuration' => 4,
|
| 515 |
':peelColor' => 'custom',
|
| 516 |
':redValue' => 255,
|
| 517 |
':greenValue' => 255,
|
| 518 |
':blueValue' => 255,
|
| 519 |
':linkTarget' => '_blank',
|
| 520 |
':link' => 'http://www.drupal.org/',
|
| 521 |
':loadSoundURL' => '',
|
| 522 |
':openSoundURL' => '',
|
| 523 |
':closeSoundURL' => '',
|
| 524 |
':flagSpeed' => 4,
|
| 525 |
':peelSpeed' => 4,
|
| 526 |
':automaticOpen' => 0,
|
| 527 |
':automaticClose' => 0,
|
| 528 |
':close_button_enable' => 0,
|
| 529 |
':text_on_close_button' => 'close',
|
| 530 |
':close_redValue' => 100,
|
| 531 |
':close_greenValue' => 100,
|
| 532 |
':close_blueValue' => 100,
|
| 533 |
':languages' => '',
|
| 534 |
':roles' => '',
|
| 535 |
':visibility' => 0,
|
| 536 |
':pages' => '',
|
| 537 |
':flagWidth' => 100,
|
| 538 |
':flagHeight' => 100,
|
| 539 |
':peelWidth' => 500,
|
| 540 |
':peelHeight' => 500,
|
| 541 |
':flagStyle' => 'style1',
|
| 542 |
':peelStyle' => 'style1',
|
| 543 |
':peelColorStyle' => 'gradient',
|
| 544 |
':weight' => 0,
|
| 545 |
':linkEnabled' => 1,
|
| 546 |
':peelPositionModel' => 'absolute',
|
| 547 |
':waitEnable' => 0,
|
| 548 |
':waitURL' => drupal_get_path('module', 'pageear') .'/pageturn/wait.gif',
|
| 549 |
':waitWidth' => 42,
|
| 550 |
':waitHeight' => 42
|
| 551 |
));
|
| 552 |
|
| 553 |
if ($insert_result) {
|
| 554 |
$ret['#success'] = array('success' => TRUE);
|
| 555 |
}
|
| 556 |
else {
|
| 557 |
$ret['#abort'] = array('success' => FALSE, 'query' => 'example pageear insertion failed');
|
| 558 |
}
|
| 559 |
}
|
| 560 |
else {
|
| 561 |
$ret['#abort'] = array('success' => FALSE, 'query' => 'pageears table installation failed');
|
| 562 |
}
|
| 563 |
|
| 564 |
return $ret;
|
| 565 |
}
|
| 566 |
|
| 567 |
$ret['#success'] = array('success' => TRUE);
|
| 568 |
return $ret;
|
| 569 |
|
| 570 |
}
|
| 571 |
|
| 572 |
/**
|
| 573 |
* Sets persistent variable numEnabledPageears.
|
| 574 |
*/
|
| 575 |
function pageear_update_6201() {
|
| 576 |
|
| 577 |
$ret = array();
|
| 578 |
$num_active = db_result(db_query("SELECT COUNT(*) FROM {pageears} WHERE status = 1"));
|
| 579 |
variable_set('numEnabledPageears', (int)$num_active);
|
| 580 |
$ret['#success'] = array('success' => TRUE);
|
| 581 |
return $ret;
|
| 582 |
|
| 583 |
}
|
| 584 |
|
| 585 |
/**
|
| 586 |
* Adds flagWidth, flagHeight, peelWidth, peelHeight columns to pageears table.
|
| 587 |
*/
|
| 588 |
function pageear_update_6210() {
|
| 589 |
|
| 590 |
$ret = array();
|
| 591 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 592 |
// these columns are created on update_6200
|
| 593 |
if (!db_column_exists('pageears', 'flagWidth')) {
|
| 594 |
db_add_field($ret, 'pageears', 'flagWidth', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 100, 'size' => 'normal', 'description' => 'Width of flag.'));
|
| 595 |
db_add_field($ret, 'pageears', 'flagHeight', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 100, 'size' => 'normal', 'description' => 'Height of flag.'));
|
| 596 |
db_add_field($ret, 'pageears', 'peelWidth', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 500, 'size' => 'normal', 'description' => 'Width of peel.'));
|
| 597 |
db_add_field($ret, 'pageears', 'peelHeight', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 500, 'size' => 'normal', 'description' => 'Height of peel.'));
|
| 598 |
}
|
| 599 |
else {
|
| 600 |
$ret['#success'] = array('success' => TRUE);
|
| 601 |
}
|
| 602 |
return $ret;
|
| 603 |
|
| 604 |
}
|
| 605 |
|
| 606 |
/**
|
| 607 |
* Adds flagStyle, peelStyle, peelColorStyle columns to pageears table.
|
| 608 |
*/
|
| 609 |
function pageear_update_6211() {
|
| 610 |
|
| 611 |
$ret = array();
|
| 612 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 613 |
// these columns are created on update_6200
|
| 614 |
if (!db_column_exists('pageears', 'flagStyle')) {
|
| 615 |
db_add_field($ret, 'pageears', 'flagStyle', array('type' => 'varchar', 'length' => 7, 'not null' => TRUE, 'default' => 'style1', 'description' => 'Style of flag.'));
|
| 616 |
db_add_field($ret, 'pageears', 'peelStyle', array('type' => 'varchar', 'length' => 7, 'not null' => TRUE, 'default' => 'style1', 'description' => 'Style of peel.'));
|
| 617 |
db_add_field($ret, 'pageears', 'peelColorStyle', array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => 'gradient', 'description' => 'The color on peel can be a flat color or a gradient.'));
|
| 618 |
}
|
| 619 |
else {
|
| 620 |
$ret['#success'] = array('success' => TRUE);
|
| 621 |
}
|
| 622 |
return $ret;
|
| 623 |
|
| 624 |
}
|
| 625 |
|
| 626 |
/**
|
| 627 |
* Adds weight column to pageears table.
|
| 628 |
*/
|
| 629 |
function pageear_update_6212() {
|
| 630 |
|
| 631 |
$ret = array();
|
| 632 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 633 |
// these columns are created on update_6200
|
| 634 |
if (!db_column_exists('pageears', 'weight')) {
|
| 635 |
db_add_field($ret, 'pageears', 'weight', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0));
|
| 636 |
}
|
| 637 |
else {
|
| 638 |
$ret['#success'] = array('success' => TRUE);
|
| 639 |
}
|
| 640 |
return $ret;
|
| 641 |
|
| 642 |
}
|
| 643 |
|
| 644 |
/**
|
| 645 |
* Adds sites column to pageears table.
|
| 646 |
*/
|
| 647 |
function pageear_update_6213() {
|
| 648 |
|
| 649 |
$ret = array();
|
| 650 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 651 |
// these columns are created on update_6200
|
| 652 |
if (!db_column_exists('pageears', 'sites')) {
|
| 653 |
db_add_field($ret, 'pageears', 'sites', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'description' => 'The sites visibility of the pageear. Comma separated string of site names.'));
|
| 654 |
}
|
| 655 |
else {
|
| 656 |
$ret['#success'] = array('success' => TRUE);
|
| 657 |
}
|
| 658 |
return $ret;
|
| 659 |
|
| 660 |
}
|
| 661 |
|
| 662 |
/**
|
| 663 |
* Adds linkEnabled column to pageears table.
|
| 664 |
*/
|
| 665 |
function pageear_update_6214() {
|
| 666 |
|
| 667 |
$ret = array();
|
| 668 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 669 |
// these columns are created on update_6200
|
| 670 |
if (!db_column_exists('pageears', 'linkEnabled')) {
|
| 671 |
db_add_field($ret, 'pageears', 'linkEnabled', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1, 'description' => 'Enabled or disabled link. (1 = enabled, 0 = disabled).'));
|
| 672 |
}
|
| 673 |
else {
|
| 674 |
$ret['#success'] = array('success' => TRUE);
|
| 675 |
}
|
| 676 |
return $ret;
|
| 677 |
|
| 678 |
}
|
| 679 |
|
| 680 |
/**
|
| 681 |
* Drops sites column from pageears table and deletes current_pageear persistent
|
| 682 |
* variable.
|
| 683 |
*/
|
| 684 |
function pageear_update_6215() {
|
| 685 |
|
| 686 |
$ret = array();
|
| 687 |
|
| 688 |
db_drop_field($ret, 'pageears', 'sites');
|
| 689 |
variable_del('current_pageear');
|
| 690 |
|
| 691 |
return $ret;
|
| 692 |
|
| 693 |
}
|
| 694 |
|
| 695 |
/**
|
| 696 |
* Adds peelPositionModel column to pageears table.
|
| 697 |
*/
|
| 698 |
function pageear_update_6216() {
|
| 699 |
|
| 700 |
$ret = array();
|
| 701 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 702 |
// these columns are created on update_6200
|
| 703 |
if (!db_column_exists('pageears', 'peelPositionModel')) {
|
| 704 |
db_add_field($ret, 'pageears', 'peelPositionModel', array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => 'absolute', 'description' => 'Position Model of pageear. (absolute or fixed).'));
|
| 705 |
}
|
| 706 |
else {
|
| 707 |
$ret['#success'] = array('success' => TRUE);
|
| 708 |
}
|
| 709 |
return $ret;
|
| 710 |
|
| 711 |
}
|
| 712 |
|
| 713 |
/**
|
| 714 |
* Adds waitEnable, waitURL, waitWidth, waitHeight columns to pageears table.
|
| 715 |
*/
|
| 716 |
function pageear_update_6217() {
|
| 717 |
|
| 718 |
$ret = array();
|
| 719 |
// This check is necesary because on an update from 6.x-1.x versions of module
|
| 720 |
// these columns are created on update_6200
|
| 721 |
if (!db_column_exists('pageears', 'waitEnable')) {
|
| 722 |
db_add_field($ret, 'pageears', 'waitEnable', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny', 'description' => 'Wait icon enabled status. (1 = enabled, 0 = disabled).'));
|
| 723 |
db_add_field($ret, 'pageears', 'waitURL', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'description' => 'Height of flag.'));
|
| 724 |
db_add_field($ret, 'pageears', 'waitWidth', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 42, 'size' => 'normal', 'description' => 'URL of the image to show while the ad is loading.'));
|
| 725 |
db_add_field($ret, 'pageears', 'waitHeight', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 42, 'size' => 'normal', 'description' => 'Height of wait icon.'));
|
| 726 |
db_query("UPDATE {pageears} SET waitURL = '%s'", array(':waitURL' => drupal_get_path('module', 'pageear') .'/pageturn/wait.gif'));
|
| 727 |
}
|
| 728 |
else {
|
| 729 |
$ret['#success'] = array('success' => TRUE);
|
| 730 |
}
|
| 731 |
return $ret;
|
| 732 |
|
| 733 |
}
|