/**
  * Constructor
  * 
  * @param string $module your module-name
  * @param array $subs the sub-module names that are possible
  * @param string $default the default sub-module
  */
 public function __construct($module, $subs = array(), $default = 'default')
 {
     $input = FWS_Props::get()->input();
     if (count($subs) == 0) {
         FWS_Helper::error('Please provide the possible submodules of this module!');
     }
     $sub = $input->correct_var('sub', 'get', FWS_Input::STRING, $subs, $default);
     // include the sub-module and create it
     include_once FWS_Path::server_app() . 'module/' . $module . '/sub_' . $sub . '.php';
     $classname = 'PC_SubModule_' . $module . '_' . $sub;
     $this->sub = new $classname();
 }
Beispiel #2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->set_action_performer(new TDL_Actions_Performer());
     $tpl = FWS_Props::get()->tpl();
     $locale = FWS_Props::get()->locale();
     $tpl->set_path('theme/templates/');
     $tpl->set_cache_folder(FWS_Path::server_app() . 'cache/');
     // add the home-breadcrumb
     $this->add_breadcrumb($locale->_('TodoList'), TDL_URL::get_mod_url('view_entries')->to_url());
     $this->_action_perf->set_prefix('TDL_Action_');
     $a = new TDL_Actions_ChangeSelProject(TDL_ACTION_CHANGE_SEL_PROJECT);
     $this->_action_perf->add_action($a);
 }
Beispiel #3
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $ap = $this->get_action_performer();
     $ap->set_prefix('PC_Action_');
     $ap->set_mod_folder('module/');
     $tpl = FWS_Props::get()->tpl();
     $tpl->set_path('templates/');
     $tpl->set_cache_folder(FWS_Path::server_app() . 'cache/');
     // add the home-breadcrumb
     $url = new FWS_URL();
     $url->set('action', 'home');
     $this->add_breadcrumb('PHP-Check', $url->to_url());
 }
/**
 * The autoloader for the todolist src-files
 * 
 * @param string $item the item to load
 * @return boolean wether the file has been loaded
 */
function TDL_autoloader($item)
{
    if (FWS_String::starts_with($item, 'TDL_')) {
        $item = FWS_String::substr($item, 4);
        $item = str_replace('_', '/', $item);
        $item = FWS_String::strtolower($item);
        $item .= '.php';
        $path = FWS_Path::server_app() . 'src/' . $item;
        if (is_file($path)) {
            include $path;
            return true;
        }
    }
    return false;
}
 /**
  * @return FWS_DB_Connection the property
  */
 protected function db()
 {
     include_once FWS_Path::server_app() . 'config/mysql.php';
     $c = new FWS_DB_MySQLi_Connection();
     $c->connect(PC_MYSQL_HOST, PC_MYSQL_LOGIN, PC_MYSQL_PASSWORD);
     $c->select_database(PC_MYSQL_DATABASE);
     $c->set_save_queries(false);
     $c->set_escape_values(true);
     $version = $c->get_server_version();
     if ($version >= '4.1') {
         $c->execute('SET CHARACTER SET utf8;');
         // we don't want to have any sql-modes
         $c->execute('SET SESSION sql_mode="";');
     }
     return $c;
 }
/**
 * The autoloader for the phpcheck src-files
 * 
 * @param string $item the item to load
 * @return boolean whether the file has been loaded
 */
function PC_autoloader($item)
{
    if (FWS_String::starts_with($item, 'PC_')) {
        $nitem = substr($item, 3);
        $parts = explode('_', $nitem);
        if (!FWS_String::starts_with($item, 'PC_Module_')) {
            array_unshift($parts, 'src');
        }
        $nitem = implode('/', $parts);
        $nitem = str_replace('_', '/', $nitem);
        $nitem = strtolower($nitem);
        $nitem .= '.php';
        $path = FWS_Path::server_app() . $nitem;
        if (is_file($path)) {
            include $path;
            return true;
        }
    }
    return false;
}
Beispiel #7
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
include_once 'config/userdef.php';
include_once 'config/mysql.php';
// define fwspath for init.php
define('FWS_PATH', TDL_FWS_PATH);
// init the framework
include_once TDL_FWS_PATH . 'init.php';
// the db is latin1
FWS_String::set_use_mb_functions(true, 'ISO-8859-1');
include_once FWS_Path::server_app() . 'src/props.php';
// init the autoloader
include_once FWS_Path::server_app() . 'src/autoloader.php';
FWS_AutoLoader::register_loader('TDL_autoloader');
// set the accessor and loader for the todolist
$accessor = new TDL_PropAccessor();
$accessor->set_loader(new TDL_PropLoader());
FWS_Props::set_accessor($accessor);
// init user
$user = FWS_Props::get()->user();
$user->init();
// ok, now show the page
$doc = FWS_Props::get()->doc();
echo $doc->render();