public function indexAction() { $ns = new Zend_Session_Namespace(); $locale = $ns->lang; Shineisp_Commons_Utilities::log("ShineISP starts now from " . $_SERVER['SERVER_ADDR']); if (empty($ns->customer)) { $this->view->dashboard = true; } else { $this->view->dashboard = false; } $this->view->mex = $this->getRequest()->getParam('mex'); $this->view->mexstatus = $this->getRequest()->getParam('status'); // Call the static Homepage $homepage = CmsPages::findbyvar("homepage", $locale); if (!empty($homepage['body'])) { // Set the custom layout of the page if (!empty($homepage['pagelayout'])) { $this->getHelper('layout')->setLayout($homepage['pagelayout']); } // Set the keywords of the page if (!empty($homepage['keywords'])) { $this->view->headMeta()->setName('keywords', $homepage['keywords']); } // Set the body of the page $this->view->content = $homepage['body']; } $this->view->headertitle = "S: " . Shineisp_Registry::get('ISP')->slogan; }
public function preStmtExecute(Doctrine_Event $event) { // Check if the administrator has enabled the query logging feature if (Settings::findbyParam('debug_queries')) { $breadcrumps = array(); $query = $event->getQuery(); $params = $event->getParams(); $callers = array_reverse(debug_backtrace(), true); $callers = array_slice($callers, 4, count($callers) - 10); foreach ($callers as $caller) { $class = !empty($caller['class']) ? $caller['class'] : null; $breadcrumps[] = $class . "->" . $caller['function']; } $strBreadcrump = "System: " . implode(" / ", $breadcrumps); //the below makes some naive assumptions about the queries being logged while (sizeof($params) > 0) { $param = array_shift($params); if (!is_numeric($param)) { $param = sprintf("'%s'", $param); } $query = substr_replace($query, $param, strpos($query, '?'), 1); } Shineisp_Commons_Utilities::log($query, "queries.log"); Shineisp_Commons_Utilities::log($strBreadcrump, "debug.log", Zend_Log::DEBUG); // Increase query counter $queryCount = Shineisp_Registry::isRegistered('querycount') ? Shineisp_Registry::get('querycount') : 0; $queryCount = $queryCount + 1; Shineisp_Registry::set('querycount', $queryCount); } }
private function eu_check() { $isp = Shineisp_Registry::get('ISP'); $VIES = new SoapClient($this->vies_soap_url); if ($VIES) { try { $r = $VIES->checkVat(array('countryCode' => $this->countryCode, 'vatNumber' => $this->vat)); foreach ($r as $chiave => $valore) { $this->viesOutput[$chiave] = $valore; } return $r->valid; } catch (SoapFault $e) { $ret = $e->faultstring; $regex = '/\\{ \'([A-Z_]*)\' \\}/'; $n = preg_match($regex, $ret, $matches); $ret = !empty($matches[1]) ? $matches[1] : $ret; $faults = array('INVALID_INPUT' => 'The provided CountryCode is invalid or the VAT number is empty', 'SERVICE_UNAVAILABLE' => 'The SOAP service is unavailable, try again later', 'MS_UNAVAILABLE' => 'The Member State service is unavailable, try again later or with another Member State', 'TIMEOUT' => 'The Member State service could not be reached in time, try again later or with another Member State', 'SERVER_BUSY' => 'The service cannot process your request. Try again later.'); $ret = $faults[$ret]; // adding a log message Shineisp_Commons_Utilities::log("Response from VIES: " . $ret); $subject = 'Invalid VAT code'; $body = "Response from VIES: " . $ret; Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body); return false; } } else { $subject = 'Connect to VIES'; $body = "Impossible to connect with VIES"; Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body); // adding a log message Shineisp_Commons_Utilities::log("Response from VIES: " . $ret); return false; } return true; }
public function errorAction() { $errors = $this->_getParam('error_handler'); $mex = $this->_getParam('mex'); // Ajax controll if (Shineisp_Commons_Utilities::isAjax()) { echo json_encode($errors->exception->getMessage()); die; } switch ($errors->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); $this->view->message = 'Controller has been not found'; break; case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); $this->view->message = 'Action has been not found'; break; default: // application error $this->getResponse()->setHttpResponseCode(500); $this->view->message = $errors->exception->getMessage(); break; } if (!empty($mex)) { $this->view->message .= "<br/><b>{$mex}</b>"; } // Save the error message in the log file errors.log $errormessage = $errors->type . ": " . $errors->exception->getMessage(); Shineisp_Commons_Utilities::log($errormessage); $this->view->exception = $errors->exception; $this->view->request = $errors->request; }
/** * Save the setup data * @param array $dbconfig * @param array $preferences * * <?xml version="1.0" encoding="UTF-8"?> <shineisp> <config> <database> <hostname>localhost</hostname> <db>shineisp</db> <username>shineisp</username> <password>shineisp2013</password> </database> </config> </shineisp> */ public static function saveConfig($dbconfig, $version = null) { try { $xml = new SimpleXMLElement('<shineisp></shineisp>'); if (!empty($version)) { $xml->addAttribute('version', $version); } $xml->addAttribute('setupdate', date('Ymdhis')); $config = $xml->addChild('config'); // Database Configuration $database = $config->addChild('database'); $database->addChild('hostname', $dbconfig->hostname); $database->addChild('username', $dbconfig->username); $database->addChild('password', $dbconfig->password); $database->addChild('database', $dbconfig->database); // Get the xml string $xmlstring = $xml->asXML(); // Prettify and save the xml configuration $dom = new DOMDocument(); $dom->loadXML($xmlstring); $dom->formatOutput = true; $dom->saveXML(); // Save the config xml file if (@$dom->save(APPLICATION_PATH . "/configs/config.xml")) { Shineisp_Commons_Utilities::log("Update ShineISP config xml file"); return true; } else { throw new Exception("Error on saving the xml file in " . APPLICATION_PATH . "/configs/config.xml <br/>Please check the folder permissions"); } } catch (Exception $e) { throw new Exception($e->getMessage()); } return false; }
public function preDispatch(Zend_Controller_Request_Abstract $request) { $this->_init($request); // echo Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(); // Zend_Debug::dump(Zend_Controller_Front::getInstance()->getRequest()->getParams()); // if the current user role is not allowed to do something $resource = $this->_module . ":" . $this->_controller; $allowed_resources[] = "default:error"; $allowed_resources[] = "api:index"; $allowed_resources[] = "api:request"; $allowed_resources[] = "admin:index"; $allowed_resources[] = "admin:login"; $allowed_resources[] = "system:index"; $allowed_resources[] = "system:cron"; $allowed_resources[] = "system:tasks"; $allowed_resources[] = "setup:index"; $allowed_resources[] = "setup:checker"; $allowed_resources[] = "setup:database"; $allowed_resources[] = "setup:localization"; $allowed_resources[] = "setup:preferences"; $allowed_resources[] = "setup:summary"; // Exclude the system index controller and the default error controller for a formal ACL check if (in_array($resource, $allowed_resources)) { return true; } // Zend_Debug::dump($resource); // Zend_Debug::dump($this->_currentRole); // Check if the user is an Administrator and let him free to access to all the resources if ($this->_currentRole == "administrator") { return true; } if ($this->_currentRole == "guest" && $this->_module == "default") { return true; } if (!$this->_acl->isAllowed($this->_currentRole, $resource, "allow")) { if ('guest' == $this->_currentRole) { Shineisp_Commons_Utilities::log("Login: The role '" . $this->_currentRole . "' has not sufficient permissions to access the resource '{$resource}'. The user has been redirected to the login page."); $request->setControllerName('login'); $request->setActionName('index'); } else { Shineisp_Commons_Utilities::log("Login: The role '" . $this->_currentRole . "' is not allowed to access to the {$resource}. It is redirected to the no authentication page."); $request->setControllerName('login'); $request->setActionName('noauth'); } } }
public function productsAction() { $ns = new Zend_Session_Namespace(); $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><shineisp></shineisp>'); $localeID = $ns->idlang; $products = $xml->addChild('products'); try { // Get all the products $records = Products::getAll(null, $localeID); if (!empty($records)) { foreach ($records as $item) { $item['ProductsData'][0]['shortdescription'] = strip_tags($item['ProductsData'][0]['shortdescription']); $item['ProductsData'][0]['description'] = strip_tags($item['ProductsData'][0]['description']); $item['ProductsData'][0]['shortdescription'] = html_entity_decode($item['ProductsData'][0]['shortdescription'], ENT_NOQUOTES, "UTF-8"); $item['ProductsData'][0]['description'] = html_entity_decode($item['ProductsData'][0]['description'], ENT_NOQUOTES, "UTF-8"); $item['ProductsData'][0]['shortdescription'] = str_replace("&", "", $item['ProductsData'][0]['shortdescription']); $item['ProductsData'][0]['description'] = str_replace("&", "", $item['ProductsData'][0]['description']); $categories = products::get_text_categories($item['categories']); $categories = htmlspecialchars($categories); $product = $products->addChild('product'); $product->addAttribute('uuid', $item['uuid']); $product->addAttribute('id', $item['product_id']); $product->addAttribute('inserted_at', !empty($item['inserted_at']) ? strtotime($item['inserted_at']) : null); $product->addAttribute('updated_at', !empty($item['updated_at']) ? strtotime($item['updated_at']) : null); $product->addChild('sku', htmlentities($item['sku'])); if (!empty($item['ProductsMedia'][0]['path']) && file_exists(PUBLIC_PATH . $item['ProductsMedia'][0]['path'])) { $product->addChild('image', "http://" . $_SERVER['HTTP_HOST'] . $item['ProductsMedia'][0]['path']); } $product->addChild('name', !empty($item['ProductsData'][0]['name']) ? $item['ProductsData'][0]['name'] : null); $product->addChild('shortdescription', !empty($item['ProductsData'][0]['shortdescription']) ? "<![CDATA[" . $item['ProductsData'][0]['shortdescription'] . "]]>" : null); $product->addChild('description', !empty($item['ProductsData'][0]['description']) ? "<![CDATA[" . $item['ProductsData'][0]['description'] . "]]>" : null); $product->addChild('categories', $categories); $price = $product->addChild('price', Products::getPrice($item['product_id'])); $price->addAttribute('taxincluded', 0); $price->addAttribute('isrecurrent', products::isRecurring($item['product_id'])); $price->addAttribute('currency', Settings::findbyParam('currency')); } } header('Content-Type: text/xml; charset=utf-8'); die($xml->asXML()); } catch (Exception $e) { Shineisp_Commons_Utilities::log(__CLASS__ . " " . $e->getMessage()); die; } }
function _isRecompileNeeded($cache_file) { // If there is no cache file, we obviously need to recompile. if (!file_exists($cache_file)) { return true; } $cache_mtime = filemtime($cache_file); // If the source files are newer than the cache file, recompile. foreach ($this->_srcs as $src) { if (filemtime($src) > $cache_mtime) { Shineisp_Commons_Utilities::log("Updating CSS Cache: {$src} must be updated."); return true; } } // Cache is up to date. Shineisp_Commons_Utilities::log("CSS Cache is up to date."); return false; }
public function init() { try { // Store logged ISP. I'm in the public area, se we use only the URL $ISP = Isp::findByUrl($_SERVER['HTTP_HOST']); if (!empty($ISP)) { Shineisp_Registry::set('ISP', $ISP); } // Load all the status in the registry $statusreg = Shineisp_Registry::get('Status'); if (empty($statusreg)) { $status = Statuses::getAll(); Shineisp_Registry::set('Status', $status); } } catch (Exception $e) { Shineisp_Commons_Utilities::log(__METHOD__ . " " . $e->getMessage()); } parent::init(); }
/** * Login in the calendar account * * @return boolean * @throws Exception */ protected static function login() { try { $client = new Google_Client(); $client->setApplicationName("ShineISP Google Calendar Application"); $clientid = Settings::findbyParam('calendar_clientid'); $clientsecret = Settings::findbyParam('calendar_clientsecret'); $redirecturi = Settings::findbyParam('calendar_redirecturi'); $developerkey = Settings::findbyParam('calendar_developerkey'); $client->setClientId($clientid); $client->setClientSecret($clientsecret); $client->setRedirectUri($redirecturi); $client->setDeveloperKey($developerkey); $cal = new Google_CalendarService($client); if (isset($_GET['logout'])) { unset($_SESSION['token']); } if (isset($_GET['code'])) { $client->authenticate($_GET['code']); $_SESSION['token'] = $client->getAccessToken(); header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); } if ($client->getAccessToken()) { self::$loggedIn = true; self::$calendar = $cal; return $cal; } else { $authUrl = $client->createAuthUrl(); return $authUrl; } } catch (Exception $e) { Shineisp_Commons_Utilities::log($e->getMessage(), "plugin_calendar.log"); } }
/** * Get all the hosting plans requested from the order list items. * @param $orderID * @return ArrayObject */ public static function get_hostingplans_from_order($orderID) { $hplan = array(); $i = 0; $items = OrdersItems::getAllDetails($orderID, null, true); if (count($items) > 0) { foreach ($items as $item) { if (strtolower($item['Products']['type']) == "hosting") { if (!empty($item['parameters'])) { $hplan[$i]['orderitem_id'] = $item['detail_id']; $hplan[$i]['customer_id'] = $item['Orders']['Customers']['customer_id']; $hplan[$i]['parameters'] = $item['parameters']; $i++; } else { Shineisp_Commons_Utilities::log("Hosting plan " . $item['Products']['sku'] . " has been skipped because it has not any parameters configured yet"); } } } } return $hplan; }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { $force = false; $registry = Shineisp_Registry::getInstance(); // Check if the config file has been created $isReady = Shineisp_Main::isReady(); $module = $request->getModuleName(); if ($module == "default") { // set the right session namespace per module $module_session = 'Default'; } elseif ($module == "admin") { $module_session = 'Admin'; } else { $module_session = 'Default'; } $ns = new Zend_Session_Namespace($module_session); try { $locale = new Zend_Locale(Zend_Locale::BROWSER); if (!empty($ns->lang)) { $locale = new Zend_Locale($ns->lang); } Shineisp_Commons_Utilities::log("System: Get the browser locale: " . $locale, "debug.log"); } catch (Exception $e) { Shineisp_Commons_Utilities::log("System: " . $e->getMessage(), "debug.log"); if (!empty($ns->lang)) { Shineisp_Commons_Utilities::log("System: Get the session var locale", "debug.log"); $locale = new Zend_Locale($ns->lang); } else { $locale = new Zend_Locale("en"); Shineisp_Commons_Utilities::log("System: There is not any available locale, set the default one: en_GB", "debug.log"); } } // check the user request if it is not set, please get the old prefereces $lang = $request->getParam('lang'); if (empty($lang)) { // Get the user preference if (strlen($locale) == 2) { // Check if the Browser locale is formed with 2 chars $lang = $locale; } elseif (strlen($locale) > 4) { // Check if the Browser locale is formed with > 4 chars $lang = substr($locale, 0, 2); // Get the language code from the browser preference } } else { $force = true; } // Get the translate language or the default language: en if (file_exists(PUBLIC_PATH . "/languages/{$lang}/{$lang}.mo")) { $translate = new Zend_Translate(array('adapter' => "Shineisp_Translate_Adapter_Gettext", 'content' => PUBLIC_PATH . "/languages/{$lang}/{$lang}.mo", 'locale' => $lang, 'disableNotices' => true)); } else { $translate = new Zend_Translate(array('adapter' => "Shineisp_Translate_Adapter_Gettext", 'locale' => $lang, 'disableNotices' => true)); } $registry->set('Zend_Translate', $translate); $registry->set('Zend_Locale', $locale); if ($isReady) { if (empty($ns->langid) || $force) { $ns->langid = Languages::get_language_id_by_code($lang); } } else { $ns->langid = 1; } $ns->lang = $lang; Shineisp_Commons_Utilities::log("System: Locale set: " . $locale, "debug.log"); Shineisp_Commons_Utilities::log("System: Language selected: " . $ns->lang, "debug.log"); }
/** * Execute the custom cron class */ private function execScript($class, $method, $params) { try { // Check if the class exists if (class_exists($class)) { // Check if the method exists if (method_exists($class, $method)) { // Check the class $theclass = new ReflectionClass($class); $themethod = $theclass->getMethod($method); $isStatic = $themethod->isStatic(); Shineisp_Commons_Utilities::log("{$class}::{$method}", 'cron.log'); // Check if the method is static if ($isStatic) { call_user_func("{$class}::{$method}", $params); } else { $obj = new $class(); call_user_func(array($obj, $method), $params); } } } } catch (Exception $e) { Shineisp_Commons_Utilities::log(__METHOD__ . " " . $e->getMessage(), 'cron.log'); } }
/** * Set specific action your image. e.g. resize image, crop, etc... * * @param string $action * @return boolean */ protected function _setAction() { // dir to where you want to save the thumbnail image $relativePath = dirname($this->getImagePath()) . '/thumbs/'; $dir = PUBLIC_PATH . '/' . $relativePath; clearstatcache(); // create the directory if it does not exist if (!is_dir($dir)) { if (@mkdir($dir) === false) { Shineisp_Commons_Utilities::log($dir . " cannot be created."); } } // name of the image based on the size of the thumbnail // @todo the sizes can be in config file/database. for not its hard coded $newFileName = $this->width . 'x' . $this->height . '_' . $this->getImageName(); $thumbPath = $dir . $newFileName; // if thumbnail exists then set cache image and return false if (file_exists($thumbPath)) { $this->setNewImage($relativePath . $newFileName); return false; } // if image product not exists set the default image if (!file_exists(PUBLIC_PATH . $this->getImagePath())) { $this->setNewImage("/media/products/default.png"); } // resize image $image = new Shineisp_Commons_Image(); // open original image to resize it // set the thumnail sizes // set new image path and quality $image->open(PUBLIC_PATH . $this->getImagePath())->resize($this->width, $this->height)->save($thumbPath, 75); // pass new image details to image view helper $this->setNewImage($relativePath . $newFileName, $image->getWidth(), $image->getHeight()); return true; }
/** * CREATE THE ORDER FOR ALL THE AUTORENEWABLE DOMAINS/SERVICES * Check all the services [domains, products] and create the orders for each customer only if the service has been set as renewable * @return void */ public static function checkServices() { try { $i = 0; $customers = array(); /* We have to start to get all the domains that them expiring date is today then we have to create a custom array sorted by customerID in order to group services and domains of a specific customer. */ // Get all the active domains that expire in 1 day $domains = Domains::getExpiringDomainsByDays(1, Statuses::id("active", "domains")); if ($domains) { Shineisp_Commons_Utilities::log("There are (" . count($domains) . ") new domains to renew"); // Create the customer group list for the email summary foreach ($domains as $domain) { if (is_numeric($domain['reseller'])) { $invoice_dest = Customers::getAllInfo($domain['reseller']); $customers[$domain['customer_id']]['id'] = $invoice_dest['customer_id']; $customers[$domain['customer_id']]['fullname'] = $invoice_dest['firstname'] . " " . $invoice_dest['lastname'] . " " . $invoice_dest['company']; $customers[$domain['customer_id']]['email'] = $invoice_dest['email']; $customers[$domain['customer_id']]['language_id'] = $invoice_dest['language_id']; } else { $customers[$domain['customer_id']]['id'] = $domain['customer_id']; $customers[$domain['customer_id']]['fullname'] = $domain['fullname']; $customers[$domain['customer_id']]['email'] = $domain['email']; $customers[$domain['customer_id']]['language_id'] = $domain['language_id']; } $customers[$domain['customer_id']]['products'][$i]['name'] = $domain['domain']; $customers[$domain['customer_id']]['products'][$i]['type'] = "domain"; $customers[$domain['customer_id']]['products'][$i]['renew'] = $domain['renew']; $customers[$domain['customer_id']]['products'][$i]['expiring_date'] = $domain['expiringdate']; $customers[$domain['customer_id']]['products'][$i]['days'] = $domain['days']; // Get the last old order item id if (!empty($domain['oldorders'])) { // find the domain foreach ($domain['oldorders'] as $olditemorder) { // Get all the information from the old order $olditem = OrdersItems::getAllInfo($olditemorder['orderitem_id']); // Check if the old order item refers to the domain selected if (!empty($olditem['parameters']) && !empty($olditem['Orders']['OrdersItemsDomains'][0]['Domains']['tld_id'])) { // Get the old configuration parameters $params = json_decode($olditem['parameters'], true); // Zend_Debug::dump($olditem); // Zend_Debug::dump($params); // Zend_Debug::dump($domain['domain']); // Extract the domain name and match it with the domain selected if (!empty($params['domain']) && $params['domain']['name'] == $domain['domain']) { $customers[$domain['customer_id']]['products'][$i]['oldorderitemid'] = $olditemorder['orderitem_id']; } } } } Shineisp_Commons_Utilities::log("- " . $domain['domain']); $i++; } } /* * Now we have to get the services expired and we have to sum the previous $customers array with these * new information. */ // Get all the services active that expire the day after $services = OrdersItems::getExpiringServicesByDays(1, Statuses::id("complete", "orders")); if ($services) { Shineisp_Commons_Utilities::log("There are (" . count($services) . ") new services to renew"); // Create the customer group list for the email summary foreach ($services as $service) { if (is_numeric($service['reseller'])) { $invoice_dest = Customers::getAllInfo($service['reseller']); $customers[$service['customer_id']]['id'] = $invoice_dest['customer_id']; $customers[$service['customer_id']]['fullname'] = $invoice_dest['firstname'] . " " . $invoice_dest['lastname'] . " " . $invoice_dest['company']; $customers[$service['customer_id']]['email'] = $invoice_dest['email']; $customers[$service['customer_id']]['password'] = $invoice_dest['password']; $customers[$service['customer_id']]['language_id'] = $invoice_dest['language_id']; } else { $customers[$service['customer_id']]['id'] = $service['id']; $customers[$service['customer_id']]['fullname'] = $service['fullname']; $customers[$service['customer_id']]['email'] = $service['email']; $customers[$service['customer_id']]['password'] = $service['password']; $customers[$service['customer_id']]['language_id'] = $service['language_id']; } $customers[$service['customer_id']]['products'][$i]['name'] = $service['product']; $customers[$service['customer_id']]['products'][$i]['type'] = "service"; $customers[$service['customer_id']]['products'][$i]['renew'] = $service['renew']; $customers[$service['customer_id']]['products'][$i]['expiring_date'] = $service['expiringdate']; $customers[$service['customer_id']]['products'][$i]['days'] = $service['days']; $customers[$service['customer_id']]['products'][$i]['oldorderitemid'] = $service['detail_id']; Shineisp_Commons_Utilities::log("- " . $service['product']); $i++; } } // Create the email messages for the customers if (count($customers) > 0) { foreach ($customers as $customer) { $items = ""; // **** CREATE THE ORDER FOR ALL THE AUTORENEWABLE DOMAINS/SERVICES *** // ============================================================ // Renew all the services and domain where the customer has choosen the autorenew of the service. $orderID = Orders::renewOrder($customer['id'], $customer['products']); if (is_numeric($orderID)) { $link = Fastlinks::findlinks($orderID, $customer['id'], 'orders'); // Create the fast link to include in the email if (!empty($link[0]['code'])) { $url = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $link[0]['code']; } else { $url = "http://" . $_SERVER['HTTP_HOST']; } Shineisp_Commons_Utilities::sendEmailTemplate($customer['email'], 'order_renew', array('fullname' => $customer['fullname'], ':shineisp:' => $customer, 'url' => $url), null, null, null, null, $customer['language_id'], Settings::findbyParam('cron_notify')); } } } /* * Now we have to set as expired all the domains records that the date is the date of the expiring of the domain * // Expired */ $dq = Doctrine_Query::create()->update('Domains d')->set('d.status_id', Statuses::id('expired', 'domains'))->where('DATEDIFF(d.expiring_date, CURRENT_DATE) <= ?', 0)->addWhere('DATEDIFF(d.expiring_date, CURRENT_DATE) >= ?', 0); $dq->execute(null, Doctrine::HYDRATE_ARRAY); /* * Now we have to set as closed all the domains records that the date is older of -2 days * // Closed */ $dq = Doctrine_Query::create()->update('Domains d')->set('d.status_id', Statuses::id('suspended', 'domains'))->where('DATEDIFF(d.expiring_date, CURRENT_DATE) <= ?', -2); $dq->execute(null, Doctrine::HYDRATE_ARRAY); /* * Now we have to set as expired all the services records * // Expired */ $dq = Doctrine_Query::create()->update('OrdersItems oi')->set('oi.status_id', Statuses::id('expired', 'orders'))->where('DATEDIFF(oi.date_end, CURRENT_DATE) <= ?', 0); $dq->execute(null, Doctrine::HYDRATE_ARRAY); /* * Now we have to set as deleted all the services records * // Deleted */ $dq = Doctrine_Query::create()->update('OrdersItems oi')->set('oi.status_id', Statuses::id('deleted', 'orders'))->where('DATEDIFF(oi.date_end, CURRENT_DATE) <= ?', -2); $dq->execute(null, Doctrine::HYDRATE_ARRAY); Shineisp_Commons_Utilities::sendEmailTemplate(null, 'cron', array('cronjob' => 'Check Services'), null, null, null, null, null, Settings::findbyParam('cron_notify')); } catch (Exception $e) { Shineisp_Commons_Utilities::logs($e->getMessage(), "cron.log"); return false; } return true; }
/** * CreatePDF * Create a pdf file * array(3) { ["header"] => array(1) { ["label"] => string(28) "Invoice No. 001 - 24/02/2012" } ["columns"] => array(8) { [0] => array(2) { ["value"] => string(3) "SKU" ["size"] => int(30) } [1] => array(1) { ["value"] => string(11) "Description" } [2] => array(3) { ["value"] => string(3) "Qty" ["size"] => int(30) ["align"] => string(6) "center" } [3] => array(2) { ["value"] => string(4) "Unit" ["size"] => int(30) } [4] => array(3) { ["value"] => string(14) "Tax Free Price" ["size"] => int(60) ["align"] => string(5) "right" } [5] => array(3) { ["value"] => string(9) "Setup fee" ["size"] => int(60) ["align"] => string(5) "right" } [6] => array(3) { ["value"] => string(5) "Tax %" ["size"] => int(40) ["align"] => string(6) "center" } [7] => array(3) { ["value"] => string(5) "Total" ["size"] => int(50) ["align"] => string(5) "right" } } ["records"] => array(16) { ["order_number"] => string(1) "1" ["invoice_number"] => string(1) "1" ["date"] => string(10) "24/02/2012" ["customer"] => array(10) { ["customer_id"] => string(1) "1" ["company"] => string(14) "Shine Software" ["firstname"] => string(8) "Giuseppe" ["lastname"] => string(9) "Bucchieri" ["vat"] => string(13) "IT03672170283" ["email"] => string(27) "*****@*****.**" ["address"] => string(11) "Via Caldera" ["city"] => string(6) "Milano" ["code"] => string(5) "20121" ["country"] => string(5) "Italy" } ["payment_date"] => string(19) "23/02/2012 00:00:00" ["payment_mode"] => string(17) "Bonifico Bancario" ["payment_description"] => string(0) "" ["payment_transaction_id"] => string(12) "XX1234567890" ["company"] => array(14) { ["name"] => string(8) "ShineISP" ["vat"] => string(13) "IT01234567890" ["bankname"] => string(7) "IWSmile" ["iban"] => string(27) "IT28G0316501600000708754625" ["bic"] => string(8) "IWBKITXX" ["address"] => string(11) "17 rue Biot" ["zip"] => string(5) "75017" ["city"] => string(5) "Paris" ["country"] => string(6) "France" ["telephone"] => string(13) "+334097123985" ["fax"] => string(13) "+334097123985" ["website"] => string(23) "http://www.shineisp.com" ["email"] => string(17) "*****@*****.**" ["slogan"] => string(18) "This is my slogan!" } ["subtotal"] => string(5) "93.90" ["grandtotal"] => string(6) "113.62" ["vat"] => string(5) "19.72" ["delivery"] => int(0) ["ribbon"] => array(3) { ["text"] => string(5) "Payed" ["color"] => string(7) "#009926" ["border-color"] => string(7) "#00661A" } [0] => array(8) { [0] => string(1) "1" [1] => string(24) "Bronze Blog Hosting Plan" [2] => string(1) "1" [3] => string(2) "nr" [4] => string(5) "84.00" [5] => string(4) "0.00" [6] => string(2) "21" [7] => string(6) "101.64" } [1] => array(8) { [0] => NULL [1] => string(11) "company.com" [2] => string(1) "1" [3] => string(2) "nr" [4] => string(4) "9.90" [5] => string(4) "0.00" [6] => NULL [7] => string(4) "9.90" } } } * @param array $data * @return void */ public function CreatePDF($data, $filename = "file.pdf", $show = true, $path = "/documents", $force = FALSE) { try { if (!file_exists(PUBLIC_PATH . "{$path}/{$filename}") || $force) { // Add new page to the document $this->page = $this->pdf->newPage(Zend_Pdf_Page::SIZE_A4); $this->pdf->pages[] = $this->page; $this->data = $data; $this->CreateHeader(); // Invoice Number and Date $this->setFontandSize(Zend_Pdf_Font::FONT_HELVETICA_BOLD, 9); // Set the label of the document if (!empty($this->data['header']['label'])) { $this->Write($this->data['header']['label'], 400, $this->h - 20); } else { $this->Write("No label", 400, $this->h - 20); } if (!empty($this->data['records']['ribbon'])) { $this->Ribbon($this->data['records']['ribbon']); $this->page->setFillColor(new Zend_Pdf_Color_Html('#000000')); } $this->Embellishments(); $this->AddresseeBox(); $this->DestinationBox(); // Create the grid for all items $this->CreateGrid(); // Creating the summary section $this->Summary(); // Adding the QRCode $this->QrCode(); // Creating the footer details section $this->FooterDetails(); // Creating the footer with the company information $this->Footer(); // Get PDF document as a string $contents = $this->pdf->render(); @mkdir(PUBLIC_PATH . "/documents/"); @mkdir(PUBLIC_PATH . "{$path}/"); $file = fopen(PUBLIC_PATH . "{$path}/{$filename}", 'a'); fputs($file, $contents); fclose($file); } else { $handle = fopen(PUBLIC_PATH . "{$path}/{$filename}", 'rb'); $contents = fread($handle, filesize(PUBLIC_PATH . "{$path}/{$filename}")); fclose($handle); } if ($show) { header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=\"" . $filename . "\""); die($contents); } } catch (exception $e) { Shineisp_Commons_Utilities::log($e->getMessage()); return $e->getMessage(); } }
public static function listener_panels_create_client_after($event) { Shineisp_Commons_Utilities::log('EVENT STARTS: ' . __METHOD__); }
/** * Login in the seafile account * * @return boolean * @throws Exception */ protected static function login() { try { $url = Settings::findbyParam('seafile_url'); $username = Settings::findbyParam('seafile_username'); $password = Settings::findbyParam('seafile_password'); $postData = array('username' => $username, 'password' => $password); $data = self::request($url . '/api2/auth-token/', true, $postData); $data = json_decode($data, true); if (!empty($data['non_field_errors'])) { throw new Exception($data['non_field_errors'][0]); } else { self::$loggedIn = true; self::$token = $data['token']; return true; } return false; } catch (Exception $e) { Shineisp_Commons_Utilities::log($e->getMessage(), "plugin_seafile.log"); } }
/** * * @param integer $domainId * @param string $type */ private function createNic($domainId, $type = 'owner') { $soap = $this->Connect(); if (!empty($this->session)) { $tld = Domains::getDomainTld($domainId); // get the domain profile $profile = DomainsProfiles::getProfileByDomainId($domainId, $type); if ($profile) { // Set generic variables for parameters $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id'])); $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']); $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString(); $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname']; $profile['legalform'] = strtolower($profile['Legalforms']['name']); $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']); $profile['legalnumber'] = null; $profile['language'] = "en"; $profile['isowner'] = $type == "owner" ? true : false; if ($tld == "it") { // Create a nicHandle for the Italian domain tld $params[] = $this->session['id']; // Session $params[] = $profile['lastname']; // Lastname $params[] = $profile['firstname']; // Firstname $params[] = $profile['gender']; // Gender $params[] = $profile['password']; // Password $params[] = $profile['email']; // Email $params[] = $profile['phone']; // Phone $params[] = $profile['fax']; // Fax $params[] = $profile['address']; // Address $params[] = $profile['city']; // City $params[] = $profile['area']; // Area $params[] = $profile['zip']; // Zip $params[] = $profile['countrycode']; // Country Code $params[] = $profile['language']; // Language $params[] = $profile['isowner']; // isOwner $params[] = $profile['legalform']; // Legalform $params[] = $profile['company']; // Organisation $params[] = $profile['fullname']; // Legal name $params[] = $profile['legalnumber']; // Legal Number $params[] = $profile['vat']; // VAT or IVA $params[] = $profile['birthdate']; // Birthday $params[] = $profile['birthplace']; // Birthcity $params[] = $profile['taxpayernumber']; // Contact fiscal code or company vat $params[] = $profile['vat']; // Company National Identification Number $params[] = $profile['corporationtype']; $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params); Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log"); } else { $params[] = $this->session['id']; // Session $params[] = $profile['lastname']; // Lastname $params[] = $profile['firstname']; // Firstname $params[] = $profile['password']; // Password $params[] = $profile['email']; // Email $params[] = $profile['phone']; // Phone $params[] = $profile['fax']; // Fax $params[] = $profile['address']; // Address $params[] = $profile['city']; // City $params[] = $profile['area']; // Area $params[] = $profile['zip']; // Zip $params[] = $profile['countrycode']; // Country Code $params[] = $profile['language']; // Language $params[] = $profile['isowner']; // isOwner $params[] = $profile['legalform']; // Legalform $params[] = $profile['company']; // Organisation $params[] = $profile['fullname']; // Legal name $params[] = $profile['legalnumber']; // Legal Number $params[] = $profile['vat']; // VAT or IVA $nicHandle = call_user_func_array(array($soap, 'nicCreate'), $params); Shineisp_Commons_Utilities::log('Calling profile nicCreate with these params: ' . json_encode($params), "registrar.ovh.log"); } if (!empty($nicHandle)) { CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle, $type, $profile['profile_id']); // Save the nic-Handle in the database } } else { // If the client has not create any profile, the main client information will be set in all domain tld field [admin, tech, owner, billing] // Get the domain information $domain = Domains::find($domainId); // Create the OVH nic-Handle $nicHandle = $this->createNicHandlebyCustomer($domain[0]['customer_id'], $domainId); // Save the nic-Handle in the database CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle); } return $nicHandle; } return false; }
/** * Event Listener * This event is triggered when the Orders PDF is created */ public static function listener_order_upload($event) { $file = $event->getParam('file'); if (self::isReady()) { // get the destination path $destinationPath = Settings::findbyParam('dropbox_ordersdestinationpath'); self::execute($file, $destinationPath); Shineisp_Commons_Utilities::log("Event triggered: orders_pdf_created", "plugin_dropbox.log"); } return false; }
function _isRecompileNeeded($cache_file) { // If there is no cache file, we obviously need to recompile. if (!file_exists($cache_file)) { Shineisp_Commons_Utilities::log("JS Cache file doesn't exists. Create a new cache file."); Shineisp_Commons_Utilities::log($this->_srcs); return true; } $cache_mtime = filemtime($cache_file); // If the source files are newer than the cache file, recompile. foreach ($this->_srcs as $src) { if (filemtime($src) > $cache_mtime) { Shineisp_Commons_Utilities::log("Updating JS Cache: {$src} must be updated."); return true; } } // If this script calling the compiler is newer than the cache file, // recompile. Note, this might not be accurate if the file doing the // compilation is loaded via an include(). if (filemtime($_SERVER["SCRIPT_FILENAME"]) > $cache_mtime) { return true; } // Cache is up to date. Shineisp_Commons_Utilities::log("JS Cache is up to date."); return false; }
/** * Create * Create an invoice starting from an order id * @param $orderid * @return Doctrine Record */ public static function Create($orderid) { if (is_numeric($orderid)) { $invoice_number = InvoicesSettings::getLastInvoice(); $customer_id = Doctrine::getTable('Orders')->find($orderid)->customer_id; // Check if there is an invoice ID set for this order. $Invoice = Doctrine::getTable('Invoices')->findOneByOrderId($orderid); if (isset($Invoice->invoice_id) && is_numeric($Invoice->invoice_id) && $Invoice->invoice_id > 0) { // Set the invoice number to the order Orders::setInvoice($orderid, $Invoice->invoice_id); return $Invoice->invoice_id; } try { if (is_numeric($customer_id)) { $Invoice = new Invoices(); $Invoice->number = $invoice_number; $Invoice->order_id = $orderid; $Invoice->customer_id = $customer_id; $Invoice->invoice_date = date('Y-m-d'); $Invoice->save(); $invoice_id = $Invoice->getIncremented(); Shineisp_Commons_Utilities::log("Created new invoice with id #" . $invoice_id, 'invoices.log'); InvoicesSettings::setLastInvoice($invoice_number); Orders::setInvoice($orderid, $invoice_id); // Generate an Invoice Number $invoice_number = self::generateNumber($invoice_id); if (isset($invoice_number)) { Shineisp_Commons_Utilities::log("Generated invoice number " . $invoice_number . " for invoice with id #" . $invoice_id, 'invoices.log'); $Invoice->formatted_number = $invoice_number; $Invoice->save(); } // Create the pdf invoice document (dropbox event is triggered by this) self::PrintPDF($invoice_id, false, true); if (intval(Settings::findbyParam('auto_send_invoice')) === 1 && $invoice_id > 0) { Invoices::sendInvoice($invoice_id); } return $invoice_id; } } catch (Exception $e) { return $e->getMessage(); } } }
/** * activate * Activate an order item * @param $orderItemId * @return true|false */ public static function activate($orderItemId) { Shineisp_Commons_Utilities::log(__METHOD__ . " - Activate Detail ID #" . $orderItemId); $orderItemId = intval($orderItemId); if ($orderItemId < 1) { // missing order item id from arguments return false; } // Get OrderItem $ordersItem = self::find($orderItemId); $ordersItem = $ordersItem->toArray(); $OrderItem = array_shift($ordersItem); if (!$OrderItem) { // order item not found return false; } // Get customerId related to this order $customerId = Orders::getCustomer($OrderItem['order_id']); /* * START ACTIVATIONS CODE */ $upgrade = Orders::isUpgrade($OrderItem['order_id']); $upgrade_uuid = false; if ($upgrade !== false) { $orderItem = OrdersItems::getDetail($upgrade); Shineisp_Commons_Utilities::logs(__METHOD__ . " - OITEM::" . print_r($orderItem, true)); $oldOrderId = $orderItem['order_id']; Orders::set_status($oldOrderId, Statuses::id("changed", "orders")); // Close the old order ::status changed OrdersItems::set_status($upgrade, Statuses::id("changed", "orders")); $upgrade_uuid = $orderItem['uuid']; // log Shineisp_Commons_Utilities::logs(__METHOD__ . " - Order changed from #" . $oldOrderId . " to #" . $OrderItem['order_id']); } if (empty($OrderItem['parameters'])) { Shineisp_Commons_Utilities::logs(__METHOD__ . " - Order items setup parameters empty"); return false; } // Is this an hosting? execute panel task // TODO: this should call an hook or an even bound to the panel if (isset($OrderItem['Products']) && isset($OrderItem['Products']['type']) && $OrderItem['Products']['type'] == 'hosting') { Shineisp_Commons_Utilities::logs(__METHOD__ . " Hosting task queued"); PanelsActions::AddTask($customerId, $OrderItem['detail_id'], "fullProfile", $OrderItem['parameters']); return true; } // Is this a domain? execute domain task if (isset($OrderItem['tld_id']) && intval($OrderItem['tld_id']) > 0) { $parameters = json_decode($OrderItem['parameters']); if (empty($parameters->domain)) { Shineisp_Commons_Utilities::logs(__METHOD__ . " Domain has been not set in the order detail #{$orderItemId}"); return false; } // Create the domain record $domain = Domains::Create($parameters->domain, intval($OrderItem['tld_id']), intval($customerId), $orderItemId); // Create the domain task if (!empty($parameters->domain) && !empty($parameters->action)) { $domains[] = array('domain' => $parameters->domain, 'action' => $parameters->action); $retval = DomainsTasks::AddTasks($domains); Shineisp_Commons_Utilities::logs(__METHOD__ . " Domain task queued"); } return $retval; } }
public static function getEmailTemplate($template, $language_id = null) { $fallbackLocale = "en_US"; $subject = ""; $locale = Shineisp_Registry::get('Zend_Locale')->toString(); if (empty($language_id)) { $language_id = Languages::get_language_id($locale); } else { $locale = Languages::get_locale($language_id); } $EmailTemplate = EmailsTemplates::findByCode($template, null, false, $language_id); // Template missing from DB. Let's add it. if (!is_object($EmailTemplate) || !isset($EmailTemplate->EmailsTemplatesData) || !isset($EmailTemplate->EmailsTemplatesData->{0}) || !isset($EmailTemplate->EmailsTemplatesData->{0}->subject)) { $filename = PUBLIC_PATH . "/languages/emails/" . $locale . "/" . $template . ".htm"; // Check if the file exists if (!file_exists($filename)) { $filename = PUBLIC_PATH . "/languages/emails/" . $fallbackLocale . "/" . $template . ".htm"; Shineisp_Commons_Utilities::log("This email template has not been found: {$filename}"); $language_id = 1; // set the right default language id // Also the fallback template is missing. Something strange is going on..... if (!file_exists($filename)) { Shineisp_Commons_Utilities::log("The default email template has not been found: {$filename}"); return array('template' => "Template: " . $template . " not found", 'subject' => $template); } } // Get the content of the file $body = ''; foreach (file($filename) as $line) { // Get the subject written in the template file if (preg_match('/<!--@subject\\s*(.*?)\\s*@-->/', $line, $matches)) { $subject = $matches[1]; // Get the subject $subject = trim($subject); continue; } // Delete all the comments $body .= preg_replace('#\\{\\*.*\\*\\}#suU', '', $line); } $isp = Isp::getActiveISP(); $body = trim($body); $subject = trim($subject); // check if the string contains html tags and if it does not contain tags // means that it is a simple text. In this case add the tag "<br/>" for each return carrier if (!self::isHtml($body)) { $body = nl2br($body); } // Store mail in DB $array = array('type' => 'general', 'name' => $template, 'code' => $template, 'plaintext' => 0, 'active' => 1, 'fromname' => is_array($isp) && isset($isp['company']) ? $isp['company'] : 'ShineISP', 'fromemail' => is_array($isp) && isset($isp['email']) ? $isp['email'] : '*****@*****.**', 'subject' => $subject, 'html' => $body); // Save the data EmailsTemplates::saveAll(null, $array, $language_id); // Return the email template return array_merge($array, array('template' => $body, 'subject' => $subject)); } // template is numeric but there is not template in db. something strange happened. Exit. if (is_numeric($template) && !is_object($EmailTemplate)) { return false; } $email = array('subject' => $EmailTemplate->EmailsTemplatesData->{0}->subject, 'plaintext' => intval($EmailTemplate->plaintext), 'fromname' => $EmailTemplate->EmailsTemplatesData->{0}->fromname, 'fromemail' => $EmailTemplate->EmailsTemplatesData->{0}->fromemail, 'cc' => $EmailTemplate->cc, 'bcc' => $EmailTemplate->bcc, 'template' => ''); if (!empty($EmailTemplate->EmailsTemplatesData->{0}->html) && !empty($EmailTemplate->EmailsTemplatesData->{0}->text)) { // Both version are present $body = intval($EmailTemplate->plaintext) ? $EmailTemplate->EmailsTemplatesData->{0}->text : $EmailTemplate->EmailsTemplatesData->{0}->html; } else { if (empty($EmailTemplate->EmailsTemplatesData->{0}->html) && !empty($EmailTemplate->EmailsTemplatesData->{0}->text)) { // Only TEXT version $body = $EmailTemplate->EmailsTemplatesData->{0}->text; } else { // Only HTML version $body = $EmailTemplate->EmailsTemplatesData->{0}->html; } } $email['template'] = $body; return $email; }
/** * (non-PHPdoc) * @see Zend_Controller_Plugin_Abstract::preDispatch() */ public function preDispatch(Zend_Controller_Request_Abstract $request) { $dayssincefirstsetup = 0; $migration = new Doctrine_Migration(APPLICATION_PATH . '/configs/migrations'); $LatestVersion = $migration->getLatestVersion(); $CurrentVersion = $migration->getCurrentVersion(); try { // Check if the config file has been created $isReady = Shineisp_Main::isReady(); if ($isReady) { // Execute the migration if ($CurrentVersion < $LatestVersion) { // write a log message Shineisp_Commons_Utilities::log("Upgrade: Current Version is {$CurrentVersion} and the latest available version is {$LatestVersion}"); $dbconfig = Shineisp_Main::databaseConfig(); // Update the version in the config.xml file previously created Settings::saveConfig($dbconfig, $LatestVersion); if ($CurrentVersion > 0) { Shineisp_Commons_Utilities::log("Upgrade: Migrate ShineISP version from {$CurrentVersion} to {$LatestVersion}"); $migration->migrate(); } } $db = Doctrine_Manager::getInstance()->getCurrentConnection(); // Read and execute all the sql files saved in the /application/configs/data/sql directory $path = PROJECT_PATH . "/application/configs/data/sql"; if (is_dir($path)) { $directory_iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); try { // get the first setup date $setupdate = Settings::getConfigSetupDate(); if (empty($setupdate)) { throw new Exception('Setup date is not set in the config.xml file'); } // for each sql file do ... foreach ($directory_iterator as $filename => $path_object) { // get the sql file information $info = pathinfo($filename); if (!empty($info['extension']) && $info['extension'] == "sql") { $name = $info['filename']; // get the first part of the name with the filename that contains the date: YYYYMMddHis-NAME.sql $arrName = explode("-", $name); // if the string is a valid date get the days betweeen the sql file name and the day of the setup of shineisp if (!empty($arrName[0]) && Zend_Date::isdate($arrName[0], 'YYYYMMddHis')) { $sqldate = new Zend_Date($arrName[0], 'YYYYMMddHis'); $mysetupdate = new Zend_Date($setupdate, 'YYYYMMddHis'); // get the difference of the two dates $diff = $sqldate->sub($mysetupdate)->toValue(); $dayssincefirstsetup = floor($diff / 60 / 60 / 24); unset($sqldate); unset($mysetupdate); } // SQL files post installation will be executed if ($dayssincefirstsetup >= 0) { // read the sql $sql = Shineisp_Commons_Utilities::readfile($info['dirname'] . "/" . $info['basename']); if (!empty($sql)) { // execute the sql strings $result = $db->execute($sql); // close the db connection $db->close(); if ($result) { // write a log message Shineisp_Commons_Utilities::log($info['filename'] . ".sql has been executed."); // rename the sql rename($info['dirname'] . "/" . $info['basename'], $info['dirname'] . "/" . $info['filename'] . ".sql.old"); } } } else { // rename the sql rename($info['dirname'] . "/" . $info['basename'], $info['dirname'] . "/" . $info['filename'] . ".sql.old"); // write a log message Shineisp_Commons_Utilities::log($info['filename'] . ".sql has been skipped because already set in the doctrine data setup."); } } } } catch (Exception $e) { die($e->getMessage()); } } } // Execute the migration if ($CurrentVersion < $LatestVersion) { $dbconfig = Shineisp_Main::databaseConfig(); // Update the version in the config.xml file previously created Settings::saveConfig($dbconfig, $LatestVersion); if ($CurrentVersion > 0) { $migration->migrate(); } } } catch (Exception $e) { Zend_Debug::dump($e->getMessage()); die; } }
/** * Login out action */ public function outAction() { $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('admin')); $auth->clearIdentity(); Shineisp_Commons_Utilities::log("Login: The user has been logged out correctly", "login.log"); $this->_helper->redirector('index', 'login', 'admin'); // back to login page }