public function errorLog($message) { if (!$this->_errorLog) { $this->_errorLog = Package::buildPath($_SERVER['DOCUMENT_ROOT'], 'fileupload.log'); } error_log($message . "\n", 3, $this->_errorLog); }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { if ('admin' == $request->getModuleName() && 'Login' != $request->getControllerName()) { // Immediate ACL check to make sure they have identity $allowUser = defined('DEBUG_MODE') ? true : false; // blacklist system $user = $request->getParam('User', null); if ($user instanceof Showcase_User) { // OK user has identity, check the roles //$allowUser = Zend_registry::get('Acl')->isAllowed($user->getRoles(), "CMS User") ? true : false; $allowUser = $user->isCmsaccess; } if (!$allowUser) { $request->setControllerName('Login')->setModuleName('index')->setActionName('index')->setDispatched(false); } else { Showcase_Controller_Action_HelperBroker::addPath(Package::buildPath(SITE_DIR, 'classes', 'Controller', 'Action', 'Helper', 'Admin'), 'Showcase_Controller_Action_Helper_Admin'); // Cretae a new helper path for administrative privileges //$request->setParam('Admin', Showcase_Admin::getInstance()); // Set the instance of the Admin object //$request->getParam('View')->assign('admin', $request->getParam('Admin')); // And inject it into the view so it can help things for Smarty // Include the CMS JS scripts //$request->getParam('View')->assign('javaScripts', array('/include/js/admin/js/cms')); // Check if the user wants to force a manual cache clearance //if ($request->getParam('flushCache')) { // Showcase_Content_Cache::flushCache(); //} } } }
/** * smarty_resource_view_source * * The first function, source() is supposed to retrieve the resource. * Its second parameter $tpl_source is a variable passed by reference * where the result should be stored. The function is supposed to * return TRUE if it was able to successfully retrieve the resource * and FALSE otherwise. * * @param string $tpl_name * @param string $tpl_source reference * @param object $smarty reference * @uses Package::buildPath() * @return void */ function smarty_resource_view_source($tplName, &$tplSource, Smarty &$smarty) { $templateVars = $smarty->get_template_vars(); $currentModule = $templateVars['__ZF__']['module']; $currentController = $templateVars['__ZF__']['controller']; $resourcePath = null; if ("login" !== strtolower($currentController) && "static" !== strtolower($currentController) && "admin" !== strtolower($currentModule)) { $client = $smarty->get_registered_object('client'); if (($path = Package::buildPath($smarty->template_dir, 'clients', $client->identifier, 'modules', $currentModule, $currentController, $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'clients', $client->identifier, 'modules', $currentModule, 'default', $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'clients', $client->identifier, 'modules', $currentModule, $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'clients', $client->identifier, 'modules', $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'clients', $client->identifier, $tplName)) && is_readable($path)) { $resourcePath = $path; } } if (!$resourcePath) { if (($path = Package::buildPath($smarty->template_dir, 'modules', $currentModule, $currentController, $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'modules', $currentModule, 'default', $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'modules', $currentModule, $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, 'modules', $tplName)) && is_readable($path)) { $resourcePath = $path; } elseif (($path = Package::buildPath($smarty->template_dir, $tplName)) && is_readable($path)) { $resourcePath = $path; } else { return false; } } if ('admin' == $currentModule && isset($resourcePath)) { if ($tpl = $smarty->_read_file($resourcePath)) { $tplSource = $tpl; } return true; } if ($resourcePath) { if ($tpl = $smarty->_read_file($resourcePath)) { $tplSource = $tpl; } // $tplSource = $path; /* $smarty->_smarty_include( array( 'smarty_include_tpl_file' => $path, 'smarty_include_vars' => array() ) ); die('we got to here'); */ return true; } return false; }
public function __construct($post) { $this->_post = $post; $this->_clientName = strtolower($this->_post['client']['name']); $this->_uploadPathImages = Package::buildPath(DOC_DIR, 'document_root', 'images', 'clients', strtolower($this->_clientName), 'campaigns') . DIRECTORY_SEPARATOR; $this->_uploadPathMedia = Package::buildPath(DOC_DIR, 'document_root', 'media', strtolower($this->_clientName)) . DIRECTORY_SEPARATOR; $this->_dbImagePath = DIRECTORY_SEPARATOR . Package::buildPath('images', 'clients', strtolower($this->_clientName), 'campaigns') . DIRECTORY_SEPARATOR; $this->_dbMediaPath = DIRECTORY_SEPARATOR . Package::buildPath('media', strtolower($this->_clientName)) . DIRECTORY_SEPARATOR; }
public function routeStartup(Zend_Controller_Request_Abstract $request) { $request->setParam('View', Showcase_View_Smarty::factory('view.xml')); $request->getParam('View')->cache_handler_func = 'zend_cache_handler'; $request->getParam('View')->caching = 0; $viewRenderer = new Showcase_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setViewSuffix('tpl')->setView($request->getParam('View'))->setViewBasePathSpec(Package::buildPath(SITE_DIR, 'views')); Zend_Controller_Action_HelperBroker::removeHelper('viewRenderer'); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); }
public function __construct($content = null) { $this->_post = $content; isset($content['contentId']) ? $this->_contentId = $content['contentId'] : NULL; isset($content['operationType']) ? $this->_operationType = $content['operationType'] : NULL; isset($content['client']) ? $this->_client = $content['client'] : NULL; isset($content['jobId']) ? $this->_jobId = $content['jobId'] : NULL; isset($content['title']) ? $this->_article['title'] = $content['title'] : NULL; isset($content['description']) ? $this->_article['description'] = $content['description'] : NULL; isset($content['image']) ? $this->_image = $content['image'] : NULL; isset($content['datePublished']) ? $this->_published = $content['datePublished'] : NULL; isset($content['status']) ? $this->_status = $content['status'] : NULL; isset($content['client']) ? $this->_uploadPathImages = Package::buildPath(DOC_DIR, 'document_root', 'images', 'clients', strtolower($this->_client['name']), 'campaigns') : NULL; isset($content['client']) ? $this->_dbImagePath = "/" . Package::buildPath('images', 'clients', strtolower($this->_client['name']), 'campaigns') . "/" : NULL; isset($content['oldImageName']) ? $this->_oldImage = array('name' => $content['oldImageName'], 'fullPath' => $this->_uploadPathImages . DIRECTORY_SEPARATOR . $content['oldImageName']) : NULL; }
public function includeAction() { $this->_helper->ViewRenderer->setUseStage(false); if (($include = $this->_getParam('include', null)) && ($extension = $this->_getParam('extension', null))) { if (!strpos($include, '/')) { $include = Package::buildPath($extension, $include); } switch ($extension) { case 'css': header("Content-type: text/css"); break; case 'js': break; } $this->view->assign('include', $include . '.' . $extension); } }
public function getFilesize() { if (!$this->path || $this->isWeblink) { return false; } $sysPath = Package::buildPath($_SERVER['DOCUMENT_ROOT'], $this->path); if (file_exists($sysPath)) { $size = filesize($sysPath) / 1024; if ($size < 1024) { $size = number_format($size, 2); $size .= ' KB'; } else { if ($size / 1024 < 1024) { $size = number_format($size / 1024, 2); $size .= ' MB'; } elseif ($size / 1024 / 1024 < 1024) { $size = number_format($size / 1024 / 1024, 2); $size .= ' GB'; } } return $size; } return false; }
/** * Set the path to the compile directory * * @param string $path The directory to set as the path. * @return void */ public function setCompilePath($path) { if (is_writable($path)) { $this->_setSmartyParams('compile_dir', $path); return; } $this->_setSmartyParams('compile_dir', Package::buildPath(SITE_DIR, 'views', 'compile')); return; //throw new Exception('Invalid compile path provided: ' . $path); }