Changeset 3582

Show
Ignore:
Timestamp:
01/20/07 16:58:03 (5 years ago)
Author:
gregmac
Message:

Moved more common code into header file, changed header loading order.
Moved admin 'welcome page' to a view (see ViewSystem)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/quickform/amp_conf/htdocs/admin/config.php

    r3579 r3582  
    1212//GNU General Public License for more details. 
    1313 
    14 $title = "freePBX administration"; 
     14$template['title'] = "freePBX administration"; 
    1515 
    1616$type = isset($_REQUEST['type'])?$_REQUEST['type']:'setup'; 
     
    3131} else { 
    3232  $message = "Setup"; 
    33 } 
    34  
    35 require_once('common/php-asmanager.php'); 
    36 require_once('functions.inc.php'); 
    37  
    38 // get settings 
    39 $amp_conf = parse_amportal_conf("/etc/amportal.conf"); 
    40 $asterisk_conf  = parse_asterisk_conf("/etc/asterisk/asterisk.conf"); 
    41 $astman   = new AGI_AsteriskManager(); 
    42 if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { 
    43   unset( $astman ); 
    4433} 
    4534 
     
    129118// check access 
    130119if ( ($display != '') && !isset($fpbx_menu[$display]) ) { 
    131   $display = "noaccess"; 
     120  showview("noaccess"); 
     121  exit; 
    132122} 
    133123 
     
    267257    } 
    268258  break; 
    269   case 'noaccess': 
    270     echo "<h2>"._("Not found")."</h2>"; 
    271     echo "<p>"._("The section you requested does not exist or you do not have access to it.")."</p>"; 
    272   break; 
    273259  case 'modules': 
    274260    include 'page.modules.php'; 
     
    276262  case '': 
    277263    if ($astman) { 
    278       printf( "<h2>%s</h2>", dgettext("welcome page", "Welcome to freePBX.") ); 
    279  
    280       $modules_needup = module_getinfo(false, MODULE_STATUS_NEEDUPGRADE); 
    281       $modules_broken = module_getinfo(false, MODULE_STATUS_BROKEN); 
    282       if (count($modules_needup) || count($modules_broken)) { 
    283         echo "<div class=\"warning\">"; 
    284         if (count($modules_needup)) { 
    285           echo "<p>"._("Warning: The following modules are disabled because they need upgrading: "); 
    286           echo implode(", ",array_keys($modules_needup)); 
    287           echo "</p>"; 
    288         } 
    289         if (count($modules_broken)) { 
    290           echo "<p>"._("Warning: The following modules are disabled because they are broken: "); 
    291           echo implode(", ",array_keys($modules_broken)); 
    292           echo "</p>"; 
    293         } 
    294         echo "<p>", sprintf(dgettext("welcome page","You should go to the <a href='%s'>Module Admin</a> page to fix these.</p>"), "config.php?display=modules&amp;type=tool"); 
    295         echo "</div>"; 
    296       } 
    297        
    298 // BETA code - remove later. 
    299       echo "<div class=\"warning\">"; 
    300       printf( "<p>%s</p>", dgettext("welcome page", "You are running Release Candidate 1 of freePBX. This release is a final test before we make the official 2.2.0 freePBX release. We are unaware of any major bugs in this release, and urge users to report any that they find.") ); 
    301        
    302       printf( "<p>%s</p>"  , dgettext("welcome page", "Currently known bugs are maintained on <a href='http://www.freepbx.org/trac/wiki/2.2Beta'>this TRAC page</a>. If you find a bug, please <a href='http://www.freepbx.org/trac/newticket'>create a bug report</a> (you need to create an account - this is to avoid spammers) and the bug report will immediately appear on the <a href='http://www.freepbx.org/trac/wiki/2.2Beta'>TRAC page</a> so that it can be easily tracked by other users.") ); 
    303       echo "</div>"; 
    304  
    305       printf( "<!--[if IE]><p>%s</p><![endif]-->"  , dgettext("welcome page", "Note, presently, Microsoft's Internet Explorer is <b>not</b> a supported web browser, and you must use a standards compliant browser, such as Firefox. There is a link on the <a href='http://www.freepbx.org'>right hand side of freePBX.org</a> that will allow you to download Firefox easily. By using that link, Google will donate US$1 to the freePBX project.") ); 
    306        
    307       if ($amp_conf['AMPMGRPASS'] == 'amp111') { 
    308         printf( "<div class=\"warning\"><p>%s</p></div>", dgettext("welcome text", "Warning: You are running freePBX and ").$amp_conf['AMPENGINE'].dgettext("welcome page", " with the default manager pass. You should consider changing this to something else.")." ".sprintf('(<a href="http://aussievoip.com/wiki/index.php?page=freePBX-ManagerPass" target="_new">%s</a>)', _("Help")) ); 
    309       } 
    310       if ($amp_conf['AMPDBPASS'] == 'amp109') { 
    311         printf( "<div class=\"warning\"><p>%s</p></div>", dgettext("welcome text", "Warning: You are running freePBX and ").$amp_conf['AMPDBENGINE'].dgettext("welcome page", " with the default password ")." ".sprintf('(<a href="http://aussievoip.com/wiki/index.php?page=freePBX-MysqlPass" target="_new">%s</a>)', _("Help")) ); 
    312       } 
    313  
    314  
    315  
    316       printf( "<p>%s</p>"  , dgettext("welcome page", "If you're new to freePBX, Welcome. Here are some quick instructions to get you started") ); 
    317        
    318       echo "<p>"; 
    319       printf( dgettext("welcome page",  
    320 "There are a large number of Plug-in modules available from the Online Repository. This is 
    321 available by clicking on the <a href='%s'>Tools menu</a> up the top, then 
    322 <a href='%s'>Module Admin</a>, then 
    323 <a href='%s'>Check for updates online</a>. 
    324 Modules are updated and patched often, so if you are having a problem, it's worth checking there to see if there's 
    325 a new version of the module available."),  
    326         "config.php?type=tool", 
    327         "config.php?display=modules&amp;type=tool", 
    328         "config.php?display=modules&amp;type=tool&amp;extdisplay=online" 
    329       ); 
    330       echo "</p>\n"; 
    331  
    332       echo "<p>"; 
    333       printf( dgettext( "welcome page", 
    334 "If you're having any problems, you can also use the <a href='%s'>Online Support</a>  
    335 module (<b>you need to install this through the <a href='%s'>Module Repository</a> first</b>) 
    336 to talk to other users and the devlopers in real time. Click on <a href='%s'>Start IRC</a>, 
    337 when the module is installed, to start a Java IRC client." ), 
    338         "config.php?type=tool&amp;display=irc", 
    339         "config.php?display=modules&amp;type=tool&amp;extdisplay=online", 
    340         "config.php?type=tool&amp;display=irc&amp;action=start" 
    341       ); 
    342       echo "</p>\n"; 
    343  
    344       echo "<p>"; 
    345       printf( dgettext( "welcome page", 
    346 "There is also a community based <a href='%s' target='_new'>freePBX Web Forum</a> where you can post 
    347 questions and search for answers for any problems you may be having."), 
    348 "http://forums.freepbx.org"  ); 
    349       echo "</p>\n"; 
    350  
    351       print( "<p>" . _("We hope you enjoy using freePBX!") . "</p>\n" ); 
    352     } // no manager, no connection to asterisk 
    353     else { 
    354       echo "<p><div class='clsError'>\n"; 
    355       echo "<b>" . _("Warning:") . "</b>\n"; 
    356       echo "<br>"; 
    357       echo "<br>\n"; 
    358       echo _("Cannot connect to Asterisk Manager with "). "<i>" .$amp_conf["AMPMGRUSER"] . "</i>"; 
    359       echo "<br>"; 
    360       echo _("Asterisk may not be running."); 
    361       echo "</div></p>\n"; 
     264      showview('welcome', array('AMP_CONF' => &$amp_conf)); 
     265    } else { 
     266      // no manager, no connection to asterisk 
     267      showview('welcome_nomanager', array('mgruser' => $amp_conf["AMPMGRUSER"])); 
    362268    } 
    363269  break; 
    364    
    365270} 
    366271 
  • freepbx/branches/quickform/amp_conf/htdocs/admin/header.php

    r3579 r3582  
    4747//header('Content-type: text/html; charset=utf-8'); 
    4848$currentFile = $parts[count($parts) - 1]; 
     49//todo: can this be removed? what is it used for? 
     50 
    4951 
    5052// Emulate gettext extension functions if gettext is not available 
     
    6567} 
    6668 
    67  
     69// setup locale 
    6870if (extension_loaded('gettext')) { 
    6971  if (isset($_COOKIE['lang'])) { 
     
    7880} 
    7981 
     82// include base functions 
     83require_once('functions.inc.php'); 
     84require_once('common/php-asmanager.php'); 
     85 
     86// get settings 
     87$amp_conf = parse_amportal_conf("/etc/amportal.conf"); 
     88$asterisk_conf  = parse_asterisk_conf("/etc/asterisk/asterisk.conf"); 
     89$astman   = new AGI_AsteriskManager(); 
     90if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { 
     91  unset( $astman ); 
     92} 
     93 
     94 
    8095// do authentication - header_auth exits if unauthorized 
    8196include('header_auth.php'); 
  • freepbx/branches/quickform/amp_conf/htdocs/admin/panel.php

    r3579 r3582  
    1717$message="Flash Operator Panel"; 
    1818 
    19 require_once('functions.inc.php'); 
    20  
    21 // get settings 
    22 $amp_conf = parse_amportal_conf("/etc/amportal.conf"); 
    23  
    2419include 'header.php'; 
    2520 
    26 showview('panel', array('deptname' => $_SESSION["AMP_user"]->_deptname)); 
     21showview('panel', array('title'=>$title, 'deptname' => $_SESSION["AMP_user"]->_deptname)); 
    2722?> 
  • freepbx/branches/quickform/amp_conf/htdocs/admin/reports.php

    r3579 r3582  
    1616$title="freePBX: Call Detail Reports"; 
    1717$message="Call Detail Reports"; 
    18  
    19 require_once('functions.inc.php'); 
    20  
    21 // get settings 
    22 $amp_conf = parse_amportal_conf("/etc/amportal.conf"); 
    2318 
    2419// BUILD an SQL clause for any AMP User restrictions 
     
    5449// cdr.php, defines.php, call-log.php, call-comp.php, graph_hourdetail.php, graph_statbar.php, graph_pie.php 
    5550 
    56 showview('reports', array('display'=>$display, 'menu' => $menu)); 
     51showview('reports', array('title'=>$title, 'display'=>$display, 'menu' => $menu)); 
    5752?> 
    5853 
  • freepbx/branches/quickform/amp_conf/htdocs/admin/views/noaccess.php

    r3579 r3582  
    11<?php 
    22 
    3 $template['content'] = _("You must log in first before you can access this page."); 
     3$template['content'] =  
     4  "<h2>"._("Not found")."</h2>". 
     5  "<p>"._("The section you requested does not exist or you do not have access to it.")."</p>"; 
    46showview('freepbx', $template); 
    57 
  • freepbx/branches/quickform/amp_conf/htdocs/admin/views/panel.php

    r3579 r3582  
    11<?php 
    22 
    3  
     3$template['title'] = $title; 
    44$template['content'] =  
    55  '<div>'. 
  • freepbx/branches/quickform/amp_conf/htdocs/admin/views/reports.php

    r3579 r3582  
    11<?php 
    22 
     3$template['title'] = $title; 
    34$template['content'] = ''; 
    45