public static function get_fielddefs()
 {
     if (cge_tmpdata::exists('cgfb_fielddefs')) {
         return cge_tmpdata::get('cgfb_fielddefs');
     }
     $db = cmsms()->GetDb();
     $query = 'SELECT * FROM ' . CGFEEDBACK_TABLE_FIELDDEFS . ' ORDER BY iorder';
     $tmp = $db->GetArray($query);
     if (is_array($tmp)) {
         for ($i = 0; $i < count($tmp); $i++) {
             $tmp[$i]['attribs'] = unserialize($tmp[$i]['attribs']);
             if (isset($tmp[$i]['attribs']['options'])) {
                 $t2 = cge_array::explode_with_key($tmp[$i]['attribs']['options'], '=', "\n");
                 $tmp[$i]['attribs']['options'] = array_flip($t2);
             }
         }
         $tmp = cge_array::to_hash($tmp, 'id');
         cge_tmpdata::set('cgfb_fielddefs', $tmp);
         return $tmp;
     }
 }
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
// an order has been deleted.
if (!isset($params['order_id'])) {
    return;
}
// handle the case of attempted recursion.
if (cge_tmpdata::exists(__FILE__)) {
    return;
}
cge_tmpdata::set(__FILE__, 1);
// here we grab the order directly.
$order_id = (int) $params['order_id'];
$order_obj = orders_ops::load_by_id($order_id);
if (!$order_obj) {
    return;
}
// find the line item with a SelfReg Subscription.
for ($s = 0; $s < $order_obj->count_destinations(); $s++) {
    $shipping = $order_obj->get_shipping($s);
    for ($i = 0; $i < $shipping->count_all_items(); $i++) {
        $item = $shipping->get_item($i);
        if ($item->get_source() != 'SelfRegistration') {
 public static function cge_array_getall($params, &$smarty)
 {
     if (!isset($params['array'])) {
         // no params, do nothing.
         return;
     }
     $arr = trim($params['array']);
     if ($arr == '') {
         return;
     }
     if (!cge_tmpdata::exists($arr)) {
         return;
     }
     $data = cge_tmpdata::get($arr);
     if (isset($params['assign'])) {
         $smarty->assign(trim($params['assign']), $data);
         return;
     }
     return $data;
 }
 public function autoload($classname)
 {
     if (!is_object($this)) {
         return FALSE;
     }
     // check for classes.
     global $CMS_ADMIN_PAGE;
     $prefix = '';
     //     if( !isset($CMS_ADMIN_PAGE) )
     //       {
     // 	$prefix = '';
     //       }
     //     else
     //       {
     // 	$config = cmsms()->GetConfig();
     // 	$prefix = $config['root_path'].'/';
     //       }
     $fn = $prefix . $this->GetModulePath() . "/lib/class.{$classname}.php";
     if (file_exists($fn)) {
         require_once $fn;
         return TRUE;
     }
     // check for interfaces
     $fn = $prefix . $this->GetModulePath() . "/lib/interface.{$classname}.php";
     if (file_exists($fn)) {
         require_once $fn;
         return TRUE;
     }
     // check for a master file
     $fn = $prefix . $this->GetModulePath() . "/lib/extraclasses.php";
     if (file_exists($fn)) {
         $extraclasses = array();
         if (cge_tmpdata::exists('extraclasses')) {
             $extraclasses = cge_tmpdata::get('extraclasses');
         }
         if (!in_array($fn, $extraclasses)) {
             require_once $fn;
             $extraclasses[] = $fn;
             cge_tmpdata::set('extraclasses', $extraclasses);
             return TRUE;
         }
     }
     return FALSE;
 }
Example #5
0
 /**
  * A quick wrapper around cms_utils::get_module that will try to use a module name saved in tmpdata
  * (the module name is stored in tmpdata in each request, for CGExtensions derived modules)
  *
  * @deprecated
  * @see cms_utils::get_module
  * @param string $module_name
  * @param string $version The desired module version
  * @return object The module object.  or null
  */
 public static function &get_module($module_name = '', $version = '')
 {
     if (empty($module_name)) {
         $version = '';
         if (cge_tmpdata::exists('module')) {
             $module_name = cge_tmpdata::get('module');
         }
     }
     $out = null;
     if ($module_name) {
         $out = cms_utils::get_module($module_name, $version);
     }
     return $out;
 }
 public static function &get_module($module_name = '', $version = '', $op = '')
 {
     if (empty($module_name) && cge_tmpdata::exists('module')) {
         $module_name = cge_tmpdata::get('module');
     }
     return cms_utils::get_module($module_name, $version);
 }
 private function _old_LoggedInId()
 {
     $gCms = cmsms();
     $config = $gCms->GetConfig();
     if (cge_tmpdata::exists('feu_logginid')) {
         // this will save a few queries in each request
         return cge_tmpdata::get('feu_logginid');
     }
     $sessionid = session_id();
     $this->ExpireUsers();
     if ($sessionid == "") {
         return false;
     }
     $db = $this->GetDb();
     $module = $this->GetModule();
     $expirytime = $module->GetPreference('user_session_expires');
     $expireusers_interval = $module->GetPreference('expireusers_interval');
     $interval = min($expireusers_interval, $expirytime);
     $q = "SELECT userid FROM " . cms_db_prefix() . "module_feusers_loggedin WHERE sessionid=?";
     $p = array($sessionid);
     $result = $db->GetOne($q, $p);
     if ($result) {
         // we know this user is logged in.
         $retval = $result;
         // now touch the lastused
         // this will ensure that every time we check that a user is
         // logged in, it touches his logged in entry
         $q = "UPDATE " . cms_db_prefix() . "module_feusers_loggedin SET lastused = ? where sessionid = ?";
         $db->Execute($q, array(time(), $sessionid));
         // refresh the cookie.
         @setcookie('feu_sessionid', $sessionid, time() + $expirytime, "/");
         @setcookie('feu_uid', $uid, time() + $expirytime, "/");
         cge_tmpdata::set('feu_logginid', $retval);
         // set some session data to save some db queries.
         // and send an event.
         $module->SendEvent('OnRefreshUser', array('id' => $retval));
         return $retval;
     } else {
         if ($module->GetPreference('cookie_keepalive', 0) && isset($_COOKIE['feu_sessionid']) && isset($_COOKIE['feu_uid'])) {
             // no session id, but we have a cookie, so what we'll do
             // is first check to see if the session is still logged in
             // if it is, force a logout for that session id
             // and start a new record, otherwise, ignore the cookie
             $uid = $_COOKIE['feu_uid'];
             $sessionid = $_COOKIE['feu_sessionid'];
             // delete the existing record
             $q = "DELETE FROM " . cms_db_prefix() . "module_feusers_loggedin \n                        WHERE sessionid = ?";
             $db->Execute($q, array($sessionid));
             // log the user in
             // todo, log this too,
             // rationalize this code with Login() and Logout() methods
             @session_start();
             $sessionid = session_id();
             $q = "INSERT INTO " . cms_db_prefix() . "module_feusers_loggedin\n                    (sessionid,lastused,userid)\n                  VALUES (?,?,?)";
             $db->Execute($q, array($sessionid, time(), $uid));
             // set the cookie again
             @setcookie('feu_sessionid', $sessionid, time() + $expirytime, "/");
             @setcookie('feu_uid', $uid, time() + $expirytime, "/");
             cge_tmpdata::set('feu_logginid', $uid);
             $module->SendEvent('OnRefreshUser', array('id' => $uid));
             return $uid;
         } else {
             $res = $this->_attempt_login_with_cookie();
             if (!is_array($res) || $res[0] == FALSE) {
                 return false;
             }
             $module->SendEvent('OnRefreshUser', array('id' => $res[0]));
             return $res[0];
         }
     }
     return false;
 }