function ProductUpdateCart($argProductID, $argQty)
 {
     $objCore = new Core();
     $objGeneral = new General();
     $arrCartDetails = array();
     $arrNewCart = array();
     if (isset($_SESSION['sessCartDetails'])) {
         $arrCartDetails = $_SESSION['sessCartDetails'];
     }
     foreach ($arrCartDetails as $arrTempCartData) {
         $varPrdId = $arrTempCartData['ProductId'];
         if ($varPrdId == $argProductID) {
             $arrTempCartData['Qty'] = $argQty;
             //getting  details
             $arrCol = array('pkProductID', 'ProductName', 'ProductCode', 'ProductDescription', 'ProductSpecifications', 'ProductWeight', 'ProductCost', 'ProductActualCost', 'ProductQuantity', 'ProductQuantityAvailable', 'ProductStatus', 'ProductIsFeatured', 'ProductImage', 'ProductIsSpecailOffer', 'ProductDateAdded', 'ProductDateModified');
             $varWhr = 'pkProductID=' . $argProductID;
             $arrProduct = $objGeneral->getRecord(TABLE_PRODUCTS, $arrCol, $varWhr);
         }
         array_push($arrNewCart, $arrTempCartData);
     }
     if ($_SESSION['sessMess']) {
         $_SESSION['sessVarMsg'] = '';
         $_SESSION['sessVarMsg'] = 'Cart details have been updated successfully .';
         $_SESSION['sessFlag'] = false;
         $objCore->setSuccessMsg($_SESSION['sessVarMsg']);
     }
     unset($_SESSION['sessCartDetails']);
     $_SESSION['sessCartDetails'] = $arrNewCart;
 }
 function forgotPasswordMail($argArrPOST)
 {
     $objTemplate = new EmailTemplate();
     $objValid = new Validate_fields();
     $objCore = new Core();
     $objGeneral = new General();
     $objValid->check_4html = true;
     $_SESSION['sessForgotValues'] = array();
     $objValid->add_text_field('Login ID', strip_tags($argArrPOST['frmUserName']), 'text', 'y', 255);
     $objValid->add_text_field('Verification Code', strip_tags($argArrPOST['frmSecurityCode']), 'text', 'y', 255);
     if (!$objValid->validation()) {
         $errorMsg = $objValid->create_msg();
     }
     if ($errorMsg) {
         $_SESSION['sessForgotValues'] = $argArrPOST;
         $objCore->setErrorMsg($errorMsg);
         return false;
     } else {
         if ($_SESSION['security_code'] == $argArrPOST['frmSecurityCode'] && !empty($_SESSION['security_code'])) {
             $varWhereCond = " AND ClientEmailAddress  ='" . $argArrPOST['frmUserName'] . "'";
             $userRecords = $this->getClientNumRows($varWhereCond);
             $userInfo = $this->getClientInfo($varWhereCond);
             if ($userRecords > 0) {
                 $varClientID = $userInfo['0']['pkClientID'];
                 $varMemberData = trim(strip_tags($argArrPOST['frmUserName']));
                 $varForgotPasswordCode = $objGeneral->getValidRandomKey(TABLE_CLIENTS, array('pkClientID'), 'ClientForgotPWCode', '25');
                 $varForgotPasswordLink = '<a href="' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '">' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '</a>';
                 $arrColumns = array('ClientForgotPWStatus' => 'Active', 'ClientForgotPWCode' => $varForgotPasswordCode);
                 $varWhereCondition = 'pkClientID = \'' . $varClientID . '\'';
                 $this->update(TABLE_CLIENTS, $arrColumns, $varWhereCondition);
                 $varClientEmail = $userInfo[0]['ClientEmailAddress'];
                 $varToUser = $varClientEmail;
                 $varFromUser = SITE_NAME . '<' . $varClientEmail . '>';
                 $varSiteName = SITE_NAME;
                 $varWhereTemplate = ' EmailTemplateTitle= \'Forgot password\' AND EmailTemplateStatus = \'Active\' ';
                 $arrMailTemplate = $objTemplate->getTemplateInfo($varWhereTemplate);
                 $varOutput = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateDescription']));
                 $varSubject = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateSubject']));
                 $varSubject = str_replace('{PROJECT_NAME}', SITE_NAME, html_entity_decode(stripcslashes($arrMailTemplate['0']['EmailTemplateSubject'])));
                 $varKeyword = array('{IMAGE_PATH}', '{MEMBER}', '{PROJECT_NAME}', '{USER_DATA}', '{FORGOT_PWD_LINK}', '{SITE_NAME}');
                 $varKeywordValues = array($varPathImage, 'Client', SITE_NAME, $varMemberData, $varForgotPasswordLink, SITE_NAME);
                 $varOutPutValues = str_replace($varKeyword, $varKeywordValues, $varOutput);
                 $objCore->sendMail($varToUser, $varFromUser, $varSubject, $varOutPutValues);
                 $_SESSION['sessForgotValues'] = '';
                 $objCore->setSuccessMsg(ADMIN_FORGOT_PASSWORD_CONFIRM_MSG);
                 return true;
             } else {
                 $_SESSION['sessForgotValues'] = $argArrPOST;
                 $objCore->setErrorMsg(EMAIL_NOT_EXIST_MSG);
                 return true;
             }
         } else {
             $_SESSION['sessForgotValues'] = $argArrPOST;
             $objCore->setErrorMsg(INVALID_SECURITY_CODE_MSG);
             return false;
         }
     }
 }
 public static function render($e)
 {
     if (is_null($e->getTemplatePath())) {
         header('HTTP/1.0 500 Server Error');
         echo '<h1>Symphony Fatal Error</h1><p>' . $e->getMessage() . '</p>';
         exit;
     }
     $xml = new DOMDocument('1.0', 'utf-8');
     $xml->formatOutput = true;
     $root = $xml->createElement('data');
     $xml->appendChild($root);
     $root->appendChild($xml->createElement('heading', General::sanitize($e->getHeading())));
     $root->appendChild($xml->createElement('message', General::sanitize($e->getMessageObject() instanceof SymphonyDOMElement ? (string) $e->getMessageObject() : trim($e->getMessage()))));
     if (!is_null($e->getDescription())) {
         $root->appendChild($xml->createElement('description', General::sanitize($e->getDescription())));
     }
     header('HTTP/1.0 500 Server Error');
     header('Content-Type: text/html; charset=UTF-8');
     header('Symphony-Error-Type: ' . $e->getErrorType());
     foreach ($e->getHeaders() as $header) {
         header($header);
     }
     $output = parent::__transform($xml, basename($e->getTemplatePath()));
     header(sprintf('Content-Length: %d', strlen($output)));
     echo $output;
     exit;
 }
Beispiel #4
0
 /**
  * Creates a new Session-object, if password is correct
  */
 static function createNewSession($password, $project_id = null)
 {
     if (!$project_id) {
         $project_id = Config::$default_project_id;
     }
     // Delete old Session object from php_session cache
     // and create new session_id to prevent session fixation:
     self::destroySession();
     $session = self::getInstance();
     if ($password) {
         // some password has to be entered
         //Allow login via Master Password
         if (Config::$allow_project_login_with_master_password && General::CheckPostMasterPassword($password)) {
             $password = '';
         }
         try {
             $session->project = new Project($project_id, $password);
         } catch (PasswordException $e) {
             $session->project = null;
         }
     } else {
         $session->project = null;
     }
     return $session;
 }
 public function install()
 {
     Symphony::Configuration()->set('lang', 'en', 'redactor');
     Symphony::Configuration()->set('direction_ltr', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_toolbar', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_source', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_focus', 'no', 'redactor');
     Symphony::Configuration()->set('enable_shortcuts', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_autoresizing', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_cleanup', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_fixed', 'no', 'redactor');
     Symphony::Configuration()->set('enable_fixedbox', 'no', 'redactor');
     Symphony::Configuration()->set('enable_paragraphy', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_convertlinks', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_convertdivs', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_fileupload', 'no', 'redactor');
     Symphony::Configuration()->set('enable_imageupload', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_overlay', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_observeimages', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_airmode', 'no', 'redactor');
     Symphony::Configuration()->set('enable_wym', 'no', 'redactor');
     Symphony::Configuration()->set('enable_mobile', 'yes', 'redactor');
     Symphony::Configuration()->set('buttons', implode($this->buttons, ','), 'redactor');
     Symphony::Configuration()->set('airbuttons', implode($this->airbuttons, ','), 'redactor');
     Symphony::Configuration()->set('allowedtags', implode($this->allowedtags, ','), 'redactor');
     Symphony::Configuration()->set('filepath', WORKSPACE . '/redactor/files', 'redactor');
     Symphony::Configuration()->set('imagepath', WORKSPACE . '/redactor/images', 'redactor');
     Symphony::Configuration()->write();
     return General::realiseDirectory(Symphony::Configuration()->get('filepath', 'redactor')) && General::realiseDirectory(Symphony::Configuration()->get('imagepath', 'redactor'));
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle('Symphony &ndash; Importers');
     $tableHead = array(array('Name', 'col'), array('Version', 'col'), array('Author', 'col'));
     $tableBody = array();
     if (!is_array($this->_importers) or empty($this->_importers)) {
         $tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
     } else {
         foreach ($this->_importers as $importer) {
             $importer = (object) $importer;
             $col_name = Widget::TableData(Widget::Anchor($this->_driver->truncateValue($importer->name), $this->_uri . "/importers/edit/{$importer->handle}/"));
             $col_name->appendChild(Widget::Input("items[{$importer->id}]", null, 'checkbox'));
             $col_version = Widget::TableData($this->_driver->truncateValue($importer->version));
             $col_author = Widget::TableData($this->_driver->truncateValue($importer->version));
             if (isset($importer->author['website']) and preg_match('/^[^\\s:\\/?#]+:(?:\\/{2,3})?[^\\s.\\/?#]+(?:\\.[^\\s.\\/?#]+)*(?:\\/[^\\s?#]*\\??[^\\s?#]*(#[^\\s#]*)?)?$/', $importer->author['website'])) {
                 $col_author = Widget::Anchor($importer->author['name'], General::validateURL($importer->author['website']));
             } elseif (isset($importer->author['email']) and preg_match('/^\\w(?:\\.?[\\w%+-]+)*@\\w(?:[\\w-]*\\.)+?[a-z]{2,}$/i', $importer->author['email'])) {
                 $col_author = Widget::Anchor($importer->author['name'], 'mailto:' . $importer->author['email']);
             } else {
                 $col_author = $importer->author['name'];
             }
             $col_author = Widget::TableData($col_author);
             $tableBody[] = Widget::TableRow(array($col_name, $col_version, $col_author));
         }
     }
     $table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody));
     $this->Form->appendChild($table);
 }
 public function view()
 {
     $params = array();
     $filter = $_GET['query'];
     if ($_GET['template']) {
         $this->template = General::sanitize($_GET['template']);
     }
     // Environment parameters
     if ($filter == 'env') {
         $params = array_merge($params, $this->__getEnvParams());
         // Page parameters
     } elseif ($filter == 'page') {
         $params = array_merge($params, $this->__getPageParams());
         // Data source parameters
     } elseif ($filter == 'ds') {
         $params = array_merge($params, $this->__getDSParams());
         // All parameters
     } else {
         $params = array_merge($params, $this->__getEnvParams());
         $params = array_merge($params, $this->__getPageParams());
         $params = array_merge($params, $this->__getDSParams());
     }
     foreach ($params as $param) {
         if (empty($filter) || strripos($param, $filter) !== false) {
             $this->_Result[] = $param;
         }
     }
     sort($this->_Result);
 }
 function write_file($filename, $text, $db_escape = false)
 {
     $text = General::input_clean($text);
     $filename = RheinaufFile::get_enc($filename);
     if (!is_file($filename) && defined('USE_FTP') && USE_FTP === true) {
         $filename = str_replace(docroot(), '', $filename);
         $root_dir = FTP_ROOTDIR;
         $tmpname = TMPDIR . '/' . uniqid('RheinaufCMS_tmp_' . basename($filename));
         $file = fopen($tmpname, "wb");
         $fwrite = fwrite($file, $text);
         fclose($file);
         $ftp_filename = $root_dir . $filename;
         RheinaufFile::ftpcmd("ftp_put(\$conn_id,'{$ftp_filename}','{$tmpname}',FTP_BINARY);");
         RheinaufFile::chmod($filename, 777);
         RheinaufFile::delete($tmpname);
     } else {
         if (is_file($filename) && !is_writable($filename)) {
             RheinaufFile::chmod($filename, '0777');
         }
         $file = fopen($filename, "wb");
         $fwrite = fwrite($file, $text);
         fclose($file);
         if (is_file($filename)) {
             RheinaufFile::chmod($filename, 777);
         }
         return $fwrite;
     }
 }
 function listAll()
 {
     $result = array();
     $people = array();
     $structure = General::listStructure(TEXTFORMATTERS, '/formatter.[\\w-]+.php/', false, 'ASC', TEXTFORMATTERS);
     if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
         foreach ($structure['filelist'] as $f) {
             $f = str_replace(array('formatter.', '.php'), '', $f);
             $result[$f] = $this->about($f);
         }
     }
     $extensionManager = new ExtensionManager($this->_Parent);
     $extensions = $extensionManager->listInstalledHandles();
     if (is_array($extensions) && !empty($extensions)) {
         foreach ($extensions as $e) {
             if (!is_dir(EXTENSIONS . "/{$e}/text-formatters")) {
                 continue;
             }
             $tmp = General::listStructure(EXTENSIONS . "/{$e}/text-formatters", '/formatter.[\\w-]+.php/', false, 'ASC', EXTENSIONS . "/{$e}/text-formatters");
             if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
                 foreach ($tmp['filelist'] as $f) {
                     $f = preg_replace(array('/^formatter./i', '/.php$/i'), '', $f);
                     $result[$f] = $this->about($f);
                 }
             }
         }
     }
     ksort($result);
     return $result;
 }
 public function __buildPageXML($page, $page_types, $qf)
 {
     $lang_code = FLang::getLangCode();
     $oPage = new XMLElement('page');
     $oPage->setAttribute('handle', $page['handle']);
     $oPage->setAttribute('id', $page['id']);
     // keep current first
     $oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lang_code]), array('lang' => $lang_code, 'handle' => $page['plh_h-' . $lang_code])));
     // add others
     foreach (FLang::getLangs() as $lc) {
         if ($lang_code != $lc) {
             $oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lc]), array('lang' => $lc, 'handle' => $page['plh_h-' . $lc])));
         }
     }
     if (in_array($page['id'], array_keys($page_types))) {
         $xTypes = new XMLElement('types');
         foreach ($page_types[$page['id']] as $type) {
             $xTypes->appendChild(new XMLElement('type', $type));
         }
         $oPage->appendChild($xTypes);
     }
     if ($page['children'] != '0') {
         if ($children = PageManager::fetch(false, array($qf . 'id, handle, title'), array(sprintf('`parent` = %d', $page['id'])))) {
             foreach ($children as $c) {
                 $oPage->appendChild($this->__buildPageXML($c, $page_types, $qf));
             }
         }
     }
     return $oPage;
 }
 public function appendFormattedElement(&$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL)
 {
     if (is_null($data) || !is_array($data) || is_null($data['value'])) {
         return;
     }
     $wrapper->appendChild(new XMLElement($this->get('element_name'), $encode ? General::sanitize($data['value']) : $data['value'], array('handle' => $data['handle'])));
 }
 public function store()
 {
     if (Input::has('btnThem')) {
         $nhomquyen = Input::get('quyen');
         $mst = str_replace(" ", "", Input::get('txtMaSoThe'));
         $pass = Hash::make(General::randomPassword());
         $hoten = str_replace("  ", " ", trim(Input::get('txtHoTen')));
         $gioitinh = Input::get('gioiTinh');
         $ngaysinh = Input::get('txtNgaySinh');
         $email = str_replace(" ", "", Input::get('txtEmail'));
         $ngaycapthe = Input::get('txtNgayCapThe');
         $ngayhethan = null;
         if (Input::get('txtNgayHetHan') != "") {
             $ngayhethan = Input::get('txtNgayHetHan');
         }
         $tthoatdong = 0;
         if (Input::get('checkHoatDong') == "hoatdong") {
             $tthoatdong = 1;
         } else {
             $tthoatdong = 0;
         }
         $result = DB::table('nguoi_dung')->insert(array('id_nhom_quyen_han' => $nhomquyen, 'ma_so_the' => $mst, 'password' => $pass, 'ho_ten' => $hoten, 'gioi_tinh' => $gioitinh, 'ngay_sinh' => $ngaysinh, 'email' => $email, 'ngay_cap_the' => $ngaycapthe, 'ngay_het_han' => $ngayhethan, 'trang_thai_hoat_dong' => $tthoatdong));
         General::storeevents(QUAN_LY_THEM_NGUOI_DUNG . " có mã số thẻ " . $mst);
         return Redirect::back()->with('message', 'Thêm người dùng thành công!');
     }
 }
Beispiel #13
0
 public function transform($data)
 {
     if (!General::validateXML($data, $errors, false, new XsltProcess())) {
         throw new TransformException('Data returned is invalid.', $errors);
     }
     return $data;
 }
 /**
  *
  * Utility function that loads all the drivers
  * in the drivers directory
  * @throws ServiceDriverException
  */
 private static final function loadDrivers()
 {
     // if the pointer is null, then we sould load the drivers
     if (self::$drivers == null) {
         // create a new array
         self::$drivers = array();
         // get all files in the drivers folders
         $drivers = General::listStructure(OEMBED_DRIVERS_DIR, '/class.service[a-zA-Z0-9]+.php/', false, 'asc');
         // for each file found
         foreach ($drivers['filelist'] as $class) {
             $class = basename($class);
             try {
                 // include the class code
                 require_once OEMBED_DRIVERS_DIR . $class;
                 // get class name
                 $class = str_replace(array('class.', '.php'), '', $class);
                 // create new instance
                 $class = new $class($url);
                 // add the class to the stack
                 self::$drivers[$class->getName()] = $class;
             } catch (Exception $ex) {
                 throw new ServiceDriverException($url, $ex);
             }
         }
     }
 }
 function processForm()
 {
     if (!$_POST['name']) {
         return Messages::getString('CreateProjectPage.ProjectNameNotEmpty');
     }
     if (!$_POST['pwd']) {
         return Messages::getString('CreateProjectPage.PasswordNotEmpty');
     }
     if ($_POST['pwd'] != $_POST['pwd2']) {
         return Messages::getString('CreateProjectPage.PasswordsNotEqual');
     }
     if (!General::CheckPostMasterPassword()) {
         return Messages::getString('CreateProjectPage.MasterPasswordWrong');
     }
     try {
         $db = Database::getInstance();
         $project_info = array('name' => stripslashes($_POST['name']), 'pwd' => stripslashes($_POST['pwd']), 'info' => Config::$default_project_info['info'], 'access' => Config::$default_project_info['access'], 'introduction' => Config::$default_project_info['introduction'], 'hint' => Config::$default_project_info['hint']);
         if (!($this->new_project_id = $db->insertProject($project_info))) {
             return sprintf("%s: %s", Messages::getString('General.dbError'), $db->lastError());
         }
     } catch (Exception $exception) {
         // in this case, render exception as error.
         return $exception;
     }
     return '';
 }
 public function grab(&$param_pool)
 {
     self::__init();
     $result = new XMLElement($this->dsParamROOTELEMENT);
     $rows = Symphony::Database()->fetch("SELECT *\n\t\t\t\tFROM `tbl_sessions` \n\t\t\t\tWHERE `session_data` != 'sym-|a:0:{}sym-members|a:0:{}' \n\t\t\t\tAND `session_data` REGEXP 'sym-members'\n\t\t\t\tAND `session_expires` > (UNIX_TIMESTAMP() - " . self::AGE . ") \n\t\t\t\tORDER BY `session_expires` DESC");
     $added = array();
     if (count($rows) > 0) {
         foreach ($rows as $r) {
             $raw = $r['session_data'];
             $data = self::session_real_decode($raw);
             if (!isset($data['sym-members'])) {
                 continue;
             }
             $record = ASDCLoader::instance()->query(sprintf("SELECT\n\t\t\t\t\t\t\t\temail.value AS `email`,\n\t\t\t\t\t\t\t\tMD5(email.value) AS `hash`,\n\t\t\t\t\t\t\t\tcreated_by.username AS `username`\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tFROM `tbl_entries_data_%d` AS `created_by`\n\t\t\t\t\t\t\tLEFT JOIN `tbl_entries_data_%d` AS `email` ON created_by.member_id = email.entry_id\n\t\t\t\t\t\t\tWHERE `created_by`.username = '******'\n\t\t\t\t\t\t\tLIMIT 1", self::findFieldID('created-by', 'comments'), self::findFieldID('email-address', 'members'), ASDCLoader::instance()->escape($data['sym-members']['username'])));
             if ($record->length() == 0) {
                 continue;
             }
             $member = $record->current();
             // This is so we dont end up with accidental duplicates. No way to select
             // distinct via the SQL since we grab raw session data
             if (in_array($member->username, $added)) {
                 continue;
             }
             $added[] = $member->username;
             $result->appendChild(new XMLElement('member', General::sanitize($member->username), array('email-hash' => $member->hash)));
         }
     } else {
         $result->setValue('No Records Found.');
         //This should never happen!
     }
     return $result;
 }
 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'PayPal Payments'));
     # Add Merchant Email field
     $label = Widget::Label('Merchant Email/Account ID');
     $label->appendChild(Widget::Input('settings[paypal-payments][business]', General::Sanitize($this->_get_paypal_business())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'The merchant email address or account ID of the payment recipient.', array('class' => 'help')));
     # Country <select>
     $countries = array('Australia', 'United Kingdom', 'United States');
     $selected_country = $this->_get_country();
     foreach ($countries as $country) {
         $selected = $country == $selected_country ? TRUE : FALSE;
         $options[] = array($country, $selected);
     }
     $label = Widget::Label();
     $select = Widget::Select('settings[paypal-payments][country]', $options);
     $label->setValue('PayPal Country' . $select->generate());
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Country you want to target.', array('class' => 'help')));
     # Sandbox
     $label = Widget::Label();
     $input = Widget::Input('settings[paypal-payments][sandbox]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('sandbox', 'paypal-payments') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Enable testing mode');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Directs payments to PayPal’s Sandbox: <code>http://www.sandbox.paypal.com/</code>', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
Beispiel #18
0
 function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     $note = isset($data['value']) ? $data['value'] : $this->get('note');
     $editable = $this->get('editable');
     # Add <div>
     $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
     $wrapper->appendChild($div);
     # Editable
     if (isset($editable) && $editable) {
         $wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
         $edit = new XMLElement("a", __("Edit note"), array("class" => "publishnotes-edit", "href" => "#edit"));
         $wrapper->appendChild($edit);
         # Add <textarea>
         $label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
         $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, 50, strlen($note) != 0 ? General::sanitize($note) : NULL);
         $label->appendChild($textarea);
         $control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
         $label->appendChild($control);
         if ($flagWithError != NULL) {
             $wrapper->appendChild(Widget::Error($label, $flagWithError));
         } else {
             $wrapper->appendChild($label);
         }
     }
 }
 /**
  *
  * Overrides the view method
  */
 public function view()
 {
     // if this is the unban request
     if (isset($this->_context) && is_array($this->_context) && count($this->_context) > 0) {
         // check if we have a hash present
         $hash = $this->_context[0];
         if (strlen($hash) == 36) {
             // Sanatize user inputed values... ALWAYS
             $hash = General::sanitize($hash);
             $this->__unban($hash);
         }
         // redirect not matter what
         // evil users won't be able to detect anything from the response
         // they *should* still be blocked since guessing a hash is
         // practically infeasible
         redirect(SYMPHONY_URL);
         die;
     } else {
         // not banned ? do not show this page!
         if (!ABF::instance()->isCurrentlyBanned()) {
             redirect(SYMPHONY_URL);
             die;
         }
         $this->setTitle(sprintf('%1$s &ndash; %2$s', __('Unban via email'), __('Symphony')));
         $this->Form = Widget::Form('', 'post');
         $this->Form->setAttribute('class', 'frame');
         $this->Form->appendChild(new XMLElement('h1', __('Symphony')));
         $this->__buildFormContent();
         $this->Body->appendChild($this->Form);
     }
 }
Beispiel #20
0
 protected function __construct()
 {
     $this->Profiler = new Profiler();
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     include CONFIG;
     self::$Configuration = new Configuration(true);
     self::$Configuration->setArray($settings);
     DateTimeObj::setDefaultTimezone(self::$Configuration->get('timezone', 'region'));
     self::$_lang = self::$Configuration->get('lang', 'symphony') ? self::$Configuration->get('lang', 'symphony') : 'en';
     // Legacy support for __LANG__ constant
     define_safe('__LANG__', self::lang());
     define_safe('__SYM_DATE_FORMAT__', self::$Configuration->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::$Configuration->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . ' ' . __SYM_TIME_FORMAT__);
     $this->initialiseLog();
     GenericExceptionHandler::initialise();
     GenericErrorHandler::initialise(self::$Log);
     $this->initialiseCookie();
     $this->initialiseDatabase();
     if (!$this->initialiseExtensionManager()) {
         throw new SymphonyErrorPage('Error creating Symphony extension manager.');
     }
     Lang::loadAll($this->ExtensionManager);
 }
		public function __viewShow() {
			$this->setPageType('form');
			$title = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $this->_log->request_time);
			$this->setTitle("Redirection Manager &ndash; {$title}");
			$this->appendSubheading("<a href=\"{$this->_uri}/logs/\">Redirection Logs</a> &mdash; {$title}");
			
			$values = unserialize($this->_log->request_args);
			
			foreach ($values as $type => $array) {
				if (!empty($array)) {
					$type = strtoupper($type);
					
					$fieldset = new XMLElement('fieldset');
					$fieldset->setAttribute('class', 'settings');
					$fieldset->appendChild(new XMLElement('legend', "{$type} Values"));
					
					$pre = new XMLElement('pre');
					$code = new XMLElement('code');
					
					ob_start();
					print_r($array);
					
					$code->setValue(General::sanitize(ob_get_clean()));
					
					$pre->appendChild($code);
					$fieldset->appendChild($pre);
					
					$this->Form->appendChild($fieldset);
				}
			}
		}
 protected function __construct()
 {
     $this->Profiler = new Profiler();
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     include CONFIG;
     self::$Configuration = new Configuration(true);
     self::$Configuration->setArray($settings);
     define_safe('__LANG__', self::$Configuration->get('lang', 'symphony') ? self::$Configuration->get('lang', 'symphony') : 'en');
     define_safe('__SYM_DATE_FORMAT__', self::$Configuration->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::$Configuration->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . ' ' . __SYM_TIME_FORMAT__);
     $this->initialiseLog();
     GenericExceptionHandler::initialise();
     GenericErrorHandler::initialise($this->Log);
     $this->initialiseCookie();
     try {
         Lang::init(LANG . '/lang.%s.php', __LANG__);
     } catch (Exception $e) {
         trigger_error($e->getMessage(), E_USER_ERROR);
     }
     $this->initialiseDatabase();
     if (!$this->initialiseExtensionManager()) {
         throw new SymphonyErrorPage('Error creating Symphony extension manager.');
     }
     DateTimeObj::setDefaultTimezone(self::$Configuration->get('timezone', 'region'));
 }
 public function delete($id)
 {
     $file = TEXTFORMATTERS . '/formatter.' . $id . '.php';
     if (!General::deleteFile($file)) {
         $this->pageAlert(__('Failed to delete <code>%s</code>. Please check permissions.', array($file)), Alert::ERROR);
     }
 }
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new General();
     }
     return self::$instance;
 }
 public static function get()
 {
     $response = new XMLElement('response');
     foreach (self::$_sections as $section) {
         $section_xml = new XMLElement('section');
         $meta = $section->get();
         foreach ($meta as $key => $value) {
             $section_xml->setAttribute(Lang::createHandle($key), $value);
         }
         $fields = $section->fetchFields();
         foreach ($fields as $field) {
             $meta = $field->get();
             unset($meta['field_id']);
             $field_xml = new XMLElement($meta['element_name'], null);
             foreach (self::$_field_attributes as $attr) {
                 $field_xml->setAttribute(Lang::createHandle($attr), $meta[$attr]);
             }
             foreach ($meta as $key => $value) {
                 if (in_array($key, self::$_field_attributes)) {
                     continue;
                 }
                 $value = General::sanitize($value);
                 if ($value != '') {
                     $field_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value)));
                 }
             }
             $section_xml->appendChild($field_xml);
         }
         $response->appendChild($section_xml);
     }
     REST_API::sendOutput($response);
 }
Beispiel #26
0
 public function transform($data)
 {
     $txtElement = new XMLElement('data');
     $txtElement->setValue(General::wrapInCDATA($data));
     $data = $txtElement->generate();
     return $data;
 }
 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     // Set date format throughout the system
     define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     DateTimeObj::setSettings(self::Configuration()->get('region'));
     self::initialiseErrorHandler();
     // Initialize language management
     Lang::initialize();
     Lang::set(self::$Configuration->get('lang', 'symphony'));
     self::initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error messages.
     if (!self::isLoggedIn() && is_null(self::$Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Engine is ready.
     self::$Profiler->sample('Engine Initialisation');
 }
Beispiel #28
0
 function action()
 {
     if (@array_key_exists('save', $_POST['action'])) {
         $this->_errors = array();
         // Polish up some field content
         $fields = $_POST['fields'];
         if (isset($fields['pages'])) {
             $fields['pages'] = implode(',', $fields['pages']);
         }
         $fields['content_formatted'] = DocumentationForm::applyFormatting($fields['content'], true, $this->_errors);
         if ($fields['content_formatted'] === false) {
             $fields['content_formatted'] = General::sanitize(DocumentationForm::applyFormatting($fields['content']));
         }
         if (!isset($fields['title']) || trim($fields['title']) == '') {
             $this->_errors['title'] = __('Title is a required field');
         }
         if (!isset($fields['pages']) || trim($fields['pages']) == '') {
             $this->_errors['pages'] = __('Page is a required field');
         }
         if (!isset($fields['content']) || trim($fields['content']) == '') {
             $this->_errors['content'] = __('Content is a required field');
         }
         if (empty($this->_errors)) {
             if (!Symphony::Database()->insert($fields, 'tbl_documentation')) {
                 $this->pageAlert(__('Unknown errors occurred while attempting to save. Please check your <a href="%s">activity log</a>.', array(URL . '/symphony/system/log/')), Alert::ERROR);
             } else {
                 $doc_id = Symphony::Database()->getInsertID();
                 redirect(URL . "/symphony/extension/documenter/edit/{$doc_id}/created/");
             }
         }
     }
     if (is_array($this->_errors) && !empty($this->_errors)) {
         $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR);
     }
 }
 public function view()
 {
     $params = array();
     $filter = $_GET['filter'];
     if ($_GET['template']) {
         $this->template = General::sanitize($_GET['template']);
     }
     // Environment parameters
     if ($filter == 'env') {
         $params = array_merge($params, $this->__getEnvParams());
         // Page parameters
     } elseif ($filter == 'page') {
         $params = array_merge($params, $this->__getPageParams());
         // Data source parameters
     } elseif ($filter == 'ds') {
         $params = array_merge($params, $this->__getDSParams());
         // All parameters
     } else {
         $params = array_merge($params, $this->__getEnvParams());
         $params = array_merge($params, $this->__getPageParams());
         $params = array_merge($params, $this->__getDSParams());
     }
     sort($params);
     $this->_Result = $params;
 }
 public function view()
 {
     $name = General::sanitize($_REQUEST['name']);
     $section = General::sanitize($_REQUEST['section']);
     $filters = self::processFilters($_REQUEST['filters']);
     $rootelement = Lang::createHandle($name);
     $doc_parts = array();
     // Add Documentation (Success/Failure)
     $this->addEntrySuccessDoc($doc_parts, $rootelement, $filters);
     $this->addEntryFailureDoc($doc_parts, $rootelement, $filters);
     // Filters
     $this->addDefaultFiltersDoc($doc_parts, $rootelement, $filters);
     // Frontend Markup
     $this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters);
     $this->addSendMailFilterDoc($doc_parts, $filters);
     /**
      * Allows adding documentation for new filters. A reference to the $documentation
      * array is provided, along with selected filters
      *
      * @delegate AppendEventFilterDocumentation
      * @param string $context
      * '/blueprints/events/(edit|new|info)/'
      * @param array $selected
      *  An array of all the selected filters for this Event
      * @param array $documentation
      *  An array of all the documentation XMLElements, passed by reference
      * @param string $rootelment
      *  The name of this event, as a handle.
      */
     Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/', array('selected' => $filters, 'documentation' => &$doc_parts, 'rootelement' => $rootelement));
     $documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts));
     $documentation = str_replace('\'', '\\\'', $documentation);
     $documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>';
     $this->_Result = $documentation;
 }