private static function import_infos($infos_)
 {
     $r = json_unserialize($infos_);
     if ($r == 0) {
         return array();
     }
     return $r;
 }
예제 #2
0
파일: sql.php 프로젝트: bloveing/openulteo
 public function generateObjectFromRow($row)
 {
     $conf = new Application_webapp_configuration($row['id'], $row['application_id'], $row['url_prefix'], $row['raw_configuration'], json_unserialize($row['values']));
     unset($row['id']);
     unset($row['application_id']);
     unset($row['url_prefix']);
     unset($row['raw_configuration']);
     unset($row['values']);
     foreach ($row as $key => $value) {
         $conf->setAttribute($key, $value);
     }
     return $conf;
 }
 public static function loadByUserLogin($login_, $key_, $container_)
 {
     $ret = array();
     $sql = SQL::getInstance();
     $res = $sql->DoQuery('SELECT @1,@2,@3,@4,@5 FROM #6 WHERE @1 = %7 AND @2 = %8 AND @3 = %9', 'login', 'key', 'container', 'element_id', 'value', self::$table, $login_, $key_, $container_);
     if ($res !== true) {
         Logger::error('main', "Abstract_User_Preferences::loadByUserLogin({$login_},{$key_},{$container_}) sql request failed");
     } else {
         $rows = $sql->FetchAllResults();
         foreach ($rows as $row) {
             $ret[$row['element_id']] = new UserGroup_Preferences($row['login'], $row['key'], $row['container'], $row['element_id'], json_unserialize($row['value']));
         }
     }
     return $ret;
 }
 public static function load_all($key_, $container_)
 {
     $ret = array();
     $sql = SQL::getInstance();
     $res = $sql->DoQuery('SELECT @1,@2,@3,@4,@5 FROM @6 WHERE @2 = %7 AND @3 = %8', 'group_id', 'key', 'container', 'element_id', 'value', $sql->prefix . self::$table, $key_, $container_);
     if ($res !== true) {
         Logger::error('main', "Abstract_UserGroup_PreferencesloadByUserGroupId({$group_id_},{$key_},{$container_}) sql request failed");
     } else {
         $rows = $sql->FetchAllResults();
         foreach ($rows as $row) {
             array_push($ret, new UserGroup_Preferences($row['group_id'], $row['key'], $row['container'], $row['element_id'], json_unserialize($row['value'])));
         }
     }
     return $ret;
 }
예제 #5
0
파일: api.php 프로젝트: Jarievilo/indexu7
}

include '../global.php';
include 'json.php';

// turn on/off debug mode
$lep->db->debug=true;

///////////////////////////////////////////////////////////////////

$raw_data = $_POST['data']; 

// use stripslashes if json_unserialize return no value
// $raw_data = stripslashes($raw_data);

$data = json_unserialize($raw_data);

// debug data value
// print_r($raw_data);
// print_r($data);

switch ($_POST['act']) {

  // +++++ Add listing +++++
  case 'res_add':
    if (is_array($data)) {
      foreach ($data as $k => $v) {
        $record = $v;

        $no_id = false;
예제 #6
0
 protected function getConfFileContents()
 {
     if (!is_readable($this->conf_file)) {
         return array();
     }
     $ret = json_unserialize(@file_get_contents($this->conf_file, LOCK_EX));
     if ($ret === false) {
         return array();
     }
     return $ret;
 }
예제 #7
0
 private static function generateFromRow($row_)
 {
     foreach ($row_ as $k => $v) {
         ${$k} = $v;
     }
     switch ($type) {
         case 'install':
             $buf = new Task_install((string) $id, (string) $server, array_map("Application::fromArray", json_unserialize($applications)));
             break;
         case 'install_from_line':
             $buf = new Task_install_from_line((string) $id, (string) $server, (string) $applications_line);
             break;
         case 'upgrade':
             $buf = new Task_upgrade((string) $id, (string) $server);
             break;
         case 'remove':
             $buf = new Task_remove((string) $id, (string) $server, json_unserialize($applications));
             break;
         case 'available':
             $buf = new Task_available_applications((string) $id, (string) $server);
             break;
     }
     $buf->type = (string) $type;
     $buf->job_id = (string) $job_id;
     $buf->server = (string) $server;
     $buf->status = (string) $status;
     $buf->t_begin = (int) $t_begin;
     $buf->t_end = (int) $t_end;
     $buf->applications_line = (string) $applications_line;
     $apps = json_unserialize($applications);
     if (!is_array($apps)) {
         $apps = array();
     }
     $buf->applications = array_map("Application::fromArray", $apps);
     return $buf;
 }
예제 #8
0
 private static function generateFromRow($row_)
 {
     foreach ($row_ as $k => $v) {
         ${$k} = $v;
     }
     $buf = new Session((string) $id);
     $buf->client_id = (string) $client_id;
     $buf->need_creation = (bool) $need_creation;
     $buf->server = (string) $server;
     $buf->mode = (string) $mode;
     $buf->type = (string) $type;
     $buf->status = (string) $status;
     $buf->settings = json_unserialize($settings);
     $buf->user_login = (string) $user_login;
     $buf->user_displayname = (string) $user_displayname;
     $buf->servers = json_unserialize($servers);
     $data = json_unserialize($applications);
     if (array_key_exists('applications', $data)) {
         $buf->setPublishedApplications(array_map("Application::fromArray", $data['applications']));
     }
     if (array_key_exists('running_applications', $data)) {
         $buf->setRunningApplications(array_map("Application::fromArray", $data['running_applications']));
     }
     if (array_key_exists('closed_applications', $data)) {
         $buf->setClosedApplications(array_map("Application::fromArray", $data['closed_applications']));
     }
     $buf->start_time = (string) $start_time;
     $buf->timestamp = (int) $timestamp;
     return $buf;
 }
예제 #9
0
 private static function loadProperties($server_)
 {
     Logger::debug('main', 'Starting Abstract_Server::loadProperties for \'' . $server_->fqdn . '\'');
     $SQL = SQL::getInstance();
     $SQL->DoQuery('SELECT @1,@2 FROM #3 WHERE @4 = %5', 'property', 'value', self::table_properties, 'server', $server_->id);
     $rows = $SQL->FetchAllResults();
     $properties = array();
     foreach ($rows as $row) {
         $properties[$row['property']] = json_unserialize($row['value']);
     }
     return $properties;
 }