function index() { // debug(func_get_args()); // debug($this->params['pass']); // debug($this->passedArgs); $this->FieldData->recursive = 0; $this->LoadModel('Company'); $company = $this->Company->find('list', array('fields' => array('nom_id', 'name'))); $company['0'] = ' '; $this->set(compact('company')); $this->set('htmlMotor', htmlMotor()); /** NOTE <build the process for group access conditions for the special group root > */ (int) ($group_id = $_SESSION['Auth']['User']['group_id']); if (!checkAdmin($group_id)) { $user_id = $_SESSION['Auth']['User']['id']; $this->paginate = array('conditions' => array('User.id' => $user_id)); } $userFieldDatas = $this->paginate('User'); foreach ($userFieldDatas as $indexFieldDatas => $fieldDatasContent) { $fieldDataUser[] = $fieldDatasContent['User']; foreach ($fieldDatasContent['FieldDatas'] as $indexFieldDatasContent => $contentFieldDatasContent) { $conditionsFieldData['FieldData.id'][] = $contentFieldDatasContent['id']; $dataUserFieldData[$fieldDatasContent['User']['id']][] = $contentFieldDatasContent['id']; } } $fieldData = $this->FieldData->find('all', array('conditions' => $conditionsFieldData)); /** NOTE <set the index array as field.id>*/ $resultFieldData = Set::combine($fieldData, '{n}.FieldData.id', '{n}'); // debug($resultFieldData); /** NOTE <set the var for the encrypted filemanager>*/ $file_dir = WWW_ROOT . 'files' . DS . 'users' . DS; $data = array('1' => 'value', '2' => Configure::read('Security.salt'), '3' => $this->Session->id(), 'dir_path' => base64_encode($file_dir), '_ip' => $this->Auth->user('last_ip')); $Hash = GeraHash(30); $decrypt = base64_encode(serialize($data)); $password = '******' . substr($Hash, 3, 12) . '#'; $salt = Configure::read('Security.salt'); $encrypt_encode = base64_encode(dEncrypt($decrypt, $password, $salt, 'encrypt')); $app = 'filemanager'; $path = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}/{$app}/filemanager.php?{$Hash}={$encrypt_encode}"; $this->set(compact('resultFieldData', 'fieldDataUser', 'dataUserFieldData', 'data', 'Hash', 'decrypt', 'password', 'salt', 'encrypt_encode', 'app', 'path')); $this->set('fieldConfig', $this->fieldConfig()); }
// $candidate->accounts()->detach(); // // return $candidate->accounts; // return Candidate::with('accounts')->find($candidate->id); }); Route::get('/test2', function () { function GeraHash($qx) { //Under the string $Caracteres you write all the characters you want to be used to randomly generate the code. $Caracteres = 'ABCDEFGHIJKLMPQRSTUVXWYZ123456789'; $QuantidadeCaracteres = strlen($Caracteres); $QuantidadeCaracteres--; $Hash = NULL; for ($x = 1; $x <= $qx; $x++) { $Posicao = rand(0, $QuantidadeCaracteres); $Hash .= substr($Caracteres, $Posicao, 1); } return $Hash; } echo GeraHash(3); }); Route::delete('/api/todos/clean', 'TodoController@clean'); Route::resource('/api/todos', 'TodoController'); // Route::controller('/api/todos', 'TodoController'); Route::resource('/api/users', 'UserController'); Route::delete('/api/users/clean', 'UserController@clean'); Route::resource('/api/votes', 'VoteController'); Route::delete('/api/votes/clean', 'VoteController@clean'); Route::delete('/api/accounts/clean', 'AccountController@clean'); Route::resource('votes', 'VoteController'); Route::resource('candidates', 'CandidateController'); Route::resource('accounts', 'AccountController');
$Hash .= substr($Caracteres, $Posicao, 1); } return $Hash; } function getName($path, $suffix) { $results = array(); $handler = opendir($path); while ($file = readdir($handler)) { if (strstr($file, $suffix)) { return $file; } } return "NAN"; } $rand_directory = GeraHash(8); #if(!isset($_FILES['modified']) || !isset($_FILES['original']) || !isset($_FILES['stage1']) || !isset($_FILES['stage2'])) die('Files not uploaded'); #if(!isset($_POST['directory'])) die('Directory not specified'); if (!mkdir('../files/' . $rand_directory)) { die('Unable to create directory'); } if (!mkdir('../files/' . $rand_directory . "/cnt")) { die('Unable to create directory'); } $cwd = getcwd(); chdir("/var/www/html/admin/2013-002-Word"); move_uploaded_file($_FILES['original']['tmp_name'], "/var/www/html/admin/2013-002-Word/original.docx"); move_uploaded_file($_FILES['scout']['tmp_name'], "/var/www/html/admin/2013-002-Word/agent.exe"); $urlbase = 'http://' . $_SERVER['SERVER_NAME'] . '/documents/' . $rand_directory . '/'; if (isset($_POST['DEMO']) && $_POST['DEMO'] == "y") { $scout_name = "demo.exe";
for ($x = 1; $x <= $qtd; $x++) { $Posicao = rand(0, $QuantidadeCaracteres); $Hash .= substr($Caracteres, $Posicao, 1); } return $Hash; } //DATABASE INFO $PARAM_hote = 'localhost'; $PARAM_nom_bd = 'vebuilde_2'; $PARAM_utilisateur = 'vebuilde_2'; $PARAM_mot_passe = 'nihaoma2014'; $table = "veCampaignBuilder"; // Table name 1 $sqlInsert = "INSERT INTO veCampaignBuilder (date, code, company, websiteUrl, contactEmail, ecommercePlatform, chatTemplate, contactTemplate, qqNumber, veContactEmail, sales, status)\n VALUES(:date, :code, :company, :websiteUrl, :contactEmail, :ecommercePlatform, :chatTemplate, :contactTemplate, :qqNumber, :veContactEmail, :sales, :status)"; /// UPLOAD INFO TO DATABASE ---------------------------------------------------- $code = GeraHash(12); $websiteUrl = $_POST['URL']; $contactEmail = $_POST['email']; $qqNumber = $_POST['qqNumber']; $company = $_POST['companyName']; $veContactEmail = $_POST['veContactEmail']; $sales = $_POST['sales']; $ecommercePlatform = $_POST['affiliate']; $chatTemplate = $_POST['chatTemplate']; $contactTemplate = $_POST['contactTemplate']; $terms = $_POST['terms']; if ($sales == "") { $sales = "None"; } $date = date('Y/m/d'); $status = 'Pending';