function initPhotoCopy($album, $directory) { global $CONFIG; mkdir($directory); pageheader($section, $meta_keywords); starttable('100%', 'ID', 2); echo "<tr><td>ID</td><td>Path</td></tr>"; $pic_array = array(); $pictures = cpg_db_query("SELECT pid,title,filename,filepath FROM {$CONFIG['TABLE_PICTURES']} WHERE `aid` = '{$album}'"); while ($picture = mysql_fetch_array($pictures)) { echo "<tr><td><span id='id_{$picture['pid']}'>{$picture['pid']}</span></td><td><span id='path_{$picture['pid']}'>{$picture['filepath']}{$picture['filename']}</span></td></tr>\n"; $pic_array[] = $picture; } $js_pictures = phpArrayToJS($pic_array, 'pictures'); ?> <script type="text/javascript"> var <?php echo $js_pictures; ?> ; processPicture(0); function processPicture(offset) { if(offset >= pictures.length) {return 0;}; // Create an xmlHttp Object (Tries Activex object then xmlHttp request) try { ajxobj = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { ajxobj = new ActiveXObject('Microsoft.XMLHTTP'); } catch (E) { ajxobj = false; } } if (!ajxobj && typeof XMLHttpRequest!='undefined') { ajxobj = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest } ajxobj.onreadystatechange=function() { //Handle successful xmlHttp transfer if(ajxobj.readyState==4) { document.getElementById('path_'+pictures[offset]['pid']).style.textDecoration = 'line-through'; document.getElementById('id_'+pictures[offset]['pid']).style.textDecoration = 'line-through'; processPicture(offset+1); } }; // Generate and do xmlHttp call ajxobj.open('GET',"<?php echo $_SERVER[PHP_SELF]; ?> ?dir=<?php echo $_POST[directory]; ?> &id=" + pictures[offset]['pid'], true); ajxobj.send(null); } </script> <?php endtable(); }
/** * Gets the content of necessary widget's application. * @param sModule - module(widget) name. * @param sApp - application name in the widget. * @param aParamValues - an associative array of parameters to be passed into the Flash object. * @param bInline - whether you want to have it with the full page code(for opening in a new window) * or only DIV with flash object (for embedding into the existing page). */ function getApplicationContent($sModule, $sApp, $aParamValues = array(), $bInline = false, $bEmbedCode = false, $sHtmlId = "") { global $sGlobalUrl; global $sHomeUrl; global $sRayHomeDir; global $sModulesUrl; global $sModulesPath; global $sFlashPlayerVersion; $sModule = isset($sModule) ? $sModule : process_db_input($_REQUEST['module']); $sApp = isset($sApp) ? $sApp : process_db_input($_REQUEST['app']); $sModuleStatus = getSettingValue($sModule, "status", "main"); if ($sModuleStatus == WIDGET_STATUS_NOT_INSTALLED || $sModuleStatus == WIDGET_STATUS_DISABLED) { return ""; } $aConfig = getFlashConfig($sModule, $sApp, $aParamValues); $aModules = $aConfig['modules']; if (!isset($bInline)) { $bInline = $aModules[$sApp]['inline']; } //--- Parameters for container's div ---// $sDivId = !empty($aModules[$sApp]['div']['id']) ? $aModules[$sApp]['div']['id'] : ''; if (!empty($sHtmlId)) { $sDivId = $sHtmlId; } if (empty($sDivId)) { $sDivId = $sModule . '_' . $sApp; } $sInnerDivId = $sDivId . "_" . time(); if (empty($sHtmlId)) { $sHtmlId = "ray_" . $sModule . "_" . $sApp . "_object"; } $sDivName = !empty($aModules[$sApp]['div']['name']) ? ' name="' . $aModules[$sApp]['div']['name'] . '"' : ''; if (!empty($aModules[$sApp]['div']['style'])) { $sDivStyle = ' style="'; foreach ($aModules[$sApp]['div']['style'] as $sKey => $sValue) { $sDivStyle .= $sKey . ':' . $sValue . ';'; } $sDivStyle .= '"'; } else { $sDivStyle = ''; } //--- Parameters for SWF object and reloading ---// $aParametersReload = array(); if (!isset($_GET["module"])) { $aParametersReload[] = "module=" . $sModule; } if (!isset($_GET["app"])) { $aParametersReload[] = "app=" . $sApp; } ob_start(); if (!$bInline) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title><?php echo $aModules[$sApp]['caption']; ?> </title> <meta http-equiv=Content-Type content="text/html;charset=UTF-8" /> </head> <body style="margin:0; padding:0;" <?php echo $aModules[$sApp]['hResizable'] || $aModules[$sApp]['vResizable'] ? 'onLoad="resizeWindow()" onResize="if ( window.resizeWindow ) resizeWindow()"' : ''; ?> > <?php echo getRayIntegrationJS(); } if (!$bEmbedCode) { foreach ($aModules[$sApp]['js'] as $sJSUrl) { echo "\t\t<script src=\"" . $sJSUrl . "\" type=\"text/javascript\" language=\"javascript\"></script>\n"; } } if (!$bEmbedCode && ($aModules[$sApp]['hResizable'] || $aModules[$sApp]['vResizable'])) { $iMinWidth = (int) $aModules[$sApp]['minSize']['width']; $iMinHeight = (int) $aModules[$sApp]['minSize']['height']; ?> <script type="text/javascript" language="javascript"> function resizeWindow() { var frameWidth = 0; var frameHeight = 0; if (document.documentElement) { if(document.documentElement.clientHeight) { frameWidth = document.documentElement.clientWidth; frameHeight = document.documentElement.clientHeight; } } else if(window.innerWidth) { frameWidth = window.innerWidth; frameHeight = window.innerHeight; } else if (document.body) { frameWidth = document.body.offsetWidth; frameHeight = document.body.offsetHeight; } var sAppName = 'ray_flash_<?php echo $sModule; ?> _<?php echo $sApp; ?> _'; var o = document.getElementById(sAppName + 'object'); var e = document.getElementById(sAppName + 'embed'); frameWidth = (frameWidth < <?php echo $iMinWidth; ?> ) ? <?php echo $iMinWidth; ?> : frameWidth; frameHeight = (frameHeight < <?php echo $iMinHeight; ?> ) ? <?php echo $iMinHeight; ?> : frameHeight; <?php $sRet = $aModules[$sApp]['hResizable'] ? "o.width = frameWidth;\n" : ""; $sRet .= $aModules[$sApp]['vResizable'] ? "o.height = frameHeight;\n" : ""; $sRet .= "if(e != null){"; $sRet .= $aModules[$sApp]['hResizable'] ? "e.width = frameWidth;\n" : ""; $sRet .= $aModules[$sApp]['vResizable'] ? "e.height = frameHeight;\n" : ""; $sRet .= "}"; echo $sRet; ?> } </script> <?php } if (!$bEmbedCode && $aModules[$sApp]['reloadable']) { if (!$bInline) { echo getRedirectForm($sModule, $sApp, array_merge($_GET, $_POST)); } ?> <script type="text/javascript" language="javascript"> function reload() { <?php $sGet = $_SERVER['QUERY_STRING']; $sExtraGet = implode("&", $aParametersReload); if (!empty($sGet) && !empty($sExtraGet)) { $sGet .= "&"; } echo !$bInline ? "redirect();" : "location.href='" . $_SERVER['PHP_SELF'] . "?" . $sGet . $sExtraGet . "';"; ?> } </script> <?php } ?> <div id="<?php echo $sDivId; ?> " <?php echo $sDivName . $sDivStyle; ?> ><div id="<?php echo $sInnerDivId; ?> "></div></div> <script type="text/javascript" language="javascript"> <?php foreach ($aConfig['flashVars'] as $sKey => $sValue) { if (!isset($_GET[$sKey]) && $sKey != 'url') { $aParametersReload[] = $sKey . "=" . (isset($aConfig['flashVars'][$sKey]) ? $aConfig['flashVars'][$sKey] : process_db_input($_REQUEST[$sKey])); } } echo phpArrayToJS($aConfig['flashVars'], "flashvars"); echo phpArrayToJS($aConfig['params'], "params"); ?> var attributes = { id: "ray_flash_<?php echo $sModule; ?> _<?php echo $sApp; ?> _object", name: "ray_flash_<?php echo $sModule; ?> _<?php echo $sApp; ?> _embed", style: "display:block;" }; swfobject.embedSWF("<?php echo $aConfig['holder']; ?> ", "<?php echo $sInnerDivId; ?> ", "<?php echo $aConfig['width']; ?> ", "<?php echo $aConfig['height']; ?> ", "<?php echo $sFlashPlayerVersion; ?> ", "<?php echo $sGlobalUrl; ?> app/expressInstall.swf", flashvars, params, attributes); </script> <?php if (!$bInline) { ?> </body> </html> <?php } $sWidgetContent = ob_get_contents(); ob_end_clean(); return $sWidgetContent; }
function initPhotoCopy($album, $directory) { global $CONFIG; $superCage = Inspekt::makeSuperCage(); if (!is_dir($directory)) { mkdir($directory); chmod($directory, octdec($CONFIG['default_dir_mode'])); } // To-do: perform a check if the export directory has been created succsessfully and die if this has failed starttable('100%', 'ID', 2); $pic_array = array(); $pictures = cpg_db_query("SELECT pid,title,filename,filepath FROM {$CONFIG['TABLE_PICTURES']} WHERE `aid` = '{$album}'"); while ($picture = mysql_fetch_assoc($pictures)) { echo "<tr><td class='tableb'><span id='id_{$picture['pid']}'>{$picture['pid']}</span></td><td><span id='path_{$picture['pid']}'>{$picture['filepath']}{$picture['filename']}</span></td></tr>\n"; $pic_array[] = $picture; } endtable(); $js_pictures = phpArrayToJS($pic_array, 'pictures'); ?> <script type="text/javascript"> var <?php echo $js_pictures; ?> ; processPicture(0); function processPicture(offset) { if(offset >= pictures.length) {return 0;}; // Create an xmlHttp Object (Tries Activex object then xmlHttp request) try { ajxobj = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { ajxobj = new ActiveXObject('Microsoft.XMLHTTP'); } catch (E) { ajxobj = false; } } if (!ajxobj && typeof XMLHttpRequest!='undefined') { ajxobj = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest } ajxobj.onreadystatechange=function() { //Handle successful xmlHttp transfer if(ajxobj.readyState==4) { document.getElementById('path_'+pictures[offset]['pid']).style.textDecoration = 'line-through'; document.getElementById('id_'+pictures[offset]['pid']).style.textDecoration = 'line-through'; processPicture(offset+1); } }; // Generate and do xmlHttp call ajxobj.open('GET',"export.php?dir=<?php echo $superCage->post->getEscaped('directory'); ?> &id=" + pictures[offset]['pid'], true); ajxobj.send(null); } </script> <?php }