コード例 #1
0
ファイル: JxAdminStatus.php プロジェクト: joestump/jax
 function render()
 {
     $user =& JxSingleton::factory('user');
     $template =& new JxTemplate(JX_BASE_PATH . '/modules/content/tpl');
     $templateFile = 'JxAdminStatus.tpl';
     if ((int) $_GET['contentID'] > 0) {
         $sql = "SELECT *\n                FROM content \n                WHERE contentID='" . $_GET['contentID'] . "'";
         $record = $this->db->getRow($sql);
         if (DB::isError($record)) {
             $this->templateFile = 'noperms.tpl';
             return false;
         }
         if ($record['w'] || $user->userID == $record['userID']) {
             $sql = "UPDATE content\n                  SET available='" . $_GET['available'] . "'\n                  WHERE contentID='" . $_GET['contentID'] . "'";
             $result = $this->db->query($sql);
             if (!DB::isError($result)) {
                 $template->assign('msg', 'Status has been updated!');
             } else {
                 $template->assign('msg', 'ERROR: status has not been updated!');
             }
         } else {
             $template->assign('msg', 'ERROR: you have no perms!');
         }
     }
     return $template->fetch($templateFile);
 }
コード例 #2
0
ファイル: JxFieldShipping.php プロジェクト: joestump/jax
    function getElement()
    {
        $this->result = $this->ups->process();
        if (JxUPS::isError($result)) {
            $log =& JxSingleton::factory('log');
            $log->log($this->result->getMessage());
            $msg = 'UPS XML Service Error: ' . $this->result->getMessage() . '. This
                error has been logged by the system';
            $class =& new JxFieldHtml($msg);
        } else {
            $list = array();
            if (is_array($this->result->services)) {
                while (list($code, $rate) = each($this->result->services)) {
                    $list[$code] = $this->ups->_serviceMap[$code] . ' ($' . number_format($rate, 2) . ')';
                }
                $class =& new JxFieldRadio($this->name, $list, $this->value, 1);
            } else {
                $html = <<<EOT

The UPS shipping calculator is currently down. This means we cannot correctly
calculate or estimate your shipping cost. Please enter the desired shipping
method into the notes field and we will contact you with shipping costs prior
to shipping.

EOT;
                $class =& new JxFieldHtml($html);
            }
        }
        return $class->getElement();
    }
コード例 #3
0
ファイル: smarty.php プロジェクト: joestump/jax
 function render(&$module)
 {
     $user =& JxSingleton::factory('user');
     $page =& JxSingleton::factory('page');
     if (PEAR::isError($page)) {
         $this->log->log($page->getMessage());
         die($page->getMessage());
     }
     $this->template =& JxSingleton::factory('page');
     $this->template->addCssFile(JX_PG_TPL_PATH . '/css/JxForm.css');
     $this->template->addCssFile(JX_PG_TPL_PATH . '/css/JxModule.css');
     $this->template->addJsFile(JX_PG_TPL_PATH . '/javascript/JAX.js');
     $module->template->assign('user', $user);
     $module->template->assign('page', $page);
     $moduleContent = $module->template->fetch($module->templateFile);
     if (!$module->displayPage) {
         $templateFile = 'nopage.tpl';
     } else {
         $templateFile = $page->templateFile;
     }
     if (!PEAR::isError($this->template)) {
         $this->template->render();
         $this->template->assign($module->name, $module->data);
         $this->template->assign('module', $moduleContent);
         $this->template->assign('user', $user);
         $this->template->display($templateFile);
     }
 }
コード例 #4
0
ファイル: JxContent.php プロジェクト: joestump/jax
 function JxContent($table)
 {
     $this->_child =& DB_DataObject::factory($table);
     $this->_groups =& DB_DataObject::factory('content_groups');
     $this->_users =& DB_DataObject::factory('users');
     if (!PEAR::isError($this->_child)) {
         $this->user = JxSingleton::factory('user');
         $this->_childTable = $table;
         $this->joinAdd($this->_child, '');
         $this->joinAdd($this->_groups, '');
         $this->joinAdd($this->_users, '');
         $this->selectAdd('SUM((CONV(content_groups.permissions,8,10) & 
                       CONV(' . JX_USER_R . ',8,2))) AS r');
         $this->selectAdd('SUM((CONV(content_groups.permissions,8,10) & 
                       CONV(' . JX_USER_W . ',8,2))) AS w');
         $this->selectAdd('SUM((CONV(content_groups.permissions,8,10) & 
                       CONV(' . JX_USER_X . ',8,2))) AS x');
         $this->whereAdd('content_groups.groupID IN (' . implode(',', $this->user->groupIds) . ')');
         $this->whereAdd('(CONV(content_groups.permissions,8,10) &
                       CONV(' . JX_USER_R . ',8,2)) > 0');
         $this->whereAdd('((content.available > 0) OR 
                            (content.userID=' . $this->user->userID . '))');
         $this->groupBy('content_groups.contentID');
     }
 }
コード例 #5
0
ファイル: JxTimer.php プロジェクト: joestump/jax
 function stop()
 {
     $this->timer->stop();
     $totalTime = $this->timer->timeElapsed();
     $this->log->log('Execution time for ' . $_SERVER['REQUEST_URI'] . ' ' . $totalTime);
     $page =& JxSingleton::factory('page');
     $page->assign('totalTime', $totalTime);
 }
コード例 #6
0
ファイル: blank.php プロジェクト: joestump/jax
 function render(&$module)
 {
     $user = JxSingleton::factory('user');
     $page = JxSingleton::factory('page');
     $module->template->assign('user', $user);
     $module->template->assign('page', $page);
     $module->template->display($module->templateFile);
 }
コード例 #7
0
ファイル: db_common.php プロジェクト: joestump/jax
/**
 * JxLogDbError
 *
 * PEAR callback function to log bad SQL queries.
 *
 * @author Joe Stump <*****@*****.**>
 * @param mixed $error
 */
function JxLogDbError($error)
{
    $log =& JxSingleton::factory('log');
    if (!PEAR::isError($log) && PEAR::isError($error)) {
        $message = trim(str_replace("\n", '', $error->userinfo));
        $message = ereg_replace('[ ]+', ' ', $message);
        $log->log($message);
    }
}
コード例 #8
0
ファイル: JxFieldCalendar.php プロジェクト: joestump/jax
 function JxFieldCalendar($name, $value = '')
 {
     $this->JxField($name, $value);
     $page =& JxSingleton::factory('page');
     $page->addCssFile('/tpl/css/dynCalendar.css');
     $page->addJsFile('/tpl/javascript/browserSniffer.js');
     $page->addJsFile('/tpl/javascript/dynCalendar.js');
     if (strlen($this->value)) {
         list($this->year, $this->month, $this->day) = explode('-', $value);
     } else {
         list($this->year, $this->month, $this->day) = explode('-', $_POST[$this->name]);
     }
 }
コード例 #9
0
ファイル: JxPref.php プロジェクト: joestump/jax
 /**
  * setModulePref
  *
  * Set a user/module specific preference. This function should be called
  * statically. 
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param string $module
  * @param string $var
  * @param string $value
  * @param int $userID
  * @return bool
  */
 function setModulePref($module, $var, $value, $userID = 0)
 {
     $db =& JxSingleton::factory('db');
     if (!$userID) {
         $user =& JxSingleton::factory('user');
         $userID = $user->userID;
     }
     if (!DB::isError($db)) {
         $sql = "REPLACE INTO preferences\n                SET userID='" . $userID . "',\n                    module='{$module}',\n                    var='{$var}',\n                    value='{$value}'";
         $result = $db->query($sql);
         return !DB::isError($result);
     }
 }
コード例 #10
0
 function render()
 {
     $user =& JxSingleton::factory('user');
     $template =& new JxTemplate(JX_MODULE_PATH . '/content/tpl');
     $templateFile = 'JxAdminContentPermissions.tpl';
     if ((int) $_GET['contentID'] > 0) {
         $content =& new JxContent();
         $sql = "SELECT *\n                FROM content \n                WHERE contentID='" . $_GET['contentID'] . "'";
         $record = $this->db->getRow($sql);
         if (DB::isError($record)) {
             $this->templateFile = 'noperms.tpl';
             return false;
         }
         if ($record['w'] || $user->userID == $record['userID']) {
             if (is_array($_POST['perms'])) {
                 $groups = $_POST['groups'];
                 $perms = $_POST['perms'];
                 for ($i = 0; $i < count($groups); ++$i) {
                     if (is_array($perms[$groups[$i]]) && count($perms[$groups[$i]])) {
                         $math = $perms[$groups[$i]];
                         $newPerms = ($math['r'] + $math['w'] + $math['x']) * 100;
                     } else {
                         $newPerms = 0;
                     }
                     $sql = "REPLACE INTO content_groups\n                        SET permissions='{$newPerms}',\n                            groupID='" . $groups[$i] . "',\n                            contentID='" . $_GET['contentID'] . "'";
                     $result = $this->db->query($sql);
                 }
             }
             $sql = "SELECT * FROM groups";
             $result = $this->db->query($sql);
             if (!DB::isError($result) && $result->numRows()) {
                 while ($row = $result->fetchRow()) {
                     $sql = "SELECT R.permissions,\n                     (CONV(R.permissions,8,10) & CONV(" . JX_USER_R . ",8,2)) AS r,\n                     (CONV(R.permissions,8,10) & CONV(" . JX_USER_W . ",8,2)) AS w,\n                     (CONV(R.permissions,8,10) & CONV(" . JX_USER_X . ",8,2)) AS x\n                      FROM content_groups AS R\n                      WHERE R.groupID='" . $row['groupID'] . "' AND\n                            R.contentID='" . $_GET['contentID'] . "'";
                     $Presult = $this->db->query($sql);
                     if (!DB::isError($Presult) && $Presult->numRows()) {
                         $Prow = $Presult->fetchRow();
                         $perms = array('r' => $Prow['r'], 'w' => $Prow['w'], 'x' => $Prow['x']);
                     } else {
                         $perms = array('r' => 0, 'w' => 0, 'x' => 0);
                     }
                     $perms['name'] = $row['name'];
                     $out[$row['groupID']] = $perms;
                 }
                 $template->assign('perms', $out);
             }
         } else {
             $templateFile = 'noperms.tpl';
         }
     }
     return $template->fetch($templateFile);
 }
コード例 #11
0
ファイル: JxTemplate.php プロジェクト: joestump/jax
 /**
  * JxTemplate Constructor
  *
  * Sets up the Smarty template engine's various directories. If you would
  * like to make sitewide changes to the Smarty template engine this is the
  * place to do it. 
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param string $templatePath
  * @return void
  */
 function JxTemplate($templatePath)
 {
     if (is_dir($templatePath)) {
         $this->Smarty();
         $this->template_dir = $templatePath . '/templates';
         $this->compile_dir = $templatePath . '/templates_c';
         $this->config_dir = $templatePath . '/config';
         $this->cache_dir = $templatePath . '/cache';
         $this->templatePath = $templatePath;
     } else {
         $log =& JxSingleton::factory('log');
         $log->log('Invalid template directory: ' . $templatePath);
     }
 }
コード例 #12
0
ファイル: JxFieldHtmlArea.php プロジェクト: joestump/jax
 function JxFieldHtmlArea($name, $value = '', $width = 90, $height = 25)
 {
     $this->JxField($name, $value);
     $this->width = $width;
     $this->height = $height;
     $this->path = JX_URI_PATH . '/includes/HTMLArea';
     $page =& JxSingleton::factory('page');
     $page->addJsFile($this->path . '/htmlarea.js');
     $page->addJsFile($this->path . '/lang/en.js');
     $page->addJsFile($this->path . '/dialog.js');
     $page->addJsFile($this->path . '/popupwin.js');
     $page->addJsFile($this->path . '/plugins/TableOperations/table-operations.js');
     $page->addJsFile($this->path . '/plugins/TableOperations/lang/en.js');
     $page->addCssFile($this->path . '/htmlarea.css');
 }
コード例 #13
0
ファイル: JxAdminHtml.php プロジェクト: joestump/jax
 function JxAdminHtml()
 {
     $this->JxAdmin();
     $this->table = 'html';
     $this->primaryKey = 'contentID';
     $this->childTable = 'html';
     $this->titleField = 'title';
     $this->label = 'HTML Page Editor';
     $this->titles = array('Content ID', 'Title', 'Name');
     $this->showFields = array('contentID', 'title', 'name');
     $this->addField(array('type' => 'JxFieldText', 'name' => 'title', 'label' => 'Page &Title', 'size' => 55, 'maxLength' => 255, 'value' => stripslashes($_POST['title']), 'required' => true));
     $this->addField(array('type' => 'JxFieldText', 'name' => 'name', 'label' => 'Page &Name', 'size' => 25, 'maxLength' => 64, 'value' => $_POST['name'], 'required' => true));
     $this->addField(array('type' => 'JxFieldEditor', 'name' => 'html', 'label' => '&Content', 'height' => '500', 'value' => stripslashes($_POST['html']), 'required' => true));
     $this->addField(array('type' => 'JxFieldHidden', 'name' => 'lastUpdate', 'value' => time(), 'required' => true));
     $user =& JxSingleton::factory('user');
     $this->addField(array('type' => 'JxFieldHidden', 'name' => 'userID', 'value' => $user->userID, 'required' => true));
 }
コード例 #14
0
ファイル: JxFunctions.php プロジェクト: joestump/jax
/**
 * createID
 *
 * Create a 
 *
 * @author Joe Stump <*****@*****.**>
 * @package Util
 * @param string $table
 * @param string $key
 * @return int
 */
function JxCreateID($table, $key, $floor = 100000000, $ceiling = 999999999)
{
    $found = 0;
    $sql = "LOCK TABLES {$table}";
    $db = JxSingleton::factory('db');
    do {
        $rand = rand($floor, $ceiling);
        $sql = "SELECT *\n              FROM {$table}\n              WHERE {$key}={$rand}";
        $result = $db->query($sql);
        if (!DB::isError($result) && $result->numRows()) {
            $found = 0;
        } else {
            $found = 1;
        }
    } while (!$found);
    $sql = "UNLOCK TABLES";
    $db->query($sql);
    return $rand;
}
コード例 #15
0
ファイル: JxAdminContent.php プロジェクト: joestump/jax
 function render()
 {
     $user =& JxSingleton::factory('user');
     $template =& new JxTemplate(JX_BASE_PATH . '/modules/content/tpl');
     $templateFile = 'JxAdminContent.tpl';
     $sql = "SELECT C.*,U.email,\n                 SUM((CONV(R.permissions,8,10) & CONV(" . JX_USER_R . ",8,2))) AS r,\n                 SUM((CONV(R.permissions,8,10) & CONV(" . JX_USER_W . ",8,2))) AS w,\n                 SUM((CONV(R.permissions,8,10) & CONV(" . JX_USER_X . ",8,2))) AS x\n              FROM content AS C, content_groups AS R, users AS U\n              WHERE C.contentID=R.contentID AND\n                C.userID=U.userID AND\n                (R.groupID IN (" . implode(',', $user->groupIds) . ") OR\n                 C.userID='" . $user->userID . "') AND\n                (CONV(R.permissions,8,10) & CONV(" . JX_USER_W . ",8,2)) > 0 ";
     if (strlen($_GET['mime'])) {
         $sql .= " AND C.mime='" . $_GET['mime'] . "' ";
     }
     if (strlen($_POST['q'])) {
         $sql .= " AND MATCH (C.title) AGAINST ('" . $_POST['q'] . "') ";
     }
     $sql .= "GROUP BY C.contentID\n               ORDER BY C.posted DESC";
     $result = $this->db->query($sql);
     if (!DB::isError($result) && $result->numRows()) {
         $total = $result->numRows();
         $result->free();
     }
     $start = $_GET['start'] > 0 ? $_GET['start'] : 0;
     $limit = 30;
     $sql .= " \n LIMIT {$start},{$limit}";
     $template->assign('start', $start);
     $template->assign('limit', $limit);
     $template->assign('total', $total);
     $result = $this->db->query($sql);
     $content = array();
     if (!DB::isError($result) && $result->numRows()) {
         while ($row = $result->fetchRow()) {
             $iconFile = '/modules/' . $row['module'] . '/tpl/images/' . $row['mime'] . '_icon.gif';
             if (file_exists(JX_BASE_PATH . $iconFile)) {
                 $row['icon'] = JX_URI_PATH . $iconFile;
             } else {
                 $row['icon'] = JX_URI_PATH . '/modules/jax/tpl/images/unknown.gif';
             }
             $content[] = $row;
         }
     }
     $template->assign('content', $content);
     return $template->fetch($templateFile);
 }
コード例 #16
0
ファイル: debug.php プロジェクト: joestump/jax
 function render($module)
 {
     echo '<html><head><title>JAX - debug</title></head>' . "\n";
     echo '<body bgcolor="white">' . "\n";
     $showVars = array('path', 'templateFile', 'displayPage', 'pref', 'canWrite', 'canExec', 'canRead', 'forceSSL', 'presenter', 'name');
     $this->_debug($module, 'JxModule', $showVars);
     $this->_debug($GLOBALS['jx_error_stack'], 'Error Stack');
     $exclude = array('db', 'log', 'groups', '_debug', '_default_error_mode', '_default_error_options', '_default_error_handler', '_error_class', '_expected_errors');
     $this->_debug(JxSingleton::factory('User'), 'User', array(), $exclude);
     $this->_debug($module->data, 'Module Data');
     $this->_debug($module->template, 'Module Template');
     $this->_debug($_POST, '$_POST');
     $this->_debug($_GET, '$_GET');
     $foo = $_SERVER;
     $foo['HTTP_ACCEPT'] = explode(',', $foo['HTTP_ACCEPT']);
     $this->_debug($foo, '$_SERVER');
     $this->_debug($_SESSION, '$_SESSION');
     $this->_debug($_FILES, '$_SESSION');
     $this->_debug(JxSingleton::factory('page'), 'Page Template');
     $this->_debug(JxSingleton::factory('db'), 'DB');
     $this->_debug(JxSingleton::factory('log'), 'Log');
 }
コード例 #17
0
ファイル: JxGroup.php プロジェクト: joestump/jax
 /**
  * getGroups
  *
  * Static method to get the system groups ordered by name and keyed by
  * groupID.
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @return mixed
  */
 function getGroups()
 {
     $db =& JxSingleton::factory('db');
     static $groups = array();
     if (!count($groups)) {
         $sql = "SELECT *\n                    FROM groups\n                    ORDER BY name";
         $result = $db->query($sql);
         if (!PEAR::isError($result) && $result->numRows()) {
             while ($row = $result->fetchRow()) {
                 $groups[$row['groupID']] = $row['name'];
             }
         }
     }
     return $groups;
 }
コード例 #18
0
ファイル: index.php プロジェクト: joestump/jax
     $jaxModulePath = JX_CORE_PATH . '/modules';
     define('JX_CONTENT_PATH', JX_CORE_PATH . '/content');
     define('JX_SECURE_CONTENT_PATH', JX_CORE_PATH . '/../secure');
     define('JX_BASE_PATH', JX_CORE_PATH);
 } else {
     define('JX_CONTENT_PATH', JX_HOSTED_PATH . '/content');
     define('JX_SECURE_CONTENT_PATH', JX_CORE_PATH . '/../secure');
     if (in_array($jaxModule, $initialized)) {
         define('JX_BASE_PATH', JX_HOSTED_PATH);
     } else {
         define('JX_BASE_PATH', JX_CORE_PATH);
     }
     $jaxModulePath = JX_BASE_PATH . '/modules';
 }
 define('JX_BASE_LOG', JX_BASE_PATH . '/jax.log');
 $log =& JxSingleton::factory('log');
 JxPlugin::initializePlugins();
 JxPlugin::doHook('indexTop', $null);
 // Decide if we are running a default module or a sub-module
 $jaxClass = JxUri::getClass();
 if (file_exists($jaxModulePath . '/' . $jaxModule . '/' . $jaxClass . '.php')) {
     $jaxModuleFile = $jaxClass;
     // we are running a sub-module
 } else {
     $jaxModuleFile = $jaxModule;
 }
 if (JxModule::isValid($jaxModule)) {
     require_once $jaxModulePath . '/' . $jaxModule . '/config.php';
     require_once $jaxModulePath . '/' . $jaxModule . '/' . $jaxModuleFile . '.php';
     $module =& new $jaxModuleFile();
     // Possibly not used ... grep came up negative
コード例 #19
0
ファイル: basket.php プロジェクト: joestump/jax
 function __construct()
 {
     parent::__construct();
     $this->db =& JxSingleton::factory('db');
     $this->user =& JxSingleton::factory('user');
 }
コード例 #20
0
ファイル: JxModule.php プロジェクト: joestump/jax
 /**
  * isValid
  *
  * Static function to check whether a module is in good enough form to
  * attempt to initialize. It not only checks the modules table, but also
  * makes sure the module's directory structure is sane and that we can
  * at least write to the templates_c directory to compile templates. If
  * ANY of the tests return false then the module is deemed non-functional.
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param string $moduleName
  * @return bool
  */
 function isValid($moduleName)
 {
     $log =& JxSingleton::factory('log');
     $modules =& DB_DataObject::factory('modules');
     if (!PEAR::isError($modules)) {
         $modules->moduleName = $moduleName;
         if ($modules->find()) {
             $modulePath = JX_CORE_PATH . '/modules/' . $moduleName;
             if (JX_PATH_MODE !== JX_PATH_MODE_DEFAULT) {
                 $moduleFile = JX_HOSTED_PATH . '/modules/' . $moduleName . '/' . $moduleName . '.php';
                 if (file_exists($moduleFile)) {
                     $modulePath = JX_HOSTED_PATH . '/modules/' . $moduleName;
                 }
             }
             if (is_dir($modulePath)) {
                 if (file_exists($modulePath . '/' . $moduleName . '.php')) {
                     if (file_exists($modulePath . '/config.php')) {
                         if (is_writable($modulePath . '/tpl/templates_c') && is_writable($modulePath . '/tpl/cache')) {
                             return true;
                         } else {
                             $log->log('Cannot write template dir: ' . $moduleName);
                         }
                     } else {
                         $log->log('Invalid config file: ' . $modulePath);
                     }
                 } else {
                     $log->log('Invalid module file: ' . $moduleName);
                 }
             } else {
                 $log->log('Invalid module path: ' . $modulePath);
             }
         } else {
             $log->log('Module does not exist in DB: ' . $moduleName);
         }
     }
     return false;
 }
コード例 #21
0
ファイル: JxUser.php プロジェクト: joestump/jax
 /**
  * getUserId
  *
  * Returns the userID for a given $email. This function should be called
  * statically. Returns 0 (false) if the given email does not exist in
  * the database.
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param string $email
  * @return int
  */
 function getUserId($email)
 {
     $db =& JxSingleton::factory('db');
     if (!PEAR::isError($db)) {
         $sql = "SELECT userID\n                    FROM users\n                    WHERE email='{$email}'";
         $userID = $db->getOne($sql);
         if (!PEAR::isError($result) && is_numeric($userID)) {
             return $userID;
         }
     }
     return 0;
 }
コード例 #22
0
ファイル: JxPlugin.php プロジェクト: joestump/jax
 /**
  * initializePlugins
  *
  * This function is ran statically from the controller file before your
  * module is initialized. THERE IS NO REASON TO RUN THIS FROM YOUR 
  * APPLICATION!
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param mixed $pluginList
  * @return void 
  */
 function initializePlugins()
 {
     $plugins =& DB_DataObject::factory('plugins');
     $log =& JxSingleton::factory('log');
     if (!PEAR::isError($plugins)) {
         if ($plugins->find()) {
             while ($plugins->fetch()) {
                 $pluginFile = JX_HOSTED_PATH . '/modules/' . $plugins->module . '/plugins/' . $plugins->name . '.php';
                 // Override if a module specific does not exist
                 if (!file_exists($pluginFile)) {
                     $pluginFile = JX_CORE_PATH . '/modules/' . $plugins->module . '/plugins/' . $plugins->name . '.php';
                 }
                 if (file_exists($pluginFile)) {
                     if (!$plugins->available) {
                         continue;
                     }
                     include_once $pluginFile;
                     $class = $plugins->name;
                     if (class_exists($class)) {
                         $instance =& new $class();
                     } else {
                         $log->log('Plugin file exists, but no plugin is there!');
                     }
                 } else {
                     $log->log('Plugin file no longer exists, plugin deleted!');
                     $plugins->delete();
                 }
             }
         }
     }
 }
コード例 #23
0
ファイル: JxSession.php プロジェクト: joestump/jax
 /**
  * isValid
  *
  * Validates the user's session cookies against the latest session on
  * file in the sessions table.
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @return bool
  * @static
  */
 function isValid()
 {
     $db =& JxSingleton::factory('db');
     if (strlen($_SESSION['jax_sessionID']) == 32) {
         $sql = "SELECT sessionID\n                    FROM users_sessions\n                    WHERE userID='" . $_SESSION['jax_userID'] . "' \n                    ORDER BY posted DESC \n                    LIMIT 1";
         $sessionID = $db->getOne($sql);
         if (!PEAR::isError($sessionID) && $sessionID == $_SESSION['jax_sessionID']) {
             return true;
         }
     }
     return false;
 }
コード例 #24
0
ファイル: xmldata.php プロジェクト: joestump/jax
<?php

// Parse XML data files with JxXMLData
require_once '../JxConfig.php';
require_once JX_CORE_PATH . '/includes/XML/JxXMLData.php';
$moduleName = $argv[1];
if (is_dir('./' . $moduleName) && file_exists('./' . $moduleName . '/' . $moduleName . '-data.xml')) {
    echo 'Attempting to import XML ... ';
    $db =& JxSingleton::factory('db');
    $xml =& new JxXMLData();
    $xml->setInputFile('./' . $moduleName . '/' . $moduleName . '-data.xml');
    $xml->parse();
    if (PEAR::isError($xml)) {
        die("\n" . $xml->getMessage() . "\n");
    }
    $sql = $xml->getSQL();
    $errors = array();
    if (is_array($sql) && count($sql)) {
        for ($i = 0; $i < count($sql); ++$i) {
            $result = $db->query($sql[$i]);
            if (DB::isError($result)) {
                $errors[] = $result->getMessage();
                $errors[] = $sql[$i];
            }
        }
        if (count($errors)) {
            echo "\n";
            echo "!!!!!!!!!!! THE FOLLOWING ERRORS WERE REPORTED !!!!!!!!!!!\n";
            for ($i = 0; $i < count($errors); ++$i) {
                echo $errors[$i] . "\n";
            }
コード例 #25
0
ファイル: JxAdmin.php プロジェクト: joestump/jax
 /**
  * JxAdmin 
  *
  * JxAdmin class constructor. Sets default values for all of the variables.
  * DOES NOT DO ANY FORM PROCESSING!
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param string $table
  * @param string $primaryKey
  * @return void
  * @see JxObjectDb, JxTemplate
  */
 function JxAdmin()
 {
     $this->JxObjectDb();
     $this->table = null;
     $this->module = null;
     $this->primaryKey = null;
     $this->childTable = null;
     $this->form =& new JxHtmlForm();
     $this->fields = array();
     $this->messages = array();
     $this->label = null;
     $this->buttonText = 'Add';
     $this->recordStart = $_GET['start'] ? $_GET['start'] : 0;
     $this->recordLimit = $_GET['limit'] ? $_GET['limit'] : 30;
     $this->user =& JxSingleton::factory('user');
 }