コード例 #1
0
ファイル: CreateTask.php プロジェクト: kisorbiswal/Creamy
*/
require_once 'DbHandler.php';
require_once 'CRMDefaults.php';
require_once 'LanguageHandler.php';
require_once 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["taskDescription"])) {
    $validated = 0;
}
if (!isset($_POST["userid"]) && !isset($_POST["touserid"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check password
    $userid = isset($_POST["touserid"]) ? $_POST["touserid"] : $_POST["userid"];
    $taskDescription = $_POST["taskDescription"];
    $taskDescription = stripslashes($taskDescription);
    $taskDescription = $db->escape_string($taskDescription);
    $taskInitialProgress = 0;
    $result = $db->createTask($userid, $taskDescription, $taskInitialProgress);
    if ($result === true) {
        // if the task was assigned to the user by another user, send the receiver a message.
        $user = \creamy\CreamyUser::currentUser();
        if (isset($user)) {
            $myId = $user->getUserId();
            if ($myId != $userid) {
                // I'm creating a task for another user. Mail that user.
                require_once 'MailHandler.php';
コード例 #2
0
ファイル: CreateEvent.php プロジェクト: kisorbiswal/Creamy
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["title"])) {
    // do we have a title?
    // if not, we do need at least some customer data...
    if (!isset($_POST["customerid"])) {
        $validated = 0;
    } else {
        if (!isset($_POST["customer_type"])) {
            $validated = 0;
        }
    }
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check if this is a new customer type of event.
    if (isset($_POST["customerid"]) && isset($_POST["customer_type"])) {
        $customerid = $_POST["customerid"];
        $customertype = $_POST["customer_type"];
        $result = $db->createContactEventForCustomer($user->getUserId(), $customerid, $customertype, true, null, null, null);
    } else {
        // normal event
        $title = $_POST["title"];
        $color = isset($_POST["color"]) ? $_POST["color"] : CRM_UI_COLOR_DEFAULT_HEX;
        error_log("Creando evento con color {$color}");
        $result = $db->createEvent($user->getUserId(), $title, $color, true, null, null, null);
    }
    // return result
    ob_clean();
    print "{$result}";
コード例 #3
0
ファイル: readmail.php プロジェクト: kisorbiswal/Creamy
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once './php/CRMDefaults.php';
require_once './php/UIHandler.php';
require_once './php/LanguageHandler.php';
require_once './php/DbHandler.php';
require_once './php/CRMUtils.php';
include './php/Session.php';
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$db = new \creamy\DbHandler();
$user = \creamy\CreamyUser::currentUser();
// get parameters
if (isset($_GET["folder"])) {
    $folder = $_GET["folder"];
} else {
    $folder = MESSAGES_GET_INBOX_MESSAGES;
}
if ($folder < 0 || $folder > MESSAGES_MAX_FOLDER) {
    $folder = MESSAGES_GET_INBOX_MESSAGES;
}
if (isset($_GET["message_id"])) {
    $messageid = $_GET["message_id"];
} else {
    $messageid = NULL;
}
コード例 #4
0
ファイル: customerslist.php プロジェクト: kisorbiswal/Creamy
require_once './php/LanguageHandler.php';
include './php/Session.php';
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// get the type of customers.
$customerType = NULL;
$customerName = NULL;
if (isset($_GET["customer_type"])) {
    $customerType = $_GET["customer_type"];
    if (isset($_GET["customer_name"])) {
        $customerName = $_GET["customer_name"];
    } else {
        // if we have not been provided with the "human readable" name, we need to find it in the database.
        require_once './php/DbHandler.php';
        $db = new \creamy\DbHandler();
        $customerName = $db->getNameForCustomerType($customerType);
    }
}
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Creamy</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="css/ionicons.min.css" rel="stylesheet" type="text/css" />
	    <!-- iCheck for checkboxes and radio inputs -->
	    <link href="css/iCheck/minimal/blue.css" rel="stylesheet" type="text/css" />
コード例 #5
0
ファイル: JunkMessages.php プロジェクト: kisorbiswal/Creamy
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once 'CRMDefaults.php';
require_once 'DbHandler.php';
require 'Session.php';
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["messageids"])) {
    $validated = 0;
}
if (!isset($_POST["folder"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // get userid, message ids and folder
    $userid = $user->getUserId();
    $messageids = $_POST["messageids"];
    $folder = $_POST["folder"];
    // junk messages and return result.
    $result = $db->junkMessages($userid, $messageids, $folder);
    ob_clean();
    print $result;
} else {
    ob_clean();
    print "0";
}
コード例 #6
0
ファイル: DeleteModule.php プロジェクト: kisorbiswal/Creamy
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once 'LanguageHandler.php';
require_once 'CRMDefaults.php';
require_once 'ModuleHandler.php';
require_once 'DbHandler.php';
require 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["module_name"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // get mandatory
    $moduleName = $_POST["module_name"];
    // first we disable the module
    $db->changeModuleStatus($moduleName, "0");
    // now we delete the module and returnt the response.
    if (\creamy\ModuleHandler::getInstance()->deleteModule($moduleName)) {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    } else {
        ob_clean();
        $lh->translateText("unable_disable_module");
    }
} else {
    ob_clean();
    $lh->translateText("some_fields_missing");
コード例 #7
0
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
require_once 'CRMDefaults.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["customertype"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check customer type
    $customerType = $_POST["customertype"];
    if ($customerType == 1) {
        // we can't delete the basic client customer type
        $lh->translateText("unable_delete_contacts_type");
    } else {
        // proceed
        $result = $db->deleteCustomerType($customerType);
        if ($result === false) {
            ob_clean();
            $lh->translateText("unable_delete_customer_type");
        } else {
            ob_clean();
            print CRM_DEFAULT_SUCCESS_RESPONSE;
        }
コード例 #8
0
ファイル: editcustomer.php プロジェクト: kisorbiswal/Creamy
?>
                        <li class="active"><?php 
$lh->translateText("modify");
?>
</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
					<!-- standard custom edition form -->
					<?php 
$customerobj = NULL;
$errormessage = NULL;
if (isset($customerid) && isset($customerType)) {
    $db = new \creamy\DbHandler();
    $customerobj = $db->getDataForCustomer($customerid, $customerType);
} else {
    $errormessage = $lh->translationFor("some_fields_missing");
}
if (!empty($customerobj)) {
    // buttons at bottom (only for writing+ permissions)
    $buttons = "";
    if ($user->userHasWritePermission()) {
        $buttons = $ui->buttonWithLink("modifyCustomerDeleteButton", $customerid, $lh->translationFor("delete"), "button", "times", CRM_UI_STYLE_DANGER);
        $buttons .= $ui->buttonWithLink("modifyCustomerOkButton", "", $lh->translationFor("save"), "submit", "check", CRM_UI_STYLE_PRIMARY, "pull-right");
        $buttons = $ui->singleFormGroupWrapper($buttons);
    }
    // form fields
    $formcontent = $ui->customerFieldsForForm($customerobj, $customerType, $customerid);
    // generate form: header
コード例 #9
0
require_once 'CRMDefaults.php';
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
require 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["messageids"])) {
    $validated = 0;
}
if (!isset($_POST["folder"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // collect data
    $userid = $user->getUserId();
    $messageids = $_POST["messageids"];
    $folder = $_POST["folder"];
    // mark messages as unread and return result.
    $result = $db->markMessagesAsUnread($userid, $messageids, $folder);
    if ($result === false) {
        // failure
        ob_clean();
        $lh->translateText("unable_set_unread");
    } else {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    }
} else {
コード例 #10
0
*/
require_once 'CRMDefaults.php';
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
require 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["newname"])) {
    $validated = 0;
}
if (!isset($_POST["customer-type-id"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // get mandatory fields
    $customerTypeId = $_POST["customer-type-id"];
    $newDescription = $_POST["newname"];
    // modify customer type/description
    $result = $db->modifyCustomerDescription($customerTypeId, $newDescription);
    // return results.
    if ($result === true) {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    } else {
        ob_clean();
        $lh->translateText("error_editing_customer_name");
    }
} else {
    ob_clean();
コード例 #11
0
ファイル: DeleteTask.php プロジェクト: kisorbiswal/Creamy
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once 'CRMDefaults.php';
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["taskid"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check taskid
    $taskid = $_POST["taskid"];
    // delete task
    $result = $db->deleteTask($taskid);
    // analyze result
    if ($result === false) {
        ob_clean();
        $lh->translateText("unable_delete_task");
    } else {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    }
} else {
    ob_clean();
    $lh->translateText("some_fields_missing");
コード例 #12
0
ファイル: ChangePassword.php プロジェクト: kisorbiswal/Creamy
// check required fields
$validated = 1;
if (!isset($_POST["userid"])) {
    $validated = 0;
}
if (!isset($_POST["old_password"])) {
    $validated = 0;
}
if (!isset($_POST["new_password_1"])) {
    $validated = 0;
}
if (!isset($_POST["new_password_2"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check password
    $userid = $_POST["userid"];
    $oldpassword = $_POST["old_password"];
    $password1 = $_POST["new_password_1"];
    $password2 = $_POST["new_password_2"];
    if ($password1 !== $password2) {
        ob_clean();
        $lh->translateText("passwords_dont_match");
    } else {
        // everything's ok, now try to set the new password.
        $result = $db->changePassword($userid, $oldpassword, $password1, $password2);
        if ($result === true) {
            ob_clean();
            print CRM_DEFAULT_SUCCESS_RESPONSE;
        } else {
コード例 #13
0
ファイル: CRMUtils.php プロジェクト: kisorbiswal/Creamy
 /**
  * Returns the base creamy URL for this creamy installation, including any root directory (if applicable). 
  * I.E: returns http://www.yoursite.com/your_crm_path/ (if Creamy is installed there).
  * This setting must be changed if the server changes.
  */
 public static function creamyBaseURL()
 {
     $db = new \creamy\DbHandler();
     return $db->getSettingValueForKey(CRM_SETTING_CRM_BASE_URL);
 }
コード例 #14
0
ファイル: edituser.php プロジェクト: kisorbiswal/Creamy
	all copies or substantial portions of the Software.
	
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once './php/CRMDefaults.php';
require_once './php/UIHandler.php';
require_once './php/DbHandler.php';
require_once './php/LanguageHandler.php';
require './php/Session.php';
$db = new \creamy\DbHandler();
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
if (isset($_POST["userid"])) {
    $userid = $_POST["userid"];
} else {
    $userid = $user->getUserId();
}
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Creamy</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
コード例 #15
0
ファイル: ModifyCustomer.php プロジェクト: kisorbiswal/Creamy
// variables
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["name"])) {
    $validated = 0;
}
if (!isset($_POST["customer_type"])) {
    $validated = 0;
}
if (!isset($_POST["customerid"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // get name (mandatory), customer id and customer type
    $name = $_POST["name"];
    $name = stripslashes($name);
    $name = $db->escape_string($name);
    $customerid = $_POST["customerid"];
    $customerid = stripslashes($customerid);
    $customerid = $db->escape_string($customerid);
    $customerType = $_POST["customer_type"];
    $customerType = stripslashes($customerType);
    $customerType = $db->escape_string($customerType);
    $createdByUser = $user->getUserId();
    // email
    $email = NULL;
    if (isset($_POST["email"])) {
        $email = $_POST["email"];
コード例 #16
0
ファイル: CreateUser.php プロジェクト: kisorbiswal/Creamy
            // check file type
            $imageFileType = strtolower(pathinfo($_FILES["avatar"]["name"], PATHINFO_EXTENSION));
            if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                $reason = $lh->translationFor("image_file_wrong_type");
                $validated = 0;
            } else {
                $avatarOrigin = $_FILES["avatar"]["tmp_name"];
            }
        }
    } else {
        $reason = $lh->translationFor("image_file_is_not_image");
        $validated = 0;
    }
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check password
    $name = $_POST["name"];
    $name = stripslashes($name);
    $name = $db->escape_string($name);
    $password1 = $_POST["password1"];
    $password2 = $_POST["password2"];
    if ($password1 !== $password2) {
        $lh->translateText("passwords_dont_match");
        exit;
    }
    $email = NULL;
    if (isset($_POST["email"])) {
        $email = $_POST["email"];
        $email = stripslashes($email);
        $email = $db->escape_string($email);
コード例 #17
0
        $code = $_POST["code"];
    }
    if (isset($_POST["nonce"])) {
        $nonce = $_POST["nonce"];
    }
    if (isset($_POST["date"])) {
        $date = $_POST["date"];
    }
    if (isset($_POST["password1"])) {
        $password1 = $_POST["password1"];
    }
    if (isset($_POST["password2"])) {
        $password2 = $_POST["password2"];
    }
    if ($password1 == $password2 && !empty($password1) && !empty($password2)) {
        $db = new \creamy\DbHandler();
        if ($db->checkEmailSecurityCode($email, $date, $nonce, $code)) {
            if ($db->changePasswordForUserIdentifiedByEmail($email, $password1)) {
                $result = $lh->translationFor("password_reset_successfully");
                $success = true;
            } else {
                $result = $lh->translationFor("password_reset_error");
            }
        }
    } else {
        $error = $lh->translationFor("passwords_dont_match");
    }
}
?>
<html class="lockscreen">
    <head>
コード例 #18
0
ファイル: login.php プロジェクト: kisorbiswal/Creamy
    // check if already installed
    header("location: ./install.php");
}
// load DB handler and Language Handler.
require_once './php/DbHandler.php';
require_once './php/LanguageHandler.php';
session_start();
// Starting Session
$lh = \creamy\LanguageHandler::getInstance();
$error = '';
// Variable To Store Error Message
if (isset($_POST['submit'])) {
    if (empty($_POST['username']) || empty($_POST['password'])) {
        $error = $lh->translationFor("insert_valid_login_password");
    } else {
        $db = new \creamy\DbHandler();
        // Define $username and $password
        $username = $_POST['username'];
        $password = $_POST['password'];
        // To protect MySQL injection for Security purpose
        $username = stripslashes($username);
        $password = stripslashes($password);
        $username = $db->escape_string($username);
        $password = $db->escape_string($password);
        // Check password and redirect accordingly
        $result = null;
        if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
            // valid email address
            $result = $db->checkLoginByEmail($username, $password);
        } else {
            // not an email. User name?
コード例 #19
0
ファイル: index.php プロジェクト: kisorbiswal/Creamy
require_once './php/Session.php';
try {
    $user = \creamy\CreamyUser::currentUser();
} catch (\Exception $e) {
    header("location: ./logout.php");
    die;
}
// initialize session and DDBB handler
include_once './php/UIHandler.php';
require_once './php/LanguageHandler.php';
require_once './php/DbHandler.php';
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$colors = $ui->generateStatisticsColors();
// calculate number of statistics and customers
$db = new \creamy\DbHandler();
$statsOk = $db->weHaveSomeValidStatistics();
$custsOk = $db->weHaveAtLeastOneCustomerOrContact();
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Creamy</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Creamy style -->
        <link href="css/creamycrm.css" rel="stylesheet" type="text/css" />
        <?php 
print $ui->creamyThemeCSS();
?>
コード例 #20
0
ファイル: DeleteUser.php プロジェクト: kisorbiswal/Creamy
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once 'CRMDefaults.php';
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["userid"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // sanity checks
    $userid = $_POST["userid"];
    $currentMainAdminData = $db->getMainAdminUserData();
    // check that we are not deleting the main admin user.
    if (is_array($currentMainAdminData) && array_key_exists("id", $currentMainAdminData)) {
        if ($userid == $currentMainAdminData["id"]) {
            // can't delete the main admin user.
            print $lh->translateText("unable_delete_main_admin");
            return;
        }
    }
    // delete user
    $result = $db->deleteUser($userid);
    if ($result === false) {
        ob_clean();
コード例 #21
0
require 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["customerid"])) {
    $validated = 0;
}
if (!isset($_POST["old_customer_type"])) {
    $validated = 0;
}
if (!isset($_POST["new_customer_type"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // parameters
    $customerid = $_POST["customerid"];
    $oldCustomerType = $_POST["old_customer_type"];
    $newCustomerType = $_POST["new_customer_type"];
    // create customer and return result.
    $result = $db->changeCustomerType($customerid, $oldCustomerType, $newCustomerType);
    if ($result === true) {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    } else {
        ob_clean();
        $lh->translateText("unable_modify_customer");
    }
} else {
    ob_clean();
コード例 #22
0
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once dirname(dirname(dirname(__FILE__))) . '/php/CRMDefaults.php';
require_once dirname(dirname(dirname(__FILE__))) . '/php/Config.php';
require_once dirname(dirname(dirname(__FILE__))) . '/php/DbHandler.php';
/** 
 * Checks the events for today and sends an email to users with pending events for
 * today. This behaviour can be enabled/disabled by means of the setting property
 * notification_email_events (1=yes, 0=no).
 */
// initialize vars.
if (!isset($db)) {
    $db = new \creamy\DbHandler();
}
// check if notifications for events is enabled.
$enabled = $db->getNotificationsForEventsSetting();
if (filter_var($enabled, FILTER_VALIDATE_BOOLEAN)) {
    // if email notifications for events is enabled...
    require_once dirname(dirname(dirname(__FILE__))) . '/php/MailHandler.php';
    if (!isset($mh)) {
        $mh = \creamy\MailHandler::getInstance();
    }
    $events = $db->getEventsForTodayForAllUsers(true);
    // error_log("Events: ".var_export($events, true));
    if (!empty($events)) {
        foreach ($events as $event) {
            // for every event...
            // send a new notification
コード例 #23
0
ファイル: job-scheduler.php プロジェクト: kisorbiswal/Creamy
{
    $basedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . CRM_JOB_SCHEDULER_BASE_DIR . DIRECTORY_SEPARATOR . $dir;
    $files = scandir($basedir);
    foreach ($files as $filename) {
        // iterate throuhg files/directories.
        $realpath = $basedir . DIRECTORY_SEPARATOR . $filename;
        // If it's a directory (except for "." & "..")
        if (is_file($realpath) && substr($filename, 0, 1) !== '.') {
            // possible script.
            include $realpath;
        }
    }
}
/** Schedule tasks for all frequencies */
// DDBB handler.
$db = new \creamy\DbHandler();
// Module handler
$mh = \creamy\ModuleHandler::getInstance();
// 1. Run the system scheduled jobs.
$scheduleMinFreq = $db->getSettingValueForKey(CRM_SETTING_JOB_SCHEDULING_MIN_FREQ);
if (empty($scheduleMinFreq)) {
    $scheduleMinFreq = CRM_JOB_SCHEDULING_HOURLY;
}
// 1.a Hourly tasks
if ($scheduleMinFreq <= CRM_JOB_SCHEDULING_HOURLY) {
    scheduleJobsInDirectory(CRM_JOB_SCHEDULER_HOURLY_DIR);
    // invoke the job scheduling in modules.
    $mh->scheduleJobsOnActiveModules(CRM_JOB_SCHEDULING_HOURLY);
}
// 1.b Daily tasks
if ($scheduleMinFreq <= CRM_JOB_SCHEDULING_DAILY) {
コード例 #24
0
ファイル: DeleteMessages.php プロジェクト: kisorbiswal/Creamy
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
require_once 'CRMDefaults.php';
require 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["messageids"])) {
    $validated = 0;
}
if (!isset($_POST["folder"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check password
    $userid = $user->getUserId();
    $messageids = $_POST["messageids"];
    $folder = $_POST["folder"];
    $result = $db->deleteMessages($userid, $messageids, $folder);
    if ($result === false) {
        ob_clean();
        $lh->translateText("unable_delete_messages");
    } else {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    }
    return;
} else {
    ob_clean();
コード例 #25
0
ファイル: ModifyTask.php プロジェクト: kisorbiswal/Creamy
require_once 'CRMDefaults.php';
require_once 'LanguageHandler.php';
require_once 'DbHandler.php';
require 'Session.php';
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["edit-task-taskid"])) {
    $validated = 0;
}
if (!isset($_POST["edit-task-description"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // get data for task description.
    $taskid = $_POST["edit-task-taskid"];
    $description = $_POST["edit-task-description"];
    $userid = $user->getUserId();
    // edit task description.
    $result = $db->editTaskDescription($taskid, $description, $userid);
    // analyze results
    if ($result === true) {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    } else {
        ob_clean();
        $lh->translateText("unable_modify_task");
    }
} else {
コード例 #26
0
ファイル: SendMessage.php プロジェクト: kisorbiswal/Creamy
// check required fields
$validated = 1;
if (!isset($_POST["touserid"])) {
    $validated = 0;
}
if (!isset($_POST["fromuserid"])) {
    $validated = 0;
}
if (!isset($_POST["message"])) {
    $validated = 0;
}
if (!isset($_POST["subject"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // message parameters
    $touserid = $_POST["touserid"];
    $fromuserid = $_POST["fromuserid"];
    $subject = $_POST["subject"];
    $message = $_POST["message"];
    if (isset($_POST["external_recipients"])) {
        $external_recipients = $_POST["external_recipients"];
        $external_recipients = ltrim($external_recipients, " [");
        $external_recipients = rtrim($external_recipients, " ]");
    } else {
        $external_recipients = null;
    }
    // send message and analyze results
    $result = $db->sendMessage($fromuserid, $touserid, $subject, $message, $_FILES, $external_recipients, "attachment");
    if ($result === true) {
コード例 #27
0
ファイル: ModifyUser.php プロジェクト: kisorbiswal/Creamy
            // check file type
            $imageFileType = strtolower(pathinfo($_FILES["avatar"]["name"], PATHINFO_EXTENSION));
            if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                $reason = $lh->translationFor("image_file_wrong_type");
                $validated = 0;
            } else {
                $avatarOrigin = $_FILES["avatar"]["tmp_name"];
            }
        }
    } else {
        $reason = $lh->translationFor("image_file_is_not_image");
        $validated = 0;
    }
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // collect new user data.
    $modifyid = $_POST["modifyid"];
    $name = NULL;
    if (isset($_POST["name"])) {
        $name = $_POST["name"];
        $name = stripslashes($name);
        $name = $db->escape_string($name);
    }
    $phone = NULL;
    if (isset($_POST["phone"])) {
        $phone = $_POST["phone"];
        $phone = stripslashes($phone);
        $phone = $db->escape_string($phone);
    }
    $avatar = NULL;
コード例 #28
0
ファイル: UnjunkMessages.php プロジェクト: kisorbiswal/Creamy
	all copies or substantial portions of the Software.
	
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once 'DbHandler.php';
require 'Session.php';
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["messageids"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // retrieve data and parameters
    $userid = $user->getUserId();
    $messageids = $_POST["messageids"];
    // unjunk messages and return result
    $result = $db->unjunkMessages($userid, $messageids);
    ob_clean();
    print $result;
} else {
    ob_clean();
    print "0";
}
コード例 #29
0
    foreach ($customerTypes as $otherCustomerType) {
        if ($otherCustomerType["table_name"] != $customer_type) {
            // add a change to... button.
            $changeTypeText = $lh->translationFor("move_to") . " " . $otherCustomerType["description"];
            $typeOptions .= $ui->actionForPopupButtonWithOnClickCode($changeTypeText, "changeCustomerType", array($customer["id"], $customer_type, $otherCustomerType["table_name"]));
        }
    }
    // add any module action.
    $args = array(CRM_MODULE_HOOK_PARAMETER_CUSTOMER_LIST_ID => $customer["id"], CRM_MODULE_HOOK_PARAMETER_CUSTOMER_LIST_NAME => $customer["name"], CRM_MODULE_HOOK_PARAMETER_CUSTOMER_LIST_TYPE => $customer_type);
    $moduleActions = $mh->applyHookOnActiveModules(CRM_MODULE_HOOK_CUSTOMER_LIST_POPUP, $args, CRM_MODULE_MERGING_STRATEGY_APPEND);
    // build the pop up action button and return it.
    $result = $ui->popupActionButton($lh->translationFor("choose_action"), array($modifyOption, $moduleActions, $eventOption, $separator, $typeOptions, $separator, $deleteOption), array("default"));
    return $result;
}
// initialize database
$db = new \creamy\DbHandler();
// get customer_type and customerid for selecting the right customers.
if (!isset($_GET["customer_type"])) {
    fatal_error("Wrong request. Missing customer_type");
}
$customer_type = $_GET["customer_type"];
// paging
$length = isset($_GET[CRM_CUSTOMER_DATATABLE_LIMIT]) ? intval($_GET[CRM_CUSTOMER_DATATABLE_LIMIT]) : 10;
$offset = isset($_GET[CRM_CUSTOMER_DATATABLE_OFFSET]) ? intval($_GET[CRM_CUSTOMER_DATATABLE_OFFSET]) : null;
$numRows = isset($offset) ? array($offset, $length) : $length;
// Ordering
$columns = $db->getCustomerColumnsToBeShownInCustomerList($customer_type);
$sorting = array();
if (isset($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMN . "0"])) {
    for ($i = 0; $i < intval($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMNS]); $i++) {
        if ($_GET[CRM_CUSTOMER_DATATABLE_IS_SORTABLE . intval($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMN . $i])] == "true") {
コード例 #30
0
ファイル: DeleteCustomer.php プロジェクト: kisorbiswal/Creamy
	THE SOFTWARE.
*/
require_once 'LanguageHandler.php';
require_once 'CRMDefaults.php';
require_once 'DbHandler.php';
$lh = \creamy\LanguageHandler::getInstance();
// check required fields
$validated = 1;
if (!isset($_POST["customerid"])) {
    $validated = 0;
}
if (!isset($_POST["customer_type"])) {
    $validated = 0;
}
if ($validated == 1) {
    $db = new \creamy\DbHandler();
    // check customer id and type
    $customerid = $_POST["customerid"];
    $customerType = $_POST["customer_type"];
    // delete customer
    $result = $db->deleteCustomer($customerid, $customerType);
    // analyze result
    if ($result === false) {
        ob_clean();
        $lh->translateText("unable_delete_customer");
    } else {
        ob_clean();
        print CRM_DEFAULT_SUCCESS_RESPONSE;
    }
} else {
    ob_clean();