function getPDFPrefs() { global $sql, $eArrayStorage; if (!is_object($eArrayStorage)) { e107_require_once(e_HANDLER . 'arraystorage_class.php'); $eArrayStorage = new ArrayData(); } if (!is_object($sql)) { $sql = new db(); } $num_rows = $sql->db_Select('core', '*', "e107_name='pdf' "); if ($num_rows == 0) { $tmp = $this->getDefaultPDFPrefs(); $tmp2 = $eArrayStorage->WriteArray($tmp); $sql->db_Insert('core', "'pdf', '" . $tmp2 . "' "); $sql->db_Select('core', '*', "e107_name='pdf' "); } $row = $sql->db_Fetch(); $pdfPref = $eArrayStorage->ReadArray($row['e107_value']); return $pdfPref; }
/** * Ensure the tree of userclass data is stored in our object ($this->class_tree). * Only read if its either not present, or the $force flag is set. * Data is cached if enabled * * @param boolean $force - set to TRUE to force a re-read of the info regardless. * @return none */ public function readTree($force = FALSE) { if (isset($this->class_tree) && count($this->class_tree) && !$force) { return; } $e107 = e107::getInstance(); $this->class_tree = array(); $this->class_parents = array(); $array = new ArrayData(); if ($temp = $e107->ecache->retrieve_sys(UC_CACHE_TAG)) { $this->class_tree = $array->ReadArray($temp); unset($temp); } else { $this->sql_r->db_Select('userclass_classes', '*', "ORDER BY userclass_parent", 'nowhere'); // The order statement should give a consistent return while ($row = $this->sql_r->db_Fetch(MYSQL_ASSOC)) { $this->class_tree[$row['userclass_id']] = $row; $this->class_tree[$row['userclass_id']]['class_children'] = array(); // Create the child array in case needed } // Add in any fixed classes that aren't already defined foreach ($this->fixed_classes as $c => $d) { if (!isset($this->class_tree[$c])) { switch ($c) { case e_UC_ADMIN: case e_UC_MAINADMIN: $this->class_tree[$c]['userclass_parent'] = e_UC_NOBODY; break; case e_UC_NEWUSER: $this->class_tree[$c]['userclass_parent'] = e_UC_MEMBER; break; default: $this->class_tree[$c]['userclass_parent'] = e_UC_PUBLIC; } $this->class_tree[$c]['userclass_id'] = $c; $this->class_tree[$c]['userclass_name'] = $d; $this->class_tree[$c]['userclass_description'] = 'Fixed class'; $this->class_tree[$c]['userclass_visibility'] = e_UC_PUBLIC; $this->class_tree[$c]['userclass_editclass'] = e_UC_MAINADMIN; $this->class_tree[$c]['userclass_accum'] = $c; $this->class_tree[$c]['userclass_type'] = UC_TYPE_STD; } } $userCache = $array->WriteArray($this->class_tree, FALSE); $e107->ecache->set_sys(UC_CACHE_TAG, $userCache); unset($userCache); } // Now build the tree. // There are just two top-level classes - 'Everybody' and 'Nobody' $this->class_parents[e_UC_PUBLIC] = e_UC_PUBLIC; $this->class_parents[e_UC_NOBODY] = e_UC_NOBODY; foreach ($this->class_tree as $uc) { if ($uc['userclass_id'] != e_UC_PUBLIC && $uc['userclass_id'] != e_UC_NOBODY) { if (!isset($this->class_tree[$uc['userclass_parent']])) { echo "Orphaned class record: ID=" . $uc['userclass_id'] . " Name=" . $uc['userclass_name'] . " Parent=" . $uc['userclass_parent'] . "<br />"; } else { // Add to array $this->class_tree[$uc['userclass_parent']]['class_children'][] = $uc['userclass_id']; } } } }
/** * Called to process outstanding PMs (which are always bulk lists) * * Emails are added to the queue. * Various events are logged in a text file * * @return none */ public function processPM() { global $pref; require_once e_PLUGIN . 'pm/pm_class.php'; $this->startTime = mktime(0, 0, 0, date('n'), date('d'), date('Y')); // Date for start processing $this->logRequirement = varset($pref['eventpost_emaillog'], 0); if ($this->debugLevel >= 2) { $this->logRequirement = 2; } // Force full logging if debug // Start of the 'real' code if ($this->ourDB->db_Select('generic', '*', "`gen_type` = 'pm_bulk' LIMIT 1")) { $pmRow = $this->ourDB->db_Fetch(MYSQL_ASSOC); $this->logLine("\r\n\r\n" . str_replace('--NUM--', $pmRow['gen_intdata'], LAN_EC_PM_06) . date('D j M Y G:i:s')); $this->ourDB->db_Delete('generic', "`gen_type` = 'pm_bulk' AND `gen_id` = " . $pmRow['gen_id']); $array = new ArrayData(); $pmData = $array->ReadArray($pmRow['gen_chardata']); unset($pmRow); $this->pmClass = new private_message(); $this->pmClass->add($pmData); $this->logLine(' .. Run completed', TRUE, TRUE); } return TRUE; }
/** * Given an array (row) of data retrieved from the DB table, converts to internal format. * Combining/splitting of fields is done as necessary * This version intended for 'Joined' reads which have both recipient and content data * * @param $data - array of DB-sourced target-related data * @param $addMissing - if TRUE, undefined fields are added * * @return void */ public function dbToBoth(&$data, $addMissing = FALSE) { $res = array(); $oneToOne = array_merge($this->dbTypes['mail_content'], $this->dbTypes['mail_recipients']); // List of valid elements // Start with simple 'one to one' fields foreach ($oneToOne as $f => $v) { if (isset($data[$f])) { $res[$f] = $data[$f]; } elseif ($addMissing) { $res[$f] = ''; } } // Now array fields $array = new ArrayData(); if (isset($data['mail_other'])) { $tmp = $array->ReadArray($data['mail_other']); if (is_array($tmp)) { $res = array_merge($res, $tmp); } unset($res['mail_other']); } elseif ($addMissing) { foreach ($this->dbOther as $f => $v) { $res[$f] = ''; } } if (isset($data['mail_target_info'])) { $tmp = $array->ReadArray($data['mail_target_info']); $res['mail_target_info'] = $tmp; } return $res; }
$row = mysql_fetch_array($result); $pref = unserialize(base64_decode($row['e107_value'])); $PrefOutput = $eArrayStorage->WriteArray($pref); mysql_query("DELETE FROM " . $mySQLprefix . "core WHERE `e107_name` = 'SitePrefs' OR `e107_name` = 'SitePrefs_Backup'"); mysql_query("INSERT INTO " . $mySQLprefix . "core VALUES ('SitePrefs', '{$PrefOutput}')"); mysql_query("INSERT INTO " . $mySQLprefix . "core VALUES ('SitePrefs_Backup', '{$PrefOutput}')"); $message = "Core backup successfully restored. <br /><br /><a href='../../index.php'>Click here to continue</a>"; $END = TRUE; } if (isset($_POST['reset_core_sub']) && $_POST['mode'] == 1) { if (($at = e_verify()) === FALSE) { exit; } $result = @mysql_query("SELECT * FROM " . $mySQLprefix . "core WHERE e107_name='SitePrefs'"); $row = @mysql_fetch_array($result); $pref = $eArrayStorage->ReadArray($row['e107_value']); echo "\n\t\t<span class='headertext2'><b>Edit your individual core items and click the button to save - <span class='headertext'>use this script with caution</span>.</b></span><br /><br />\n\t\t<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n\t\t<table style='width:95%'>\n"; while (list($key, $prefr) = each($pref)) { if (is_array($prefr)) { foreach ($prefr as $akey => $apref) { echo "<tr><td class='headertext2' style='width:50%; text-align:right;'>{$key}[{$akey}] </td>\n\t\t\t\t<td style='width:50%'><input type='text' name='{$key}[{$akey}]' value='{$apref}' size='50' maxlength='100' /></td></tr>\n"; } } else { echo "<tr><td class='headertext2' style='width:50%; text-align:right;'>{$key} </td>\n\t\t\t<td style='width:50%'><input type='text' name='{$key}' value='{$prefr}' size='50' maxlength='100' /></td></tr>\n"; } } echo "\n\t\t<tr>\n\t\t<td colspan='2' style='text-align:center'><br /><input class='button' type='submit' name='coreedit_sub' value='Save Core Settings' /></td>\n\t\t</tr>\n\t\t</table>\n\t\t<input type='hidden' name='a_name' value='" . $_POST['a_name'] . "' />\n\t\t<input type='hidden' name='a_password' value='" . preg_replace("/\\W/", '', $_POST['a_password']) . "' />\n\t\t</form>"; $END = TRUE; } if (isset($message)) { echo "<br /><br /><div style='text-align:center'><span class='headertext2'>{$message}</span></div><br />";