/** * Update a plugin * * @access private * @param mixed $plugin * @return array */ function _wprp_upgrade_plugin($plugin) { include_once ABSPATH . 'wp-admin/includes/admin.php'; if (!_wprp_supports_plugin_upgrade()) { return array('status' => 'error', 'error' => 'WordPress version too old for plugin upgrades'); } $skin = new WPRP_Plugin_Upgrader_Skin(); $upgrader = new Plugin_Upgrader($skin); $is_active = is_plugin_active($plugin); // Do the upgrade ob_start(); $result = $upgrader->upgrade($plugin); $data = ob_get_contents(); ob_clean(); if (!$result && !is_null($result) || $data) { return array('status' => 'error', 'error' => 'file_permissions_error'); } elseif (is_wp_error($result)) { return array('status' => 'error', 'error' => $result->get_error_code()); } if ($skin->error) { return array('status' => 'error', 'error' => $skin->error); } // If the plugin was activited, we have to re-activate it // @todo Shouldn't this use activate_plugin? if ($is_active) { $current = get_option('active_plugins', array()); $current[] = plugin_basename(trim($plugin)); sort($current); update_option('active_plugins', $current); } return array('status' => 'success'); }
/** * PC标签中调用数据 * @param array $data 配置数据 */ public function pc_tag($data) { $siteid = isset($data['siteid']) && intval($data['siteid']) ? intval($data['siteid']) : get_siteid(); $r = $this->db->select(array('pos' => $data['pos'], 'siteid' => $siteid)); $str = ''; if (!empty($r) && is_array($r)) { foreach ($r as $v) { if (defined('IN_ADMIN') && !defined('HTML')) { $str .= '<div id="block_id_' . $v['id'] . '" class="admin_block" blockid="' . $v['id'] . '">'; } if ($v['type'] == '2') { extract($v, EXTR_OVERWRITE); $data = string2array($data); if (!defined('HTML')) { ob_start(); include $this->template_url($id); $str .= ob_get_contents(); ob_clean(); } else { include $this->template_url($id); } } else { $str .= $v['data']; } if (defined('IN_ADMIN') && !defined('HTML')) { $str .= '</div>'; } } } return $str; }
function template($filename, $flag = TEMPLATE_DISPLAY) { global $_W; $source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html"; $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$filename}.tpl.php"; if (!is_file($source)) { $source = IA_ROOT . "/web/themes/default/{$filename}.html"; $compile = IA_ROOT . "/data/tpl/web/default/{$filename}.tpl.php"; } if (!is_file($source)) { exit("Error: template source '{$filename}' is not exist!"); } if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) { template_compile($source, $compile); } switch ($flag) { case TEMPLATE_DISPLAY: default: extract($GLOBALS, EXTR_SKIP); include $compile; break; case TEMPLATE_FETCH: extract($GLOBALS, EXTR_SKIP); ob_clean(); ob_start(); include $compile; $contents = ob_get_contents(); ob_clean(); return $contents; break; case TEMPLATE_INCLUDEPATH: return $compile; break; } }
/** * Export to XML format (print to browser) * * @param string $objName * @return void */ public function exportXML($objName) { // get the current UI bizobj /* @var $bizForm EasyForm */ $bizForm = BizSystem::getObject($objName); // get the existing bizform object $bizObj = $bizForm->getDataObj(); $recList = array(); $bizObj->fetchRecords("", $recList, -1, -1, false); $xmlString = "<?xml version='1.0' standalone='yes'?>\n"; $xmlString .= "<BizDataObj Name=\"" . $bizObj->m_Name . "\">\n"; foreach ($recList as $rec) { $xmlRecord = "\t<Record>\n"; foreach ($rec as $fld => $val) { $xmlRecord .= "\t\t<Field Name=\"{$fld}\" Value=\"{$val}\" />\n"; } $xmlRecord .= "\t</Record>\n"; $xmlString .= $xmlRecord; } $xmlString .= "</BizDataObj>"; // output variables $name = str_replace(".", "_", $bizObj->m_Name) . ".xml"; $size = strlen($xmlString); $type = "text/plain"; ob_clean(); header("Cache-Control: "); // leave blank to avoid IE errors header("Pragma: "); // leave blank to avoid IE errors header("Content-Disposition: attachment; filename=\"{$name}\""); header("Content-length: {$size}"); header("Content-type: {$type}"); echo $xmlString; exit; }
function display() { ob_clean(); if (!$this->get('f')) { return; } $from = $this->get('f'); if (filter_var($from, FILTER_VALIDATE_EMAIL)) { $node = 'urn:xmpp:microblog:0'; } else { return; } $pd = new \modl\PostnDAO(); $cd = new \modl\ContactDAO(); $this->view->assign('contact', $cd->get($from, true)); $this->view->assign('uri', Route::urlize('blog', array($from))); if (isset($from) && isset($node)) { $messages = $pd->getPublic($from, $node, 10, 0); $this->view->assign('messages', $messages); } if (isset($messages[0])) { header("Content-Type: application/atom+xml; charset=UTF-8"); $this->view->assign('date', date('c')); } }
function importFromRedshop() { @ob_clean(); echo $this->getHtmlPage(); $this->token = hikashop_getFormToken(); flush(); if (isset($_GET['import']) && $_GET['import'] == '1') { $time = microtime(true); $processed = $this->doImport(); if ($processed) { $elasped = microtime(true) - $time; if (!$this->refreshPage) { echo '<p></br><a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=import&importfrom=redshop&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>'; } echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>'; } else { echo '<a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>'; } } else { echo $this->getStartPage(); } if ($this->refreshPage) { echo "<script type=\"text/javascript\">\r\nr = true;\r\n</script>"; } echo '</body></html>'; exit; }
/** * Execute the login view */ public function perform() { $this->initVars(); // create capcha picture and public key $this->model->action('common', 'captchaMake', array('captcha_pic' => &$this->tplVar['captcha_pic'], 'public_key' => &$this->tplVar['public_key'], 'configPath' => &$this->config['config_path'])); // Check login data if (isset($_POST['dologin'])) { // validate captcha turing/public keys if (FALSE == $this->model->action('common', 'captchaValidate', array('turing_key' => (string) $_POST['captcha_turing_key'], 'public_key' => (string) $_POST['captcha_public_key'], 'configPath' => (string) $this->config['config_path']))) { $this->resetFormData(); return TRUE; } // verify user and password. If those dosent match // reload the login page $login = $this->model->action('user', 'checkLogin', array('login' => (string) $_POST['login'], 'passwd' => (string) $_POST['password'])); // If login was successfull reload the destination page if ($login == TRUE) { ob_clean(); // get url vars to switch to the destination page $url = $this->model->session->get('url'); $this->model->session->del('url'); @header('Location: ' . SMART_CONTROLLER . '?' . $url); exit; } } }
function download($verze) { $verze_ = $GLOBALS['download_dir'] . $verze; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($verze_)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($verze_)); ob_clean(); flush(); readfile($verze_); $relace = mysql_connect('localhost', 'host', 'h0st207p'); if (!$relace) { die('Could not connect: ' . mysql_error()); } if (!mysql_select_db('host', $relace)) { die('Could not select database'); } $sql = 'SELECT stazeno FROM sfepy_downloads WHERE verze="' . $verze . '"'; $data = mysql_query($sql, $relace); if (!$data) { die('DB Error, could not query the database: ' . mysql_error()); } list($stazeno) = mysql_fetch_row($data); $stazeno = $stazeno + 1; $sql = 'UPDATE sfepy_downloads SET stazeno="' . $stazeno . '" WHERE verze="' . $verze . '"'; mysql_query($sql, $relace); mysql_free_result($data); }
function cms7_exception_handler($e) { ob_clean(); echo '<b>A Fatal error has occured</b><br/>'; echo $e->getMessage() . '<br/>'; echo '<pre>', print_r($e, TRUE), '</pre>'; }
function create($width = '120', $height = '40', $characters = '6') { ob_clean(); $code = $this->generateCode($characters); /* font size will be 75% of the image height */ $font_size = $height * 0.7; $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream'); /* set the colours */ $background_color = imagecolorallocate($image, 220, 220, 220); $text_color = imagecolorallocate($image, 10, 30, 80); $noise_color = imagecolorallocate($image, 150, 180, 220); /* generate random dots in background */ for ($i = 0; $i < $width * $height / 3; $i++) { imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color); } /* generate random lines in background */ for ($i = 0; $i < $width * $height / 150; $i++) { imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color); } /* create textbox and add text */ $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4]) / 2; $y = ($height - $textbox[5]) / 2; $y -= 5; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font, $code) or die('Error in imagettftext function'); /* output captcha image to browser */ header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $this->Controller->Session->write('security_code', $code); }
public function index() { ob_clean(); $image_handle = imagecreatetruecolor(150, 60); $white = imagecolorallocate($image_handle, 255, 255, 255); $rndm = imagecolorallocate($image_handle, rand(64, 192), rand(64, 192), rand(64, 192)); imagefill($image_handle, 0, 0, $white); $fontName = PUBLICPATH . "/fonts/elephant.ttf"; $myX = 15; $myY = 30; $angle = 0; for ($x = 0; $x <= 100; $x++) { $myX = rand(1, 148); $myY = rand(1, 58); imageline($image_handle, $myX, $myY, $myX + rand(-5, 5), $myY + rand(-5, 5), $rndm); } $myCryptBase = tep_create_random_value(50, 'digits'); $secure_image_hash_string = ""; for ($x = 0; $x <= 4; $x++) { $dark = imagecolorallocate($image_handle, rand(5, 128), rand(5, 128), rand(5, 128)); $capChar = substr($myCryptBase, rand(1, 35), 1); $secure_image_hash_string .= $capChar; $fs = rand(20, 26); $myX = 15 + ($x * 28 + rand(-5, 5)); $myY = rand($fs + 2, 55); $angle = rand(-30, 30); ImageTTFText($image_handle, $fs, $angle, $myX, $myY, $dark, $fontName, $capChar); } $this->session->set_userdata('secure_image_hash_string', $secure_image_hash_string); header("Content-type: image/jpeg"); imagejpeg($image_handle, "", 95); imagedestroy($image_handle); die; }
function createXLSAdv(&$rows, $row_labels = null, $row_headers = null, $title = null) { ob_clean(); ob_start(); require_once JPATH_COMPONENT_SITE . DS . 'libraries' . DS . 'pear' . DS . 'PEAR.php'; require_once JPATH_COMPONENT_SITE . DS . 'libraries' . DS . 'Excel' . DS . 'Writer.php'; // Creating a workbook $workbook = new Spreadsheet_Excel_Writer(); $worksheet = $workbook->addWorksheet($title); $BIFF = new Spreadsheet_Excel_Writer_BIFFwriter(); $format = new Spreadsheet_Excel_Writer_Format($BIFF); $format->setBold(1); $format->setAlign('center'); for ($k = 0; $k < count($row_labels); $k++) { $worksheet->write(0, $k, $row_headers[$row_labels[$k]], $format); } for ($i = 0; $i < count($rows); $i++) { for ($k = 0; $k < count($row_labels); $k++) { $worksheet->write($i + 1, $k, $rows[$i][$row_labels[$k]]); } } $workbook->close(); $attachment = ob_get_contents(); @ob_end_clean(); echo $attachment; }
public function PageLoad() { ob_clean(); $this->presenter->PageLoad(); $config = Configuration::Instance(); $feed = new FeedWriter(ATOM); $title = $config->GetKey(ConfigKeys::APP_TITLE); $feed->setTitle("{$title} Reservations"); $url = $config->GetScriptUrl(); $feed->setLink($url); $feed->setChannelElement('updated', date(DATE_ATOM, time())); $feed->setChannelElement('author', array('name' => $title)); foreach ($this->reservations as $reservation) { /** @var FeedItem $item */ $item = $feed->createNewItem(); $item->setTitle($reservation->Summary); $item->setLink($reservation->ReservationUrl); $item->setDate($reservation->DateCreated->Timestamp()); $item->setDescription(sprintf('<div><span>Start</span> %s</div> <div><span>End</span> %s</div> <div><span>Organizer</span> %s</div> <div><span>Description</span> %s</div>', $reservation->DateStart->ToString(), $reservation->DateEnd->ToString(), $reservation->Organizer, $reservation->Description)); $feed->addItem($item); } $feed->genarateFeed(); }
function ierror($msg, $code) { global $logger; if ($code == 301 || $code == 302) { if (ob_get_length() !== FALSE) { ob_clean(); } // default url is on html format $url = html_entity_decode($msg); $logger->warning($code . ' ' . $url, 'i.php', array('url' => $_SERVER['REQUEST_URI'])); header('Request-URI: ' . $url); header('Content-Location: ' . $url); header('Location: ' . $url); exit; } if ($code >= 400) { $protocol = $_SERVER["SERVER_PROTOCOL"]; if ('HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol) { $protocol = 'HTTP/1.0'; } header("{$protocol} {$code} {$msg}", true, $code); } //todo improve echo $msg; $logger->error($code . ' ' . $msg, 'i.php', array('url' => $_SERVER['REQUEST_URI'])); exit; }
public function test_initialize_obs_content() { // TODO: fix this test $this->markTestSkipped('The test needs fixed'); /** @var $thisPlugin action_plugin_door43obs_PopulateOBS */ $thisPlugin = plugin_load('action', 'door43obs_PopulateOBS'); if (ob_get_contents()) { ob_clean(); } $thisPlugin->initialize_obs_content(); $result = ob_get_clean(); // test the return value $expect = sprintf($thisPlugin->getLang('obsCreatedSuccess'), self::$destNs, '/' . self::$destNs . '/obs'); $this->assertEquals($expect, $result); // check for files $this->assertFileExists($this->destNsDir . '/home.txt'); $this->assertFileExists($this->destNsDir . '/obs.txt'); $this->assertFileExists($this->destNsDir . '/sidebar.txt'); $this->assertFileExists($this->destNsDir . '/obs/app_words.txt'); $this->assertFileExists($this->destNsDir . '/obs/back-matter.txt'); $this->assertFileExists($this->destNsDir . '/obs/front-matter.txt'); $this->assertFileExists($this->destNsDir . '/obs/cover-matter.txt'); $this->assertFileExists($this->destNsDir . '/obs/sidebar.txt'); $this->assertFileExists($this->destNsDir . '/obs/stories.txt'); // currently not checking all 50 files, just the first and last $this->assertFileExists($this->destNsDir . '/obs/01.txt'); $this->assertFileExists($this->destNsDir . '/obs/50.txt'); }
public function export() { // @rule: Test for user access if on 1.6 and above if (EasyBlogHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('easyblog.manage.setting', 'com_easyblog')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } $db = JFactory::getDBO(); $query = 'SELECT `params` FROM ' . $db->quoteName('#__easyblog_configs') . ' WHERE `name` = ' . $db->Quote('config'); $db->setQuery($query); $data = $db->loadResult(); // Get the file size $size = strlen($data); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=settings.json'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); ob_clean(); flush(); echo $data; exit; }
/** * Ajax handler for Admin Widget * * @return json|int */ function ajax_widget_reports() { global $GADASH_Config; if (!isset($_REQUEST['gadash_security_widget_reports']) or !wp_verify_nonce($_REQUEST['gadash_security_widget_reports'], 'gadash_get_widgetreports')) { wp_die(-30); } $projectId = $_REQUEST['projectId']; $from = $_REQUEST['from']; $to = $_REQUEST['to']; $query = $_REQUEST['query']; if (ob_get_length()) { ob_clean(); } $tools = new GADASH_Tools(); if (!$tools->check_roles($GADASH_Config->options['ga_dash_access_back']) or 0 == $GADASH_Config->options['dashboard_widget']) { wp_die(-31); } if ($GADASH_Config->options['ga_dash_token'] and $projectId and $from and $to) { include_once $GADASH_Config->plugin_path . '/tools/gapi.php'; global $GADASH_GAPI; } else { wp_die(-24); } $profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $projectId); if (isset($profile_info[4])) { $GADASH_GAPI->timeshift = $profile_info[4]; } else { $GADASH_GAPI->timeshift = (int) current_time('timestamp') - time(); } $GADASH_GAPI->get($projectId, $query, $from, $to); }
function rev_slider_shortcode($args) { $sliderAlias = UniteFunctionsRev::getVal($args, 0); ob_start(); $slider = RevSliderOutput::putSlider($sliderAlias); $content = ob_get_contents(); ob_clean(); ob_end_clean(); //handle slider output types if (!empty($slider)) { $outputType = $slider->getParam("output_type", ""); switch ($outputType) { case "compress": $content = str_replace("\n", "", $content); $content = str_replace("\r", "", $content); return $content; break; case "echo": echo $content; //bypass the filters break; default: return $content; break; } } else { return $content; } //normal output }
/** * Render the chart output * * @param string $objName object name which is the bizform name * @return void */ public function render($objName) { // get the value of the control that issues the call $chartName = BizSystem::clientProxy()->getFormInputs("__this"); // get the current UI bizobj $formObj = BizSystem::getObject($objName); // get the existing bizform object $bizDataObj = $formObj->getDataObj(); // get chart config xml file $chartXmlFile = BizSystem::GetXmlFileWithPath($objName . "_chart"); $xmlArr = BizSystem::getXmlArray($chartXmlFile); ob_clean(); // get the chart section from config xml file foreach ($xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"] as $chart) { if (count($xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"]) == 1) { $chart = $xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"]; } // try to match the chartName, if no chartName given, always draw the first chart defined in xml file if ($chartName && $chart["ATTRIBUTES"]["NAME"] == $chartName || !$chartName) { if ($chart["ATTRIBUTES"]["GRAPHTYPE"] == 'XY') { $this->xyGraphRender($bizDataObj, $chart); break; } if ($chart["ATTRIBUTES"]["GRAPHTYPE"] == 'Pie') { $this->pieGraphRender($bizDataObj, $chart); break; } } } }
public function save_html($dir) { $tpl = $this->templatedir . "main.html"; $com = $this->compiledir . "main.php"; //当不存在模板文件时,返回 if (!file_exists($tpl)) { return false; } //判断什么时候需要编译文件 if (!file_exists($com) || filemtime($tpl) > filemtime($com)) { $tpl_content = file_get_contents($tpl); $tpl_content = $this->tag_replace($this->include_combine($tpl_content)); file_put_contents($com, $tpl_content); } ob_start(); include $com; $html = ob_get_contents(); ob_clean(); //获取要保存文件的名称 $filename = trim(file_get_contents(dirname($this->compiledir) . "/filename.txt")) + 1; //把数字html文件名存入以便下次使用 file_put_contents(dirname($this->compiledir) . "/filename.txt", $filename, LOCK_EX); //把实际html内容存入文档 file_put_contents(Croot . $dir . "/" . $filename . ".html", $html); }
public function render($display = true) { $render = false; $this->pdf_renderer->setFontForLang(Context::getContext()->language->iso_code); foreach ($this->objects as $object) { $template = $this->getTemplateObject($object); if (!$template) { continue; } if (empty($this->filename)) { $this->filename = $template->getFilename(); if (count($this->objects) > 1) { $this->filename = $template->getBulkFilename(); } } $template->assignHookData($object); $this->pdf_renderer->createHeader($template->getHeader()); $this->pdf_renderer->createFooter($template->getFooter()); $this->pdf_renderer->createContent($template->getContent()); $this->pdf_renderer->writePage(); $render = true; unset($template); } if ($render) { // clean the output buffer if (ob_get_level() && ob_get_length() > 0) { ob_clean(); } return $this->pdf_renderer->render($this->filename, $display); } }
public function execute($request) { $id = trim($request->getParameter('subunitId')); try { $form = new DefaultListForm(); $form->bind($request->getParameter($form->getName())); $object = new stdClass(); if ($form->isValid()) { $subunit = $this->getCompanyStructureService()->getSubunitById($id); $result = $this->getCompanyStructureService()->deleteSubunit($subunit); if ($result) { $object->messageType = 'success'; $object->message = __(TopLevelMessages::DELETE_SUCCESS); } else { $object->messageType = 'error'; $object->message = __(TopLevelMessages::DELETE_FAILURE); } } else { $object->messageType = 'error'; $object->message = __(TopLevelMessages::VALIDATION_FAILED); } } catch (Exception $e) { $logger = Logger::getLogger('admin.subunit'); $logger->error('Error deleting subunut: ' . $e); $object->messageType = 'error'; $object->message = __(TopLevelMessages::DELETE_FAILURE); } @ob_clean(); return $this->renderText(json_encode($object)); }
public function displayOptions() { ob_start(); global $current_language, $app_list_strings; $mod_strings = return_module_language($current_language, 'AOR_Reports'); $optionsSmarty = new Sugar_Smarty(); $optionsSmarty->assign('MOD', $mod_strings); $optionsSmarty->assign('id', $this->id); $optionsSmarty->assign('dashletTitle', $this->title); $optionsSmarty->assign('aor_report_id', $this->report->id); $optionsSmarty->assign('aor_report_name', $this->report->name); $optionsSmarty->assign('onlyCharts', $this->onlyCharts); $charts = array(); if (!empty($this->report->id)) { foreach ($this->report->get_linked_beans('aor_charts', 'AOR_Charts') as $chart) { $charts[$chart->id] = $chart->name; } } $conditions = getConditionsAsParameters($this->report, $this->params); $optionsSmarty->assign('parameters', $conditions); $chartOptions = get_select_options_with_id($charts, $this->charts); $optionsSmarty->assign('chartOptions', $chartOptions); $optionsTemplate = get_custom_file_if_exists('modules/AOR_Reports/Dashlets/AORReportsDashlet/dashletConfigure.tpl'); ob_clean(); return $optionsSmarty->fetch($optionsTemplate); }
/** * Sends the email with the contents of the object (Body etc. set using the parant calls in phpMailer!) * @author Bobby Allen (ballen@bobbyallen.me) * @return boolean */ public function SendEmail() { $this->Mailer = ctrl_options::GetSystemOption('mailer_type'); $this->From = ctrl_options::GetSystemOption('email_from_address'); $this->FromName = ctrl_options::GetSystemOption('email_from_name'); if (ctrl_options::GetSystemOption('email_smtp') != 'false') { $this->IsSMTP(); if (ctrl_options::GetSystemOption('smtp_auth') != 'false') { $this->SMTPAuth = true; $this->Username = ctrl_options::GetSystemOption('smtp_username'); $this->Password = ctrl_options::GetSystemOption('smtp_password'); } if (ctrl_options::GetSystemOption('smtp_secure') != 'false') { $this->SMTPSecure = ctrl_options::GetSystemOption('smtp_secure'); } $this->Host = ctrl_options::GetSystemOption('smtp_server'); $this->Port = ctrl_options::GetSystemOption('smtp_port'); } ob_start(); $send_resault = $this->Send(); $error = ob_get_contents(); ob_clean(); if ($send_resault) { runtime_hook::Execute('OnSuccessfulSendEmail'); return true; } else { $logger = new debug_logger(); $logger->method = ctrl_options::GetSystemOption('logmode'); $logger->logcode = "061"; $logger->detail = 'Error sending email (using sys_email): ' . $error . ''; $logger->writeLog(); runtime_hook::Execute('OnFailedSendEmail'); return false; } }
public function fireAction() { $row = filter_input(INPUT_POST, 'row'); $col = filter_input(INPUT_POST, 'col'); $view = new \View(); if (!$row || !$col) { $view->dislayJson(array('status' => 0, 'msg' => 'Invalid coordinates!')); return; } //fire $status = $this->fire($row, $col); $view->grid = $this->board->getGrid(); $view->symbols = $this->getBoardSymbols(); $view->rows = $this->getRowsNames(); $view->cols = $this->getColsNames(); //Get the html for the board ob_start(); $view->display('Web/board'); $html = ob_get_contents(); ob_clean(); $data = array('status' => 1, 'msg' => $this->getMessageByStatus($status), 'html' => $html, 'tries' => $this->board->getTries()); $view->dislayJson($data); //Reset the game if it's over if ($this->isGameOver()) { $this->reset(); } }
private function _format($id, $data, $type) { switch ($type) { case '1': // json if (CHARSET == 'gbk') { $data = array_iconv($data, 'gbk', 'utf-8'); } return json_encode($data); break; case '2': // xml $xml = Loader::lib('Xml'); return $xml->xml_serialize($data); break; case '3': // js Loader::func('dbsource:global'); ob_start(); include template_url($id); $html = ob_get_contents(); ob_clean(); return format_js($html); break; } }
public function verify_c() { ob_clean(); $Verify = new \Think\Verify(); $Verify->codeSet = '123456789netsrvic'; $Verify->entry(); }
public function exec() { if (!$this->value) { echo "Exec " . $this->text . ": SKIP\n"; } if ($this->_exec instanceof \Closure && $this->value) { echo "Exec " . $this->text . ": "; ob_start(); $transaction = Yii::$app->db->beginTransaction(); $res = call_user_func($this->_exec, $this); if ($res) { $transaction->commit(); } else { $transaction->rollBack(); } ob_clean(); ob_end_flush(); echo ($res ? "OK" : "FAIL") . "\n"; } if ($this->items) { foreach ($this->items as $child) { $child->exec(); } } }
public function actionUpdate($fid = 0, $gid = 0, $sort = '') { $timer = new CountTimer(); $cacheToken = 'cache-update'; Yii::beginProfile($cacheToken); ob_start(); // 生成版块列表缓存 $this->forward('forum/forumlist', false); // 生成帖子列表缓存 $sortArr = array('', 'new', 'marrow', 'top'); $fids = $this->_getFids($fid); $uids = $this->_getUidsByGid($gid); foreach ($sortArr as $sort) { foreach ($fids as $fid) { foreach ($uids as $uid) { $_GET = array_merge($_GET, array('hacker_uid' => $uid, 'boardId' => $fid, 'page' => 1, 'pageSize' => 10, 'sortby' => $sort)); $res = $this->forward('forum/topiclist', false); ob_clean(); } } } ob_end_clean(); var_dump($timer->stop()); Yii::endProfile($cacheToken); }
public function prepareExceptionViewModel(MvcEvent $event) { // Do nothing if no error in the event $error = $event->getError(); if (empty($error)) { return; } // Do nothing if the result is a response object $result = $event->getResult(); if ($result instanceof Response) { return; } switch ($error) { case Application::ERROR_CONTROLLER_NOT_FOUND: case Application::ERROR_CONTROLLER_INVALID: case Application::ERROR_ROUTER_NO_MATCH: // Specifically not handling these return; case Application::ERROR_EXCEPTION: default: $exception = $event->getParam('exception'); if ($exception) { $response = $event->getResponse(); if (!$response || $response->getStatusCode() === 200) { header('HTTP/1.0 500 Internal Server Error', true, 500); } ob_clean(); $this->run->handleException($event->getParam('exception')); } break; } }