Example #1
0
function replace_files ($dir, $pos=2,$fileitem,$environment,$namearray) {
   $handle = @opendir($dir);
   while ( $file = @readdir($handle) ) {
      if ( preg_match("~^\.{1,2}$~u", $file) ) {
         continue;
      }

      if ( is_dir($dir.$file) ) {
         replace_files($dir.$file."/", $pos + 3,$fileitem,$environment,$namearray);
      } else {
         $extension = mb_strtolower(mb_substr(strrchr($dir.$file,"."),1), 'UTF-8');
         if ( is_file($dir.$file) and ( $extension == "htm"
                                        or $extension == "html"
                                        or $extension == "js"
                                        or $extension == "xml"
                                        or $extension == "xslt"
                                        or $extension == "xsd"
                                        #or $extension == "css"
                                      )
            ) {
            $replacement = replacement($environment,$fileitem,$dir,$file,$namearray);
            $open = fopen($dir.$file,'w');
            fputs($open,$replacement);
            fclose($open);
            update_progress_bar(count_for_process($namearray));
         }
      }
   }
   @closedir($handle);
}
Example #2
0
function changeWikis2 ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis2($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,'$COMMSY_ROOM_ID') and !mb_stristr($str,'session_name') ) {
            $str = str_replace(array("\r\n", "\r"), "\n", $str);
            $str_array = explode("\n",$str);
            $str_out = '';
            foreach ( $str_array as $value ) {
               $str_out .= $value.LF;
               if ( mb_stristr($value, '$COMMSY_ROOM_ID = "') ) {
                  $str_out .= 'session_name(\'SESSID-\'.$COMMSY_ROOM_ID);'.LF;
               }
            }
            if ( !empty($str_out) ) {
               file_put_contents($directory.'/'.$entry,trim($str_out));
            }
         }
         update_progress_bar($count);
      }
   }
}
 public function testupdate_progress_bar()
 {
     //execute the method and test if it doesn't throw an exception.
     //this method uses flush so we cannot get and verify content printed
     try {
         ob_start();
         update_progress_bar('test', 80, 100, false);
         ob_end_clean();
         $this->assertTrue(true);
     } catch (Exception $e) {
         $this->fail();
     }
 }
Example #4
0
function changeWikis ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'index.php') {
         unlink($directory.'/'.$entry);
         global $c_pmwiki_absolute_path_file;
         $str = "<?php include('".$c_pmwiki_absolute_path_file."/pmwiki.php');?>";
         file_put_contents($directory.'/'.$entry,$str);
         update_progress_bar($count);
      }
   }
}
Example #5
0
function changeWikis ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,'authuser.php') and !mb_stristr($str,'authusercommsy.php') ) {
            $str = str_replace('include_once("$FarmD/scripts/authuser.php");','include_once("$FarmD/cookbook/authusercommsy.php");'.LF.'include_once("$FarmD/scripts/authuser.php");',$str);
            file_put_contents($directory.'/'.$entry,$str);
         }
         update_progress_bar($count);
      }
   }
}
Example #6
0
function check_syntax ($file) {
   global $c_commsy_path_file;
   $retour = array();
   $output = '';
   $result = '';

   $file_to_check = $c_commsy_path_file.'/'.$file;

   $cmd = PHP_CMD . " -l ".$file_to_check;

   exec($cmd,$output,$result);
   $len = count($output);
   if ( $len <= 0 ) {
      echo "Sorry! internal error, no syntax check output :-(";
      exit(1);
   }

   // finally parse output of syntax check

   if ( mb_substr($output[0],0,mb_strlen(OK_LINE_START)) == OK_LINE_START ) {
       $syntax_OK = true;
       flush();
    } else {
       $error_array = array();
       $syntax_OK = false;
       $filtered_output = array();
       if ( $len > 0 && rtrim($output[0]) == "<br />" )  {
          array_shift($output);
          $len--;
       }
       if ( $len > 0 && rtrim($output[$len-1]) == "Errors parsing " . $file )  {
           $len--;   // N.B. skip last line
       }
       for ( $i=0; $i < $len; $i++ ) {
           $line = $output[$i];
           $filtered_output[] = $line;
           if ( preg_match(ON_LINE_PATTERN, $line, $matches) ) {
              $error_array[] = $line;
           }
       }
       $retour = $error_array;
   }
   global $count_files;
   update_progress_bar($count_files);
   return $retour;
}
function changeWikis ($directory,$count) {
   global $c_commsy_path_file;
   if ( empty($c_commsy_path_file) ) {
      @include_once('../../etc/cs_config.php');
   }
   $str2 = file_get_contents($c_commsy_path_file.'/etc/pmwiki/wiki_config.php');
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,"include_once('commsy_config.php');") and !empty($str2) ) {
            file_put_contents($directory.'/'.$entry,trim($str2));
         }
         update_progress_bar($count);
      }
   }
}
         if (mb_strpos($extra,'ontology_')!=false){
            $home_conf_string = str_replace(',ontology_short','',$treffer[2]);
            $home_conf_string = str_replace(',ontology_tiny','',$home_conf_string);
            $home_conf_string = str_replace(',ontology_none','',$home_conf_string);
            $home_conf_string = str_replace('ontology_short,','',$home_conf_string);
            $home_conf_string = str_replace('ontology_tiny,','',$home_conf_string);
            $home_conf_string = str_replace('ontology_none,','',$home_conf_string);
            $extra = preg_replace('~(<HOMECONF>.+</HOMECONF>)~u', '<HOMECONF>'.$home_conf_string.'</HOMECONF>', $extra);
            // save project
            $insert_query = 'UPDATE room SET extras="'.addslashes($extra).'" WHERE item_id="'.$project_id.'"';
            select($insert_query);
         }
      }
      $row = mysql_fetch_row($result);
      $project_id = $row[0];
      $extra = $row[1];
      update_progress_bar($count_project);
   }
}

if ($success) {
   echo('[ <font color="#00ff00">done</font> ]<br/>'."\n");
} else {
   echo('[ <font color="#ff0000">failed</font> ]<br/>'."\n");
}

// end of execution time
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
echo "<br/>Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60))."\n";
?>
Example #9
0
 function disable($base_dir)
 {
     global $app_strings;
     $total_steps = 3;
     //min steps with no tasks
     $current_step = 0;
     $this->base_dir = $base_dir;
     $tasks = array('disable_copy', 'disable_menus', 'disable_dashlets', 'disable_userpage', 'disable_administration', 'disable_vardefs', 'disable_layoutdefs', 'disable_relationships', 'disable_languages', 'disable_logichooks', 'reset_opcodes');
     $total_steps += count($tasks);
     //now the real number of steps
     if (file_exists($this->base_dir . '/manifest.php')) {
         if (!$this->silent) {
             $current_step++;
             display_progress_bar('install', $current_step, $total_steps);
             echo '<div id ="displayLoglink" ><a href="#" onclick="toggleDisplay(\'displayLog\')">' . $app_strings['LBL_DISPLAY_LOG'] . '</a> </div><div id="displayLog" style="display:none">';
         }
         require_once $this->base_dir . '/manifest.php';
         $this->installdefs = $installdefs;
         $this->id_name = $this->installdefs['id'];
         $installed_modules = array();
         if (isset($this->installdefs['beans'])) {
             foreach ($this->installdefs['beans'] as $bean) {
                 $installed_modules[] = $bean['module'];
             }
             mkdir_recursive("custom/Extension/application/Ext/Include/" . DISABLED_PATH, true);
             //Clear any older disabled version
             if (file_exists("custom/Extension/application/Ext/Include/" . DISABLED_PATH . '/' . $this->id_name . '.php')) {
                 rmdir_recursive("custom/Extension/application/Ext/Include/" . DISABLED_PATH . '/' . $this->id_name . '.php');
             }
             if (file_exists("custom/Extension/application/Ext/Include/{$this->id_name}.php")) {
                 rename("custom/Extension/application/Ext/Include/{$this->id_name}.php", "custom/Extension/application/Ext/Include/" . DISABLED_PATH . '/' . $this->id_name . '.php');
             }
             $this->rebuild_modules();
         }
         if (!$this->silent) {
             $current_step++;
             update_progress_bar('install', $current_step, $total_steps);
         }
         foreach ($tasks as $task) {
             $this->{$task}();
             if (!$this->silent) {
                 $current_step++;
                 update_progress_bar('install', $current_step, $total_steps);
             }
         }
         if (!$this->silent) {
             $current_step++;
             update_progress_bar('install', $current_step, $total_steps);
             echo '</div>';
         }
         UpdateSystemTabs('Restore', $installed_modules);
     } else {
         die("No manifest.php Defined In {$this->base_dir}/manifest.php");
     }
 }
Example #10
0
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
ob_start();
require_once '../include/utils/progress_bar_utils.php';
display_flow_bar('myflow', 1);
display_progress_bar('myprogress', 0, 10);
for ($i = 0; $i <= 10; $i++) {
    update_progress_bar('myprogress', $i, 10);
    sleep(1);
}
destroy_flow_bar('myflow');
function read_body_firmware($ch, $string)
{
    global $g, $fout, $file_size, $downloaded, $counter, $version, $latest_version;
    $length = strlen($string);
    $downloaded += intval($length);
    $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
    $downloadProgress = 100 - $downloadProgress;
    $a = $file_size;
    $b = $downloaded;
    $c = $downloadProgress;
    $text = "  " . gettext("Auto Update Download Status") . "\\n";
    $text .= "----------------------------------------------------\\n";
    $text .= "  " . gettext("Current Version") . " : {$g['product_version']}\\n";
    $text .= "  " . gettext("Latest Version") . "  : {$latest_version}\\n";
    $text .= "  " . gettext("File size") . "       : {$a}\\n";
    $text .= "  " . gettext("Downloaded") . "      : {$b}\\n";
    $text .= "  " . gettext("Percent") . "         : {$c}%\\n";
    $text .= "----------------------------------------------------\\n";
    $counter++;
    if ($counter > 150) {
        update_output_window($text);
        update_progress_bar($downloadProgress);
        $counter = 0;
    }
    fwrite($fout, $string);
    return $length;
}
Example #12
0
 function disable($base_dir)
 {
     global $app_strings;
     $total_steps = 3;
     //min steps with no tasks
     $current_step = 0;
     $this->base_dir = $base_dir;
     $tasks = array('disable_copy', 'disable_dashlets', 'disable_relationships', 'disable_extensions', 'disable_global_search', 'disable_manifest_logichooks', 'reset_opcodes');
     $total_steps += count($tasks);
     //now the real number of steps
     if (file_exists($this->base_dir . '/manifest.php')) {
         if (!$this->silent) {
             $current_step++;
             display_progress_bar('install', $current_step, $total_steps);
             echo '<div id ="displayLoglink" ><a href="#" onclick="toggleDisplay(\'displayLog\')">' . $app_strings['LBL_DISPLAY_LOG'] . '</a> </div><div id="displayLog" style="display:none">';
         }
         require_once $this->base_dir . '/manifest.php';
         $this->installdefs = $installdefs;
         $this->id_name = $this->installdefs['id'];
         $installed_modules = array();
         if (isset($this->installdefs['beans'])) {
             foreach ($this->installdefs['beans'] as $bean) {
                 $installed_modules[] = $bean['module'];
             }
         }
         if (!$this->silent) {
             $current_step++;
             update_progress_bar('install', $current_step, $total_steps);
         }
         foreach ($tasks as $task) {
             $this->{$task}();
             if (!$this->silent) {
                 $current_step++;
                 update_progress_bar('install', $current_step, $total_steps);
             }
         }
         if (!$this->silent) {
             $current_step++;
             update_progress_bar('install', $current_step, $total_steps);
             echo '</div>';
         }
         UpdateSystemTabs('Restore', $installed_modules);
     } else {
         die("No manifest.php Defined In {$this->base_dir}/manifest.php");
     }
 }
   $sql_array = array();
   foreach (  $must_sort_father_array as $father_id ) {
      $sql = 'SELECT * FROM tag WHERE item_id IN ('.implode(',',$children_array[$father_id]).') ORDER BY title';
      $result = select($sql);
      $new_place_array = array();
      $place = 0;
      while ( $row = mysql_fetch_assoc($result) ) {
         $place++;
         $new_place_array[$row['item_id']] = $place;
      }
      foreach ($children_array[$father_id] as $child_id) {
         if ( !empty($new_place_array[$child_id]) ) {
            $sql = 'UPDATE tag2tag SET sorting_place='.$new_place_array[$child_id].' WHERE from_item_id='.$father_id.' AND to_item_id='.$child_id.';';
            $sql_array[] = $sql;
         }
      }
   }
   init_progress_bar(count(array_unique($sql_array)));
   foreach ( array_unique($sql_array) as $sql ) {
      $result = select($sql);
      update_progress_bar(count(array_unique($sql_array)));
   }
} else {
   echo('<br/>nothing to do'."\n");
}

// end of execution time
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
echo "<br/>Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60))."\n";
?>
function read_body($ch, $string)
{
    global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_pfsense_version;
    $length = strlen($string);
    $downloaded += intval($length);
    $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
    $downloadProgress = 100 - $downloadProgress;
    $a = $file_size;
    $b = $downloaded;
    $c = $downloadProgress;
    $text = "  Auto Update Download Status\\n";
    $text .= "---------------------------------\\n";
    $text .= "  Latest Version  : {$latest_version}\\n";
    $text .= "  Current Version : {$current_installed_pfsense_version}\\n";
    $text .= "  File size       : {$a}\\n";
    $text .= "  Downloaded      : {$b}\\n";
    $text .= "  Percent         : {$c}%\\n";
    $text .= "---------------------------------\\n";
    $counter++;
    if ($counter > 150) {
        update_output_window($text);
        update_progress_bar($downloadProgress);
        $counter = 0;
    }
    fwrite($fout, $string);
    return $length;
}
Example #15
0
   $success_array[] = select($sql,false,'utf8');
   unset($sql);

   $sql = getCreateTableSQL(str_replace('utf8_','',$table),$column_array,'utf8');
   $success_array[] = select($sql,false,'utf8');
   unset($sql);

   $sql = 'INSERT INTO '.str_replace('utf8_','',$table).' SELECT * FROM '.$table.';';
   $success_array[] = select($sql,false,'utf8');
   unset($sql);

   $sql = 'DROP TABLE '.$table.';';
   $success_array[] = select($sql,false,'utf8');
   unset($sql);

   update_progress_bar(count($utf8_table_array));
}
echo(LINEBREAK);
flush();

// success
foreach ( $success_array as $success_item ) {
   $success = $success && $success_item;
}
$success_array = array();

// delete old_tables
echo(LINEBREAK);
echo('STEP8: delete old tables');
echo(LINEBREAK);
flush();
function process_disambiguations()
{
    global $session_data;
    set_progress_bar_title('Processing ambiguous entries');
    if (!@$session_data['ambiguities']) {
        return;
    }
    $i = 0;
    foreach (array_keys($session_data['ambiguities']) as $id) {
        $ambig_entry =& $session_data['ambiguities'][$id];
        if (!$ambig_entry->getPotentialMatches()) {
            $ambig_entry =& $ambig_entry->_ancestor;
        }
        if (!@$_REQUEST['ambig'][$id]) {
            // user hasn't chosen an option, let them sit there and fester
            $ambig_entry->_matches = array();
            continue;
        }
        $ambig_bib_id = $_REQUEST['ambig'][$id];
        if ($ambig_bib_id == -1) {
            // user has selected NEW -- none of the presented options were correct
            // move the hitherto potential matches to DEFINITE NON-MATCHES
            $ambig_entry->eliminatePotentialMatches();
        } else {
            if (in_array($ambig_bib_id, $ambig_entry->getPotentialMatches())) {
                setPermanentBiblioID($ambig_entry, $ambig_bib_id);
                $ambig_entry->eliminatePotentialMatches();
            } else {
                // funny buggers
                $ambig->_matches = array();
            }
        }
        update_progress_bar(++$i / count($session_data['ambiguities']));
    }
    update_progress_bar(-1);
    flush_fo_shizzle();
}
Example #17
0
                        add_to_msg('Storing Sync Info', false);
                        write_array_to_file('sync_info', $sync_info, 'modules/Sync/config.php');
                        add_to_msg('<b>Sync Complete</b>', false);
                        $_REQUEST['do_action'] = 'execute';
                        $_REQUEST['repair_silent'] = true;
                        global $current_user;
                        $current_user->is_admin = '1';
                        require_once 'ModuleInstall/ModuleInstaller.php';
                        global $mod_strings, $current_language;
                        $mod_strings = return_module_language($current_language, 'Administration');
                        $mi = new ModuleInstaller();
                        $mi->rebuild_all();
                        $current_user->is_admin = '0';
                        echo '<script>document.getElementById("stop_sync_btn").value="Done"</script>';
                        echo '<script>opener.location.href = "index.php?module=Home&action=index";</script>';
                        update_progress_bar('Total', sizeof($sync_modules), sizeof($sync_modules));
                        //$current_user->setPreference('last_sync'.  $sync_module, $start_time);
                        clear_sync_session();
                        unset($_SESSION['ACL']);
                    }
                }
            }
        } else {
        }
    }
} else {
    include_once 'syncconnect.php';
}
echo '</form>';
if ($sync_module_index > -1) {
    echo '<br><br><form action="index.php" name="restart_sync" id="restart_sync"><input type="hidden" name="action" value="Popup"><input type="hidden" name="module" value="Sync"><input type="hidden" name="new_sync" value="new_sync"></form>';
            $insert_query = 'INSERT INTO link_items ( item_id, context_id , creator_id , deleter_id ,
                                                      creation_date , modification_date , deletion_date , first_item_id ,
                                                      first_item_type , second_item_id , second_item_type )
                             VALUES ("'.$link_id.'", "'.$room_id.'", "'.$user_id.'", NULL , "'
                                       .date("Y-m-d H:i:s").'", "'.date("Y-m-d H:i:s").'", NULL , "'.$user_id.'", '
                                       .'"user", "'.$group_all_id.'", '
                                       .'"group")';
            mysql_query($insert_query);
            if ($error = mysql_error()) {
               echo '<br />'.$error." QUERY: ".$insert_query.'<br />'."\n";
               $success = false;
            }
         }

         // next user
         $row2 = mysql_fetch_row($result2);
         $user_id = $row2[0];
      }

      // next room
      $row = mysql_fetch_row($result);
      $room_id = $row[0];
      $campus_id = $row[1];
      update_progress_bar($count_rooms);
   }
}

// end of execution time
echo(getProcessedTimeInHTML($time_start));
?>
Example #19
0
   while ($item_id) {
      $filename_on_disc = '../../var/'.$portal_id.'/'.$context_id.'/cid'.$context_id.'_'.$item_id.'_'.$filename;
      if (file_exists($filename_on_disc)) {
         $size = filesize($filename_on_disc);
         if ( !empty($size) ) {
            $query = 'UPDATE files SET size="'.$size.'" WHERE files_id="'.$item_id.'";';
            $succ = select($query);
            $success = $success and $succ;
         }
      }
   
	   $row = mysql_fetch_row($result);
      $item_id = $row[0];
      $context_id = $row[1];
      $filename = $row[2];
      $portal_id = $row[3];
      update_progress_bar($count);
	}
}

if ($success) {
   echo('[ <font color="#00ff00">done</font> ]<br/>'."\n");
} else {
   echo('[ <font color="#ff0000">failed</font> ]<br/>'."\n");
}

// end of execution time
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
echo "<br/>Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60))."\n";
?>
Example #20
0
 $ibfd->module = $module;
 for ($i = $offset; $i < $total && $i < $offset + $recordsPerPage; $i++) {
     $ibfd->count = $i;
     /* Don't turbo Users or Teams */
     if (!$_SESSION['turbo'] || $i == $offset || $module != 'Users' || $module != 'Teams') {
         $ibfd->clean();
         $ibfd->count = $i;
         $ibfd->generateData();
     }
     $ibfd->generateId();
     $ibfd->createInserts();
     $ibfd->generateRelationships();
     $_SESSION['processedRecords']++;
     if ($i % 10 == 0) {
         update_progress_bar('modules_progress', $_SESSION['processedRecords'], $_SESSION['totalRecords']);
         update_progress_bar('module_progress', $i, $total);
     }
     //flush the relatedQueries every 2000, and at the end of each page.
     if ($relQueryCount >= 2000 || $i == $total - 1 || $i == $offset + $recordsPerPage - 1) {
         echo '.';
         foreach ($GLOBALS['relatedQueries'] as $data) {
             $head = $data['head'];
             unset($data['head']);
             processQueries($head, $data);
         }
         $GLOBALS['relatedQueries'] = array();
         $relQueryCount = 0;
     }
 }
 /* Use our query wrapper that makes things fast. */
 processQueries($GLOBALS['queryHead'], $GLOBALS['queries']);
Example #21
0
function sodUpdateProgressBar($itemweight)
{
    global $progress_bar_percent;
    global $totalweight;
    global $totalitems;
    global $currentitems;
    $currentitems++;
    if ($currentitems == $totalitems) {
        update_progress_bar("diagnostic", 100, 100);
    } else {
        $progress_bar_percent += $itemweight / $GLOBALS['totalweight'] * 100;
        update_progress_bar("diagnostic", $progress_bar_percent, 100);
    }
}
 function uninstall($base_dir)
 {
     $total_steps = 4;
     //min steps with no tasks
     $current_step = 0;
     $this->base_dir = $base_dir;
     $tasks = array('uninstall_mkdirs', 'uninstall_copy', 'uninstall_menus', 'uninstall_dashlets', 'uninstall_administration', 'uninstall_vardefs', 'uninstall_layoutdefs', 'uninstall_relationships', 'uninstall_languages');
     $total_steps += count($tasks);
     //now the real number of steps
     if (file_exists($this->base_dir . '/manifest.php')) {
         if (!$this->silent) {
             $current_step++;
             display_progress_bar('install', $current_step, $total_steps);
             echo '<div id ="displayLoglink" ><a href="#" onclick="toggleDisplay(\'displayLog\')">Display Log</a> </div><div id="displayLog" style="display:none">';
         }
         require_once $this->base_dir . '/manifest.php';
         $this->installdefs = $installdefs;
         $this->id_name = $this->installdefs['id'];
         $installed_modules = array();
         if (isset($this->installdefs['beans'])) {
             foreach ($this->installdefs['beans'] as $bean) {
                 $installed_modules[] = $bean['module'];
                 $this->uninstall_user_prefs($bean['module']);
             }
             $this->uninstall_beans($installed_modules);
             if (!$this->silent) {
                 $current_step++;
                 update_progress_bar('install', $total_steps, $total_steps);
             }
             rmdir_recursive("custom/Extension/application/Ext/Include/{$this->id_name}.php");
             $this->merge_files('Ext/Include', 'modules.ext.php', '', true);
         }
         if (!$this->silent) {
             $current_step++;
             update_progress_bar('install', $current_step, $total_steps);
         }
         foreach ($tasks as $task) {
             $this->{$task}();
             if (!$this->silent) {
                 $current_step++;
                 update_progress_bar('install', $current_step, $total_steps);
             }
         }
         if (isset($installdefs['custom_fields'])) {
             $GLOBALS['log']->debug('Uninstalling Custom Fields...');
             $this->uninstall_custom_fields($installdefs['custom_fields']);
         }
         if (!$this->silent) {
             $current_step++;
             update_progress_bar('install', $current_step, $total_steps);
             echo '</div>';
         }
         $GLOBALS['log']->debug('Complete');
         update_progress_bar('install', $total_steps, $total_steps);
     } else {
         die("No manifest.php Defined In {$this->base_dir}/manifest.php");
     }
 }
function read_body_firmware($ch, $string)
{
    global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_pfsense_version;
    $length = strlen($string);
    $downloaded += intval($length);
    $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
    $downloadProgress = 100 - $downloadProgress;
    $a = $file_size;
    $b = $downloaded;
    $c = $downloadProgress;
    $text = "  Snort download in progress\\n";
    $text .= "----------------------------------------------------\\n";
    $text .= "  Downloaded      : {$b}\\n";
    $text .= "----------------------------------------------------\\n";
    $counter++;
    if ($counter > 150) {
        update_output_window($text);
        update_progress_bar($downloadProgress);
        flush();
        $counter = 0;
    }
    conf_mount_rw();
    fwrite($fout, $string);
    conf_mount_ro();
    return $length;
}
Example #24
0
                    $db->query($query);
                    // insert a new database row to show the rebuild extensions is done
                    $id = create_guid();
                    $gmdate = TimeDate::getInstance()->nowDb();
                    $date_entered = db_convert("'{$gmdate}'", 'datetime');
                    $query = 'INSERT INTO versions (id, deleted, date_entered, date_modified, modified_user_id, created_by, name, file_version, db_version) ' . "VALUES ('{$id}', '0', {$date_entered}, {$date_entered}, '1', '1', 'Rebuild Extensions', '4.0.0', '4.0.0')";
                    $db->query($query);
                    $current_step++;
                    update_progress_bar('sync_setup', $current_step, $module_steps);
                    add_to_msg('Done updating files<br>');
                    add_to_msg('Updating User Information<br>');
                    $current_step++;
                    update_progress_bar('sync_setup', $current_step, $module_steps);
                    sync_users($soapclient, $session, $_REQUEST['clean_sync']);
                    $current_step++;
                    update_progress_bar('sync_setup', $current_step, $module_steps);
                    add_to_msg('Done Updating User Information<br>');
                }
                //end new sync
                destroy_flow_bar('file_update');
                echo '<script>document.location.href = "index.php?&action=Popup&module=Sync&sync_module_index=0&new_sync=true&clean_sync=' . $_REQUEST['clean_sync'] . '&global_accept_server=' . $_REQUEST['global_accept_server'] . '";</script>';
                die;
            }
        } else {
            add_to_msg('Server and Client must both be running the same flavor of Sugar.');
        }
    } else {
        add_to_msg('Your Offline Client instance has been disabled by your administrator');
    }
} else {
    add_to_msg('Failed to Login<br>');