Exemplo n.º 1
0
 public function Save()
 {
     //if installed goto dashboard
     if ($this->getSystemSetting(OpenSms::INSTALLATION_STATUS)) {
         OpenSms::redirectToAction('index', 'dashboard');
     }
     //var_dump($_POST);die();
     // CREATE
     $config = new SimpleXmlElement('<settings/>');
     $config->{OpenSms::VERSION} = $this->getSystemSetting(OpenSms::VERSION);
     $config->{OpenSms::SITE_NAME} = $this->getFormData(OpenSms::SITE_NAME);
     $config->{OpenSms::SITE_URL} = $this->getFormData(OpenSms::SITE_URL);
     $config->{OpenSms::DB_TYPE} = 'mysql';
     $config->{OpenSms::DB_HOST} = $this->getFormData(OpenSms::DB_HOST);
     $config->{OpenSms::DB_NAME} = $this->getFormData(OpenSms::DB_NAME);
     $config->{OpenSms::DB_TABLE_PREFIX} = $this->getFormData(OpenSms::DB_TABLE_PREFIX);
     $config->{OpenSms::DB_USERNAME} = $this->getFormData(OpenSms::DB_USERNAME);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::CURRENT_THEME_KEY} = $this->getFormData(OpenSms::CURRENT_THEME_KEY);
     $config->{OpenSms::OPEN_PRICE_PER_UNIT} = $this->getFormData(OpenSms::OPEN_PRICE_PER_UNIT);
     $config->{OpenSms::OPEN_UNITS_PER_SMS} = $this->getFormData(OpenSms::OPEN_UNITS_PER_SMS);
     $config->{OpenSms::INSTALLATION_STATUS} = false;
     //unlink(OpenSms::SETTINGS_FILE_PATH);
     $config->saveXML(OpenSms::SETTINGS_FILE_PATH);
     $this->setNotification('Settings saved', 'settings_save');
     OpenSms::redirectToAction('index');
 }
Exemplo n.º 2
0
 /**
  * Output as XML
  *
  * @param array $shellList The shell list.
  * @return void
  */
 protected function _asXml($shellList)
 {
     $shells = new SimpleXmlElement('<shells></shells>');
     foreach ($shellList as $command) {
         $callable = $command;
         $shell = $shells->addChild('shell');
         $shell->addAttribute('name', $command);
         $shell->addAttribute('call_as', $callable);
         $shell->addAttribute('help', $callable . ' -h');
     }
     $this->out($shells->saveXML());
 }
Exemplo n.º 3
0
 public function save()
 {
     if (!isset($_POST[OpenSms::DB_HOST])) {
         OpenSms::redirectToAction('index');
     }
     //if installed goto dashboard
     if ($this->getSystemSetting(OpenSms::INSTALLATION_STATUS)) {
         OpenSms::redirectToAction('index', 'dashboard');
     }
     //var_dump($_POST);die();
     // CREATE
     $config = new SimpleXmlElement('<settings/>');
     $config->{OpenSms::VERSION} = $this->getSystemSetting(OpenSms::VERSION);
     $config->{OpenSms::SITE_NAME} = $this->getFormData(OpenSms::SITE_NAME);
     $config->{OpenSms::SITE_URL} = $this->getFormData(OpenSms::SITE_URL);
     $config->{OpenSms::DB_TYPE} = 'mysql';
     $config->{OpenSms::DB_HOST} = $this->getFormData(OpenSms::DB_HOST);
     $config->{OpenSms::DB_NAME} = $this->getFormData(OpenSms::DB_NAME);
     $config->{OpenSms::DB_TABLE_PREFIX} = $this->getFormData(OpenSms::DB_TABLE_PREFIX);
     $config->{OpenSms::DB_USERNAME} = $this->getFormData(OpenSms::DB_USERNAME);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::CURRENT_THEME_KEY} = 'default';
     $config->{OpenSms::OPEN_PRICE_PER_UNIT} = $this->getFormData(OpenSms::OPEN_PRICE_PER_UNIT);
     $config->{OpenSms::OPEN_UNITS_PER_SMS} = $this->getFormData(OpenSms::OPEN_UNITS_PER_SMS);
     $config->{OpenSms::INSTALLATION_STATUS} = 'installed';
     //unlink(OpenSms::SETTINGS_FILE_PATH);
     $config->saveXML(OpenSms::SETTINGS_FILE_PATH);
     $this->loadSystemSettings();
     //create tables
     OpenSms_Helper_Db::executeNonQuery($this->getDbScript());
     //create admin account
     $user = $this->loadModel('OpenSms_Model_User');
     $user->LoginId = $this->getFormData('admin_username');
     $user->Password = $this->getFormData('admin_password');
     $user->Role = OpenSms_Model_User::ADMIN;
     $saved = $user->save();
     OpenSms::redirectToAction('complete', 'install', 'admin', [0 => $saved == true ? 1 : 0]);
 }
 /**
  * Simply get text out of an element
  *
  * @param SimpleXmlElement $xmlElement
  *
  * @return string
  */
 protected function parseTextElement($xmlElement)
 {
     $text = "";
     $italic = strpos($xmlElement->saveXML(), "<w:i/>") !== false;
     $bold = strpos($xmlElement->saveXML(), "<w:b/>") !== false;
     $underline = strpos($xmlElement->saveXML(), "<w:u/>") !== false;
     foreach ($xmlElement->xpath('w:t') as $textElement) {
         $text .= strip_tags($textElement->saveXML());
     }
     // exclude if needed
     if (in_array($text, $this->exclude)) {
         return "";
     }
     // apply styles
     $text = $this->normalize($text);
     $text = $italic ? "<i " . $this->getAttributes('i') . ">" . $text . "</i>" : $text;
     $text = $bold ? "<b " . $this->getAttributes('b') . ">" . $text . "</b>" : $text;
     $text = $underline ? "<u " . $this->getAttributes('u') . ">" . $text . "</u>" : $text;
     return $text;
 }
function getInnerXml(SimpleXmlElement $xml, $rootNodeToRemove)
{
    return str_replace(array('<' . $rootNodeToRemove . '>', '</' . $rootNodeToRemove . '>'), '', $xml->saveXML());
}