Example #1
0
 }
 unset($dns_records);
 */
 $folder_ids = array();
 /* web_folder creation*/
 $protected_dirs = $exdb->queryAllRecords("SELECT `id`, `non_ssl`, `ssl`, `cgi_bin`, `realm`, `path`, `dom_id` FROM protected_dirs");
 foreach ($protected_dirs as $entry) {
     if ($entry['path'] == 'plesk-stat') {
         continue;
     }
     $params = array('server_id' => $server_id, 'parent_domain_id' => $domain_ids[$entry['dom_id']], 'path' => $entry['path'], 'active' => 'y');
     $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
     $folder_id = 0;
     $check = $app->db->queryOneRecord('SELECT * FROM `web_folder` WHERE `parent_domain_id` = \'' . $domain_ids[$entry['dom_id']] . '\' AND `path` = \'' . $app->db->quote($entry['path']) . '\'');
     if ($check) {
         $ok = $importer->sites_web_folder_update($session_id, $client_id, $check['web_folder_id'], array_merge($check, $params));
         if ($ok === false) {
             $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
         }
         $folder_id = $check['web_folder_id'];
         $msg .= 'Updated HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
     } else {
         $folder_id = $importer->sites_web_folder_add($session_id, $client_id, $params);
         $msg .= 'Created HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
         if (!$folder_id) {
             $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
         }
     }
     $folder_ids[$entry['id']] = $folder_id;
 }
 $pd_users = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.pd_id, a.password, d.dom_id FROM pd_users as u INNER JOIN protected_dirs as d ON (d.id = u.pd_id) INNER JOIN accounts as a ON (a.id = u.account_id)");