예제 #1
0
 public function _validateObject($dataObject, $requiredFields = null)
 {
     $parent = new parent();
     $parent->_validateObject($dataObject, $this->requiredFields);
     // run validation for change_type
     $this->validateChangeType($dataObject->attributes->change_type, $dataObject);
 }
 private function _init_structure($data, $user_options, $widget_title)
 {
     $this->_structure = parent::array_to_object($this->_structure);
     $this->_structure->data = $data;
     $this->_structure->options = parent::set_array_prop_def($this->_options_map, $user_options);
     $uid = parent::create_id(true);
     $this->_structure->id = $uid;
     // set the id as default id
     $this->_uid = $uid;
     $ui = new parent();
     $this->_structure->widget = $ui->create_widget();
     $this->_structure->widget->header('icon', 'fa-table')->header('title', $widget_title)->body("class", "no-padding")->body("editbox", '<input class="form-control" type="text">
                     <span class="note"><i class="fa fa-check text-success"></i> Change title to update and save instantly!</span>');
     if (!$this->_structure->data) {
         $col_list = array("No Data");
     } else {
         $col_list = array_keys(is_object($data[0]) ? get_object_vars($data[0]) : $data[0]);
     }
     $cols = array_combine($col_list, $col_list);
     $cells = array_fill_keys($col_list, array());
     $hide = array_fill_keys($col_list, false);
     $this->_cells_map = $cells;
     $this->_cols_map = $cols;
     $this->_hide_map = $hide;
     $this->_structure->col = $cols;
     $this->_structure->cell = $cells;
     $this->_structure->hide = $hide;
     $this->_structure->row = array_fill(1, count($data) + 1, array());
     $this->_structure->js = array("properties" => array(), "oTable" => 'oTable_' . $this->_uid, "custom" => "");
 }
예제 #3
0
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     $tlds = array();
     if (isset($dataObject->data->selected) && $dataObject->data->selected) {
         $tlds = explode(';', $dataObject->data->selected);
     }
     if (empty($tlds) && isset($dataObject->data->defaulttld) && $dataObject->data->defaulttld) {
         $tlds = explode(';', $dataObject->data->defaulttld);
     }
     if (empty($tlds)) {
         $tlds = $this->defaultTlds;
     }
     /*
      * setting service_override
      */
     $newDataObject->attributes->service_override = new \stdClass();
     $service_override = new \stdCLass();
     $service_override->tlds = $tlds;
     if (isset($dataObject->data->maximum) && $dataObject->data->maximum) {
         $service_override->maximum = $dataObject->data->maximum;
     }
     $newDataObject->attributes->service_override->suggestion = $service_override;
     $newDataObject->attributes->services = array('suggestion');
     /* end setting service_override **/
     return $newDataObject;
 }
예제 #4
0
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     // run customizations required by this particular class
     // set custom nameservers to nameserver_list
     if (isset($dataObject->data)) {
         if ($dataObject->data->custom_nameservers == 1) {
             $newDataObject->attributes->nameserver_list = array();
             for ($j = 1; $j <= 10; ++$j) {
                 $tns = 'name' . $j;
                 $tso = 'sortorder' . $j;
                 if (isset($dataObject->data->{$tns}) && $dataObject->data->{$tns} != '' && isset($dataObject->data->{$tso}) && $dataObject->data->{$tso}) {
                     $nameserver = new \stdClass();
                     $nameserver->name = $dataObject->data->{$tns};
                     $nameserver->sortorder = $dataObject->data->{$tso};
                     $newDataObject->attributes->nameserver_list[] = $nameserver;
                 }
             }
         }
     }
     if (isset($dataObject->personal)) {
         $newDataObject->attributes->contact_set = new \stdClass();
         $newDataObject->attributes->contact_set->owner = $dataObject->personal;
         $newDataObject->attributes->contact_set->admin = $dataObject->personal;
         $newDataObject->attributes->contact_set->billing = $dataObject->personal;
         $newDataObject->attributes->contact_set->tech = $dataObject->personal;
     }
     // end customizations
     return $newDataObject;
 }
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     // run customizations required by this particular class
     // set custom nameservers to nameserver_list
     if (isset($dataObject->data->nameserver_names) && $dataObject->data->nameserver_names != '') {
         $nameServers = explode(',', $dataObject->data->nameserver_names);
         if (isset($dataObject->data->nameserver_ips) && $dataObject->data->nameserver_ips != '') {
             $ipAddresses = explode(',', $dataObject->data->nameserver_ips);
         } else {
             $ipAddresses = array();
         }
         $i = 0;
         $newDataObject->attributes->nameserver_list = array();
         for ($i = 0; $i < count($nameServers); ++$i) {
             $nameserver_obj = new \stdClass();
             $nameserver_obj->fqdn = $nameServers[$i];
             if (isset($ipAddresses[$i])) {
                 $nameserver_obj->fqdn = $ipAddresses[$i];
             }
         }
     }
     // end customizations
     return $newDataObject;
 }
 public function _validateObject($dataObject, $requiredFields = null)
 {
     if (empty($dataObject->cookie) && empty($dataObject->attributes->domain)) {
         Exception::notDefined('cookie and/or domain.');
     }
     $parent = new parent();
     $parent->_validateObject($dataObject, $this->requiredFields);
 }
 public function _validateObject($dataObject, $requiredFields = null)
 {
     if (!isset($dataObject->attributes->order_id) and !isset($dataObject->attributes->product_id)) {
         Exception::notDefined('order_id or product_id');
     }
     $parent = new parent();
     $parent->_validateObject($dataObject, $this->requiredFields);
 }
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     return $newDataObject;
 }
 private function _init_structure($fields, $user_options = array())
 {
     $this->_structure = parent::array_to_object($this->_structure);
     $this->_structure->options = parent::set_array_prop_def($this->_options_map, $user_options);
     $this->_structure->field = $fields;
     $ui = new parent();
     $widget = $ui->create_widget();
     $widget->options('editbutton', false)->body('class', 'no-padding')->header('title', '<h2></h2>');
     $this->_structure->widget = $widget;
 }
예제 #10
0
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     $newDataObject->attributes->add_to_all_registry = explode(',', $newDataObject->attributes->add_to_all_registry);
     return $newDataObject;
 }
예제 #11
0
 /**
  * Check for the key in the error manager session else return the messages 
  * from the message bag
  *
  * @param  string  $key
  * @param  string  $format
  * @return array
  */
 public function get($key, $format = null)
 {
     if (Session::has('errorManager.errors')) {
         $errors = new parent(Session::get('errorManager.errors'));
         if ($errors->has($key)) {
             return $errors->get($key);
         }
     }
     return parent::get($key);
 }
 public function _validateObject($dataObject, $requiredFields = null)
 {
     if ((!isset($dataObject->cookie) || $dataObject->cookie == '') && (!isset($dataObject->attributes->domain) || $dataObject->attributes->domain == '')) {
         Exception::notDefined('cookie or domain');
     }
     if (isset($dataObject->cookie) && $dataObject->cookie != '' && isset($dataObject->attributes->domain) && $dataObject->attributes->domain != '') {
         Exception::cannotSetOneCall('cookie and domain');
     }
     $parent = new parent();
     $parent->_validateObject($dataObject, $this->requiredFields);
 }
예제 #13
0
 private function _init_structure($steps, $user_options = array())
 {
     $this->_structure = parent::array_to_object($this->_structure);
     $this->_structure->options = parent::set_array_prop_def($this->_options_map, $user_options);
     $this->_structure->step = $steps;
     $this->_structure->id = parent::create_id(true);
     $ui = new parent();
     $widget = $ui->create_widget();
     $widget->options('editbutton', false)->header('title', '<h2></h2>');
     $this->_structure->widget = $widget;
 }
예제 #14
0
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     if (!is_array($newDataObject->attributes->change_items)) {
         $newDataObject->attributes->change_items = explode(',', $newDataObject->attributes->change_items);
     }
     return $newDataObject;
 }
예제 #15
0
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     // run old 'getTlds' method (now called 'getServiceOverride') to get
     // info that should be part of service override entries
     $newDataObject->attributes->service_override = $this->getServiceOverride($dataObject);
     $newDataObject->attributes->services = array('lookup', 'suggestion');
     /* end setting service_override **/
     return $newDataObject;
 }
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     // make sure attributes->reg_domain is set, even if it's
     // an empty string
     if (!isset($newDataObject->attributes->reg_domain)) {
         $newDataObject->attributes->reg_domain = '';
     }
     return $newDataObject;
 }
 public function convertDataObject($dataObject, $newStructure = null)
 {
     $p = new parent();
     if (is_null($newStructure)) {
         $newStructure = $this->newStructure;
     }
     $newDataObject = $p->convertDataObject($dataObject, $newStructure);
     // set attributes->domain_list
     if (!is_object($newDataObject->attributes)) {
         $newDataObject->attributes = new \stdClass();
     }
     $newDataObject->attributes->domain_list = explode(',', $dataObject->data->domain_list);
     return $newDataObject;
 }
예제 #18
0
 public function add()
 {
     $tabelas = array_intersect(parent::$dev['tabelas'], parent::$homolog['tabelas']);
     $string = $stringResult = "";
     if (!empty($tabelas)) {
         $propriedade = new PropriedadeBO();
         parent::$fase = FaseQuery::ADD;
         foreach ($tabelas as $tabelaInput) {
             list(parent::$schema, parent::$tabela) = explode(".", $tabelaInput);
             $schema = parent::$schema;
             $tabela = parent::$tabela;
             if (isset(parent::$dev['schema'][$schema]['tabela'][$tabela]['coluna'])) {
                 $dev = array_keys(parent::$dev['schema'][$schema]['tabela'][$tabela]['coluna']);
             }
             if (isset(parent::$homolog['schema'][$schema]['tabela'][$tabela]['coluna'])) {
                 $homolog = array_keys(parent::$homolog['schema'][$schema]['tabela'][$tabela]['coluna']);
             }
             $colunas = array_diff($dev, $homolog);
             if (!empty($colunas)) {
                 $stringResult = "\n\n\n" . str_pad(" ADD COLUMN ", 100, "-", STR_PAD_BOTH);
                 foreach ($colunas as $coluna) {
                     parent::$coluna = $coluna;
                     $string .= "\n\nALTER TABLE {$schema}.{$tabela} ADD COLUMN {$coluna} ";
                     $string .= $propriedade->construct() . ";";
                 }
             }
         }
     }
     return $stringResult . $string;
 }
예제 #19
0
파일: DB.php 프로젝트: jpmschuler/cooluri
 public static function getInstance()
 {
     if (!parent::$_instance instanceof self) {
         parent::$_instance = new self();
     }
     return parent::$_instance;
 }
예제 #20
0
 public function alter()
 {
     $constraints = array_intersect(parent::$dev['constraints'], parent::$homolog['constraints']);
     $string = $stringResult = "";
     if (!empty($constraints)) {
         $restricao = new RestricaoBO();
         foreach ($constraints as $constraintInput) {
             list(parent::$schema, parent::$tabela, $constraint) = explode(".", $constraintInput);
             $schema = parent::$schema;
             $tabela = parent::$tabela;
             $dev = parent::$dev['schema'][$schema]['tabela'][$tabela]['constraint'][$constraint];
             $homolog = parent::$homolog['schema'][$schema]['tabela'][$tabela]['constraint'][$constraint];
             if ($dev != $homolog) {
                 parent::$constraint = $constraint;
                 $restricoes = $restricao->construct();
                 if ($restricoes != "") {
                     $stringResult = "\n\n\n" . str_pad(" ALTER DE CONSTRAINT ", 100, "-", STR_PAD_BOTH);
                     $string .= "\n\nALTER TABLE IF EXISTS {$schema}.{$tabela}";
                     $string .= "\n\tDROP CONSTRAINT IF EXISTS {$constraint};";
                     $string .= "\n\nALTER TABLE {$schema}.{$tabela}";
                     $string .= "\n\tADD CONSTRAINT {$constraint} {$restricoes};";
                 }
             }
         }
     }
     return $stringResult . $string;
 }
예제 #21
0
파일: ADODB.php 프로젝트: shupp/Framework
 /**
  * Create a singleton of ADODB or ADODBLite;  This driver works for 
  * both.  Just specify the correct directory in 
  * config->db->options->adodbDir.
  * The directory in which adodbDir resides in must be in your
  * include_path.
  *
  * @access public
  * @throws Framework_DB_Exception on failure
  * @return object                 Instance of ADODB[Lite] connected to the DB
  */
 public function singleton()
 {
     if (!is_null(parent::$db) && parent::$db instanceof ADOConnection) {
         return parent::$db;
     }
     // Manually include files, ADODB does not follow naming conventions
     if (empty($this->options->adodbDir)) {
         throw new Framework_DB_Exception('Error: you must set $config->db->options->adodbDir');
     }
     $path = (string) $this->options->adodbDir . DIRECTORY_SEPARATOR;
     if (!(include_once $path . 'adodb-exceptions.inc.php') || !(include_once $path . 'adodb.inc.php')) {
         throw new Framework_DB_Exception('Error: could not include ADODB files');
     }
     // Connect
     try {
         parent::$db = ADONewConnection($this->dsn);
     } catch (Exception $error) {
         throw new Framework_DB_Exception($error->getMessage(), $error->getCode());
     }
     // Fetch Modes
     $fetchModes = array('ADODB_FETCH_DEFAULT' => ADODB_FETCH_DEFAULT, 'ADODB_FETCH_NUM' => ADODB_FETCH_NUM, 'ADODB_FETCH_ASSOC' => ADODB_FETCH_ASSOC, 'ADODB_FETCH_BOTH' => ADODB_FETCH_BOTH);
     $fetchMode = ADODB_FETCH_ASSOC;
     if (isset($this->options->fetchMode) && isset($fetchModes[(string) $this->options->fetchMode])) {
         $fetchMode = $fetchModes[(string) $this->options->fetchMode];
     }
     parent::$db->SetFetchMode($fetchMode);
     return parent::$db;
 }
예제 #22
0
 public static function singleton()
 {
     if (is_null(self::$instance)) {
         parent::$instance = new Session();
     }
     return parent::$instance;
 }
예제 #23
0
파일: Router.php 프로젝트: kirsantov/keyzen
 public function get()
 {
     $path = str_replace(array('%2F', '%26', '%23', '//', '%28', '%29'), array('/', '%2526', '%2523', '/%252F', '(', ')'), rawurlencode($_GET['path']));
     if (substr($path, -1) == '/') {
         $path = substr($path, 0, -1);
     }
     foreach (self::$routes as $base_template => $routes) {
         foreach ($routes as $pattern) {
             $prefix = strpos('@', $pattern['re']) !== FALSE ? '/' : '@';
             $p = sprintf('%s%s%s', $prefix, $pattern['re'], $prefix);
             $match = preg_match($p, $path, $matches, PREG_OFFSET_CAPTURE);
             if ($match) {
                 $view = explode('/', $pattern['view']);
                 // Если после слеша не указан метод, запускаем метод default
                 if (!isset($view[1])) {
                     $view[1] = 'default';
                 }
                 array_shift($matches);
                 foreach ($matches as $item) {
                     $params[] = $item[0];
                 }
                 parent::$template = $base_template;
                 return array('class' => $view[0], 'method' => $view[1], 'params' => $params);
             }
         }
     }
     return false;
 }
예제 #24
0
 /**
  * Construtor.
  *
  * O primeiro <i>param</i> define o tipo de banco de dados que sera utilizado (pgsql, mysql, sqlite, etc), o segundo
  * define a entidade (valueObject ou namespace para o mesmo) no qual sera obtido as informacoes necessarias para
  * montar a consulta (nome da entidade, apelido - se houver - e a relacao de colunas que poderao ser utilizadas.
  *
  * @see vide Query::factory
  * @param string $driver
  * @param Entity $entity
  * */
 private function __construct($driver, Entity $entity = NULL)
 {
     parent::$_useQuotes = TRUE;
     $namespace = __NAMESPACE__ . self::NAMESPACE_SEPARATOR . $driver . self::NAMESPACE_SEPARATOR . 'Select';
     $this->_select = $namespace::factory($entity);
     $this->_entity = $entity;
 }
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_BANNED_VISITORS);
     if (!defined('MAX_BAD_URL_BEFORE_BANNED')) {
         define("MAX_BAD_URL_BEFORE_BANNED", 4);
     }
     $this->array_wsp_banned_users = WspBannedVisitors::getBannedVisitors();
     $this->table_ban = new Table();
     $this->table_ban->setId("table_ban")->activateAdvanceTable()->activatePagination()->activateSort(2, "desc")->setWidth(500);
     $this->table_ban->addRowColumns("IP", __(LAST_ACCESS), __(DURATION), __(AUTHORIZE))->setHeaderClass(0);
     $ban_vistors_obj = new Object("<br/><br/>", $this->table_ban, "<br/><br/>");
     $ban_ip_table = new Table();
     $form = new Form($this);
     $this->ip_edt = new TextBox($form);
     $validation = new LiveValidation();
     $validation->addValidatePresence();
     $this->ip_edt->setLiveValidation($validation);
     $this->duration_edt = new TextBox($form);
     $this->duration_edt->setValue(0);
     $validation = new LiveValidation();
     $validation->addValidatePresence()->addValidateNumericality(true);
     $this->duration_edt->setLiveValidation($validation);
     $ip_btn = new Button($form);
     $ip_btn->setValue(__(BAN_IP))->onClick("onBannedIP")->setAjaxEvent();
     $ban_ip_table->addRowColumns("IP : ", $this->ip_edt);
     $ban_ip_table->addRowColumns(__(DURATION) . " : ", $this->duration_edt);
     $form->setContent(new Object($ban_ip_table, $ip_btn));
     $ban_vistors_obj->add($form, "<br/><br/>");
     $this->render = new AdminTemplateForm($this, $ban_vistors_obj);
 }
예제 #26
0
 /**
  * render a .tpl
  */
 public function render($tpl, $parames = array())
 {
     parent::$compile_dir = SlightPHP::$appDir . DIRECTORY_SEPARATOR . "templates_c";
     parent::$template_dir = SlightPHP::$appDir . DIRECTORY_SEPARATOR . "templates";
     parent::assign($parames);
     return parent::fetch("{$tpl}");
 }
예제 #27
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(ERROR_USER_BANNED) . " - " . __(SITE_NAME);
     parent::$PAGE_META_ROBOTS = "noindex, nofollow";
     $can_use_captacha = true;
     if (WspBannedVisitors::isBannedIp($this->getRemoteIP())) {
         $last_access = new DateTime(WspBannedVisitors::getBannedIpLastAccess($this->getRemoteIP()));
         $duration = WspBannedVisitors::getBannedIpDuration($this->getRemoteIP());
         $dte_ban = $last_access->modify("+" . $duration . " seconds");
         if ($dte_ban > new DateTime()) {
             $can_use_captacha = false;
         }
     }
     $obj_error_msg = new Object(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "<br/><br/>");
     $obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_1), true), "<br/>");
     if ($can_use_captacha) {
         $obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_2), true), "<br/><br/>");
         $this->captcha_error_obj = new Object();
         $form = new Form($this);
         $this->captcha = new Captcha($form);
         $this->captcha->setFocus();
         $unblock_btn = new Button($form);
         $unblock_btn->setValue(__(ERROR_USER_BUTTON))->onClick("onClickUnblock");
         $form->setContent(new Object($this->captcha, "<br/>", $unblock_btn));
         $obj_error_msg->add($this->captcha_error_obj, "<br/>", $form);
     }
     $obj_error_msg->add("<br/><br/>", __(MAIN_PAGE_GO_BACK), new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
     $this->render = new ErrorTemplate($obj_error_msg, __(ERROR_USER_BANNED));
 }
 /**
  * Add extra headers to wp_get_themes()
  *
  * @param $extra_headers
  * @return array
  */
 public static function add_theme_headers($extra_headers)
 {
     $ghu_extra_headers = array('Bitbucket Theme URI', 'Bitbucket Branch');
     parent::$extra_headers = array_unique(array_merge(parent::$extra_headers, $ghu_extra_headers));
     $extra_headers = array_merge((array) $extra_headers, (array) $ghu_extra_headers);
     return $extra_headers;
 }
예제 #29
0
 /**
  * Add extra headers to wp_get_themes()
  *
  * @param $extra_headers
  * @return array
  */
 public static function add_theme_headers($extra_headers)
 {
     $ghu_extra_headers = array('GitHub Theme URI', 'GitHub Branch', 'GitHub Access Token');
     parent::$extra_headers = array_unique(array_merge(parent::$extra_headers, $ghu_extra_headers));
     $extra_headers = array_merge((array) $extra_headers, (array) $ghu_extra_headers);
     return $extra_headers;
 }
예제 #30
0
 /**
  * 获取真实姓名
  * @method getName
  * @param  [type]  $number [description]
  * @param  [type]  $pwd    [description]
  * @param  [type]  $code   [description]
  * @return [type]          [description]
  */
 public static function getName($number, $pwd, $code = null)
 {
     if (!$code) {
         return 0;
     }
     $data['zjh'] = $number;
     $data['mm'] = $pwd;
     $data['v_yzm'] = $code;
     if ($cookie = Cookie::get('verify_cookie')) {
         Cookie::del('verify_cookie', null, $_SERVER['HTTP_HOST']);
     } else {
         if (\Input::I('verify_cookie', $cookie, 'trim')) {
             $cookie = @base64_decode($cookie);
         }
     }
     parent::$_cookie = $cookie;
     $result = parent::getHtml(self::LOGIN_URL, $data, 'gb2312');
     if (strpos($result, self::SUCCESS_MSG) > 0) {
         $result = parent::getHtml(self::INFO_URL, null, 'GBK');
         if ($result) {
             $name = parent::parseName($result, "当前用户:{$number}(", ')');
             return trim($name);
         }
     }
     return false;
 }