Example #1
0
 $formErrors = explode("[@]", $sr->Get('form_errors'));
 /* Stopped Subscription */
 if (intval($sr->Get('subscription_stop')) != 0) {
     die(errMod(showIn($formErrors[3], 'page'), 'danger'));
     # Custom Error (Subscription Stopped)
 }
 /* Fetch Form Variables */
 $opFields = $myconn->query("SELECT * FROM " . db_table_pref . "subscribe_form_fields WHERE FID=" . $sr->Get('ID') . " ORDER BY sorting ASC") or die(mysqli_error($myconn));
 $errText = '';
 $saveList = array();
 $GRP = 0;
 # Check Group Availability
 $opGrp = $myconn->query("SELECT * FROM " . db_table_pref . "subscriber_groups WHERE OID=" . intval($srOrg->Get('ID')) . " AND ID=" . $sr->Get('form_group') . "") or die(mysqli_error($myconn));
 if (mysqli_num_rows($opGrp) == 0) {
     # There no group found, Add to Ungroup
     $GRP = getOrgData($srOrg->Get('ID'), 0);
 } else {
     $GRP = $sr->Get('form_group');
 }
 $saveList['GID']['data'] = $GRP;
 $saveList['GID']['type'] = 'number';
 $saveList['GID']['label'] = 'Group';
 while ($opFieldsRs = $opFields->fetch_assoc()) {
     /* Check errors */
     if (isset($_POST[$opFieldsRs['field_name']])) {
         if ($opFieldsRs['field_required'] == 1) {
             # Required Fields
             if (empty($_POST[$opFieldsRs['field_name']])) {
                 $errText .= '* ' . showIn($opFieldsRs['field_error'], 'page') . '<br>';
             } else {
                 /* E-Mail */
        // A list of names of data record attributes that contain y-values.
        ykeys: ['money'],
        // Labels for the ykeys -- will be displayed when you hover over the
        // chart.
        labels: ['Value']
    });
HTML;
    echo <<<HTML
    new Morris.Bar({
        // ID of the element in which to draw the chart.
        element: 'myfirstchart2',
        // Chart data records -- each entry in this array corresponds to a point on
        // the chart.
        data:
HTML;
    getOrgData($_GET["keyword"]);
    echo <<<HTML
        ,
        // The name of the data record attribute that contains x-values.
        xkey: 'year',
        // A list of names of data record attributes that contain y-values.
        ykeys: ['money'],
        // Labels for the ykeys -- will be displayed when you hover over the
        // chart.
        labels: ['Value']
    });
</script>
HTML;
}
?>
Example #3
0
 public function addOrganization()
 {
     global $myconn;
     global $LETHE_ORG_DISK_QUOTA_LIST;
     global $LETHE_ORG_EDITABLE_CODES;
     global $LETHE_SUBSCRIBE_ERRORS;
     $this->errPrint = '';
     if (!isset($_POST['org_name']) || empty($_POST['org_name'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_organization_name . '<br>';
     }
     if (!isset($_POST['org_max_user']) || !is_numeric($_POST['org_max_user'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_user_limit . '<br>';
     }
     if (!isset($_POST['org_max_newsletter']) || !is_numeric($_POST['org_max_newsletter'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_newsletter_limit . '<br>';
     }
     if (!isset($_POST['org_max_autoresponder']) || !is_numeric($_POST['org_max_autoresponder'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_autoresponder_limit . '<br>';
     }
     if (!isset($_POST['org_max_subscriber']) || !is_numeric($_POST['org_max_subscriber'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_subscriber_limit . '<br>';
     }
     if (!isset($_POST['org_max_subscriber_group']) || !is_numeric($_POST['org_max_subscriber_group'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_subscriber_group_limit . '<br>';
     }
     if (!isset($_POST['org_max_subscribe_form']) || !is_numeric($_POST['org_max_subscribe_form'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_subscribe_form_limit . '<br>';
     }
     if (!isset($_POST['org_max_blacklist']) || !is_numeric($_POST['org_max_blacklist'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_black_list_limit . '<br>';
     }
     if (!isset($_POST['org_max_template']) || !is_numeric($_POST['org_max_template'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_maximum_template_limit . '<br>';
     }
     if (!isset($_POST['org_max_shortcode']) || !is_numeric($_POST['org_max_shortcode'])) {
         $this->errPrint .= '* ' . organizations_please_enter_maximum_short_code_limit . '<br>';
     }
     if (!isset($_POST['org_max_daily_limit']) || !is_numeric($_POST['org_max_daily_limit'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_daily_sending_limit . '<br>';
     }
     if (!isset($_POST['org_standby_organization']) || !is_numeric($_POST['org_standby_organization'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_standby_time_for_organizations . '<br>';
     }
     if (!isset($_POST['org_submission_account']) || intval($_POST['org_submission_account']) == 0) {
         $this->errPrint .= '* ' . organizations_please_choose_a_submission_account . '<br>';
     }
     if (!isset($_POST['org_sender_title']) || empty($_POST['org_sender_title'])) {
         $this->errPrint .= '* ' . organizations_please_enter_a_sender_title . '<br>';
     }
     if (!isset($_POST['org_reply_mail']) || !mailVal($_POST['org_reply_mail'])) {
         $this->errPrint .= '* ' . organizations_invalid_reply_mail . '<br>';
     }
     if (!isset($_POST['org_test_mail']) || !mailVal($_POST['org_test_mail'])) {
         $this->errPrint .= '* ' . organizations_invalid_test_mail . '<br>';
     }
     if (!isset($_POST['org_timezone']) || empty($_POST['org_timezone'])) {
         $this->errPrint .= '* ' . organizations_please_choose_a_timezone . '<br>';
     }
     if (!isset($_POST['org_after_unsubscribe']) || !is_numeric($_POST['org_after_unsubscribe'])) {
         $this->errPrint .= '* ' . organizations_please_choose_a_unsubscribe_action . '<br>';
     }
     if (!isset($_POST['org_verification']) || !is_numeric($_POST['org_verification'])) {
         $this->errPrint .= '* ' . organizations_please_choose_a_verification_method . '<br>';
     }
     if (!isset($_POST['org_random_load']) || empty($_POST['org_random_load'])) {
         $_POST['org_random_load'] = '';
     } else {
         $_POST['org_random_load'] = 1;
     }
     if (!isset($_POST['org_load_type']) || !is_numeric($_POST['org_load_type'])) {
         $this->errPrint .= '* ' . organizations_please_choose_a_load_type . '<br>';
     }
     if (!isset($_POST['org_max_disk_quota']) || !in_array($_POST['org_max_disk_quota'], $LETHE_ORG_DISK_QUOTA_LIST)) {
         $this->errPrint .= '* ' . organizations_invalid_disk_quota_value . '<br>';
     }
     if ($this->errPrint == '') {
         /* Common Values */
         $this->isPrimary = cntData("SELECT * FROM " . db_table_pref . "organizations WHERE isPrimary=1") == 0 ? 1 : 0;
         $billingDate = $this->billingDate == 0 ? '' : $this->billingDate;
         $orgTag = $this->orgTag == '' ? slugify($_POST['org_name'] . '-' . substr(encr($_POST['org_name'] . time()), 0, 12)) : $this->orgTag;
         $public_key = $this->public_key == '' ? md5($orgTag . time() . rand() . $_POST['org_name'] . uniqid(true)) : $this->public_key;
         $private_key = $this->private_key == '' ? md5($orgTag . sha1(time() . rand() . $_POST['org_name'] . uniqid(true)) . sha1(uniqid(true))) : $this->private_key;
         $genAPIKey = sha1($private_key + time() + $_SERVER['REMOTE_ADDR'] + $private_key + $public_key);
         $genAPIKey = substr(base64_encode($genAPIKey), 0, 32);
         # RSS Url
         if (!isset($_POST['org_rss_url']) || empty($_POST['org_rss_url'])) {
             # Define as system URL
             $_POST['org_rss_url'] = lethe_root_url . 'lethe.newsletter.php?pos=rss&oid=' . $public_key;
         } else {
             $_POST['org_rss_url'] = $_POST['org_rss_url'];
         }
         $addOrg = $myconn->prepare("INSERT INTO \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . db_table_pref . "organizations\n\t\t\t\t\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\t\t\t\t\t\torgTag=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\torgName=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbillingDate=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisActive=1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpublic_key=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprivate_key=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tapi_key=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tip_addr=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisPrimary=" . $this->isPrimary . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trss_url=?\n\t\t\t\t\t\t\t\t\t\t\t\t\t") or die(mysqli_error($myconn));
         $addOrg->bind_param('ssssssss', $orgTag, $_POST['org_name'], $billingDate, $public_key, $private_key, $genAPIKey, $_SERVER['REMOTE_ADDR'], $_POST['org_rss_url']);
         $addOrg->execute();
         $addOrg->close();
         /* Organization ID */
         $orgID = $myconn->insert_id;
         $this->OID = $orgID;
         /* Create Folders */
         if (mkdir(LETHE_RESOURCE . DIRECTORY_SEPARATOR . $orgTag, 0755)) {
             mkdir(LETHE_RESOURCE . DIRECTORY_SEPARATOR . $orgTag . '/expimp', 0755);
         }
         /* Load Settings */
         global $LETHE_ORG_SET_VALS;
         $addSet = $myconn->prepare("INSERT INTO " . db_table_pref . "organization_settings SET set_key=?,set_val=?,OID=?") or die(mysqli_error($myconn));
         foreach ($LETHE_ORG_SET_VALS as $k => $v) {
             $addSet->bind_param('ssi', $v, $_POST[$v], $orgID);
             $addSet->execute();
         }
         $addSet->close();
         /* Primary Records */
         # Groups
         $myconn->query("INSERT INTO " . db_table_pref . "subscriber_groups (OID,UID,group_name,isUnsubscribe,isUngroup) VALUES \n\t\t\t\t(" . $orgID . ",0,'Unsubscribes',1,0),\n\t\t\t\t(" . $orgID . ",0,'Ungrouped',0,1)\n\t\t\t") or die(mysqli_error($myconn));
         $unGroupID = getOrgData($orgID, 0);
         # Forms
         $newFormID = "LetheForm_" . substr(encr(time() . uniqid(true)), 0, 7);
         $defCustErrors = array();
         foreach ($LETHE_SUBSCRIBE_ERRORS as $fks => $fvs) {
             $defCustErrors[] = $fvs[1];
         }
         $defCustErrors = implode("[@]", $defCustErrors);
         $myconn->query("INSERT INTO \n\t\t\t\t\t\t\t\t\t\t\t" . db_table_pref . "subscribe_forms\n\t\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\t\t\tOID=" . $orgID . ",\n\t\t\t\t\t\t\t\t\t\t\tform_name='System Form',\n\t\t\t\t\t\t\t\t\t\t\tform_id='" . $newFormID . "',\n\t\t\t\t\t\t\t\t\t\t\tform_type=0,\n\t\t\t\t\t\t\t\t\t\t\tform_success_url=NULL,\n\t\t\t\t\t\t\t\t\t\t\tform_success_url_text=NULL,\n\t\t\t\t\t\t\t\t\t\t\tform_success_text='Your mail recorded successfully!',\n\t\t\t\t\t\t\t\t\t\t\tform_success_redir=0,\n\t\t\t\t\t\t\t\t\t\t\tform_remove=0,\n\t\t\t\t\t\t\t\t\t\t\tisSystem=1,\n\t\t\t\t\t\t\t\t\t\t\tisDraft=0,\n\t\t\t\t\t\t\t\t\t\t\tform_errors='" . $defCustErrors . "',\n\t\t\t\t\t\t\t\t\t\t\tform_group=" . $unGroupID . "\n\t\t\t\t\t\t\t") or die(mysqli_error($myconn));
         $sysFormID = getOrgData($orgID, 2);
         $myconn->query("INSERT INTO\n\t\t\t\t\t\t\t\t\t\t\t" . db_table_pref . "subscribe_form_fields (OID,FID,field_label,field_name,field_type,field_required,field_pattern,field_placeholder,sorting,field_data,field_static,field_save,field_error) VALUES\n\t\t\t\t\t\t\t\t\t\t\t(" . $orgID . ", " . $sysFormID . ", 'E-Mail', 'LetheForm_Mail', 'email', 1, NULL, 'E-Mail', 1, NULL, 1, 'subscriber_mail', 'Invalid E-Mail Address'),\n\t\t\t\t\t\t\t\t\t\t\t(" . $orgID . ", " . $sysFormID . ", 'Save', 'LetheForm_Save', 'submit', 0, NULL, NULL, 2, NULL, 1, NULL, NULL)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t") or die(mysqli_error($myconn));
         # Templates
         $this->createSystemTemplates();
         /* Public Registration */
         if ($this->public_registration) {
             /* Verification Mails Here */
             # Only PRO
         }
         if (!$this->onInstall) {
             unset($_POST);
         }
         $this->isSuccess = 1;
         $this->errPrint = errMod('' . letheglobal_recorded_successfully . '!', 'success');
     } else {
         $this->errPrint = errMod($this->errPrint, 'danger');
     }
 }