public function show() { $aElements = $this->_oPage->getElementsByField($this->_oField); if (count($aElements)) { $oElement = $aElements[0]; /* @var $oElement AM_Model_Db_Element */ $aElementView = array('id' => $oElement->id); $aExtraDataItem = array(AM_Model_Db_Element_Data_Html::DATA_KEY_TEMPLATE_TYPE, AM_Model_Db_Element_Data_Html::DATA_KEY_URL); foreach ($aExtraDataItem as $sItem) { $aElementView[$sItem] = $oElement->getResources()->getDataValue($sItem); } $aResourceView = $this->_getResourceViewData($oElement); $aElementView = array_merge($aElementView, $aResourceView); } $aFieldView = array(); if (isset($aElementView)) { $aFieldView['element'] = $aElementView; } if (!isset($aElementView) || !isset($aElementView['fileName'])) { $aFieldView['defaultImageUri'] = AM_Tools::getImageUrl(AM_Handler_Thumbnail_Interface::PRESET_FIELD . '-' . $this->_sPageOrientation, 'element', null, null); } $sExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_Html::getAllowedFileExtensions()); sort($sExtensions, SORT_STRING); $aFieldView['allowedExtensions'] = implode(' / ', $sExtensions); $this->_setFieldData($aFieldView); parent::show(); }
public function testShouldCopyResource() { //GIVEN $oThumbnailerMock = $this->getMock('AM_Handler_Thumbnail', array('addSourceFile', 'loadAllPresets', 'createThumbnails', 'getSources')); AM_Handler_Locator::getInstance()->setHandler('thumbnail', $oThumbnailerMock); $oStandardMock = $this->getMock('AM_Tools_Standard', array('is_dir', 'mkdir', 'copy')); $oElement = AM_Model_Db_Table_Abstract::factory('element')->findOneBy('id', 1); $oResource = new AM_Model_Db_Element_Data_MockResource($oElement); $oResource->addAdditionalResourceKey('additional_key'); //Emulating the element copying $oElement->id = 2; //The current path of the resource $sOldDir = AM_Tools::getContentPath(AM_Model_Db_Element_Data_Resource::TYPE, 1); //The path of the resource after copying $sNewDir = AM_Tools::getContentPath(AM_Model_Db_Element_Data_Resource::TYPE, 2); //THEN //Checking all file operations $oStandardMock->expects($this->at(0))->method('is_dir')->with($this->equalTo($sOldDir))->will($this->returnValue(true)); $oStandardMock->expects($this->at(1))->method('is_dir')->with($this->equalTo($sNewDir))->will($this->returnValue(false)); $oStandardMock->expects($this->once())->method('mkdir')->with($this->equalTo($sNewDir), $this->equalTo(0777), $this->equalTo(true))->will($this->returnValue(true)); $sNewResourcePath = $sNewDir . DIRECTORY_SEPARATOR . 'resource.png'; $sOldResourcePath = $sOldDir . DIRECTORY_SEPARATOR . 'resource.png'; $sNewAdditionalResourcePath = $sNewDir . DIRECTORY_SEPARATOR . 'additional_key.png'; $sOldAdditionalResourcePath = $sOldDir . DIRECTORY_SEPARATOR . 'additional_key.png'; $oStandardMock->expects($this->at(3))->method('copy')->with($this->equalTo($sOldResourcePath), $this->equalTo($sNewResourcePath))->will($this->returnValue(true)); $oStandardMock->expects($this->at(4))->method('copy')->with($this->equalTo($sOldAdditionalResourcePath), $this->equalTo($sNewAdditionalResourcePath))->will($this->returnValue(true)); //Checking the init of the resizing operation $oThumbnailerMock->expects($this->any())->method('addSourceFile')->will($this->returnValue($oThumbnailerMock)); $oThumbnailerMock->expects($this->any())->method('loadAllPresets')->will($this->returnValue($oThumbnailerMock)); $oResourceMock = new AM_Resource_Concrete_Mock($sNewResourcePath); $oThumbnailerMock->expects($this->at(3))->method('getSources')->will($this->returnValue(array($oResourceMock))); $oAdditionalResourceMock = new AM_Resource_Concrete_Mock($sNewAdditionalResourcePath); $oThumbnailerMock->expects($this->at(7))->method('getSources')->will($this->returnValue(array($oAdditionalResourceMock))); //WHEN $oResource->copy(); //THEN $oGivenDataSet = $this->getConnection()->createQueryTable('element_data', 'SELECT id_element, key_name, value FROM element_data ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/ElementResourceCopyTest.xml')->getTable('element_data'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); //Checking the background tasks $oTasks = AM_Model_Db_Table_Abstract::factory('task')->findAllBy(array('status' => AM_Task_Worker_Abstract::STATUS_NEW)); $this->assertEquals(2, $oTasks->count(), 'Precess should init 2 tasks'); $oTaskForResource = $oTasks[0]; $aExpectedParams = array('resource' => $sNewResourcePath, 'image_type' => 'png', 'zooming' => 0, 'resource_type' => 'element-vertical'); $this->assertEquals($aExpectedParams, $oTaskForResource->getOptions()); $oTaskForAdditionalResource = $oTasks[1]; $aExpectedParams = array('resource' => $sNewAdditionalResourcePath, 'image_type' => 'png', 'zooming' => 0, 'resource_type' => 'element-vertical'); $this->assertEquals($aExpectedParams, $oTaskForAdditionalResource->getOptions()); }
public function testShouldCopyResource() { //GIVEN $oResource = new AM_Model_Db_StaticPdf_Data_Resource($this->_oStaticPdf); $this->_oStaticPdf->id = 2; $this->_oStaticPdf->issue = 2; //THEN $sOldDir = AM_Tools::getContentPath(AM_Model_Db_StaticPdf_Data_Resource::TYPE, 1); $sNewDir = AM_Tools::getContentPath(AM_Model_Db_StaticPdf_Data_Resource::TYPE, 2); $this->_oStandardMock->expects($this->at(0))->method('is_dir')->with($this->equalTo($sOldDir))->will($this->returnValue(true)); $this->_oStandardMock->expects($this->at(1))->method('is_dir')->with($this->equalTo($sNewDir))->will($this->returnValue(false)); $this->_oStandardMock->expects($this->once())->method('mkdir')->with($this->equalTo($sNewDir), $this->equalTo(0777), $this->equalTo(true))->will($this->returnValue(true)); $this->_oStandardMock->expects($this->at(3))->method('copy')->with($this->equalTo($sOldDir . DIRECTORY_SEPARATOR . '1.pdfmock'), $this->equalTo($sNewDir . DIRECTORY_SEPARATOR . '2.pdfmock'))->will($this->returnValue(true)); //WHEN $oResource->copy(); }
public function show() { $aElements = $this->_oPage->getElementsByField($this->_oField); $aFieldView = array(); if (count($aElements)) { $aElementsView = array(); foreach ($aElements as $oElement) { /* @var $oElement AM_Model_Db_Element */ $aElementView = array('id' => $oElement->id); $mTopArea = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_TOP_AREA); if (false !== $mTopArea) { $aFieldView['topAreaId'] = $oElement->id; $aFieldView[AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_TOP_AREA] = $mTopArea; continue; } $sUniq = '?' . strtotime($oElement->updated); $sVideo = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_VIDEO); if (false !== $sVideo) { $aElementView[AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_VIDEO] = $sVideo; } $sThumbnail = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_THUMBNAIL); if (false !== $sThumbnail) { $sFileExtension = pathinfo($sThumbnail, PATHINFO_EXTENSION); $aElementView['thumbnail'] = $sThumbnail; $aElementView['thumbnailUri'] = AM_Tools::getImageUrl('none', 'element', $oElement->id, AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_THUMBNAIL . '.' . $sFileExtension) . $sUniq; } $sThumbnailSelected = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_THUMBNAIL_SELECTED); if (false !== $sThumbnailSelected) { $sFileExtension = pathinfo($sThumbnail, PATHINFO_EXTENSION); $aElementView['thumbnailSelected'] = $sThumbnailSelected; $aElementView['thumbnailSelectedUri'] = AM_Tools::getImageUrl('none', 'element', $oElement->id, AM_Model_Db_Element_Data_DragAndDrop::DATA_KEY_THUMBNAIL_SELECTED . '.' . $sFileExtension) . $sUniq; } $aResourceView = $this->_getResourceViewData($oElement); $aElementView = array_merge($aElementView, $aResourceView); $aElementsView[] = $aElementView; } } if (isset($aElementsView)) { $aFieldView['elements'] = $aElementsView; } $aExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_DragAndDrop::getAllowedFileExtensions()); sort($aExtensions, SORT_STRING); $aFieldView['allowedExtensions'] = implode(' / ', $aExtensions); $this->_setFieldData($aFieldView); parent::show(); }
/** * Resizes given image * @param string $sFileBaseName * @param object $oResource The instance of element | term | horisontal page * @param string $sResourceType The type of resource's parent (element, toc, cache-static-pdf) * @param string $sResourceKeyName The name of the resource type (resource, thumbnail, etc) * @param bool $bZoom * @return @void */ protected function _resizeImage($sFileBaseName, $oResource, $sResourceType, $sResourceKeyName, $sResourcePresetName = null, $bZoom = false) { if (is_null($sResourcePresetName)) { $sResourcePresetName = $sResourceType; } $sImageType = $oResource->getResources()->getImageType(); $sFileExtension = strtolower(pathinfo($sFileBaseName, PATHINFO_EXTENSION)); $sFilePath = AM_Tools::getContentPath($sResourceType, $oResource->id) . DIRECTORY_SEPARATOR . $sResourceKeyName . '.' . $sFileExtension; $this->_oThumbnailer->clearSources()->addSourceFile($sFilePath)->setImageType($sImageType)->setZooming($bZoom); if (empty($this->_sPreset)) { $this->_oThumbnailer->loadAllPresets($sResourcePresetName); } else { $this->_oThumbnailer->clearPresets()->addPreset($this->_sPreset); } $this->_oThumbnailer->createThumbnails(); $this->_echo(sprintf('%s', $sFilePath), 'success'); }
public function testShouldCopyResource() { //GIVEN $oResource = new AM_Model_Db_Term_Data_Resource($this->_oTerm); $this->_oTerm->id = 2; //THEN $sOldDir = AM_Tools::getContentPath(AM_Model_Db_Term_Data_Resource::TYPE, 1); $sNewDir = AM_Tools::getContentPath(AM_Model_Db_Term_Data_Resource::TYPE, 2); $this->_oStandardMock->expects($this->at(0))->method('is_dir')->with($this->equalTo($sOldDir))->will($this->returnValue(true)); //thumb_summary $this->_oStandardMock->expects($this->at(1))->method('is_dir')->with($this->equalTo($sNewDir))->will($this->returnValue(false)); $this->_oStandardMock->expects($this->once())->method('mkdir')->with($this->equalTo($sNewDir), $this->equalTo(0777), $this->equalTo(true))->will($this->returnValue(true)); $this->_oStandardMock->expects($this->at(3))->method('copy')->with($this->equalTo($sOldDir . DIRECTORY_SEPARATOR . 'summary.ext'), $this->equalTo($sNewDir . DIRECTORY_SEPARATOR . 'summary.ext'))->will($this->returnValue(true)); //thumb_stripe $this->_oStandardMock->expects($this->at(4))->method('is_dir')->with($this->equalTo($sNewDir))->will($this->returnValue(true)); $this->_oStandardMock->expects($this->at(5))->method('copy')->with($this->equalTo($sOldDir . DIRECTORY_SEPARATOR . 'stripe.ext'), $this->equalTo($sNewDir . DIRECTORY_SEPARATOR . 'stripe.ext'))->will($this->returnValue(true)); //WHEN $oResource->copy(); }
public function show() { $aElements = $this->_oPage->getElementsByField($this->_oField); $aFieldView = array(); if (count($aElements)) { $aElementView = array(); $oElement = $aElements[0]; /* @var $oElement AM_Model_Db_Element */ $sBody = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_Html5::DATA_KEY_HTML5_BODY); $aElementView[AM_Model_Db_Element_Data_Html5::DATA_KEY_HTML5_BODY] = $sBody; if (!empty($sBody)) { /** Select and fill fields, that refers to selected body */ foreach (AM_Model_Db_Element_Data_Html5::$aFieldList[$sBody] as $sFieldName) { $sFieldValue = $oElement->getResources()->getDataValue($sFieldName); if (AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE == $sFieldName && !empty($sFieldValue)) { $aFileInfo = pathinfo($sFieldValue); $sFileName = $aFileInfo['filename']; $sFileExtension = $aFileInfo['extension']; $aElementView['element']['fileName'] = $sFileName . '.' . $sFileExtension; $aElementView['element']['fileNameShort'] = $this->getHelper('String')->cut($sFileName) . '.' . $sFileExtension; $sResourceFileName = AM_Model_Db_Element_Data_Html5::DATA_KEY_RESOURCE . '.' . $sFileExtension; $aElementView['element']['smallUri'] = AM_Tools::getIconForNonImageFile($sResourceFileName); } $aElementView[$sFieldName] = $sFieldValue; } $aElementView['element']['id'] = $oElement->id; } } if (isset($aElementView)) { $aFieldView = $aElementView; } $aFieldView['select_body'] = AM_Model_Db_Element_Data_Html5::$aBodyList; $aExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_Html5::getAllowedFileExtensions()); sort($aExtensions, SORT_STRING); $aFieldView['allowedExtensions'] = implode(' / ', $aExtensions); $aFieldView['defaultImageUri'] = AM_Tools::getImageUrl(AM_Handler_Thumbnail_Interface::PRESET_FIELD . '-' . $this->_sPageOrientation, 'element', null, null); $this->_setFieldData($aFieldView); parent::show(); }
/** * Save action */ public function saveAction() { try { $aMessage = array('status' => 0); $sKey = trim($this->_getParam('key')); $sValue = trim($this->_getParam('value')); if (empty($sKey)) { throw new AM_Exception('Trying to set value with empty key'); } $oField = AM_Model_Db_Table_Abstract::factory('field')->findOneBy('id', $this->_iFieldId); /* @var $oField AM_Model_Db_Field */ if (is_null($oField)) { throw new AM_Exception(sprintf('Field with id "%d" not found.', $this->_iFieldId)); } $oPage = AM_Model_Db_Table_Abstract::factory('page')->findOneBy('id', $this->_iPageId); /* @var $oPage AM_Model_Db_Page */ if (is_null($oPage)) { throw new AM_Exception(sprintf('Page with id "%d" not found.', $this->_iPageId)); } $iTopAreaId = intval($this->_getParam('topAreaId')); if ($iTopAreaId) { $oElement = AM_Model_Db_Table_Abstract::factory('element')->findOneBy(array('id' => $iTopAreaId)); } else { $oElement = $oPage->getElementForField($oField); } /* @var $oElement AM_Model_Db_Element */ $oElement->getResources()->addKeyValue($sKey, $sValue); $oPage->setUpdated(false); $aMessage['defaultImageUri'] = AM_Tools::getImageUrl(AM_Handler_Thumbnail_Interface::PRESET_FIELD . '-' . $oPage->getOrientation(), 'element', null, ''); $aMessage['status'] = 1; $aMessage['value'] = $oElement->getResources()->getDataValue($sKey); } catch (Exception $oException) { $aMessage["message"] = $this->__("Error. Can't set value! ") . PHP_EOL . $oException->getMessage(); } return $this->getHelper('Json')->sendJson($aMessage, false); }
protected function _preOperation() { $sIdentifer = $this->controls['identifer']->getValue(); $this->controls['identifer']->setValue(AM_Tools::filter_xss($sIdentifer)); }
protected function _preOperation() { $sTitle = $this->controls['title']->getValue(); $this->controls['title']->setValue(AM_Tools::filter_xss($sTitle)); }
/** * Create revision from simple pdf * @param AM_Model_Db_IssueSimplePdf $oSimplePdf * @return AM_Model_Db_Revision * @throws AM_Handler_Issue_Exception */ public function createRevisionFromSimplePdf(AM_Model_Db_IssueSimplePdf $oSimplePdf) { $aImages = $oSimplePdf->getAllPagesThumbnails(); //Create revision $oRevision = new AM_Model_Db_Revision(); $oRevision->state = AM_Model_Db_Issue::STATUS_WIP; $oRevision->user = $this->getIssue()->user; $oRevision->issue = $this->getIssue()->id; $oRevision->save(); $oRevision->title = 'Revision #' . $oRevision->id; $oRevision->save(); //Create cover page $oPage = new AM_Model_Db_Page(); $oPage->title = 'Root page'; $oPage->template = AM_Model_Db_Template::TPL_COVER_PAGE; $oPage->revision = $oRevision->id; $oPage->user = $this->getIssue()->user; $oPage->root_page = true; $oPage->save(); //Find field record for type 'Body' $oFieldBody = AM_Model_Db_Table_Abstract::factory('field')->findOneBy(array('field_type' => 1, 'template' => AM_Model_Db_Template::TPL_COVER_PAGE)); if (is_null($oFieldBody)) { throw new AM_Handler_Issue_Exception('Field "Body" not found'); } //Create element for cover page $oElement = new AM_Model_Db_Element(); $oElement->field = $oFieldBody->id; $oElement->page = $oPage->id; $oElement->save(); AM_Tools::clearContent(AM_Model_Db_Element::RESOURCE_TYPE, $oElement->id); AM_Tools::clearResizerCache(AM_Model_Db_Element::RESOURCE_TYPE, $oElement->getResources()->getThumbnailPresetName(), $oElement->id); //Prepare resources for the element $sImage = array_shift($aImages); $oElement->getResources()->setData(array(AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE => $sImage))->save(); //Set page background $oElement->getResources()->setPageBackground(); //Create childs $oFieldBody = AM_Model_Db_Table_Abstract::factory('field')->findOneBy(array('field_type' => 1, 'template' => AM_Model_Db_Template::TPL_SIMPLE_PAGE)); if (is_null($oFieldBody)) { throw new AM_Handler_Issue_Exception('Field "Body" not found'); } $oPageRoot = clone $oPage; foreach ($aImages as $sImage) { $oPage = new AM_Model_Db_Page(); $oPage->title = 'Right connected to page ' . $oPageRoot->id; $oPage->template = AM_Model_Db_Template::TPL_SIMPLE_PAGE; $oPage->revision = $oRevision->id; $oPage->user = $this->getIssue()->user; $oPage->setConnectionBit(AM_Model_Db_page::LINK_LEFT); $oPage->save(); $oPageRoot->setConnectionBit(AM_Model_Db_page::LINK_RIGHT); $oPageRoot->save(); $oPage->setParent($oPageRoot); $oPage->setLinkType(AM_Model_Db_page::LINK_RIGHT)->savePageImposition(); //Create element for cover page $oElement = new AM_Model_Db_Element(); $oElement->field = $oFieldBody->id; $oElement->page = $oPage->id; $oElement->save(); AM_Tools::clearContent(AM_Model_Db_Element::RESOURCE_TYPE, $oElement->id); AM_Tools::clearResizerCache(AM_Model_Db_Element::RESOURCE_TYPE, $oElement->getResources()->getThumbnailPresetName(), $oElement->id); //Prepare resources for the element $oElement->getResources()->setData(array(AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE => $sImage))->save(); //Set page background $oElement->getResources()->setPageBackground(); $oPageRoot = clone $oPage; } $oRevision->exportRevision(); return $oRevision; }
/** * Get client application/issues/revision tree * * @param int $iApplicationId * @param string $sUdid * @return array */ public function getIssues($iApplicationId, $sUdid = null, $sPlatform = self::PLATFORM_IOS, $sPublisherToken = NULL) { $iApplicationId = intval($iApplicationId); if ($iApplicationId <= 0) { throw new AM_Api_Client_Exception(sprintf('Invalid application id "%d"', $iApplicationId)); } $sPlatform = trim($sPlatform); if (!in_array($sPlatform, $this->_aValidPlatforms)) { $sPlatform = self::PLATFORM_IOS; } if (!is_null($sUdid)) { $sUdid = trim($sUdid); } //Does udid belong to admin user $bIsUdidUserAdmin = false; $oDevice = null; if (!empty($sUdid)) { $oDevice = AM_Model_Db_Table_Abstract::factory('device')->findOneBy(array('identifer' => $sUdid)); if (!is_null($oDevice)) { $this->getLogger()->debug(sprintf('Existing device given: %s', $sUdid)); $oUser = $oDevice->getUser(); if (!is_null($oUser)) { $bIsUdidUserAdmin = (bool) $oUser->is_admin; } } } $aResult = array('code' => self::RESULT_SUCCESS, 'applications' => array()); $oApplications = AM_Model_Db_Table_Abstract::factory('application')->findAllBy(array('id' => $iApplicationId, 'deleted' => 'no')); foreach ($oApplications as $oApplication) { if ($this->authenticatePublisher($sPublisherToken, $oApplication->id, $oApplication) == self::RESULT_SUCCESS) { $bIsUdidUserAdmin = true; } if (!is_null($oDevice)) { if (!is_null($oDevice->getUser()) && $oApplication->client == $oDevice->getUser()->client) { $bIsUdidUserAdmin = true; } } $oVocabulary = AM_Model_Db_Table_Abstract::factory('application')->findOneBy('id', $iApplicationId)->getVocabularyTag(); $aApplicationTags = array(); $oApplicationTags = AM_Model_Db_Table_Abstract::factory('term')->getTagsForApplicationExisting($oVocabulary->id); foreach ($oApplicationTags as $oApplicationTag) { $aApplicationTags[] = array('id' => $oApplicationTag->id, 'title' => $oApplicationTag->title); } $aApplication = array('application_id' => $oApplication->id, 'application_title' => $oApplication->title, 'application_type' => $oApplication->type, 'application_description' => $oApplication->description, 'application_product_id' => $oApplication->product_id, 'application_notification_email' => $oApplication->{'nm_email_' . $sPlatform}, 'application_notification_email_title' => $oApplication->{'nt_email_' . $sPlatform}, 'application_notification_twitter' => $oApplication->{'nm_twitter_' . $sPlatform}, 'application_notification_facebook' => $oApplication->{'nm_fbook_' . $sPlatform}, 'application_preview' => $oApplication->preview, 'application_tags' => $aApplicationTags); if ($oApplication->type == AM_Model_Db_ApplicationType::TYPE_RUE98WE) { $aApplication['application_welcome_message'] = !empty($oApplication->welcome) ? str_replace("\n", "\\n", $oApplication->welcome) : null; $aApplication['application_welcome_message_part2'] = !empty($oApplication->welcome_part2) ? str_replace("\n", "\\n", $oApplication->welcome_part2) : null; $aApplication['application_message_for_readers'] = $oApplication->message_for_readers; $aApplication['application_share_url'] = $oApplication->share_url; $aApplication['application_share_message'] = $oApplication->share_message; $aApplication['application_email'] = $oApplication->application_email; $aApplication['application_contact_email_subject'] = $oApplication->contact_email_subject; $aApplication['application_contact_email_text'] = $oApplication->contact_email_text; $aApplication['application_subscribe_title'] = $oApplication->subscribe_title; $aApplication['application_subscribe_button'] = $oApplication->subscribe_button; $oSubscriptions = AM_Model_Db_Table_Abstract::factory('subscription')->findAllBy(array('application' => $oApplication->id)); $aApplication['application_subscriptions'] = array(); foreach ($oSubscriptions as $oSubscription) { $aApplication['application_subscriptions'][$oSubscription->id] = array('button_title' => $oSubscription->button_title, 'itunes_id' => $oSubscription->itunes_id, 'google_id' => $oSubscription->google_id); } if (!empty($oApplication->newsstand_cover_image)) { $aApplication['application_newsstand_cover_path'] = AM_Tools::getImageUrl('1066-600', AM_Model_Db_Application::PRESET_APPLICATION_IMAGE, $oApplication->id, $oApplication->newsstand_cover_image, 'png') . '?' . strtotime($oApplication->updated); } } $aApplication['issues'] = array(); //Checking subscripton $oSubscription = null; if (!is_null($oDevice)) { $aProductIds = array($oApplication->product_id); foreach (AM_Api_Purchase::$aSubscriptionTypes as $sType) { $aProductIds[] = $oApplication->product_id . '.' . $sType; } foreach ($aProductIds as $sProductId) { $oSubscription = AM_Model_Db_Table_Abstract::factory('purchase')->findOneBy(array('device_id' => $oDevice->id, 'product_id' => $sProductId, 'deleted' => 'no')); /* @var $oSubscription AM_Model_Db_Purchase */ if (!is_null($oSubscription)) { $this->getLogger()->debug(sprintf('Found subscription for device: %s', $sUdid)); if ($oSubscription->isExpired()) { $this->getLogger()->debug(sprintf('Subscription is expired: %s', $sUdid)); $oSubscription = null; } else { break; } } } } //Looking for the issues $aCriteria = array('application' => $oApplication->id, 'deleted' => 'no'); if (!$bIsUdidUserAdmin) { $aCriteria['state'] = AM_Model_Db_State::STATE_PUBLISHED; } $oIssues = AM_Model_Db_Table_Abstract::factory('issue')->findAllBy($aCriteria); foreach ($oIssues as $oIssue) { if (!empty($oIssue->exclude)) { continue; } $oTermEntities = AM_Model_Db_Table_Abstract::factory('termEntity')->findAllBy(array('entity' => $oIssue->id, 'entity_type' => 'issue')); $aTags = array(); foreach ($oTermEntities as $oTermEntity) { $oTag = AM_Model_Db_Table_Abstract::factory('term')->findOneBy('id', $oTermEntity->term); $aTags[] = array('id' => $oTag->id, 'title' => $oTag->title); } $aIssue = array('issue_id' => $oIssue->id, 'issue_title' => $oIssue->title, 'issue_number' => $oIssue->number, 'issue_state' => AM_Model_Db_State::stateToName($oIssue->state), 'revisions' => array(), 'tags' => $aTags, 'issue_publish_date' => $oIssue->state == AM_Model_Db_State::STATE_PUBLISHED && !empty($oIssue->publish_date) ? $oIssue->publish_date : null, 'updated' => $oIssue->updated); if ($oApplication->type == AM_Model_Db_ApplicationType::TYPE_GENERIC) { $aIssue['paid'] = !empty($oIssue->paid) ? true : false; $aIssue['issue_product_id'] = $oIssue->product_id; } if ($oApplication->type == AM_Model_Db_ApplicationType::TYPE_RUE98WE) { $aIssue['issue_author'] = $oIssue->author; $aIssue['issue_words'] = $oIssue->words; $aIssue['issue_excerpt'] = !empty($oIssue->excerpt) ? str_replace("\n", "\\n", $oIssue->excerpt) : null; $aIssue['issue_title_short'] = $oIssue->title_short; $aIssue['issue_excerpt_short'] = !empty($oIssue->excerpt_short) ? str_replace("\n", "\\n", $oIssue->excerpt_short) : null; $aIssue['issue_category'] = !empty($oIssue->category) ? str_replace("\n", "\\n", $oIssue->category) : null; $aIssue['issue_pricing_plan'] = AM_Model_Db_Issue::pricingToName($oIssue->pricing_plan); $aIssue['issue_google_play_id'] = $oIssue->google_play_id; $aIssue['issue_itunes_id'] = $oIssue->itunes_id; if (!empty($oIssue->image)) { $aIssue['issue_image_large'] = AM_Tools::getImageUrl('1066-600', AM_Model_Db_Issue::PRESET_ISSUE_IMAGE, $oIssue->id, $oIssue->image, 'png') . '?' . strtotime($oIssue->updated); $aIssue['issue_image_small'] = AM_Tools::getImageUrl('533-300', AM_Model_Db_Issue::PRESET_ISSUE_IMAGE, $oIssue->id, $oIssue->image, 'png') . '?' . strtotime($oIssue->updated); } } //Prepearing help pages $oHelpPages = AM_Model_Db_Table_Abstract::factory('issue_help_page')->findAllBy(array('id_issue' => $oIssue->id)); //Checking the payment if (!is_null($oDevice)) { if (!is_null($oSubscription)) { $aIssue['paid'] = true; $aIssue['subscription_type'] = $oSubscription->subscription_type; } else { $this->getLogger()->debug(sprintf('Checking purchase: %s', $sUdid)); $oPurchase = AM_Model_Db_Table_Abstract::factory('purchase')->findOneBy(array('device_id' => $oDevice->id, 'product_id' => $oIssue->product_id, 'deleted' => 'no')); if (!is_null($oPurchase)) { $this->getLogger()->debug(sprintf('Found purchase record: %s', $sUdid)); $aIssue['paid'] = true; } else { $this->getLogger()->debug(sprintf('Purchases not found: %s', $sUdid)); } } } //Looking for the revisions $aCriteria = array('issue' => $oIssue->id, 'deleted' => 'no'); if (!$bIsUdidUserAdmin) { $aCriteria['state'] = AM_Model_Db_State::STATE_PUBLISHED; } $oRevisions = AM_Model_Db_Table_Abstract::factory('revision')->findAllBy($aCriteria); foreach ($oRevisions as $oRevision) { $aRevision = array('revision_id' => $oRevision->id, 'revision_title' => $oRevision->title, 'revision_state' => AM_Model_Db_State::stateToName($oRevision->state), 'revision_cover_image_list' => '', 'revision_video' => '', 'revision_created' => null, 'revision_color' => $oIssue->issue_color, 'summary_color' => $oIssue->summary_color, 'pastille_color' => $oIssue->pastille_color, 'revision_horizontal_mode' => $oIssue->static_pdf_mode, 'revision_orientation' => $oIssue->orientation, 'help_pages' => array(AM_Model_Db_IssueHelpPage::TYPE_HORIZONTAL => '', AM_Model_Db_IssueHelpPage::TYPE_VERTICAL => '')); foreach ($oHelpPages as $oHelpPage) { /* @var $oHelpPage AM_Model_Db_IssueHelpPage */ $aRevision['help_pages'][$oHelpPage->type] = (string) $oHelpPage->getResource()->getResourcePathForExport(); } //Revision creation date $oDate = new Zend_Date($oRevision->created); $aRevision['revision_created'] = $oDate->toString(Zend_Date::ISO_8601); $oPageCover = AM_Model_Db_Table_Abstract::factory('revision')->findOneBy('id', $oRevision->id)->getPageRoot(); /* @var $oPageCover AM_Model_Db_Page */ if (!is_null($oPageCover)) { $aRevision['revision_cover_image_list'] = (string) $oPageCover->getPageCoverUri(); $aRevision['revision_video'] = (string) $oPageCover->getStartVideoUri(); } $aIssue['revisions'][$oRevision->id] = $aRevision; } $aApplication['issues'][$oIssue->id] = $aIssue; } $aResult['applications'][$oApplication->id] = $aApplication; } return $aResult; }
/** * Magic method to validate facebook account name * @param mixed $mValue * @return string * @throws AM_Model_Db_Element_Data_Exception */ protected function _addFacebookNamePage($mValue) { $mValue = AM_Tools::filter_xss($mValue); if (!Zend_Validate::is($mValue, 'regex', array('pattern' => '/^[a-z\\d.]{5,}$/i'))) { throw new AM_Model_Db_Element_Data_Exception(sprintf('Wrong parameter "%s" given', self::DATA_KEY_HTML5_FACEBOOK_NAME_PAGE)); } return $mValue; }
/** * Clear resources and thumbnail * * @return void */ public function clearResources() { $sFileNameMask = $this->_getHorizontalPdf()->id . '.*'; AM_Tools::clearContent(self::TYPE, $this->_getHorizontalPdf()->issue, $sFileNameMask); AM_Tools::clearResizerCache(self::TYPE, self::TYPE, $this->_getHorizontalPdf()->issue, $sFileNameMask); AM_Tools::clearContent(self::TYPE_CACHE, $this->_getHorizontalPdf()->issue); AM_Tools::clearResizerCache(self::TYPE_CACHE, self::TYPE_CACHE, $this->_getHorizontalPdf()->issue); }
/** * @return void */ public function show() { $oTermEntities = AM_Model_Db_Table_Abstract::factory('termEntity')->findAllBy(array('entity' => $this->primaryKeyValue, 'entity_type' => 'issue')); $sExistingTags = ''; foreach ($oTermEntities as $oTermEntity) { $oTag = AM_Model_Db_Table_Abstract::factory('term')->findOneBy('id', $oTermEntity->term); $sExistingTags .= $oTag->title . ', '; } if (!$this->controls['tags']->getValue()) { $this->controls['tags']->setValue($sExistingTags); } if ($this->primaryKeyValue) { $oIssue = AM_Model_Db_Table_Abstract::factory('issue')->findOneBy('id', $this->primaryKeyValue); if ($oIssue->image) { $sIssueImageUri = AM_Tools::getImageUrl('270-150', AM_Model_Db_Issue::PRESET_ISSUE_IMAGE, $this->primaryKeyValue, $oIssue->image, 'png') . '?' . strtotime($oIssue->updated); } } $aPricingPlans = AM_Model_Db_Issue::getPricingPlans(); $aRecord = array('appId' => $this->applicationId, 'imageUri' => isset($sIssueImageUri) ? $sIssueImageUri : null, 'pricingPlans' => $aPricingPlans); if (isset($this->view->{$this->getName()})) { $aRecord = array_merge($aRecord, $this->view->{$this->getName()}); } $this->view->{$this->getName()} = $aRecord; parent::show(); }
/** * Clear resources and thumbnail * * @param string|null $sKey Have to delete data by $key or all data * @return void */ public function clearResources($sKey = null) { if (is_null($sKey)) { $sKey = '*'; } AM_Tools::clearContent(self::TYPE, $this->getElement()->id, $sKey . '.*'); AM_Tools::clearResizerCache(self::TYPE, $this->getElement()->getResources()->getThumbnailPresetName(), $this->getElement()->id, $sKey . '.*'); }
/** * Creates toc term for current vocabulary * @param string $sTocItemName * @param AM_Model_Db_Revision $oRevision * @param int | null $iParentId * @return AM_Model_Db_Term */ public function createTocTerm($sTocItemName, AM_Model_Db_Revision $oRevision, $iParentId = null, $iPosition = 0) { $sTocItemName = trim(AM_Tools::filter_xss($sTocItemName)); $iParentId = 0 == $iParentId ? null : $iParentId; $oTocTerm = new AM_Model_Db_Term(); $oTocTerm->title = $sTocItemName; $oTocTerm->vocabulary = $this->id; $oTocTerm->revision = $oRevision->id; $oTocTerm->parent_term = $iParentId; $oTocTerm->position = $iPosition; $oTocTerm->updated = new Zend_Db_Expr('NOW()'); $oTocTerm->save(); return $oTocTerm; }
/** * Filter description value * * @param string $sValue * @return string */ public function preSetDescription($sValue) { $sValue = AM_Tools::filter_xss($sValue); return $sValue; }
/** * Action saves key-value data for element */ public function saveWordAction() { $aMessage = array('status' => 0); try { $aWord = (array) $this->_getParam('word'); $oField = AM_Model_Db_Table_Abstract::factory('field')->findOneBy('id', $this->_iFieldId); /* @var $oField AM_Model_Db_Field */ if (is_null($oField)) { throw new AM_Exception(sprintf('Field with id "%d" not found.', $this->_iFieldId)); } $oPage = AM_Model_Db_Table_Abstract::factory('page')->findOneBy('id', $this->_iPageId); /* @var $oPage AM_Model_Db_Page */ if (is_null($oPage)) { throw new AM_Exception(sprintf('Page with id "%d" not found.', $this->_iPageId)); } $oElement = $oPage->getElementForField($oField); /* @var $oElement AM_Model_Db_Element */ $oGame = AM_Model_Db_Table_Abstract::factory('game')->findOneBy(array('page' => $oPage->id, 'type' => AM_Model_Db_GameType::GAME_TYPE_CROSSWORD)); if (is_null($oGame)) { throw new AM_Exception(sprintf('Game for page "%d" not found.', $this->_iPageId)); } $oWordModel = new AM_Model_Db_GameCrosswordWord(); $oWordModel->start_x = $aWord['startX']; $oWordModel->start_y = $aWord['startY']; $oWordModel->question = AM_Tools::filter_xss($aWord['question']); $oWordModel->answer = AM_Tools::filter_xss($aWord['answer']); $oWordModel->length = $aWord['length']; $oWordModel->direction = $aWord['direction']; $oWordModel->game = $oGame->id; $oWordModel->save(); $oPage->setUpdated(false); $aMessage['word_id'] = $oWordModel->id; $aMessage['status'] = 1; } catch (Exception $oException) { $aMessage['message'] = $this->__('Error. Can\'t set value! ') . PHP_EOL . $oException->getMessage(); } return $this->getHelper('Json')->sendJson($aMessage, false); }
/** * Clear resources and thumbnail * * @return void */ public function clearResources() { AM_Tools::clearContent($this->_getIssueHelpPage()->getThumbnailPresetType(), $this->_getIssueHelpPage()->id_issue); AM_Tools::clearResizerCache($this->_getIssueHelpPage()->getThumbnailPresetType(), $this->_getIssueHelpPage()->getThumbnailPresetType(), $this->_getIssueHelpPage()->id_issue); }
/** * Issue upload-help-page action * * Upload help page for issue */ public function uploadHelpPageAction() { $aMessage = array('status' => 0); try { $iIssueId = intval($this->_getParam('iid')); $sHelpPageType = (string) $this->_getParam('type'); if (!AM_Model_Db_Table_Abstract::factory('issue')->checkAccess($iIssueId, $this->_aUserInfo)) { throw new AM_Controller_Exception_Forbidden('Access denied'); } $oIssue = AM_Model_Db_Table_Abstract::factory('issue')->findOneBy('id', $iIssueId); /* @var $oIssue AM_Model_Db_Issue */ if (is_null($oIssue)) { throw new AM_Controller_Exception_Forbidden('Access denied'); } $oHelpPage = $oIssue->uploadHelpPage($sHelpPageType); /* @var $oHelpPage AM_Model_Db_IssueHelpPage */ $aFile = array(); $aFile['name'] = $oHelpPage->name; $aFile['nameShort'] = $this->getHelper('String')->cut($oHelpPage->name, 12); $aFile['smallUri'] = AM_Tools::getImageUrl($oHelpPage->getThumbnailPresetType(), $oHelpPage->getThumbnailPresetType(), $iIssueId, $oHelpPage->getResource()->getResourceBaseName()) . '?' . strtotime($oHelpPage->updated); $aFile['bigUri'] = AM_Tools::getImageUrl($oHelpPage->getResolutionForPreview(), $oHelpPage->getThumbnailPresetType(), $iIssueId, $oHelpPage->getResource()->getResourceBaseName()) . '?' . strtotime($oHelpPage->updated); $aMessage['file'] = $aFile; $aMessage['status'] = 1; } catch (Exception $e) { if (isset($oHelpPage)) { $oHelpPage->delete(); } $aMessage['message'] = 'Error. Can\'t upload file.' . PHP_EOL . $e->getMessage(); } return $this->sendJsonAsPlainText($aMessage); }
/** * Upload vertical pdf * @return AM_Model_Db_IssueSimplePdf */ public function uploadSimplePdf() { $oVerticalPdf = AM_Model_Db_Table_Abstract::factory('issue_simple_pdf')->findOneBy('id_issue', $this->id); if (is_null($oVerticalPdf)) { $oVerticalPdf = new AM_Model_Db_IssueSimplePdf(); } AM_Tools::clearContent(AM_Model_Db_IssueSimplePdf_Data_Abstract::TYPE, $this->id); AM_Tools::clearResizerCache(AM_Model_Db_IssueSimplePdf_Data_Abstract::TYPE, AM_Model_Db_IssueSimplePdf_Data_Abstract::TYPE, $this->id); $oVerticalPdf->setIssue($this); $oVerticalPdf->save(); $oVerticalPdf->uploadResource(); return $oVerticalPdf; }
/** * Clear resources and thumbnail * * @return void */ public function clearResources() { AM_Tools::clearContent(self::TYPE, $this->_getIssueSimplePdf()->id_issue); AM_Tools::clearResizerCache(self::TYPE, self::TYPE, $this->_getIssueSimplePdf()->id_issue); }
/** * Gets page's start video (API uses this method) * @return false|string */ public function getStartVideoUri() { $oFieldVideo = AM_Model_Db_Table_Abstract::factory('field')->findOneBy(array('name' => AM_Model_Db_FieldType::TYPE_VIDEO, 'template' => AM_Model_Db_Template::TPL_COVER_PAGE)); $oElementVideo = AM_Model_Db_Table_Abstract::factory('element')->findOneBy(array('page' => $this->id, 'field' => $oFieldVideo->id)); /* @var $oElementVideo AM_Model_Db_Element */ if (is_null($oElementVideo)) { // if it is root page, but not cover page template $oPage = AM_Model_Db_Table_Abstract::factory('page')->findOneBy('id', $this->id); if ($oPage->root_page) { $oFieldVideo = AM_Model_Db_Table_Abstract::factory('field')->findOneBy(array('name' => AM_Model_Db_FieldType::TYPE_VIDEO, 'template' => $this->template)); if (empty($oFieldVideo)) { return null; } $oElementVideo = AM_Model_Db_Table_Abstract::factory('element')->findOneBy(array('page' => $this->id, 'field' => $oFieldVideo->id)); } if (is_null($oElementVideo)) { return null; } } $sResource = $oElementVideo->getResources()->getDataValue(AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE); if (empty($sResource)) { return null; } $sFileExtension = pathinfo($sResource, PATHINFO_EXTENSION); $sFileName = 'resource.' . $sFileExtension; $sUri = AM_Tools::getImageUrl('none', AM_Model_Db_Element_Data_Abstract::TYPE, $oElementVideo->id, $sFileName); return $sUri; }
protected function _preOperation() { $sDescription = $this->controls['description']->getValue(); $this->controls['description']->setValue(AM_Tools::filter_xss($sDescription)); $sProductId = $this->controls['product_id']->getValue(); $this->controls['product_id']->setValue(AM_Tools::filter_xss($sProductId)); }
/** * Editor toc-delete-summary action */ public function tocDeleteSummaryAction() { $aMessage = array('status' => 0); try { $iRevisionId = intval($this->_getParam('rid')); $iTocItemId = intval($this->_getParam('id')); if (!AM_Model_Db_Table_Abstract::factory('term')->checkAccess($iTocItemId, $this->_aUserInfo)) { throw new AM_Controller_Exception_BadRequest('Error. Invalid params were given'); } $oRevision = AM_Model_Db_Table_Abstract::factory('revision')->findOneBy('id', $iRevisionId); /* @var $oRevision AM_Model_Db_Revision */ if (is_null($oRevision)) { throw new AM_Controller_Exception_Forbidden('Access denied'); } $oTerm = AM_Model_Db_Table_Abstract::factory('term')->findOneBy('id', $iTocItemId); /* @var $oTerm AM_Model_Db_Term */ if (is_null($oTerm)) { throw new AM_Controller_Exception_Forbidden('Access denied'); } AM_Tools::clearContent(AM_Model_Db_Term_Data_Abstract::TYPE, $oTerm->id, 'sumary.*'); AM_Tools::clearResizerCache(AM_Model_Db_Term_Data_Abstract::TYPE, AM_Model_Db_Term_Data_Abstract::TYPE, $oTerm->id, 'sumary.*'); $oTerm->thumb_summary = null; $oTerm->updated = new Zend_Db_Expr('NOW()'); $oTerm->save(); $oRevision->exportRevision(); $aDefaultImage = array(); $aDefaultImage['defaultUri'] = AM_Tools::getImageUrl('toc-summary', 'toc', $iTocItemId); $aMessage['file'] = $aDefaultImage; $aMessage['status'] = 1; } catch (Exception $oException) { $aMessage['message'] = $this->__('Error. Can\'t delete file') . PHP_EOL . $oException->getMessage(); } return $this->getHelper('Json')->sendJson($aMessage); }
/** * Clear resources and thumbnail * * @param string|null $sResourceKey Have to delete data by $key or all data * @return void */ public function clearResources($sResourceKey = null) { if (is_null($sResourceKey)) { $sResourceKey = '*'; } AM_Tools::clearContent(AM_Model_Db_Term_Data_Abstract::TYPE, $this->getTerm()->id, $sResourceKey . '.*'); AM_Tools::clearResizerCache(AM_Model_Db_Term_Data_Abstract::TYPE, AM_Model_Db_Term_Data_Abstract::TYPE, $this->getTerm()->id, $sResourceKey . '.*'); }
protected function _preOperation() { $sLogin = $this->controls['login']->getValue(); $this->controls['login']->setValue(AM_Tools::filter_xss($sLogin)); $sFirstName = $this->controls['first_name']->getValue(); $this->controls['first_name']->setValue(AM_Tools::filter_xss($sFirstName)); $sLastName = $this->controls['last_name']->getValue(); $this->controls['last_name']->setValue(AM_Tools::filter_xss($sLastName)); }
/** * Resizes elements */ protected function _resizeElements() { $oQuery = AM_Model_Db_Table_Abstract::factory('element_data')->select()->setIntegrityCheck(false)->from('element_data')->joinInner('element', 'element.id = element_data.id_element')->joinInner('page', 'page.id = element.page')->joinInner('revision', 'revision.id = page.revision')->joinInner('issue', 'issue.id = revision.issue')->joinInner('application', 'application.id = issue.application')->joinInner('client', 'client.id = application.client')->where(sprintf('element_data.key_name IN ("%s", "%s", "%s")', AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE, AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_THUMBNAIL, AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_THUMBNAIL_SELECTED))->where('page.deleted = ?', 'no')->where('revision.deleted = ?', 'no')->where('issue.deleted = ?', 'no')->where('application.deleted = ?', 'no')->where('client.deleted = ?', 'no')->columns(array('id' => 'element_data.id_element'))->order('element_data.id_element ASC'); /* @var $oQuery Zend_Db_Table_Select */ if ($this->_iFromId > 0) { $oQuery->where('element_data.id_element > ?', $this->_iFromId); } if ($this->_iElementId > 0) { $oQuery->where('element_data.id_element = ?', $this->_iElementId); } if ($this->_iPageId > 0) { $oQuery->where('page.id = ?', $this->_iPageId); } if ($this->_iRevisionId > 0) { $oQuery->where('revision.id = ?', $this->_iRevisionId); } if ($this->_iIssueId > 0) { $oQuery->where('issue.id = ?', $this->_iIssueId); } if ($this->_iApplicationId > 0) { $oQuery->where('application.id = ?', $this->_iApplicationId); } $oElementDatas = AM_Model_Db_Table_Abstract::factory('element_data')->fetchAll($oQuery); $iCounter = 0; foreach ($oElementDatas as $oElementData) { try { $oData = $oElementData->getData(); $bZoom = (bool) $oElementData->getData()->getDataValue(AM_Model_Db_Element_Data_Gallery::DATA_KEY_ENABLE_ZOOM, false); if (!is_null($oData) && method_exists($oData, 'getThumbnailPresetName')) { $this->_resizeImage($oElementData->value, $oElementData->getElement(), AM_Model_Db_Element_Data_Resource::TYPE, $oElementData->key_name, $oElementData->getData()->getThumbnailPresetName(), $bZoom); $sFileExtension = strtolower(pathinfo($oElementData->value, PATHINFO_EXTENSION)); if ('pdf' == $sFileExtension && AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE == $oElementData->key_name) { $oData->delete(AM_Model_Db_Element_Data_Resource::PDF_INFO, false); $sFilePath = AM_Tools::getContentPath(AM_Model_Db_Element_Data_Resource::TYPE, $oElementData->getElement()->id) . DIRECTORY_SEPARATOR . AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE . '.' . $sFileExtension; $oResource = AM_Resource_Factory::create($sFilePath); $sPdfInfo = $oResource->getPdfInfo(); $oData->addKeyValue(AM_Model_Db_Element_Data_Resource::PDF_INFO, $sPdfInfo); } } } catch (Exception $oException) { $this->_echo(sprintf('%s', $oException->getMessage()), 'error'); } if ($iCounter++ > 100) { $iCounter = 0; AM_Handler_Temp::getInstance()->end(); } } }
protected function _preOperation() { $sTitle = $this->controls['title']->getValue(); $this->controls['title']->setValue(AM_Tools::filter_xss($sTitle)); $sNumber = $this->controls['number']->getValue(); $this->controls['number']->setValue(AM_Tools::filter_xss($sNumber)); if (get_class($this) == 'AM_Component_Record_Database_Issue_Generic') { $sProductId = $this->controls['product_id']->getValue(); $this->controls['product_id']->setValue(AM_Tools::filter_xss($sProductId)); } }