makeCode() 정적인 공개 메소드

returns code (str)
static public makeCode ( $length = false )
예제 #1
0
 * 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 program; see the file docs/LICENSE. If not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require 'bootstrap.php';
Pommo::init();
require_once Pommo::$_baseDir . 'classes/Pommo_Mail_Ctl.php';
set_time_limit(0);
$code = Pommo_Helper::makeCode();
if (!Pommo_Mail_Ctl::spawn(Pommo::$_baseUrl . 'mailing.runtime2.php?code=' . $code)) {
    Pommo::kill('Initial Spawn Failed! You must correct this before poMMo can send mailings.');
}
echo 'Initial Run Time: ' . ini_get('max_execution_time') . ' seconds <br>';
echo '<br/> This test takes at least 90 seconds. Upon completetion "SUCCESS" will be printed. If you do not see "SUCCESS", the max runtime should be set near the second highest "reported working" value.';
echo '<hr>';
echo '<b>Reported working value(s)</b><br />';
ob_flush();
flush();
sleep(5);
if (!is_file(Pommo::$_workDir . '/mailing.test.php')) {
    // make sure we can write to the file
    if (!($handle = fopen(Pommo::$_workDir . '/mailing.test.php', 'w'))) {
        Pommo::kill('Unable to write to test file!');
    }
예제 #2
0
if ($logger->isErr() || !Pommo_Validate::subscriberData($subscriber['data'], array('active' => FALSE))) {
    $smarty->assign('back', TRUE);
    $smarty->display('user/process.tpl');
    Pommo::kill();
}
$comments = isset($_POST['comments']) ? substr($_POST['comments'], 0, 255) : false;
/**********************************
	ADD SUBSCRIBER
 *********************************/
$config = Pommo_Api::configGet(array('site_success', 'site_confirm', 'list_confirm', 'notices'));
$notices = unserialize($config['notices']);
require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
if ($config['list_confirm'] == 'on') {
    // email confirmation required.
    // add user as "pending"
    $subscriber['pending_code'] = Pommo_Helper::makeCode();
    $subscriber['pending_type'] = 'add';
    $subscriber['status'] = 2;
    $id = Pommo_Subscribers::add($subscriber);
    if (!$id) {
        $logger->addErr('Error adding subscriber! Please contact the administrator.');
        $smarty->assign('back', TRUE);
    } else {
        $logger->addMsg(Pommo::_T('Subscription request received.'));
        // send confirmation message.
        if (Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'code' => $subscriber['pending_code'], 'type' => 'confirm'))) {
            $subscriber['registered'] = date("F j, Y, g:i a", $subscriber['registered']);
            if ($comments || isset($notices['pending']) && $notices['pending'] == 'on') {
                Pommo_Helper_Messages::notify($notices, $subscriber, 'pending', $comments);
            }
            if ($config['site_confirm']) {
예제 #3
0
     $table = $dbo->table[$key];
     $sql = 'DROP TABLE IF EXISTS ' . $table;
     $dbo->query($sql);
 }
 if (isset($_REQUEST['debugInstall'])) {
     $dbo->debug(TRUE);
 }
 $install = Pommo_Install::parseSQL();
 if ($install) {
     // installation of DB went OK, set configuration values to user supplied ones
     $pass = $_POST['admin_password'];
     // install configuration
     $_POST['admin_password'] = md5($_POST['admin_password']);
     Pommo_Api::configUpdate($_POST);
     // generate key to uniquely identify this installation
     $key = Pommo_Helper::makeCode(6);
     Pommo_Api::configUpdate(array('key' => $key), TRUE);
     Pommo::reloadConfig();
     // load configuration [depricated?], set message defaults, load templates
     require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
     Pommo_Helper_Messages::resetDefault('all');
     // install templates
     $file = Pommo::$_baseDir . 'sql/sql.templates.php';
     if (!Pommo_Install::parseSQL(false, $file)) {
         $logger->addErr('Error Loading Default Mailing Templates.');
     }
     $logger->addMsg(Pommo::_T('Installation Complete! You may now login and setup poMMo.'));
     $logger->addMsg(Pommo::_T('Login Username: '******'admin');
     $logger->addMsg(Pommo::_T('Login Password: '******'installed', TRUE);
 } else {
예제 #4
0
 function add(&$subscriber, $type = null)
 {
     global $pommo;
     $dbo =& Pommo::$_dbo;
     $logger =& Pommo::$_logger;
     switch ($type) {
         case 'add':
         case 'del':
         case 'change':
         case 'password':
             break;
         default:
             $logger->addErr('Unknown type passed to Pommo_Pending::add');
             return false;
     }
     $p = array('subscriber_id' => $subscriber['id'], 'type' => $type, 'code' => Pommo_Helper::makeCode(), 'array' => $type == 'change' ? $subscriber : array());
     $pending = Pommo_Pending::make($p);
     if (!Pommo_Pending::validate($pending)) {
         $logger->addErr('Pommo_Pending::add() failed validation');
         return false;
     }
     if (!empty($pending['array'])) {
         $pending['array'] = serialize($pending['array']);
     }
     // check for pre-existing pending request
     if (Pommo_Pending::isPending($pending['subscriber_id'])) {
         return false;
     }
     $query = "\n\t\t\tINSERT INTO " . $dbo->table['subscriber_pending'] . "\n\t\t\tSET\n\t\t\t\t[pending_array='%S',]\n\t\t\t\tsubscriber_id=%i,\n\t\t\t\tpending_type='%s',\n\t\t\t\tpending_code='%s'";
     $query = $dbo->prepare($query, array($pending['array'], $pending['subscriber_id'], $pending['type'], $pending['code']));
     if (!$dbo->query($query)) {
         return false;
     }
     return $pending['code'];
 }
예제 #5
0
 function add(&$in)
 {
     $dbo = Pommo::$_dbo;
     // set the start time if not provided
     if (empty($in['start'])) {
         $in['start'] = time();
     }
     if (empty($in['sent'])) {
         $in['sent'] = 0;
     }
     if (!Pommo_Mailing::validate($in)) {
         return false;
     }
     //	Add image to track views
     if (1 == $in['track']) {
         $in['body'] .= '<img src="http://' . $_SERVER['SERVER_NAME'] . Pommo::$_baseUrl . 'track-[[!mailing_id]]-[[!subscriber_id]]' . '.png">';
     }
     $query = "INSERT INTO " . $dbo->table['mailings'] . "\n                SET\n                [fromname='%S',]\n                [fromemail='%S',]\n                [frombounce='%S',]\n                [subject='%S',]\n                [body='%S',]\n                [altbody='%S',]\n                [ishtml='%S',]\n                [mailgroup='%S',]\n                [subscriberCount=%I,]\n                [finished=FROM_UNIXTIME(%I),]\n                [sent=%I,]\n                [charset='%S',]\n                [status=%I,]\n                [track=%I,]\n                started=FROM_UNIXTIME(%i)";
     $query = $dbo->prepare($query, @array($in['fromname'], $in['fromemail'], $in['frombounce'], $in['subject'], $in['body'], $in['altbody'], $in['ishtml'], $in['group'], $in['tally'], $in['end'], $in['sent'], $in['charset'], $in['status'], $in['track'], $in['start']));
     // fetch new mailing_id
     $id = $dbo->lastId($query);
     if (!$id) {
         return false;
     }
     // Save the attachments
     if ($in['attachments']) {
         $attach = explode(',', $in['attachments']);
         foreach ($attach as $key => $attachment) {
             $query = "INSERT INTO " . $dbo->table['mailings_attachments'] . "\n                        SET\n                        [mailing_id='%I',]\n                        [file_id='%I']";
             $query = $dbo->prepare($query, @array($id, $attachment));
             $dbo->query($query);
         }
     }
     // insert current if applicable
     if (!empty($in['status']) && $in['status'] == 1) {
         if (empty($in['code'])) {
             $in['code'] = Pommo_Helper::makeCode();
         }
         $query = "INSERT INTO " . $dbo->table['mailing_current'] . "\n            SET\n            [command='%S',]\n            [serial=%I,]\n            [securityCode='%S',]\n            [current_status='%S',]\n            current_id=%i";
         $query = $dbo->prepare($query, @array($in['command'], $in['serial'], $in['code'], $in['current_status'], $id));
         if (!$dbo->query($query)) {
             return false;
         }
         return $in['code'];
     }
     return $id;
 }
예제 #6
0
 function add(&$in)
 {
     $dbo =& Pommo::$_dbo;
     // set the start time if not provided
     if (empty($in['start'])) {
         $in['start'] = time();
     }
     if (empty($in['sent'])) {
         $in['sent'] = 0;
     }
     if (!Pommo_Mailing::validate($in)) {
         return false;
     }
     $query = "\n\t\t\tINSERT INTO " . $dbo->table['mailings'] . "\n\t\t\tSET\n\t\t\t[fromname='%S',]\n\t\t\t[fromemail='%S',]\n\t\t\t[frombounce='%S',]\n\t\t\t[subject='%S',]\n\t\t\t[body='%S',]\n\t\t\t[altbody='%S',]\n\t\t\t[ishtml='%S',]\n\t\t\t[mailgroup='%S',]\n\t\t\t[subscriberCount=%I,]\n\t\t\t[finished=FROM_UNIXTIME(%I),]\n\t\t\t[sent=%I,]\n\t\t\t[charset='%S',]\n\t\t\t[status=%I,]\n\t\t\tstarted=FROM_UNIXTIME(%i)";
     $query = $dbo->prepare($query, @array($in['fromname'], $in['fromemail'], $in['frombounce'], $in['subject'], $in['body'], $in['altbody'], $in['ishtml'], $in['group'], $in['tally'], $in['end'], $in['sent'], $in['charset'], $in['status'], $in['start']));
     // fetch new subscriber's ID
     $id = $dbo->lastId($query);
     if (!$id) {
         return false;
     }
     // insert current if applicable
     if (!empty($in['status']) && $in['status'] == 1) {
         if (empty($in['code'])) {
             $in['code'] = Pommo_Helper::makeCode();
         }
         $query = "\n\t\t\tINSERT INTO " . $dbo->table['mailing_current'] . "\n\t\t\tSET\n\t\t\t[command='%S',]\n\t\t\t[serial=%I,]\n\t\t\t[securityCode='%S',]\n\t\t\t[current_status='%S',]\n\t\t\tcurrent_id=%i";
         $query = $dbo->prepare($query, @array($in['command'], $in['serial'], $in['code'], $in['current_status'], $id));
         if (!$dbo->query($query)) {
             return false;
         }
         return $in['code'];
     }
     return $id;
 }