All pastes #805246 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-12-04 04:12 UTC
rendered paste body
		case "goXferAI":						$ids    = $_POST['ids'];			$ids    = split(",",$ids);						$pIDs   = $_POST['pIDs'];			$pIDs   = split(",",$pIDs);						$pageID = $_POST['pID'];						$ec     = count($pIDs);			$errs   = array();						if(!empty($pIDs)){								if($pageID == $pIDs[$ec-1]){					// ok we are x'fering images to the last page					// first have to get the count of images on 					// that page. 										$sID    = $pIDs[$ec-1];					$iCount = $tenMM->imageCount($sID);											if($iCount[0]){							$iCount = $iCount[1];						}else{							$iCount = 0;						}											$startSort = $ec*12;					$endSort   = $startSort;					$endSort   = $endSort + $iCount;										for($i=0;$i<count($ids);$i++){							$endSort++;							$upSort = $tenMM->upSort($ids[$i],$endSort);							if(!$upSort[0]){								$errs[] = $upSort[1];							}						}										if(empty($errs)){						// ok we re-addressed the sort value of the images						// we now need to reset the rest of the images						$goReset = $tenMM->resetAIsort();						if($goReset[0]){							// al set							header("Content-type: text/xml");							echo '<?xml version="1.0" ?>';							echo '<xferAI>';							echo '<pass>1</pass>';							echo '</xferAI>';																					}else{							// error with reseting sort							header("Content-type: text/xml");							echo '<?xml version="1.0" ?>';							echo '<xferAI>';							echo '<pass>0</pass>';							echo '<error> Error with reseting sort </error>';							echo '</xferAI>';							}					}				}else{					// ok we are not xfering to last page. 					// we will need to go ahead and get setup						// get our IDs of the 12 pictures on that 					// page															$imgIDs = $tenMM->getIIDS($pageID,$tenMM->imageGID,12);											if($imgIDs[0]){							// ok we have our image IDs							// now we need to subtract the count 							// of our images being xfered  from the							// count of image ids							// we also need to get the IDs of the pictures							// after the last image we are updating							// so we count the iamges and get those ids							// starting w/ last id of img ids														$imgIDs = $imgIDs[1];														$ec2 = count($imgIDs) - count($ids);														$oldIDs = $tenMM->getIIDs($imgIDs[$ec2],$tenMM->imageGID,count($ids));														if($oldIDs[0]){								$oldIDs = $oldIDs[1];												}else{								$errs += $oldIDs[1];								header("Content-type: text/xml");								echo '<?xml version="1.0" ?>';								echo '<xferAI>';								echo '<pass>0</pass>';								for($i=0;$i<count($errs);$i++){									echo '<error>' . $errs[$i] . '</error>';								}								echo '</xferAI>';								}														if(empty($errs)){															$startCount = count($imgIDs)- count($ids); 								$startID = $imgIDs[$startCount];																// ok we now have our start ID we need to now								// find out the sort value for this ID																$startSort = $tenMM->getISort($startID);																	if($startSort[0]){										$startSort = $startSort[1];									}else{										header("Content-type: text/xml");										echo '<?xml version="1.0" ?>';										echo '<xferAI>';										echo '<pass>0</pass>';										echo '<error>' . $startSort[1] . '</error>';										echo '</xferAI>';																			}																								// ok we now have our start sort, we need to update our sort values								// of our image ids started w. 								$startSort--;																for($i=0;$i<count($ids);$i++){									$startSort++;									$upSort = $tenMM->upSort($ids[$i],$startSort);										if(!$upSort[0]){											$errs[] = $upSort[1];										}								}															}														if(empty($errs)){								// ok now that we have succesfully updated our ids with								// there new sort value. We need to update our old ones								// to there new value starting with the end of startSort								// sine we are reseting the sort values after this we								// will simply add in decimal values 																$sam = .01;																for($i=0;$i<count($oldIDs);$i++){																		$newSort = $startSort + $sam;									$upSort = $tenMM->upSort($oldIDs[$i],$newSort);																		if(!$upSort[0]){										$errs[] = $upSort[1];									}																		$sam = $sam + .01;								}																// ok we have no updated that								/// now we have to make sure there was no errors																if(empty($errs)){									// ok there was none, time to reset the image's sort. 									$goReset = $tenMM->resetAIsort();									if($goReset[0]){										// al set										header("Content-type: text/xml");										echo '<?xml version="1.0" ?>';										echo '<xferAI>';										echo '<pass>1</pass>';										echo '</xferAI>';																											}else{										// error with reseting sort										header("Content-type: text/xml");										echo '<?xml version="1.0" ?>';										echo '<xferAI>';										echo '<pass>0</pass>';										echo '<error> Error with reseting sort </error>';										echo '</xferAI>';										}																	}else{									// ok error 									header("Content-type: text/xml");									echo '<?xml version="1.0" ?>';									echo '<xferAI>';									echo '<pass>0</pass>';									for($i=0;$i<count($errs);$i++){										echo '<error>' . $errs[$i] . '</error>';									}									echo '</xferAI>';									}												}else{								// ok error 								header("Content-type: text/xml");								echo '<?xml version="1.0" ?>';								echo '<xferAI>';								echo '<pass>0</pass>';								for($i=0;$i<count($errs);$i++){									echo '<error>' . $errs[$i] . '</error>';								}								echo '</xferAI>';																}						}else{							// error with getting image IDs							header("Content-type: text/xml");							echo '<?xml version="1.0" ?>';							echo '<xferAI>';							echo '<pass>0</pass>';							echo '<error>' . $imgIDs[1] . '</error>';							echo '</xferAI>';															}				}								}									break;