function data($data)
 {
     if (!empty($data)) {
         $dataF = new data($data);
         return $dataF->dataBrasileira($dataF->tratarDataZend($data, "americano"));
     }
 }
Ejemplo n.º 2
0
 function company()
 {
     if (!isset($_GET['id']) or $_GET['id'] == 1) {
         $this->error('没有该企业的信息');
     }
     $uid = intval($_GET['id']);
     //企业ID
     $db = M('company_info');
     $company = $db->where('uid=' . $uid)->find();
     if (!$company) {
         $this->error('没有该企业的信息');
     }
     $cond = array('uid' => $uid, 'expiration_time>' . time(), 'verify=1', 'state=1');
     $recruits = $db->table('recruit')->where($cond)->field('recruit_id,start_time,recruit_name')->findall();
     $data = new data('recruit');
     $company = $data->convert($company);
     $this->assign('company', $company);
     $this->assign('recruits', $recruits);
     if (empty($company['tpl_style'])) {
         $company['tpl_style'] = 'skyblue';
         //默认风格
     }
     if (!empty($_GET['style']) && $uid == $_SESSION['uid']) {
         //企业预览模板
         $company['tpl_style'] = $_GET['style'];
     }
     $this->display(PATH_ROOT . '/templates/company_tpl/' . $company['tpl_style'] . '/index');
 }
Ejemplo n.º 3
0
 /**
  * Create new Scaffold instance
  *
  * @param Array $data
  */
 public function __construct($data)
 {
     $this->data = new DataSystem($data);
     $this->names = new NamesGenerate($data);
     $this->paths = new Paths($this->names);
     $this->generator = new Generator($this->data->dataScaffold('view'), $this->data->dataScaffold('migration'), $this->names, $this->paths);
 }
Ejemplo n.º 4
0
 public function outputHowTo($i_howtoID)
 {
     $objThis_M = new data();
     $s_sql = "select\r\n\t\t\t    D.howtoName,\r\n\t\t\t    C.chapterID, \r\n\t\t\t    C.chapterName, \r\n\t\t\t    C.displayOrder,\r\n\t\t\t    H.headingID,\r\n\t\t\t    H.displayOrder,\r\n\t\t\t    H.headingName,\r\n\t\t\t    T.contentID,\r\n\t\t\t    T.contentTitle,\r\n\t\t\t    T.displayOrder,\r\n\t\t\t    T.howtoContent\r\n\t\t\tfrom cms.dyn_howto_document D\r\n\t\t\tinner join cms.dyn_howto_content T\r\n\t\t\t    on D.howtoID = T.howtoID\r\n\t\t\tleft join cms.cfg_howto_headings H\r\n\t\t\t    on T.headingID = H.headingID \r\n\t\t\tinner join cms.cfg_howto_chapters C\r\n\t\t\t    on T.chapterID = C.chapterID \r\n\t\t\twhere D.howtoID = {$i_howtoID} \r\n\t\t\torder by\r\n\t\t\t    C.displayOrder,\r\n\t\t\t    H.displayOrder,\r\n\t\t\t    T.displayOrder,\r\n\t\t\t    T.howtoContent;";
     $q_getData = $objThis_M->runSQL($s_sql);
     $objThis_V = new view();
     $s_main = $objThis_V->outputHowTo($q_getData);
     return $s_main;
 }
Ejemplo n.º 5
0
 function dataDropdown($name, $id, $currentValue, $sql)
 {
     include "test_lib_m.php";
     $objThis_S = new data();
     $q_data = $objThis_S->getData($sql = $sql);
     include "test_lib_v.php";
     $objThis_V = new display();
     $tmpX = $objThis_V->showBox($name = $name, $id = $id, $q_query = $q_data, $currentValue = $currentValue);
     return $tmpX;
 }
Ejemplo n.º 6
0
function insert()
{
    if (isset($_POST)) {
        foreach ($_POST as $index => $valeur) {
            $donnees[$index] = $valeur;
        }
    }
    $data = new data();
    $data->insert($donnees);
}
Ejemplo n.º 7
0
function update()
{
    if (array_key_exists("id", $_POST)) {
        foreach ($_POST as $index => $valeur) {
            $donnees[$index] = $valeur;
        }
    }
    $data = new data();
    $data->update($donnees);
}
Ejemplo n.º 8
0
 public function __construct($name, $param = array())
 {
     parent::__construct($name, $param);
     if (!file_exists(PATH_ROOT . '/' . DIR_CACHE . '/captcha')) {
         mkdir(PATH_ROOT . '/' . DIR_CACHE . '/captcha');
         chmod(PATH_ROOT . '/' . DIR_CACHE . '/captcha', 0777);
     }
     $opt = new data(array('font' => PATH_ROOT . '/' . DIR_LIBRARY . '/font/arial.ttf', 'imgDir' => PATH_ROOT . '/' . DIR_CACHE . '/captcha', 'imgUrl' => '/' . DIR_CACHE . '/captcha', 'wordlen' => 4, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'fsize' => 20, 'width' => 100, 'height' => 60));
     if (isset($param['captcha'])) {
         $opt->set($param['captcha']);
     }
     $this->captcha = new Zend\Captcha\Image($opt->to_array());
     $this->validator['captcha'] = array('captcha' => $this->captcha);
 }
Ejemplo n.º 9
0
 protected function form($user = null)
 {
     $mode = $user ? 'edit' : 'add';
     $fields = data::read(panel()->roots()->forms() . DS . 'user.' . $mode . '.php', 'yaml');
     $content = $user ? $user->data() : array();
     // add all languages
     $fields['language']['options'] = array();
     $fields['language']['default'] = kirby()->option('panel.language', 'en');
     foreach (panel()->languages() as $code => $lang) {
         $fields['language']['options'][$code] = $lang->title();
     }
     // add all roles
     $fields['role']['options'] = array();
     $fields['role']['default'] = site()->roles()->findDefault()->id();
     foreach (site()->roles() as $role) {
         $fields['role']['options'][$role->id()] = $role->name();
     }
     // make the role selector readonly when the user is not an admin
     if (!site()->user()->isAdmin()) {
         $fields['role']['readonly'] = true;
     }
     // make sure the password is never shown in the form
     unset($content['password']);
     return new Form($fields, $content);
 }
Ejemplo n.º 10
0
 public function info()
 {
     if (!is_null($this->info)) {
         return $this->info;
     }
     return $this->info = new Obj(data::read($this->root . DS . 'package.json'));
 }
Ejemplo n.º 11
0
 /**
  * Método para verificar o status da diligencia
  * @access public
  * @param integer $idPronac
  * @return string
  */
 public function statusDiligencia($idPronac = null, $idProduto = null)
 {
     if (isset($idPronac) && !empty($idPronac)) {
         $where['idPronac = ?'] = $idPronac;
     }
     if (isset($idProduto) && !empty($idProduto)) {
         $where['idProduto = ?'] = $idProduto;
     }
     $diligencias = array();
     $Diligencia = new Diligencia();
     $buscar = $Diligencia->buscar($where);
     foreach ($buscar as $d) {
         if ($d[0]->DtSolicitacao && $d[0]->DtResposta == NULL) {
             $diligencias['img'] = "notice.png";
             $diligencias['msg'] = "Diligenciado";
         } else {
             if ($d[0]->DtSolicitacao && $d[0]->DtResposta != NULL) {
                 $diligencias['img'] = "notice3.png";
                 $diligencias['msg'] = "Diligencia respondida";
             } else {
                 if ($d[0]->DtSolicitacao && round(data::CompararDatas($d[0]->DtDistribuicao)) > $d[0]->tempoFimDiligencia) {
                     $diligencias['img'] = "notice2.png";
                     $diligencias['msg'] = "Diligencia não respondida";
                 } else {
                     $diligencias['img'] = "notice1.png";
                     $diligencias['msg'] = "A Diligenciar";
                 }
             }
         }
     }
     return 'Não terminei';
 }
Ejemplo n.º 12
0
Archivo: fac.php Proyecto: envylv/home
 public function makeHtml($id, $path)
 {
     self::filter($path);
     $array = data::getData($path);
     $html = '';
     $total = '';
     foreach ($array as $k => $v) {
         if ($k) {
             $t = $id ? $id . '_' . $k : $k;
             $name = $v[0] !== '-' ? '<a href="javascript:;" id="a_' . $t . '" path="' . $path . '">' . $v[1] . '</a>' : $v[1];
             if ($id) {
                 $blank = "";
                 $b_count = count(explode("_", $id));
                 for ($i = 1; $i < $b_count; $i++) {
                     $blank .= "&nbsp;&nbsp;";
                 }
                 $name = $blank . $name;
             }
             $name = $id ? "&nbsp;&nbsp;" . $name : $name;
             $html .= "<div id='d_" . $t . "'>\n\t<span class='content' style='width:30px;text-align: center'><input type='checkbox' id='c_" . $t . "'/></span>\n\t<span class='content' style='width:680px;padding-left: 20px'>" . $name . "</span>\n\t<span class='content' style='width:150px'>" . $v[2] . "</span>\n\t<span class='content' style='width:80px;text-align: right'>" . $v[3] . "</span>\n</div>";
         } else {
             $total_t = $id ? $id . "_total" : "total";
             $total = "<div id='d_" . $total_t . "'>\n\t<span class='content' style='width:30px;text-align: center'></span>\n\t<span class='content' style='width:680px;padding-left: 20px'></span>\n\t<span class='content' style='width:150px'></span>\n\t<span class='content' style='width:80px;text-align: right'>总计:" . $v . "</span>\n</div>";
         }
     }
     return $html . $total;
 }
Ejemplo n.º 13
0
 public function tearDown()
 {
     $this->noPhpWebserver();
     $this->noSelenium();
     $this->module->_after($this->makeTest());
     data::clean();
 }
Ejemplo n.º 14
0
function init()
{
    $data = new data();
    $donnees = $data->getIndexData();
    foreach ($donnees->fetchAll(PDO::FETCH_ASSOC) as $key => $value) {
        foreach ($value as $key2 => $value2) {
            if ($key2 == "reponse") {
                $value[$key2] = $data->getStatus($value2);
            }
        }
        $list[$key] = $value;
    }
    $smarty = new Smarty();
    $smarty->assign(array('list' => $list, 'tpl_name' => "index"));
    $smarty->display('base.tpl');
}
Ejemplo n.º 15
0
 public function load($name)
 {
     // make sure there's no path included in the name
     $name = basename(strtolower($name));
     if (isset(static::$cache[$name])) {
         $this->file = static::$cache[$name]['file'];
         $this->name = static::$cache[$name]['name'];
         $this->yaml = static::$cache[$name]['yaml'];
         return true;
     }
     // find the matching blueprint file
     $file = kirby()->get('blueprint', $name);
     if ($file) {
         $this->file = $file;
         $this->name = $name;
         $this->yaml = data::read($this->file, 'yaml');
         // remove the broken first line
         unset($this->yaml[0]);
         static::$cache[$name] = array('file' => $this->file, 'name' => $this->name, 'yaml' => $this->yaml);
         return true;
     } else {
         if ($name == 'default') {
             throw new Exception(l('blueprints.error.default.missing'));
         } else {
             return $this->load('default');
         }
     }
 }
Ejemplo n.º 16
0
 public function update($id, array $values_array)
 {
     if (isset($values_array['password'])) {
         $values_array['password'] = md5(data::escapeString($values_array['clave']));
     }
     return parent::update($id, $values_array);
 }
Ejemplo n.º 17
0
 public function delete()
 {
     if (file_exists(self::$example_file)) {
         unlink(self::$example_file);
     }
     return data::success(array('file' => false));
 }
Ejemplo n.º 18
0
 public static function write($file, $data, $type = null)
 {
     // type autodetection
     if (is_null($type)) {
         $type = f::extension($file);
     }
     return f::write($file, data::encode($data, $type));
 }
Ejemplo n.º 19
0
 public function send()
 {
     if ($this->entry !== API_PASSWORD) {
         $status = array('status' => 400, 'result' => 'Missing the required field to use the service');
         print_r(json_encode($status));
         exit;
     }
     // Mailer only accepts POST requests
     if (strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
         define('ACCESS', true);
         //access to other classes
         $form_data = filter_input_array(INPUT_POST, FILTER_UNSAFE_RAW);
         //check if incoming params are correct
         require_once '../helpers/Data.php';
         $email_data_fields = new data($form_data);
         $required_params = $email_data_fields->cleaner();
         if (isset($required_params->error['error'])) {
             $status = array('status' => 400, 'result' => 'Missing required fields (from, from_email, to, to_email, subject, text)');
             print_r(json_encode($status));
         } else {
             //try mailgun
             try {
                 $result = $this->call_mailgun($email_data_fields);
             } catch (Exception $ex) {
             }
             //failed, try mandrill
             if (isset($result['error']) || $ex) {
                 $man_result = $this->call_mandrill($email_data_fields);
                 //failed, both methods failed
                 if (isset($man_result['error'])) {
                     $status = array('status' => 400, 'result' => array("mailgun and mandrill failed" => array('mailgun' => $result, 'mandrill' => $man_result)));
                     print_r(json_encode($status));
                 } else {
                     //worked
                     print_r(json_encode($man_result));
                 }
             } else {
                 print_r(json_encode($result));
             }
         }
     } else {
         $status = array('status' => 405, 'result' => "Wrong HTTP method(" . $_SERVER['REQUEST_METHOD'] . ")");
         print_r(json_encode($status));
         exit;
     }
 }
Ejemplo n.º 20
0
 public function testAjax()
 {
     $this->module->sendAjaxGetRequest('/info');
     $this->assertNotNull(data::get('ajax'));
     $this->module->sendAjaxPostRequest('/form/complex', array('show' => 'author'));
     $this->assertNotNull(data::get('ajax'));
     $post = data::get('form');
     $this->assertEquals('author', $post['show']);
 }
Ejemplo n.º 21
0
function init()
{
    $id = $_GET['id'];
    $data = new data();
    $list = $data->getDataById($id);
    $list = $list->fetchAll(PDO::FETCH_ASSOC);
    if (is_array($list)) {
        $list = current($list);
    }
    foreach ($list as $key => $value) {
        if ($key == "reponse") {
            $list[$key] = $data->getStatus($value);
        }
    }
    $smarty = new Smarty();
    $smarty->assign(array('list' => $list, 'tpl_name' => "details"));
    $smarty->display('base.tpl');
}
Ejemplo n.º 22
0
 public static function isGoodCaptcha($recaptchaResponse)
 {
     $r = \data::curlPost(\ipinga\options::get('recaptcha_siteverify_url'), array(), array('secret' => \ipinga\options::get('recaptcha_secret_key'), 'response' => $recaptchaResponse, 'remoteip' => $_SERVER['REMOTE_ADDR']));
     \ipinga\log::info('reCaptcha $recaptchaResponse == ' . $recaptchaResponse);
     \ipinga\log::info('reCaptcha remoteip == ' . $_SERVER['REMOTE_ADDR']);
     \ipinga\log::info('reCaptcha siteverify response == ' . var_export($r, true));
     \ipinga\log::notice('reCaptcha ' . ($r['success'] ? ' Success!' : ' Failure'));
     return $r['success'];
 }
Ejemplo n.º 23
0
 function save()
 {
     if (!$this->id) {
         $this->id = uniqid();
     }
     data::set($this->id, $this->data);
     $this->saved = true;
     return true;
 }
 function Buildings()
 {
     data::initialize();
     $this->planet_id = current_planet();
     $this->building_id = isset($_REQUEST['building_id']) ? (int) $_REQUEST['building_id'] : NULL;
     permissions_check(PERMISSION_PLANET, $this->planet_id, array('build', 'commission'));
     $this->data->updater->update(0, $this->planet_id);
     $this->quiet = false;
 }
Ejemplo n.º 25
0
 /**
  * Retrieves hash on an object descriptor and its related secret information.
  *
  * @param string $object some public object hash is to be used for (e.g. a user's name)
  * @param string $secret some internal-only information related to that object (e.g. the user's internal ID or similar)
  * @return string
  * @throws \InvalidArgumentException on missing/invalid object or secret
  */
 public static function get($object, $secret)
 {
     $object = trim(data::asString($object));
     $secret = trim(data::asString($secret));
     if ($object === '' || $secret === '') {
         throw new \InvalidArgumentException('missing/invalid hashing data');
     }
     return static::_get($object, $secret, time());
 }
Ejemplo n.º 26
0
 public static function createFromTable($tableName)
 {
     $cmp = data::createComponentFromTable($tableName);
     if ($cmp !== false) {
         self::$cmp[$tableName] = $cmp;
     } else {
         return false;
     }
 }
Ejemplo n.º 27
0
 function POST()
 {
     data::set('form', $_POST);
     data::set('files', $_FILES);
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
         data::set('ajax', 'post');
     }
     $notice = 'Thank you!';
     include __DIR__ . '/view/index.php';
 }
Ejemplo n.º 28
0
 protected function tableInfo($tableName, $buffered = false)
 {
     if ($buffered !== true and array_key_exists($tableName, $this->tableInfo) or !array_key_exists($tableName, $this->tableInfo)) {
         $result = data::query("PRAGMA table_info('" . $tableName . "')");
         $sqliteDriver = $this;
         data::forEachRow($result, function ($r) use($sqliteDriver, $tableName) {
             $sqliteDriver->tableInfo[$tableName][$r->name] = $r;
         });
     }
 }
Ejemplo n.º 29
0
 public function delete($args)
 {
     $users_id = get($args, 'users_id');
     if ($users_id) {
         if ($user = DBTable::get('users')->loadRow($users_id)) {
             DBTable::deleteRow($user);
             return data::success($user->export());
         }
         return data::error('invalid user id');
     }
     return data::error('user id required');
 }
Ejemplo n.º 30
0
 public static function driver($driverName = 'mysql')
 {
     $driverName = strtolower($driverName);
     $driverFile = dirname(__DIR__) . '/drivers/' . $driverName . '.php';
     if (is_file($driverFile)) {
         require_once $driverFile;
         $driverClass = $driverName . 'Driver';
         self::$driver = new $driverClass();
     } else {
         die('Error: No such Driver: ' . $driverName);
     }
 }